This commit is contained in:
aozhiwei 2021-09-07 06:59:37 +00:00
parent 9191585bac
commit 9f5d6c5f7d
2 changed files with 11 additions and 5 deletions

View File

@ -2779,14 +2779,20 @@ bool Creature::CanFollow(Creature* follower)
return false; return false;
} }
#endif #endif
if (!follower->HasBuffEffect(kBET_Jump) && room->GetGasData().gas_mode != GasInactive) { if (follower->HasBuffEffect(kBET_Jump)) {
return false;
}
if (!follower->HasBuffEffect(kBET_Fly) && room->GetGasData().gas_mode != GasInactive) {
return false; return false;
} }
if (!IsPlayer()) { if (!IsPlayer()) {
return false; return false;
} }
if (!HasBuffEffect(kBET_Jump) && room->GetGasData().gas_mode != GasInactive) { if (HasBuffEffect(kBET_Jump)) {
return false;
}
if (!HasBuffEffect(kBET_Fly) && room->GetGasData().gas_mode != GasInactive) {
return false; return false;
} }
return true; return true;
@ -2800,12 +2806,12 @@ void Creature::FollowToTarget()
#if 1 #if 1
{ {
#else #else
if (GetPos().ManhattanDistance(follow_target.Get()->GetPos()) > 20) { if (GetPos().ManhattanDistance(follow_target.Get()->GetPos()) > 50) {
#endif #endif
a8::Vec2 dir = a8::Vec2::UP; a8::Vec2 dir = a8::Vec2::UP;
dir.Rotate(a8::RandAngle()); dir.Rotate(a8::RandAngle());
dir.Normalize(); dir.Normalize();
a8::Vec2 target_pos = follow_target.Get()->GetPos() + dir * (10 + (rand() % 10)); a8::Vec2 target_pos = follow_target.Get()->GetPos() + dir * (30 + (rand() % 10));
if (GetPos().ManhattanDistance(target_pos) > 5) { if (GetPos().ManhattanDistance(target_pos) > 5) {
a8::Vec2 move_dir = target_pos - GetPos(); a8::Vec2 move_dir = target_pos - GetPos();
move_dir.Normalize(); move_dir.Normalize();

View File

@ -1265,7 +1265,7 @@ void Player::UpdateFollow()
room->frame_event.AddPropChg(GetWeakPtrRef(), kPropFollowTarget, 0, follow, true); room->frame_event.AddPropChg(GetWeakPtrRef(), kPropFollowTarget, 0, follow, true);
follow_target_timer_ = room->xtimer.AddRepeatTimerAndAttach follow_target_timer_ = room->xtimer.AddRepeatTimerAndAttach
( (
FRAME_RATE_MS, 400 / FRAME_RATE_MS,
a8::XParams() a8::XParams()
.SetSender(this), .SetSender(this),
[] (const a8::XParams& param) [] (const a8::XParams& param)