diff --git a/server/gameserver/creature.h b/server/gameserver/creature.h index 3e7cb35..7670a73 100644 --- a/server/gameserver/creature.h +++ b/server/gameserver/creature.h @@ -28,6 +28,8 @@ class Creature : public MoveableEntity HumanAbility ability; a8::Vec2 target_pos; std::function on_move_collision; + bool poisoning = false; + long long poisoning_time = 0; Weapon* curr_weapon = nullptr; Weapon car_weapon; diff --git a/server/gameserver/hero.ai.cc b/server/gameserver/hero.ai.cc index a1fdfa9..ccbe2f0 100644 --- a/server/gameserver/hero.ai.cc +++ b/server/gameserver/hero.ai.cc @@ -119,10 +119,6 @@ void HeroAI::UpdateIdle() void HeroAI::UpdateThinking() { - #if 1 - ChangeToStateAI(HSE_RandomWalk); - return ; - #endif Hero* hero = (Hero*)owner; if (hero->room->GetGasData().gas_mode == GasInactive || hero->room->IsWaitingStart() || @@ -134,7 +130,7 @@ void HeroAI::UpdateThinking() ChangeToStateAI(HSE_RandomWalk); } } else { - Human* target = GetTarget(); + Creature* target = GetTarget(); if (target) { node_.target.Attach(target); ChangeToStateAI(HSE_Attack); @@ -329,7 +325,7 @@ void HeroAI::ChangeToStateAI(HeroState_e to_state) node_.exec_frame_num = 0; } -Human* HeroAI::GetTarget() +Creature* HeroAI::GetTarget() { if (GetAiLevel() <= 1) { return nullptr; @@ -339,20 +335,11 @@ Human* HeroAI::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())) { diff --git a/server/gameserver/hero.ai.h b/server/gameserver/hero.ai.h index 7d853a0..d3c5fb1 100644 --- a/server/gameserver/hero.ai.h +++ b/server/gameserver/hero.ai.h @@ -56,7 +56,7 @@ private: void ChangeToStateAI(HeroState_e to_state); void DoShotAI(); - Human* GetTarget(); + Creature* GetTarget(); float GetAttackRange(); int GetAttackTimes(); diff --git a/server/gameserver/human.h b/server/gameserver/human.h index eb2130e..19974fd 100644 --- a/server/gameserver/human.h +++ b/server/gameserver/human.h @@ -77,8 +77,6 @@ class Human : public Creature int max_energy_shield = 0; int vip = 0; int sdmg = 0; - bool poisoning = false; - long long poisoning_time = 0; int lethal_weapon = 0; long long join_frameno = 0; long long enable_frameno = 0;