if (getAI().getNextIntention() == null && (skill.getSkillType() == SkillType.PDAM && skill.getCastRange() < 400) || skill.getSkillType() == SkillType.BLOW || skill.getSkillType() == SkillType.DRAIN_SOUL || skill.getSkillType() == SkillType.SOW || skill.getSkillType() == SkillType.SPOIL)
{
if (this instanceof L2PcInstance)
{
L2PcInstance currPlayer = (L2PcInstance) this;
SkillDat skilldat = currPlayer.getCurrentSkill();
// Like L2OFF if the skill is BLOW the player doesn't auto attack
// If on XML skill nextActionAttack = true the char auto attack
// If CTRL is pressed the autoattack is aborted (like L2OFF)
if (skilldat != null && !skilldat.isCtrlPressed() && skill.nextActionIsAttack() && getTarget() != null && getTarget() instanceof L2Character)
{
getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, getTarget());
}
}
else
// case NPC
{
if (skill.nextActionIsAttack() && getTarget() != null && getTarget() instanceof L2Character)
{
getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, getTarget());
}
else if ((skill.isOffensive()) && !(skill.getSkillType() == SkillType.UNLOCK) && !(skill.getSkillType() == SkillType.BLOW) && !(skill.getSkillType() == SkillType.DELUXE_KEY_UNLOCK) && skill.getId() != 345 && skill.getId() != 346)
{
getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, getTarget());
getAI().clientStartAutoAttack();
}
}
}
if (this instanceof L2PcInstance)
{
L2PcInstance currPlayer = (L2PcInstance) this;
SkillDat skilldat = currPlayer.getCurrentSkill();
if (skilldat != null && !skilldat.isCtrlPressed() && (skill.isOffensive()) && !(skill.getSkillType() == SkillType.UNLOCK) && !(skill.getSkillType() == SkillType.BLOW) && !(skill.getSkillType() == SkillType.DELUXE_KEY_UNLOCK) && skill.getId() != 345 && skill.getId() != 346)
{
if(!skill.isMagic() && skill.nextActionIsAttack())
getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, getTarget());
getAI().clientStartAutoAttack();
}
}
else
// case npc
{
if ((skill.isOffensive()) && !(skill.getSkillType() == SkillType.UNLOCK) && !(skill.getSkillType() == SkillType.BLOW) && !(skill.getSkillType() == SkillType.DELUXE_KEY_UNLOCK) && skill.getId() != 345 && skill.getId() != 346)
{
if(!skill.isMagic())
getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, getTarget());
getAI().clientStartAutoAttack();
}
}
}
else
{
getAI().clientStopAutoAttack();
}
// Notify the AI of the L2Character with EVT_FINISH_CASTING
getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING);
notifyQuestEventSkillFinished(skill, getTarget());
/*
* If character is a player, then wipe their current cast state and check if a skill is queued. If there is a queued skill, launch it and wipe the queue.
*/
if (this instanceof L2PcInstance)
{
L2PcInstance currPlayer = (L2PcInstance) this;
SkillDat queuedSkill = currPlayer.getQueuedSkill();
currPlayer.setCurrentSkill(null, false, false);
if (queuedSkill != null)
{
currPlayer.setQueuedSkill(null, false, false);
// DON'T USE : Recursive call to useMagic() method
// currPlayer.useMagic(queuedSkill.getSkill(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed());
ThreadPoolManager.getInstance().executeTask(new QueuedMagicUseTask(currPlayer, queuedSkill.getSkill(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()));
}
queuedSkill = null;
final L2Weapon activeWeapon = getActiveWeaponItem();