This commit is contained in:
aozhiwei 2020-07-29 16:33:45 +08:00
parent 591d11f662
commit ac15c56895
3 changed files with 17 additions and 3 deletions

View File

@ -364,3 +364,5 @@ const int HUMAN_RACE_META_START_ID = 5001;
const int ZOMBIE_RACE_META_START_ID = 6001;
const int TERMINATOR_BUFF_ID = 1033;
const int TURN_OVER_SKILL_ID = 41001;

View File

@ -186,7 +186,11 @@ void ZombieModeAI::UpdateAttack()
}
float distance = myself->GetPos().Distance(node_->target->GetPos());
if (distance > GetAttackRange()) {
if (node_->ai_meta->i->pursuit_radius() <= 0) {
if (myself->CanUseSkill() &&
myself->CurrentSkillMeta()->i->skill_id() != TURN_OVER_SKILL_ID &&
distance < myself->CurrentSkillMeta()->i->skill_distance()) {
DoSkill();
} else if (node_->ai_meta->i->pursuit_radius() <= 0) {
//站桩
ChangeToState(ZSE_Thinking);
} else {
@ -391,8 +395,7 @@ Human* ZombieModeAI::GetTarget()
node_->nearest_human = target;
node_->last_check_nearest_human_frameno = myself->room->GetFrameNo();
float distance = myself->GetPos().Distance(target->GetPos());
#if 1
#else
#if 0
if (distance > GetAttackRange()) {
target = nullptr;
}
@ -454,6 +457,14 @@ void ZombieModeAI::DoShot()
}
}
void ZombieModeAI::DoSkill()
{
Human* myself = (Human*)owner;
myself->skill_target_id = node_->target->GetEntityUniId();
myself->skill_target_pos = node_->target->GetPos();
myself->DoSkill();
}
int ZombieModeAI::GetAttackTimes()
{
Human* myself = (Human*)owner;

View File

@ -33,6 +33,7 @@ private:
void DoMove();
void ChangeToState(ZombieState_e to_state);
void DoShot();
void DoSkill();
Human* GetTarget();
float GetAttackRange();