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, kUpdateEnergyShieldEvent,
[this] (const a8::Args& args) mutable [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 event_handlers_.push_back(owner->GetTrigger()->AddListener
( (
kDestoryEnergyShieldEvent, kDestoryEnergyShieldEvent,
[this] (const a8::Args& args) mutable [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, max_energy_shield,
true); true);
GetTrigger()->ReceiveDmg(); GetTrigger()->ReceiveDmg();
if (energy_shield <= 0) {
GetTrigger()->DestoryEnergyShield();
}
} else { } else {
float old_health = GetHP(); float old_health = GetHP();
float new_health = std::max(0.0f, GetHP() - dec_hp); float new_health = std::max(0.0f, GetHP() - dec_hp);