This commit is contained in:
aozhiwei 2024-01-19 19:11:10 +08:00
parent b41a83eea2
commit d25eeeee61
3 changed files with 18 additions and 7 deletions

View File

@ -1457,10 +1457,14 @@ void CallFuncBuff::Shot()
if (ignore_original_dmg) {
owner->GetAbility()->IncSwitch(kIgnoreOriginalDmg);
}
CreatureWeakPtr owner_wp = owner->GetWeakPtrRef();
int buff_uniid_copy = buff_uniid;
auto on_bullet_exit =
[] (Bullet* bullet)
[owner_wp, buff_uniid_copy] (Bullet* bullet) mutable
{
if (owner_wp.Get()) {
}
};
glm::vec3 old_attack_dir = owner->GetAttackDir();
if (spec_target_pos) {

View File

@ -126,9 +126,11 @@ void Bullet::OnHit(std::set<Entity*>& objects)
ProcFlyHook(target);
if (!c || (c->team_id != sender.Get()->team_id)) {
if (!c || !c->IsCar()) {
if (!ignore_original_dmg) {
target->OnBulletHit(this);
}
}
}
break;
}
}
@ -150,7 +152,9 @@ void Bullet::OnHit(std::set<Entity*>& objects)
if (!eat) {
bool old_is_dead = target->IsDead(room);
TriggerHitBuff(target);
if (!ignore_original_dmg) {
target->OnBulletHit(this);
}
if (target->IsDead(room) && !old_is_dead) {
OnKillTarget(target);
}
@ -811,6 +815,9 @@ void Bullet::ForceRemove()
if (!keep_shot_animi_timer_ptr.expired()) {
room->xtimer.Delete(keep_shot_animi_timer_ptr);
}
if (on_bullet_exit) {
on_bullet_exit(this);
}
}
}
@ -1076,7 +1083,6 @@ void Bullet::ProcRequestBulletDmg(int shield_hit, int strength_wall_uniid, int t
if (!sender.Get()) {
return;
}
GetMutablePos().FromGlmVec3(pos);
room->grid_service->MoveBullet(this);
float distance = GlmHelper::Norm(GetPos().ToGlmVec3() - born_pos.ToGlmVec3());

View File

@ -33,7 +33,8 @@ class Bullet : public MoveableEntity, public IBullet
a8::XTimerWp keep_shot_animi_timer_ptr;
float shot_animi_time = 0.0f;
std::shared_ptr<std::set<int>> reporter_list;
bool ignore_original_dmg = false;
std::function<void(Bullet*)> on_bullet_exit = nullptr;
virtual ~Bullet() override;
virtual void Initialize() override;