This commit is contained in:
aozhiwei 2023-04-12 14:19:30 +08:00
parent deb8ec286d
commit 8e50ea6aea
2 changed files with 7 additions and 0 deletions

View File

@ -349,12 +349,16 @@ void CallFuncBuff::ProcAddEnergyShield()
kUpdateEnergyShieldEvent,
[this] (const a8::Args& args) mutable
{
int value = args.Get<int>(0);
int new_time = args.Get<int>(1);
owner->AddEnergyShield(value);
}));
event_handlers_.push_back(owner->GetTrigger()->AddListener
(
kDestoryEnergyShieldEvent,
[this] (const a8::Args& args) mutable
{
owner->RemoveBuffByUniId(buff_uniid);
}));
}
}

View File

@ -262,6 +262,9 @@ void Human::DecHP(float dec_hp, int killer_id, const std::string killer_name, in
max_energy_shield,
true);
GetTrigger()->ReceiveDmg();
if (energy_shield <= 0) {
GetTrigger()->DestoryEnergyShield();
}
} else {
float old_health = GetHP();
float new_health = std::max(0.0f, GetHP() - dec_hp);