callSkillAI(npc, c2, skill);
}
public void callSkillAI(L2NpcInstance npc, L2Character c2, L2Skill skill)
{
QuestTimer timer = getQuestTimer("launch_random_skill", npc, null);
if (npc == null)
{
if (timer != null)
timer.cancel();
return;
}
if (npc.isInvul())
return;
if (c2 == null || c2.isDead() || timer == null)
{
c2 = getRandomTarget(npc); // just in case if hate AI fail
if (timer == null)
{
startQuestTimer("launch_random_skill", 500, npc, null, true);
return;
}
}
L2Character target = c2;
if (target == null || target.isDead())
{
return;
}
if (Util.checkIfInRange(skill.getCastRange(), npc, target, true))
{
timer.cancel();
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
//npc.setIsCastingNow(true);
npc.setTarget(target);
npc.doCast(skill);