This commit is contained in:
aozhiwei 2023-10-26 11:03:09 +08:00
parent f0e9712b6c
commit a6098052e3
4 changed files with 5 additions and 2 deletions

View File

@ -3539,7 +3539,7 @@ void Creature::ClearIgnoreTarget()
}
}
void Creature::SetLastAttacker(CreatureWeakPtr& attacker)
void Creature::SetLastAttacker(CreatureWeakPtr attacker)
{
last_attacker_ = attacker;
last_beattack_frameno_ = room->GetFrameNo();

View File

@ -374,7 +374,7 @@ class Creature : public MoveableEntity
void DelIgnoreTarget(int target_uniid);
bool IsIgnoreTarget(int target_uniid);
void ClearIgnoreTarget();
void SetLastAttacker(CreatureWeakPtr& attacker);
void SetLastAttacker(CreatureWeakPtr attacker);
CreatureWeakPtr& GetLastAttacker() { return last_attacker_; }
long long GetLastBeAttackFrameNo() { return last_beattack_frameno_; }
int GetLastAttackerReviveTimes() { return last_attacker_revive_times_; }

View File

@ -180,6 +180,7 @@ void Hero::OnBulletHit(IBullet* bullet)
float finaly_dmg = bullet->GetSender().Get()->GetBattleContext()->CalcDmg(this, bullet);
if (bullet->GetSender().Get()->IsHuman()) {
bullet->GetSender().Get()->AsHuman()->stats->damage_amount_out += finaly_dmg;
SetLastAttacker(bullet->GetSender());
}
if (bullet->GetBulletMeta()->_buff_meta) {
MustBeAddBuff(bullet->GetSender().Get(), bullet->GetBulletMeta()->buffid());

View File

@ -2300,6 +2300,7 @@ void Human::OnBulletHit(IBullet* bullet)
#endif
if (bullet->GetSender().Get()) {
bullet->GetSender().Get()->GetTrigger()->BulletHit(bullet, this);
SetLastAttacker(bullet->GetSender());
}
RemoveBuffByEffectId(kBET_PeaceMode);
@ -2455,6 +2456,7 @@ void Human::OnExplosionHit(Explosion* e)
if (e->GetSender().Get()) {
real_killer_id = e->GetSender().Get()->GetUniId();
real_killer_name = e->GetSender().Get()->GetName();
SetLastAttacker(e->GetSender());
}
RemoveBuffByEffectId(kBET_PeaceMode);