1
This commit is contained in:
parent
e42c46ffd6
commit
b4ec86c3b2
@ -28,6 +28,8 @@ class Creature : public MoveableEntity
|
|||||||
HumanAbility ability;
|
HumanAbility ability;
|
||||||
a8::Vec2 target_pos;
|
a8::Vec2 target_pos;
|
||||||
std::function<bool ()> on_move_collision;
|
std::function<bool ()> on_move_collision;
|
||||||
|
bool poisoning = false;
|
||||||
|
long long poisoning_time = 0;
|
||||||
|
|
||||||
Weapon* curr_weapon = nullptr;
|
Weapon* curr_weapon = nullptr;
|
||||||
Weapon car_weapon;
|
Weapon car_weapon;
|
||||||
|
@ -119,10 +119,6 @@ void HeroAI::UpdateIdle()
|
|||||||
|
|
||||||
void HeroAI::UpdateThinking()
|
void HeroAI::UpdateThinking()
|
||||||
{
|
{
|
||||||
#if 1
|
|
||||||
ChangeToStateAI(HSE_RandomWalk);
|
|
||||||
return ;
|
|
||||||
#endif
|
|
||||||
Hero* hero = (Hero*)owner;
|
Hero* hero = (Hero*)owner;
|
||||||
if (hero->room->GetGasData().gas_mode == GasInactive ||
|
if (hero->room->GetGasData().gas_mode == GasInactive ||
|
||||||
hero->room->IsWaitingStart() ||
|
hero->room->IsWaitingStart() ||
|
||||||
@ -134,7 +130,7 @@ void HeroAI::UpdateThinking()
|
|||||||
ChangeToStateAI(HSE_RandomWalk);
|
ChangeToStateAI(HSE_RandomWalk);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Human* target = GetTarget();
|
Creature* target = GetTarget();
|
||||||
if (target) {
|
if (target) {
|
||||||
node_.target.Attach(target);
|
node_.target.Attach(target);
|
||||||
ChangeToStateAI(HSE_Attack);
|
ChangeToStateAI(HSE_Attack);
|
||||||
@ -329,7 +325,7 @@ void HeroAI::ChangeToStateAI(HeroState_e to_state)
|
|||||||
node_.exec_frame_num = 0;
|
node_.exec_frame_num = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Human* HeroAI::GetTarget()
|
Creature* HeroAI::GetTarget()
|
||||||
{
|
{
|
||||||
if (GetAiLevel() <= 1) {
|
if (GetAiLevel() <= 1) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -339,20 +335,11 @@ Human* HeroAI::GetTarget()
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Human* target = nullptr;
|
Creature* target = nullptr;
|
||||||
myself->TouchAllLayerHumanList
|
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 (target) {
|
||||||
if (myself->GetPos().ManhattanDistance(target->GetPos()) >
|
if (myself->GetPos().ManhattanDistance(target->GetPos()) >
|
||||||
myself->GetPos().ManhattanDistance(hum->GetPos())) {
|
myself->GetPos().ManhattanDistance(hum->GetPos())) {
|
||||||
|
@ -56,7 +56,7 @@ private:
|
|||||||
void ChangeToStateAI(HeroState_e to_state);
|
void ChangeToStateAI(HeroState_e to_state);
|
||||||
void DoShotAI();
|
void DoShotAI();
|
||||||
|
|
||||||
Human* GetTarget();
|
Creature* GetTarget();
|
||||||
float GetAttackRange();
|
float GetAttackRange();
|
||||||
int GetAttackTimes();
|
int GetAttackTimes();
|
||||||
|
|
||||||
|
@ -77,8 +77,6 @@ class Human : public Creature
|
|||||||
int max_energy_shield = 0;
|
int max_energy_shield = 0;
|
||||||
int vip = 0;
|
int vip = 0;
|
||||||
int sdmg = 0;
|
int sdmg = 0;
|
||||||
bool poisoning = false;
|
|
||||||
long long poisoning_time = 0;
|
|
||||||
int lethal_weapon = 0;
|
int lethal_weapon = 0;
|
||||||
long long join_frameno = 0;
|
long long join_frameno = 0;
|
||||||
long long enable_frameno = 0;
|
long long enable_frameno = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user