diff --git a/server/gameserver/bullet.h b/server/gameserver/bullet.h index 98f0fb04..6ad10db8 100644 --- a/server/gameserver/bullet.h +++ b/server/gameserver/bullet.h @@ -35,6 +35,7 @@ class Bullet : public MoveableEntity int trace_target_id = 0; int strengthen_wall = 0; int hand = 0; + std::weak_ptr keep_shot_animi_timer_ptr; virtual ~Bullet() override; virtual void Initialize() override; diff --git a/server/gameserver/creature.cc b/server/gameserver/creature.cc index 4a890c60..cb4b3422 100644 --- a/server/gameserver/creature.cc +++ b/server/gameserver/creature.cc @@ -43,6 +43,7 @@ struct BulletInfo float track_change_time = 0; int is_through = 0; int hand = 0; + std::weak_ptr keep_shot_animi_timer_ptr; }; static void InternalCreateBullet(BulletInfo& bullet_info) @@ -92,7 +93,8 @@ static void InternalCreateBullet(BulletInfo& bullet_info) bullet_info.fly_distance, bullet_info.weapon_uniid, bullet_info.trace_target_uniid, - bullet_info.hand); + bullet_info.hand, + bullet_info.keep_shot_animi_timer_ptr); #ifdef DEBUG1 if (bullet_info.c.Get()->IsPlayer()) { bullet_info.c.Get()->SendDebugMsg(a8::Format("CreateBullet id:%d", @@ -300,6 +302,13 @@ void InternalShot(Creature* c, } MetaData::HeroShotAnimation* shot_animi = c->GetHeroMeta() ? c->GetHeroMeta()->GetShotAnimi(weapon_meta->i->shootfire()) : nullptr; + std::weak_ptr keep_shot_animi_timer_ptr; + { + int shot_animi_time = (shot_animi ? shot_animi->t : 0); + if (weapon_meta && weapon_meta->i->equip_subtype() == GUN_SUB_EQUIP_TYPE_FLY_HOOk) { + keep_shot_animi_timer_ptr = c->TryDelayAddBuff(c, kKeepShotAnimiBuffId, shot_animi_time); + } + } int bulletIdx = 0; int bulletNum = weapon_meta->bullet_born_offset.size(); for (auto& tuple : weapon_meta->bullet_born_offset) { @@ -372,6 +381,7 @@ void InternalShot(Creature* c, bullet_info->recoil_force = std::get<4>(tuple); bullet_info->invincible_buff_uniid = invincible_buff_uniid; bullet_info->trace_target_uniid = trace_target_uniid; + bullet_info->keep_shot_animi_timer_ptr = keep_shot_animi_timer_ptr; if (skill_meta && (skill_meta->GetMagicId() == MAGIC_AXXF || skill_meta->GetMagicId() == MAGIC_HJHX)) { @@ -411,12 +421,6 @@ void InternalShot(Creature* c, #endif } } - { - int shot_animi_time = (shot_animi ? shot_animi->t : 0); - if (weapon_meta && weapon_meta->i->equip_subtype() == GUN_SUB_EQUIP_TYPE_FLY_HOOk) { - c->TryDelayAddBuff(c, kKeepShotAnimiBuffId, shot_animi_time); - } - } c->GetTrigger()->Shot(weapon_meta); if (weapon_meta->i->recoil_force() > 0.000001) { c->DoRecoilForce(weapon_meta->i->recoil_force()); diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index 8d46fb90..43eab4d5 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -598,7 +598,8 @@ int Room::CreateBullet(Creature* sender, float fly_distance, long long weapon_uniid, int trace_target_id, - int hand) + int hand, + std::weak_ptr keep_shot_animi_timer_ptr) { int bullet_uniid = 0; if (grid_service->CanAdd(pos.x, pos.y)) { @@ -619,6 +620,7 @@ int Room::CreateBullet(Creature* sender, bullet->fly_distance = fly_distance; bullet->trace_target_id = trace_target_id; bullet->hand = hand; + bullet->keep_shot_animi_timer_ptr = keep_shot_animi_timer_ptr; bullet->Initialize(); AddObjectLater(bullet); bullet_uniid = bullet->GetUniId(); diff --git a/server/gameserver/room.h b/server/gameserver/room.h index 2248e8a6..8bd6b923 100644 --- a/server/gameserver/room.h +++ b/server/gameserver/room.h @@ -172,7 +172,8 @@ public: float fly_distance, long long weapon_uniid, int trace_target_id, - int hand); + int hand, + std::weak_ptr keep_shot_animi_timer_ptr); Car* CreateCar(Human* driver, int car_uniid, MetaData::Equip* meta,