This commit is contained in:
aozhiwei 2022-10-10 20:12:46 +08:00
parent d43e781022
commit 9b77cb1b91
3 changed files with 16 additions and 4 deletions

View File

@ -809,9 +809,19 @@ void Bullet::ProcFlyHook(Entity* target)
if (target->IsCreature(room)) {
Creature* c = (Creature*)target;
room->frame_event.AddPropChg(c->GetWeakPtrRef(), kPropBeHook, 0, sender.Get()->GetUniId());
c->AutoNavigation(born_pos, gun_meta->i->bullet_speed() * 2);
int buff_uniid = c->TryAddBuff(c, gun_meta->i->buffid());
c->AutoNavigation(born_pos, gun_meta->i->bullet_speed() * 2,
[buff_uniid] (Creature* c)
{
c->RemoveBuffByUniId(buff_uniid);
}
);
} else {
sender.Get()->AutoNavigation(GetPos(), gun_meta->i->bullet_speed() * 2);
sender.Get()->AutoNavigation(GetPos(), gun_meta->i->bullet_speed() * 2,
[] (Creature* c)
{
});
}
sender.Get()->IncDisableMoveTimes();

View File

@ -3616,7 +3616,8 @@ void Creature::_UpdateSpecMove()
}
}
void Creature::AutoNavigation(a8::Vec2 target_pos, float speed)
void Creature::AutoNavigation(a8::Vec2 target_pos, float speed,
std::function<void (Creature*)> cb)
{
float distance = GetPos().Distance(target_pos);
if (distance < 0.001f) {

View File

@ -278,7 +278,8 @@ class Creature : public MoveableEntity
float GetAttrAbs(int attr_id);
float GetAttrRate(int attr_id);
void RecalcDtoAttr();
void AutoNavigation(a8::Vec2 target_pos, float speed);
void AutoNavigation(a8::Vec2 target_pos, float speed,
std::function<void (Creature*)> cb);
void AddTraceBullet(int bullet_uniid, int target_uniid, int gun_id);
void LockAttackDir(int time);