diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java index 58a6ee155c..451d9a575b 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java @@ -723,8 +723,29 @@ 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 ((_skill.getNextAction() != NextActionType.NONE) && (caster.getAI().getNextIntention() == null)) + { + if ((_skill.getNextAction() == NextActionType.ATTACK) && (target != null) && (target != caster) && target.isAutoAttackable(caster)) + { + caster.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); + } + else if ((_skill.getNextAction() == NextActionType.CAST) && (target != null) && (target != caster) && target.isAutoAttackable(caster)) + { + caster.getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, _skill, target, _item, false, false); + } + else + { + caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING); + } + } + else + { + caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING); + } + // Notify the AI of the L2Character with EVT_FINISH_CASTING - caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING); // If there is a queued skill, launch it and wipe the queue. if (caster.isPlayer()) @@ -743,23 +764,6 @@ public class SkillCaster implements Runnable return; } } - - // 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 ((_skill.getNextAction() != NextActionType.NONE) && (target != null) && (target != caster) && target.canBeAttacked()) - { - if ((caster.getAI().getIntention() == null) || (caster.getAI().getIntention() != CtrlIntention.AI_INTENTION_MOVE_TO)) - { - if (_skill.getNextAction() == NextActionType.ATTACK) - { - caster.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); - } - else if (_skill.getNextAction() == NextActionType.CAST) - { - caster.getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, _skill, target, _item, false, false); - } - } - } } private void calcSkillTiming(L2Character creature, Skill skill) @@ -868,7 +872,7 @@ public class SkillCaster implements Runnable */ public boolean canAbortCast() { - return _targets == null; // When targets are allocated, that means skill is already launched, therefore cannot be aborted. + return getCaster().getTarget() == null; // When targets are allocated, that means skill is already launched, therefore cannot be aborted. } /** diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java index f6cd5bde92..0f57c18729 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java @@ -151,14 +151,6 @@ public class SkillChannelizer implements Runnable // Apply channeling skills on the targets. if (skill.getChannelingSkillId() > 0) { - final Skill baseSkill = SkillData.getInstance().getSkill(skill.getChannelingSkillId(), 1); - if (baseSkill == null) - { - _log.warning(getClass().getSimpleName() + ": skill " + skill + " couldn't find effect id skill: " + skill.getChannelingSkillId() + " !"); - _channelizer.abortCast(); - return; - } - final List targetList = new ArrayList<>(); final L2Object target = skill.getTarget(_channelizer, false, false, false); if (target != null) diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java index 58a6ee155c..451d9a575b 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java @@ -723,8 +723,29 @@ 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 ((_skill.getNextAction() != NextActionType.NONE) && (caster.getAI().getNextIntention() == null)) + { + if ((_skill.getNextAction() == NextActionType.ATTACK) && (target != null) && (target != caster) && target.isAutoAttackable(caster)) + { + caster.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); + } + else if ((_skill.getNextAction() == NextActionType.CAST) && (target != null) && (target != caster) && target.isAutoAttackable(caster)) + { + caster.getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, _skill, target, _item, false, false); + } + else + { + caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING); + } + } + else + { + caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING); + } + // Notify the AI of the L2Character with EVT_FINISH_CASTING - caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING); // If there is a queued skill, launch it and wipe the queue. if (caster.isPlayer()) @@ -743,23 +764,6 @@ public class SkillCaster implements Runnable return; } } - - // 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 ((_skill.getNextAction() != NextActionType.NONE) && (target != null) && (target != caster) && target.canBeAttacked()) - { - if ((caster.getAI().getIntention() == null) || (caster.getAI().getIntention() != CtrlIntention.AI_INTENTION_MOVE_TO)) - { - if (_skill.getNextAction() == NextActionType.ATTACK) - { - caster.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); - } - else if (_skill.getNextAction() == NextActionType.CAST) - { - caster.getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, _skill, target, _item, false, false); - } - } - } } private void calcSkillTiming(L2Character creature, Skill skill) @@ -868,7 +872,7 @@ public class SkillCaster implements Runnable */ public boolean canAbortCast() { - return _targets == null; // When targets are allocated, that means skill is already launched, therefore cannot be aborted. + return getCaster().getTarget() == null; // When targets are allocated, that means skill is already launched, therefore cannot be aborted. } /** diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java index f6cd5bde92..0f57c18729 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java @@ -151,14 +151,6 @@ public class SkillChannelizer implements Runnable // Apply channeling skills on the targets. if (skill.getChannelingSkillId() > 0) { - final Skill baseSkill = SkillData.getInstance().getSkill(skill.getChannelingSkillId(), 1); - if (baseSkill == null) - { - _log.warning(getClass().getSimpleName() + ": skill " + skill + " couldn't find effect id skill: " + skill.getChannelingSkillId() + " !"); - _channelizer.abortCast(); - return; - } - final List targetList = new ArrayList<>(); final L2Object target = skill.getTarget(_channelizer, false, false, false); if (target != null) diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java index 58a6ee155c..451d9a575b 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java @@ -723,8 +723,29 @@ 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 ((_skill.getNextAction() != NextActionType.NONE) && (caster.getAI().getNextIntention() == null)) + { + if ((_skill.getNextAction() == NextActionType.ATTACK) && (target != null) && (target != caster) && target.isAutoAttackable(caster)) + { + caster.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); + } + else if ((_skill.getNextAction() == NextActionType.CAST) && (target != null) && (target != caster) && target.isAutoAttackable(caster)) + { + caster.getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, _skill, target, _item, false, false); + } + else + { + caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING); + } + } + else + { + caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING); + } + // Notify the AI of the L2Character with EVT_FINISH_CASTING - caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING); // If there is a queued skill, launch it and wipe the queue. if (caster.isPlayer()) @@ -743,23 +764,6 @@ public class SkillCaster implements Runnable return; } } - - // 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 ((_skill.getNextAction() != NextActionType.NONE) && (target != null) && (target != caster) && target.canBeAttacked()) - { - if ((caster.getAI().getIntention() == null) || (caster.getAI().getIntention() != CtrlIntention.AI_INTENTION_MOVE_TO)) - { - if (_skill.getNextAction() == NextActionType.ATTACK) - { - caster.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); - } - else if (_skill.getNextAction() == NextActionType.CAST) - { - caster.getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, _skill, target, _item, false, false); - } - } - } } private void calcSkillTiming(L2Character creature, Skill skill) @@ -868,7 +872,7 @@ public class SkillCaster implements Runnable */ public boolean canAbortCast() { - return _targets == null; // When targets are allocated, that means skill is already launched, therefore cannot be aborted. + return getCaster().getTarget() == null; // When targets are allocated, that means skill is already launched, therefore cannot be aborted. } /** diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java index f6cd5bde92..0f57c18729 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java @@ -151,14 +151,6 @@ public class SkillChannelizer implements Runnable // Apply channeling skills on the targets. if (skill.getChannelingSkillId() > 0) { - final Skill baseSkill = SkillData.getInstance().getSkill(skill.getChannelingSkillId(), 1); - if (baseSkill == null) - { - _log.warning(getClass().getSimpleName() + ": skill " + skill + " couldn't find effect id skill: " + skill.getChannelingSkillId() + " !"); - _channelizer.abortCast(); - return; - } - final List targetList = new ArrayList<>(); final L2Object target = skill.getTarget(_channelizer, false, false, false); if (target != null) diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java index 58a6ee155c..451d9a575b 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java @@ -723,8 +723,29 @@ 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 ((_skill.getNextAction() != NextActionType.NONE) && (caster.getAI().getNextIntention() == null)) + { + if ((_skill.getNextAction() == NextActionType.ATTACK) && (target != null) && (target != caster) && target.isAutoAttackable(caster)) + { + caster.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); + } + else if ((_skill.getNextAction() == NextActionType.CAST) && (target != null) && (target != caster) && target.isAutoAttackable(caster)) + { + caster.getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, _skill, target, _item, false, false); + } + else + { + caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING); + } + } + else + { + caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING); + } + // Notify the AI of the L2Character with EVT_FINISH_CASTING - caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING); // If there is a queued skill, launch it and wipe the queue. if (caster.isPlayer()) @@ -743,23 +764,6 @@ public class SkillCaster implements Runnable return; } } - - // 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 ((_skill.getNextAction() != NextActionType.NONE) && (target != null) && (target != caster) && target.canBeAttacked()) - { - if ((caster.getAI().getIntention() == null) || (caster.getAI().getIntention() != CtrlIntention.AI_INTENTION_MOVE_TO)) - { - if (_skill.getNextAction() == NextActionType.ATTACK) - { - caster.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); - } - else if (_skill.getNextAction() == NextActionType.CAST) - { - caster.getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, _skill, target, _item, false, false); - } - } - } } private void calcSkillTiming(L2Character creature, Skill skill) @@ -868,7 +872,7 @@ public class SkillCaster implements Runnable */ public boolean canAbortCast() { - return _targets == null; // When targets are allocated, that means skill is already launched, therefore cannot be aborted. + return getCaster().getTarget() == null; // When targets are allocated, that means skill is already launched, therefore cannot be aborted. } /** diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java index f6cd5bde92..0f57c18729 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java @@ -151,14 +151,6 @@ public class SkillChannelizer implements Runnable // Apply channeling skills on the targets. if (skill.getChannelingSkillId() > 0) { - final Skill baseSkill = SkillData.getInstance().getSkill(skill.getChannelingSkillId(), 1); - if (baseSkill == null) - { - _log.warning(getClass().getSimpleName() + ": skill " + skill + " couldn't find effect id skill: " + skill.getChannelingSkillId() + " !"); - _channelizer.abortCast(); - return; - } - final List targetList = new ArrayList<>(); final L2Object target = skill.getTarget(_channelizer, false, false, false); if (target != null) diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java index 58a6ee155c..451d9a575b 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java @@ -723,8 +723,29 @@ 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 ((_skill.getNextAction() != NextActionType.NONE) && (caster.getAI().getNextIntention() == null)) + { + if ((_skill.getNextAction() == NextActionType.ATTACK) && (target != null) && (target != caster) && target.isAutoAttackable(caster)) + { + caster.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); + } + else if ((_skill.getNextAction() == NextActionType.CAST) && (target != null) && (target != caster) && target.isAutoAttackable(caster)) + { + caster.getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, _skill, target, _item, false, false); + } + else + { + caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING); + } + } + else + { + caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING); + } + // Notify the AI of the L2Character with EVT_FINISH_CASTING - caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING); // If there is a queued skill, launch it and wipe the queue. if (caster.isPlayer()) @@ -743,23 +764,6 @@ public class SkillCaster implements Runnable return; } } - - // 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 ((_skill.getNextAction() != NextActionType.NONE) && (target != null) && (target != caster) && target.canBeAttacked()) - { - if ((caster.getAI().getIntention() == null) || (caster.getAI().getIntention() != CtrlIntention.AI_INTENTION_MOVE_TO)) - { - if (_skill.getNextAction() == NextActionType.ATTACK) - { - caster.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target); - } - else if (_skill.getNextAction() == NextActionType.CAST) - { - caster.getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, _skill, target, _item, false, false); - } - } - } } private void calcSkillTiming(L2Character creature, Skill skill) @@ -868,7 +872,7 @@ public class SkillCaster implements Runnable */ public boolean canAbortCast() { - return _targets == null; // When targets are allocated, that means skill is already launched, therefore cannot be aborted. + return getCaster().getTarget() == null; // When targets are allocated, that means skill is already launched, therefore cannot be aborted. } /** diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java index f6cd5bde92..0f57c18729 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/skills/SkillChannelizer.java @@ -151,14 +151,6 @@ public class SkillChannelizer implements Runnable // Apply channeling skills on the targets. if (skill.getChannelingSkillId() > 0) { - final Skill baseSkill = SkillData.getInstance().getSkill(skill.getChannelingSkillId(), 1); - if (baseSkill == null) - { - _log.warning(getClass().getSimpleName() + ": skill " + skill + " couldn't find effect id skill: " + skill.getChannelingSkillId() + " !"); - _channelizer.abortCast(); - return; - } - final List targetList = new ArrayList<>(); final L2Object target = skill.getTarget(_channelizer, false, false, false); if (target != null)