This commit is contained in:
aozhiwei 2024-01-09 11:21:57 +08:00
parent 5bfd670b35
commit 9110870fdc
4 changed files with 22 additions and 70 deletions

View File

@ -8,7 +8,7 @@
#include "mt/Equip.h"
#include "mt/Buff.h"
struct AttrAddition
struct AttrAddition : public std::enable_shared_from_this<AttrAddition>
{
list_head entry;
list_head list_entry;
@ -286,49 +286,27 @@ float Ability::GetAttrRuduce(int attr_id)
void Ability::GMDelAttr(int attr_id, int idx)
{
#if 0
list_head* head = nullptr;
if (IsValidHumanAttr(attr_id)) {
if (type == 1) {
list_head* head = &std::get<1>(attr_abs_[attr_id]);
list_head* pos = nullptr;
list_head* next = nullptr;
int i = 0;
list_for_each_safe(pos, next, head) {
if (idx == -1 || idx == i) {
AttrAbs* e = list_entry(pos,
AttrAbs,
entry);
list_del_init(&e->entry);
e->holder = nullptr;
if (idx > -1) {
break;
}
}
++i;
head = &attr_list_[attr_id];
} else if (IsValidHumanVirtualAttr(attr_id)) {
head = &vattr_list_[attr_id];
}
if (head) {
list_head* pos = nullptr;
list_head* next = nullptr;
int i = 0;
list_for_each_safe(pos, next, head) {
AttrAddition* e = list_entry(pos,
AttrAddition,
entry);
if (i == idx) {
RemoveAttr(e->shared_from_this());
return;
}
RecalcAttrAbs(attr_id);
} else if (type == 2) {
list_head* head = &std::get<1>(attr_rate_[attr_id]);
list_head* pos = nullptr;
list_head* next = nullptr;
int i = 0;
list_for_each_safe(pos, next, head) {
if (idx == -1 || idx == i) {
AttrRate* e = list_entry(pos,
AttrRate,
entry);
list_del_init(&e->entry);
e->holder = nullptr;
if (idx > -1) {
break;
}
}
++i;
}
RecalcAttrRate(attr_id);
++i;
}
}
#endif
}
void Ability::GMClearAttr()

View File

@ -124,5 +124,6 @@ enum HumanVirtualAttrType_e
kHVAT_WeaponExplosionDealyTime = 1010,
kHVAT_WeaponDmg = 1011,
kHVAT_WeaponExplosionRange = 1012,
kHVAT_SkillTime = 1013,
kHVAT_End
};

View File

@ -815,7 +815,8 @@ float BattleDataContext::CalcDmg(Obstacle* target, IBullet* bullet)
g_calc_dmg_context = {0};
g_calc_dmg_context.is_crit = 0;
#ifdef NEW_NUM
return GetTotalAtk(bullet);
/// 888 return GetTotalAtk(bullet);
return 100;
#else
g_calc_dmg_context.is_crit = IsCrit(bullet) ? 1 : 0;
@ -916,37 +917,10 @@ float BattleDataContext::CalcDmg(Explosion* e)
return finaly_dmg;
}
float BattleDataContext::GetTotalAtk(IBullet* bullet)
{
#if 0
888
float direct_atk = owner_.Get()->GetAbility()->GetAttrDirect(kXHAT_Atk);
if (direct_atk > 0.001f) {
return direct_atk;
} else {
float total_atk = (GetHeroTotalAtk() / 100) * GetWeaponAtk(bullet);
return total_atk;
}
#else
float total_atk = (GetHeroTotalAtk() / 100) * GetWeaponAtk(bullet);
return total_atk;
#endif
}
float BattleDataContext::GetMaxHP()
{
#if 0
888
float hp = hero_ability_->GetHP();
hp += owner_.Get()->GetAbility()->GetAttrAbs(kXHAT_Hp);
hp *= 1.0f + owner_.Get()->GetAbility()->GetAttrRate(kXHAT_Hp);
hp *= 1.0f + owner_.Get()->GetAbility()->GetAttrAddition(kXHAT_Hp) -
owner_.Get()->GetAbility()->GetAttrRuduce(kXHAT_Hp);
return hp;
#else
float hp = hero_ability_->GetHP();
return hp;
#endif
}
float BattleDataContext::GetAttack()
@ -1174,7 +1148,7 @@ float BattleDataContext::GetBrainLifePct()
float BattleDataContext::GetSkillCdPct()
{
return hero_ability_->GetSkillCdPct() + owner_.Get()->GetAbility()->GetAttrAddition(kXHAT_SkillTime);
return hero_ability_->GetSkillCdPct() + owner_.Get()->GetAbility()->GetAttr(kHVAT_SkillTime);
}
float BattleDataContext::GetRescueTimePct()

View File

@ -103,7 +103,6 @@ struct BattleDataContext
private:
void Clear();
float GetTotalAtk(IBullet* bullet);
float GetWeaponAtk(IBullet* bullet);
std::shared_ptr<WeaponAbility> GetWeaponByUniId(long long weapon_uniid);