1
This commit is contained in:
parent
b41a83eea2
commit
d25eeeee61
@ -1457,11 +1457,15 @@ void CallFuncBuff::Shot()
|
|||||||
if (ignore_original_dmg) {
|
if (ignore_original_dmg) {
|
||||||
owner->GetAbility()->IncSwitch(kIgnoreOriginalDmg);
|
owner->GetAbility()->IncSwitch(kIgnoreOriginalDmg);
|
||||||
}
|
}
|
||||||
|
CreatureWeakPtr owner_wp = owner->GetWeakPtrRef();
|
||||||
|
int buff_uniid_copy = buff_uniid;
|
||||||
auto on_bullet_exit =
|
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();
|
glm::vec3 old_attack_dir = owner->GetAttackDir();
|
||||||
if (spec_target_pos) {
|
if (spec_target_pos) {
|
||||||
glm::vec3 target_pos = glm::vec3(x, y, z);
|
glm::vec3 target_pos = glm::vec3(x, y, z);
|
||||||
|
@ -126,7 +126,9 @@ void Bullet::OnHit(std::set<Entity*>& objects)
|
|||||||
ProcFlyHook(target);
|
ProcFlyHook(target);
|
||||||
if (!c || (c->team_id != sender.Get()->team_id)) {
|
if (!c || (c->team_id != sender.Get()->team_id)) {
|
||||||
if (!c || !c->IsCar()) {
|
if (!c || !c->IsCar()) {
|
||||||
target->OnBulletHit(this);
|
if (!ignore_original_dmg) {
|
||||||
|
target->OnBulletHit(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -150,7 +152,9 @@ void Bullet::OnHit(std::set<Entity*>& objects)
|
|||||||
if (!eat) {
|
if (!eat) {
|
||||||
bool old_is_dead = target->IsDead(room);
|
bool old_is_dead = target->IsDead(room);
|
||||||
TriggerHitBuff(target);
|
TriggerHitBuff(target);
|
||||||
target->OnBulletHit(this);
|
if (!ignore_original_dmg) {
|
||||||
|
target->OnBulletHit(this);
|
||||||
|
}
|
||||||
if (target->IsDead(room) && !old_is_dead) {
|
if (target->IsDead(room) && !old_is_dead) {
|
||||||
OnKillTarget(target);
|
OnKillTarget(target);
|
||||||
}
|
}
|
||||||
@ -811,6 +815,9 @@ void Bullet::ForceRemove()
|
|||||||
if (!keep_shot_animi_timer_ptr.expired()) {
|
if (!keep_shot_animi_timer_ptr.expired()) {
|
||||||
room->xtimer.Delete(keep_shot_animi_timer_ptr);
|
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()) {
|
if (!sender.Get()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetMutablePos().FromGlmVec3(pos);
|
GetMutablePos().FromGlmVec3(pos);
|
||||||
room->grid_service->MoveBullet(this);
|
room->grid_service->MoveBullet(this);
|
||||||
float distance = GlmHelper::Norm(GetPos().ToGlmVec3() - born_pos.ToGlmVec3());
|
float distance = GlmHelper::Norm(GetPos().ToGlmVec3() - born_pos.ToGlmVec3());
|
||||||
|
@ -33,7 +33,8 @@ class Bullet : public MoveableEntity, public IBullet
|
|||||||
a8::XTimerWp keep_shot_animi_timer_ptr;
|
a8::XTimerWp keep_shot_animi_timer_ptr;
|
||||||
float shot_animi_time = 0.0f;
|
float shot_animi_time = 0.0f;
|
||||||
std::shared_ptr<std::set<int>> reporter_list;
|
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 ~Bullet() override;
|
||||||
virtual void Initialize() override;
|
virtual void Initialize() override;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user