This commit is contained in:
aozhiwei 2021-03-30 14:35:18 +08:00
parent 418d98deea
commit e42c46ffd6
2 changed files with 6 additions and 15 deletions

View File

@ -482,7 +482,7 @@ void AndroidNewAI::UpdateThinking()
ChangeToStateNewAI(ASE_RandomWalk);
}
} else {
Human* target = GetTarget();
Creature* target = GetTarget();
if (target) {
node_.target.Attach(target);
ChangeToStateNewAI(ASE_Attack);
@ -682,7 +682,7 @@ void AndroidNewAI::ChangeToStateNewAI(AndroidStateEx_e to_state)
node_.exec_frame_num = 0;
}
Human* AndroidNewAI::GetTarget()
Creature* AndroidNewAI::GetTarget()
{
if (GetAiLevel() <= 1) {
return nullptr;
@ -692,20 +692,11 @@ Human* AndroidNewAI::GetTarget()
return nullptr;
}
Human* target = nullptr;
myself->TouchAllLayerHumanList
Creature* target = nullptr;
myself->TouchProperTargets
(
[myself, &target] (Human* hum, bool& stop)
[myself, &target] (Creature* hum, bool& stop)
{
if (hum->dead) {
return;
}
if (a8::HasBitFlag(hum->status, HS_Disable)) {
return;
}
if (myself->team_id == hum->team_id) {
return;
}
if (target) {
if (myself->GetPos().ManhattanDistance(target->GetPos()) >
myself->GetPos().ManhattanDistance(hum->GetPos())) {

View File

@ -82,7 +82,7 @@ private:
void ChangeToStateNewAI(AndroidStateEx_e to_state);
void DoShotNewAI();
Human* GetTarget();
Creature* GetTarget();
float GetAttackRange();
int GetAttackTimes();