1
This commit is contained in:
parent
e42c46ffd6
commit
b4ec86c3b2
@ -28,6 +28,8 @@ class Creature : public MoveableEntity
|
||||
HumanAbility ability;
|
||||
a8::Vec2 target_pos;
|
||||
std::function<bool ()> on_move_collision;
|
||||
bool poisoning = false;
|
||||
long long poisoning_time = 0;
|
||||
|
||||
Weapon* curr_weapon = nullptr;
|
||||
Weapon car_weapon;
|
||||
|
@ -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())) {
|
||||
|
@ -56,7 +56,7 @@ private:
|
||||
void ChangeToStateAI(HeroState_e to_state);
|
||||
void DoShotAI();
|
||||
|
||||
Human* GetTarget();
|
||||
Creature* GetTarget();
|
||||
float GetAttackRange();
|
||||
int GetAttackTimes();
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user