This commit is contained in:
aozhiwei 2022-09-29 15:26:33 +08:00
parent bfc2917467
commit 7c51eeabc4
2 changed files with 9 additions and 3 deletions

View File

@ -36,7 +36,7 @@ void Bullet::Initialize()
ability_ = sender.Get()->GetAbility(); ability_ = sender.Get()->GetAbility();
is_curr_weapon = sender.Get()->GetCurrWeapon()->meta == gun_meta; is_curr_weapon = sender.Get()->GetCurrWeapon()->meta == gun_meta;
create_frameno_ = room->GetFrameNo(); create_frameno_ = room->GetFrameNo();
if (gun_meta->i->equip_subtype() == GUN_SUB_EQUIP_TYPE_FLY_HOOk) { if (IsFlyHook()) {
int buff_uniid = sender.Get()->TryAddBuff(sender.Get(), kVertigoBuffId); int buff_uniid = sender.Get()->TryAddBuff(sender.Get(), kVertigoBuffId);
if (buff_uniid) { if (buff_uniid) {
Buff* buff = sender.Get()->GetBuffByUniId(buff_uniid); Buff* buff = sender.Get()->GetBuffByUniId(buff_uniid);
@ -75,7 +75,7 @@ void Bullet::OnHit(std::set<Entity*>& objects)
sender.Get()->context_dir = dir; sender.Get()->context_dir = dir;
sender.Get()->context_pos = GetPos(); sender.Get()->context_pos = GetPos();
if (gun_meta->i->equip_subtype() == GUN_SUB_EQUIP_TYPE_FLY_HOOk) { if (IsFlyHook()) {
if (sender.Get() && !sender.Get()->dead) { if (sender.Get() && !sender.Get()->dead) {
for (auto& target : objects) { for (auto& target : objects) {
ProcFlyHook(target); ProcFlyHook(target);
@ -606,7 +606,7 @@ void Bullet::Check(float distance)
} }
} }
if (need_remove) { if (need_remove) {
if (gun_meta->i->equip_subtype() == GUN_SUB_EQUIP_TYPE_FLY_HOOk) { if (IsFlyHook()) {
if (!hited) { if (!hited) {
sender.Get()->IncDisableMoveTimes(); sender.Get()->IncDisableMoveTimes();
sender.Get()->IncDisableAttackDirTimes(); sender.Get()->IncDisableAttackDirTimes();
@ -855,3 +855,8 @@ void Bullet::TriggerHitBuff(Entity* e)
} }
} }
} }
bool Bullet::IsFlyHook()
{
return gun_meta->i->equip_subtype() == GUN_SUB_EQUIP_TYPE_FLY_HOOk;
}

View File

@ -48,6 +48,7 @@ class Bullet : public MoveableEntity
void ForceRemove(); void ForceRemove();
void OnHit(std::set<Entity*>& objects); void OnHit(std::set<Entity*>& objects);
void TriggerHitBuff(Entity* e); void TriggerHitBuff(Entity* e);
bool IsFlyHook();
protected: protected:
Bullet(); Bullet();