⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 abilityupdater_applydata.cpp

📁 墨香最新私服
💻 CPP
字号:
// AbilityUpdater_ApplyData.cpp: implementation of the CAbilityUpdater_ApplyData class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "AbilityUpdater_ApplyData.h"
#include "AbilityGroup.h"
#include "AbilityCommonHeader.h"
#include "Player.h"
#include "CharacterCalcManager.h"

#ifdef _MHCLIENT_
#include "GameIn.h"
#include "CharacterDialog.h"
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CAbilityUpdater_ApplyData::CAbilityUpdater_ApplyData()
{

}

CAbilityUpdater_ApplyData::~CAbilityUpdater_ApplyData()
{

}

void CAbilityUpdater_ApplyData::Update(DWORD& UpdateCmd,DWORD Param,CAbilityGroup* pGroup,CYHHashTable<CAbilityInfo>* pInfoTable)
{
	if(UpdateCmd == ABILITYUPDATE_ABILITYQUICK_CHANGED)
		return;

	CPlayer* pObj = pGroup->GetOwenerObject();
	ABILITY_STATS* pStats = pObj->GetAbilityStats();
	CAbilityInfo* pAbilityInfo;
	CAbility* pAbility;
	ABILITY_INFO* pInfo;
	pStats->Clear();
	pGroup->SetPositionHead();
	while(pAbility = pGroup->GetNextAbility(eAGK_Battle))
	{
		pAbilityInfo = pAbility->GetAbilityInfo();
		pInfo = pAbilityInfo->GetInfo();
		BYTE AbilLevel = pAbility->GetLevel();

		ySWITCH(pInfo->Ability_effect_Kind)
			yCASE(eAUK_PHYATTACK)
				DWORD upVal = 0;
				if(0 < AbilLevel)	upVal += min(AbilLevel-0,5) * 2;
				if(5 < AbilLevel)	upVal += min(AbilLevel-5,5) * 3;
				if(10 < AbilLevel)	upVal += min(AbilLevel-10,5) * 4;
				if(15 < AbilLevel)	upVal += min(AbilLevel-15,5) * 5;
				if(20 < AbilLevel)	upVal += min(AbilLevel-20,5) * 7;
				if(25 < AbilLevel)	upVal += min(AbilLevel-25,5) * 9;
			
				pStats->SetPhyAttackUp(pInfo->Ability_effect_Param1,upVal);
				
			yCASE(eAUK_ATTRIB)
				WORD Attrib = pInfo->Ability_effect_Param1;
				float attackupVal = 0;
				float registupVal = 0;
				if(0 < AbilLevel)	attackupVal += min(AbilLevel-0,5) * 0.01;
				if(5 < AbilLevel)	attackupVal += min(AbilLevel-5,5) * 0.02;
				if(10 < AbilLevel)	attackupVal += min(AbilLevel-10,5) * 0.04;
				if(15 < AbilLevel)	attackupVal += min(AbilLevel-15,5) * 0.06;
				if(20 < AbilLevel)	attackupVal += min(AbilLevel-20,5) * 0.08;
				if(25 < AbilLevel)	attackupVal += min(AbilLevel-25,5) * 0.09;
				registupVal = AbilLevel * 0.02f;
			
				pStats->AttAttackUp.SetElement_Val(Attrib,attackupVal);
				pStats->AttRegistUp.SetElement_Val(Attrib,registupVal);

			yCASE(eAUK_MAXLIFE)
				DWORD upVal = 0;
				if(0 < AbilLevel)	upVal += min(AbilLevel-0,5) * 10;
				if(5 < AbilLevel)	upVal += min(AbilLevel-5,5) * 14;
				if(10 < AbilLevel)	upVal += min(AbilLevel-10,5) * 18;
				if(15 < AbilLevel)	upVal += min(AbilLevel-15,5) * 22;
				if(20 < AbilLevel)	upVal += min(AbilLevel-20,5) * 26;
				if(25 < AbilLevel)	upVal += min(AbilLevel-25,5) * 30;
			
				pStats->LifeUp = upVal;

			yCASE(eAUK_DEFENCE)
				DWORD upVal = 0;
				if(0 < AbilLevel)	upVal += min(AbilLevel-0,5) * 5;
				if(5 < AbilLevel)	upVal += min(AbilLevel-5,5) * 7;
				if(10 < AbilLevel)	upVal += min(AbilLevel-10,5) * 9;
				if(15 < AbilLevel)	upVal += min(AbilLevel-15,5) * 11;
				if(20 < AbilLevel)	upVal += min(AbilLevel-20,5) * 13;
				if(25 < AbilLevel)	upVal += min(AbilLevel-25,5) * 19;
			
				pStats->DefenceUp = upVal;

			yCASE(eAUK_MAXNEARYUK)
				DWORD upVal = 0;
				if(0 < AbilLevel)	upVal += min(AbilLevel-0,5) * 10;
				if(5 < AbilLevel)	upVal += min(AbilLevel-5,5) * 14;
				if(10 < AbilLevel)	upVal += min(AbilLevel-10,5) * 18;
				if(15 < AbilLevel)	upVal += min(AbilLevel-15,5) * 22;
				if(20 < AbilLevel)	upVal += min(AbilLevel-20,5) * 26;
				if(25 < AbilLevel)	upVal += min(AbilLevel-25,5) * 30;
			
				pStats->NaeRyukUp = upVal;

			yCASE(eAUK_MAXSHIELD)
				DWORD upVal = 0;
				if(0 < AbilLevel)	upVal += min(AbilLevel-0,5) * 10;
				if(5 < AbilLevel)	upVal += min(AbilLevel-5,5) * 14;
				if(10 < AbilLevel)	upVal += min(AbilLevel-10,5) * 18;
				if(15 < AbilLevel)	upVal += min(AbilLevel-15,5) * 22;
				if(20 < AbilLevel)	upVal += min(AbilLevel-20,5) * 26;
				if(25 < AbilLevel)	upVal += min(AbilLevel-25,5) * 30;
			
				pStats->ShieldUp = upVal;
				
			yCASE(eAUK_UNGISPEED)
				pStats->UngiUpVal = AbilLevel*10;

		yENDSWITCH
	}


#ifdef _MAPSERVER_
	if(UpdateCmd != ABILITYUPDATE_ABILITYINITED)
	{
		CCharacterCalcManager::CalcMaxLife(pObj);
		CCharacterCalcManager::CalcMaxShield(pObj);
		CCharacterCalcManager::CalcMaxNaeRyuk(pObj);
	}
#else
	GAMEIN->GetCharacterDialog()->UpdateData();
#endif
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -