This commit is contained in:
aozhiwei 2023-03-21 14:00:52 +08:00
parent 4d59b16aaa
commit 076323856a
3 changed files with 14 additions and 7 deletions

View File

@ -2787,7 +2787,7 @@ void Creature::ClearEnergyShield()
kPropEnergyShield,
energy_shield,
max_energy_shield,
true);
false);
}
std::weak_ptr<Effect> Creature::AddEffect(int effect_id)

View File

@ -702,6 +702,7 @@ void Human::DecHP(float dec_hp, int killer_id, const std::string killer_name, in
SetHP(std::max(0.0f, new_health));
if (old_health - GetHP() > 0.001f) {
stats.damage_amount_in += old_health - GetHP();
real_dmg_out = old_health - GetHP();
GetTrigger()->ReceiveDmg();
}
if (GetHP() <= 0.0001f && !dead) {
@ -2559,6 +2560,7 @@ void Human::OnBulletHit(IBullet* bullet)
bullet->GetPassenger().Get()->GetUniId(),
bullet->GetPassenger().Get()->GetName(),
dmg_out);
bullet->GetSender().Get()->GetTrigger()->DmgOut(this, dmg_out);
}
} else {
if (!bullet->IsPreBattleBullet()) {
@ -2574,6 +2576,7 @@ void Human::OnBulletHit(IBullet* bullet)
bullet->GetSender().Get()->GetUniId(),
bullet->GetSender().Get()->GetName(),
dmg_out);
bullet->GetSender().Get()->GetTrigger()->DmgOut(this, dmg_out);
}
}
}

View File

@ -503,12 +503,16 @@ void Trigger::Attacked(Creature* sender)
void Trigger::DmgOut(Creature* target, float dmg)
{
DispatchEvent(kDmgOutEvent, {target, dmg});
TraverseCondBuffs
(kEventBuffDmgOut,
[this, dmg] (Buff* buff, bool& stop)
{
AddBuffs(buff, buff->meta->_int_buff_param1, buff->meta->_buff_param4_int_list);
});
if (HasCondBuff(kEventBuffDmgOut)) {
TraverseCondBuffs
(kEventBuffDmgOut,
[this, dmg] (Buff* buff, bool& stop)
{
auto buff_vars = std::make_shared<std::vector<float>>();
buff_vars->push_back(dmg);
AddBuffs(buff, buff->meta->_int_buff_param1, buff->meta->_buff_param4_int_list, buff_vars);
});
}
}
void Trigger::BulletBlock(IBullet* bullet, const glm::vec3& pos)