This commit is contained in:
aozhiwei 2021-07-21 07:58:54 +00:00
parent 47734c0917
commit c71d6ebc91
2 changed files with 11 additions and 1 deletions

View File

@ -54,9 +54,19 @@ void Bullet::RecalcSelfCollider()
void Bullet::OnHit(std::set<Entity*>& objects) void Bullet::OnHit(std::set<Entity*>& objects)
{ {
std::shared_ptr<Ability> old_context_ability = sender.Get()->context_ability;
a8::Vec2 old_context_dir = sender.Get()->context_dir;
a8::Vec2 old_context_pos = sender.Get()->context_pos;
sender.Get()->context_dir = dir;
sender.Get()->context_pos = GetPos();
for (auto& target : objects) { for (auto& target : objects) {
target->OnBulletHit(this); target->OnBulletHit(this);
} }
sender.Get()->context_dir = old_context_dir;
sender.Get()->context_pos = old_context_pos;
sender.Get()->context_ability = old_context_ability;
} }
void Bullet::ProcBomb() void Bullet::ProcBomb()

View File

@ -3541,7 +3541,7 @@ void Human::OnBulletHit(Bullet* bullet)
sender->stats.damage_amount_out += finaly_dmg; sender->stats.damage_amount_out += finaly_dmg;
#endif #endif
if (bullet->meta->buff_meta) { if (bullet->meta->buff_meta) {
MustBeAddBuff(this, bullet->meta->i->buffid()); MustBeAddBuff(bullet->sender.Get(), bullet->meta->i->buffid());
} }
if (bullet->sender.Get() && bullet->sender.Get()->IsCar() && bullet->passenger.Get()) { if (bullet->sender.Get() && bullet->sender.Get()->IsCar() && bullet->passenger.Get()) {
DecHP(finaly_dmg, DecHP(finaly_dmg,