Check for queued skill before next action.

This commit is contained in:
MobiusDev
2019-01-12 01:18:01 +00:00
parent 7cb742db48
commit 7220436930
10 changed files with 170 additions and 220 deletions

View File

@ -740,8 +740,23 @@ public class SkillCaster implements Runnable
caster.sendPacket(ActionFailed.get(_castingType)); // send an "action failed" packet to the caster
}
// Attack target after skill use
// TODO: This shouldnt be here. If skill condition fail, you still go autoattack. This doesn't happen if skill is in cooldown though.
// If there is a queued skill, launch it and wipe the queue.
if (caster.isPlayer())
{
final L2PcInstance currPlayer = caster.getActingPlayer();
final SkillUseHolder queuedSkill = currPlayer.getQueuedSkill();
if (queuedSkill != null)
{
ThreadPool.execute(() ->
{
currPlayer.setQueuedSkill(null, null, false, false);
currPlayer.useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed());
});
return;
}
}
// Attack target after skill use.
if ((_skill.getNextAction() != NextActionType.NONE) && (caster.getAI().getNextIntention() == null))
{
if ((_skill.getNextAction() == NextActionType.ATTACK) && (target != null) && (target != caster) && target.isAutoAttackable(caster))
@ -761,26 +776,6 @@ public class SkillCaster implements Runnable
{
caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING);
}
// Notify the AI of the L2Character with EVT_FINISH_CASTING
// If there is a queued skill, launch it and wipe the queue.
if (caster.isPlayer())
{
final L2PcInstance currPlayer = caster.getActingPlayer();
final SkillUseHolder queuedSkill = currPlayer.getQueuedSkill();
if (queuedSkill != null)
{
ThreadPool.execute(() ->
{
currPlayer.setQueuedSkill(null, null, false, false);
currPlayer.useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed());
});
return;
}
}
}
private void calcSkillTiming(L2Character creature, Skill skill)