From 2dec30dbd5469c99b78ac90a83f31aadf2a893d4 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 29 Mar 2023 10:34:04 +0800 Subject: [PATCH] 1 --- server/gameserver/battledatacontext.cc | 14 ++++++++++++-- server/gameserver/buff/callfunc.cc | 3 ++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/server/gameserver/battledatacontext.cc b/server/gameserver/battledatacontext.cc index 9224d5bf..ef600766 100644 --- a/server/gameserver/battledatacontext.cc +++ b/server/gameserver/battledatacontext.cc @@ -715,12 +715,22 @@ float BattleDataContext::GetMaxHP() float BattleDataContext::GetDef() { - return hero_ability_->GetDef(); + float def = hero_ability_->GetDef(); + def += owner_.Get()->GetAbility()->GetAttrAbs(kHAT_Def); + def *= 1.0f + owner_.Get()->GetAbility()->GetAttrRate(kHAT_Def); + def *= 1.0f + owner_.Get()->GetAbility()->GetAttrAddition(kHAT_Def) - + owner_.Get()->GetAbility()->GetAttrRuduce(kHAT_Def); + return def; } float BattleDataContext::GetHeroTotalAtk() { - return hero_ability_->GetAtk(); + float atk = hero_ability_->GetAtk(); + atk += owner_.Get()->GetAbility()->GetAttrAbs(kHAT_Atk); + atk *= 1.0f + owner_.Get()->GetAbility()->GetAttrRate(kHAT_Atk); + atk *= 1.0f + owner_.Get()->GetAbility()->GetAttrAddition(kHAT_Atk) - + owner_.Get()->GetAbility()->GetAttrRuduce(kHAT_Atk); + return atk; } float BattleDataContext::GetWeaponAtk(IBullet* bullet) diff --git a/server/gameserver/buff/callfunc.cc b/server/gameserver/buff/callfunc.cc index d11a310c..380ab247 100644 --- a/server/gameserver/buff/callfunc.cc +++ b/server/gameserver/buff/callfunc.cc @@ -12,6 +12,7 @@ #include "human.h" #include "team.h" #include "collision.h" +#include "battledatacontext.h" #include "mt/Buff.h" #include "mt/Skill.h" @@ -35,7 +36,7 @@ void CallFuncBuff::Activate() hold_param2_ = meta->GetBuffParam2(this); if (GetCaster().Get()) { float dmg = hold_param2_; - dmg = owner->CalcReceiveDmg(GetCaster().Get(), dmg); + dmg = owner->GetBattleContext()->CalcReceiveDmg(GetCaster().Get(), dmg); float dmg_out = 0.0f; owner->DecHP(dmg, GetCaster().Get()->GetUniId(),