This commit is contained in:
aozhiwei 2022-09-29 16:02:21 +08:00
parent ef3390cdd3
commit 33eac34743
3 changed files with 30 additions and 0 deletions

View File

@ -620,6 +620,7 @@ void Bullet::Check(float distance)
Creature* c = (Creature*)param.sender.GetUserData(); Creature* c = (Creature*)param.sender.GetUserData();
c->DecDisableMoveTimes(); c->DecDisableMoveTimes();
c->DecDisableAttackDirTimes(); c->DecDisableAttackDirTimes();
c->RemoveBuffById(kKeepShotAnimiBuffId);
}, },
&sender.Get()->xtimer_attacher.timer_list_ &sender.Get()->xtimer_attacher.timer_list_
); );
@ -828,6 +829,7 @@ void Bullet::ProcFlyHook(Entity* target)
}, },
&sender.Get()->xtimer_attacher.timer_list_ &sender.Get()->xtimer_attacher.timer_list_
); );
sender.Get()->RemoveBuffById(kKeepShotAnimiBuffId);
} }
void Bullet::ForceRemove() void Bullet::ForceRemove()

View File

@ -402,6 +402,9 @@ void InternalShot(Creature* c,
delete bullet_info; delete bullet_info;
} }
); );
if (skill_meta && skill_meta->GetMagicId() == MAGIC_FG) {
c->TryDelayAddBuff(c, kKeepShotAnimiBuffId, shot_animi_time);
}
} }
} }
c->GetTrigger()->Shot(weapon_meta); c->GetTrigger()->Shot(weapon_meta);
@ -669,6 +672,30 @@ int Creature::TryAddBuff(Creature* caster, int buff_id)
return -1; return -1;
} }
void Creature::TryDelayAddBuff(Creature* caster, int buff_id, int time)
{
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(buff_id);
if (buff_meta) {
room->xtimer.AddDeadLineTimerAndAttach
(
time / FRAME_RATE_MS,
a8::XParams()
.SetSender(this)
.SetParam1(caster->GetUniId())
.SetParam2(buff_id),
[] (const a8::XParams& param)
{
Creature* c = (Creature*)param.sender.GetUserData();
Entity* e = c->room->GetEntityByUniId(param.param1);
if (e->IsCreature(c->room) && !c->IsDead(c->room)) {
c->TryAddBuff((Creature*)e, param.param2);
}
},
&xtimer_attacher.timer_list_
);
}
}
int Creature::TryAddBuffWithTarget(Creature* caster, int buff_id) int Creature::TryAddBuffWithTarget(Creature* caster, int buff_id)
{ {
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(buff_id); MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(buff_id);

View File

@ -136,6 +136,7 @@ class Creature : public MoveableEntity
bool no_check_immune = false); bool no_check_immune = false);
bool IsImmuneBuffEffect(int buff_effect); bool IsImmuneBuffEffect(int buff_effect);
int MustBeAddBuff(Creature* caster, int buff_id); int MustBeAddBuff(Creature* caster, int buff_id);
void TryDelayAddBuff(Creature* caster, int buff_id, int time);
int TryAddBuff(Creature* caster, int buff_id); int TryAddBuff(Creature* caster, int buff_id);
int TryAddBuffWithTarget(Creature* caster, int buff_id); int TryAddBuffWithTarget(Creature* caster, int buff_id);
void RemoveBuffById(int buff_id); void RemoveBuffById(int buff_id);