From bd10f32cb974f432e06fdb4bc02713d1b2d14ebc Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 4 Jun 2020 18:46:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9C=BA=E5=99=A8=E4=BA=BA?= =?UTF-8?q?=E8=A1=8C=E5=8A=A8=E5=AE=95=E6=9C=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/gameserver/android.ai.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/server/gameserver/android.ai.cc b/server/gameserver/android.ai.cc index 912c5bf..4fc227f 100644 --- a/server/gameserver/android.ai.cc +++ b/server/gameserver/android.ai.cc @@ -164,8 +164,10 @@ void AndroidAI::UpdateNewBieNpc() { Human* hum = (Human*)owner; if (hum->room->GetFrameNo() - hum->enable_frameno < 2) { - hum->move_dir = hum->room->GetFirstNewBie()->GetPos() - hum->GetPos(); - hum->move_dir.Normalize(); + if (hum->GetPos().ManhattanDistance(hum->room->GetFirstNewBie()->GetPos()) > 100) { + hum->move_dir = hum->room->GetFirstNewBie()->GetPos() - hum->GetPos(); + hum->move_dir.Normalize(); + } hum->attack_dir = hum->move_dir; if (hum->curr_weapon->weapon_idx != 0) { hum->curr_weapon->ammo = MetaMgr::Instance()->newbie_first_robot_ammo; @@ -204,8 +206,10 @@ void AndroidAI::UpdateLastNpc() { Human* hum = (Human*)owner; if (hum->room->GetFrameNo() - hum->enable_frameno < 2) { - hum->move_dir = hum->last_human_target->GetPos() - hum->GetPos(); - hum->move_dir.Normalize(); + if (hum->GetPos().ManhattanDistance(hum->last_human_target->GetPos()) > 100) { + hum->move_dir = hum->last_human_target->GetPos() - hum->GetPos(); + hum->move_dir.Normalize(); + } hum->attack_dir = hum->move_dir; if (hum->curr_weapon->weapon_idx != 0) { hum->curr_weapon->ammo = MetaMgr::Instance()->newbie_first_robot_ammo * 2;