Fixed issue caused from a lair NPC starting combat with itself.

This commit is contained in:
Cekis
2017-01-20 17:35:36 +00:00
parent f2c021c1cd
commit 1086ba0ced
@@ -83,28 +83,25 @@ public class npc_lair_ai extends script.theme_park.poi.base
switch (job)
{
case JOB_DEFEND:
obj_id target = params.getObjId("target");
respondToScoutAlarm(mobile, target);
return;
obj_id target = params.getObjId("target");
respondToScoutAlarm(mobile, target);
break;
case JOB_HEAL:
if (!ai_lib.isMonster(mobile))
{
return;
}
obj_id myTarget = getTarget(mobile);
if (!isIdValid(myTarget))
{
doLairHealing(mobile, params);
}
else if (getTarget(myTarget) != mobile)
{
doLairHealing(mobile, params);
}
if (!ai_lib.isMonster(mobile))
{
return;
}
obj_id myTarget = getTarget(mobile);
if (!isIdValid(myTarget) || getTarget(myTarget) != mobile)
{
doLairHealing(mobile, params);
}
break;
}
}
public void respondToScoutAlarm(obj_id mobile, obj_id target) throws InterruptedException
{
if (!isIdValid(target) || ai_lib.isAiDead(target))
if (!isIdValid(target) || ai_lib.isAiDead(target) || mobile.equals(target))
{
return;
}