This commit is contained in:
aozhiwei 2021-07-08 09:37:14 +00:00
parent a5d5be071e
commit cce7549812
3 changed files with 10 additions and 3 deletions

View File

@ -865,8 +865,9 @@ void Human::DecHP(float dec_hp, int killer_id, const std::string& killer_name, i
float new_health = std::max(0.0f, GetHP() - dec_hp);
AdjustDecHp(old_health, new_health);
SetHP(std::max(0.0f, new_health));
if (GetHP() - old_health > 0.001f) {
stats.damage_amount_in += GetHP() - old_health;
if (old_health - GetHP() > 0.001f) {
stats.damage_amount_in += old_health - GetHP();
GetTrigger()->ReceiveDmg();
}
if (GetHP() <= 0.0001f && !dead) {
if (downed) {

View File

@ -177,6 +177,11 @@ void Trigger::HpChg()
});
}
void Trigger::ReceiveDmg()
{
TriggeCondBuffAll(kCondBuffReceiveDmg);
}
void Trigger::Die()
{
TriggeCondBuffAll(kCondBuffDid);
@ -221,7 +226,7 @@ void Trigger::TriggeCondBuffAll(int cond)
[this, cond] (Buff* buff, bool& stop)
{
AddBuffs(cond, buff->meta->param4_int_list);
});
});
owner_->context_pos = old_context_pos;
owner_->context_ability = old_context_ability;
}

View File

@ -23,6 +23,7 @@ public:
void UseItemAction(int slot_id);
void UseSkill(Skill* skill);
void HpChg();
void ReceiveDmg();
void Die();
void ActiveBuff(MetaData::Buff* buff_meta);
void DeactiveBuff(MetaData::Buff* buff_meta);