diff --git a/server/gameserver/android.ai.cc b/server/gameserver/android.ai.cc index 59b6059..64a25f4 100644 --- a/server/gameserver/android.ai.cc +++ b/server/gameserver/android.ai.cc @@ -535,7 +535,7 @@ void AndroidAI::ChangeToStateNewAI(AndroidStateEx_e to_state) Creature* AndroidAI::GetTarget() { - if (GetAiLevel() <= 1) { + if (ai_meta->i->attack_range() <= 0) { return nullptr; } Human* myself = (Human*)owner; diff --git a/server/gameserver/constant.h b/server/gameserver/constant.h index ab74d22..9950d84 100644 --- a/server/gameserver/constant.h +++ b/server/gameserver/constant.h @@ -514,3 +514,5 @@ const long long SPEC_MAP_OBJECT_FLAGS = A8_DEFINE_RANGE_BIT(long long, kCollider const float DEFAULT_FLY_DISTANCE = 5.0f; const int MAP_BLOCK_START_ID = 1000000000; + +const int ANDROID_AI_ID_START = 1001; diff --git a/server/gameserver/hero.ai.cc b/server/gameserver/hero.ai.cc index e99aa42..e1dd199 100644 --- a/server/gameserver/hero.ai.cc +++ b/server/gameserver/hero.ai.cc @@ -379,11 +379,9 @@ void HeroAI::ChangeToStateAI(HeroState_e to_state) Creature* HeroAI::GetTarget() { - #if 0 - if (GetAiLevel() <= 1) { + if (ai_meta->i->attack_range() <= 0) { return nullptr; } - #endif Hero* myself = (Hero*)owner; if (myself->room->GetGasData().gas_mode == GasInactive) { return nullptr; diff --git a/server/gameserver/hero.cc b/server/gameserver/hero.cc index 8bd7607..0a288d1 100644 --- a/server/gameserver/hero.cc +++ b/server/gameserver/hero.cc @@ -249,7 +249,7 @@ void Hero::InitAI() #ifdef DEBUG abort(); #endif - ai_meta = MetaMgr::Instance()->GetHeroAI(1001); + ai_meta = MetaMgr::Instance()->GetHeroAI(ANDROID_AI_ID_START); } if (!ai_meta) { abort(); diff --git a/server/gameserver/metamgr.cc b/server/gameserver/metamgr.cc index 1d7e90d..4560d3b 100644 --- a/server/gameserver/metamgr.cc +++ b/server/gameserver/metamgr.cc @@ -694,7 +694,7 @@ private: item.Init(); ai_hash[item.i->id()] = &item; if (item.i->ai_kind() == kAI_Android) { - android_ai_hash[a8::MakeInt64(meta.ai_level(), meta.ai_mode())] = &item; + android_ai_hash[a8::MakeInt64(meta.id() - ANDROID_AI_ID_START + 1, meta.ai_mode())] = &item; } } diff --git a/server/gameserver/zombiemode.ai.cc b/server/gameserver/zombiemode.ai.cc index f1d0417..e51e5eb 100644 --- a/server/gameserver/zombiemode.ai.cc +++ b/server/gameserver/zombiemode.ai.cc @@ -379,7 +379,7 @@ void ZombieModeAI::ChangeToState(ZombieState_e to_state) Creature* ZombieModeAI::GetTarget() { - if (GetAiLevel() <= 1) { + if (ai_meta->i->attack_range() <= 0) { return nullptr; } Human* myself = (Human*)owner; diff --git a/server/tools/protobuild/metatable.proto b/server/tools/protobuild/metatable.proto index 8c1f399..f391f3b 100755 --- a/server/tools/protobuild/metatable.proto +++ b/server/tools/protobuild/metatable.proto @@ -340,7 +340,7 @@ message KillPoint message AI { optional int32 id = 13; - optional int32 ai_level = 1; + //optional int32 ai_level = 1; optional int32 pursuit_radius = 2; optional int32 attack_interval = 3; optional int32 attack_times = 4;