1
This commit is contained in:
parent
ac6c57a65c
commit
6dfb750f09
@ -176,11 +176,35 @@ behaviac::EBTStatus BaseAgent::CoAttackTarget(int target_id)
|
|||||||
is_shot = true;
|
is_shot = true;
|
||||||
}
|
}
|
||||||
if (is_shot) {
|
if (is_shot) {
|
||||||
bool shot_ok = false;
|
bool use_skill_ok = false;
|
||||||
glm::vec3 shot_dir = dir;
|
if (context->target.Get() &&
|
||||||
GetOwner()->SetAttackDir(dir);
|
!context->target.Get()->dead) {
|
||||||
GetOwner()->shot_hold = true;
|
int skill_id = GetUseableSkill(context->target.Get());
|
||||||
GetOwner()->Shot(shot_dir, shot_ok, 0, 0);
|
if (skill_id >= 0) {
|
||||||
|
GetOwner()->shot_hold = false;
|
||||||
|
int wait_time = 0;
|
||||||
|
use_skill_ok = InternalUseSkill(skill_id, context->target, wait_time);
|
||||||
|
if (use_skill_ok) {
|
||||||
|
Sleep(wait_time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#ifdef DEBUG
|
||||||
|
if (context->target.Get()->IsPlayer()) {
|
||||||
|
a8::XPrintf("DoAttack %d use_skill_ok:%d time:%d\n",
|
||||||
|
{GetOwner()->GetUniId(),
|
||||||
|
use_skill_ok ? 1 : 0,
|
||||||
|
GetOwner()->GetMainSkill() ? GetOwner()->GetMainSkill()->GetLeftTime() : 0
|
||||||
|
});
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if (!use_skill_ok) {
|
||||||
|
bool shot_ok = false;
|
||||||
|
glm::vec3 shot_dir = dir;
|
||||||
|
GetOwner()->SetAttackDir(dir);
|
||||||
|
GetOwner()->shot_hold = true;
|
||||||
|
GetOwner()->Shot(shot_dir, shot_ok, 0, 0);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
GetOwner()->shot_hold = false;
|
GetOwner()->shot_hold = false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user