This commit is contained in:
aozhiwei 2022-10-01 09:33:49 +08:00
parent c2586b87e9
commit 683eb01d91
4 changed files with 17 additions and 9 deletions

View File

@ -35,6 +35,7 @@ class Bullet : public MoveableEntity
int trace_target_id = 0;
int strengthen_wall = 0;
int hand = 0;
std::weak_ptr<a8::XTimerPtr> keep_shot_animi_timer_ptr;
virtual ~Bullet() override;
virtual void Initialize() override;

View File

@ -43,6 +43,7 @@ struct BulletInfo
float track_change_time = 0;
int is_through = 0;
int hand = 0;
std::weak_ptr<a8::XTimerPtr> 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<a8::XTimerPtr> 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());

View File

@ -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<a8::XTimerPtr> 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();

View File

@ -172,7 +172,8 @@ public:
float fly_distance,
long long weapon_uniid,
int trace_target_id,
int hand);
int hand,
std::weak_ptr<a8::XTimerPtr> keep_shot_animi_timer_ptr);
Car* CreateCar(Human* driver,
int car_uniid,
MetaData::Equip* meta,