From 36f8ef4f3005c853cc9dc1b25b7c90750c79b9f2 Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Wed, 11 Aug 2021 23:27:14 +0000 Subject: [PATCH] Finish attack action and then cast skills. Thanks to paparas21. --- .../org/l2jmobius/gameserver/ai/PlayerAI.java | 20 +++++++++++++++++++ .../model/actor/instance/PlayerInstance.java | 2 +- .../org/l2jmobius/gameserver/ai/PlayerAI.java | 20 +++++++++++++++++++ .../model/actor/instance/PlayerInstance.java | 2 +- .../org/l2jmobius/gameserver/ai/PlayerAI.java | 20 +++++++++++++++++++ .../model/actor/instance/PlayerInstance.java | 2 +- .../org/l2jmobius/gameserver/ai/PlayerAI.java | 20 +++++++++++++++++++ .../model/actor/instance/PlayerInstance.java | 2 +- .../org/l2jmobius/gameserver/ai/PlayerAI.java | 20 +++++++++++++++++++ .../model/actor/instance/PlayerInstance.java | 2 +- .../org/l2jmobius/gameserver/ai/PlayerAI.java | 20 +++++++++++++++++++ .../model/actor/instance/PlayerInstance.java | 2 +- .../org/l2jmobius/gameserver/ai/PlayerAI.java | 20 +++++++++++++++++++ .../model/actor/instance/PlayerInstance.java | 2 +- .../org/l2jmobius/gameserver/ai/PlayerAI.java | 20 +++++++++++++++++++ .../model/actor/instance/PlayerInstance.java | 2 +- .../org/l2jmobius/gameserver/ai/PlayerAI.java | 20 +++++++++++++++++++ .../model/actor/instance/PlayerInstance.java | 2 +- .../org/l2jmobius/gameserver/ai/PlayerAI.java | 20 +++++++++++++++++++ .../model/actor/instance/PlayerInstance.java | 2 +- .../org/l2jmobius/gameserver/ai/PlayerAI.java | 20 +++++++++++++++++++ .../model/actor/instance/PlayerInstance.java | 2 +- .../org/l2jmobius/gameserver/ai/PlayerAI.java | 20 +++++++++++++++++++ .../model/actor/instance/PlayerInstance.java | 2 +- .../org/l2jmobius/gameserver/ai/PlayerAI.java | 20 +++++++++++++++++++ .../model/actor/instance/PlayerInstance.java | 2 +- .../org/l2jmobius/gameserver/ai/PlayerAI.java | 20 +++++++++++++++++++ .../model/actor/instance/PlayerInstance.java | 2 +- .../org/l2jmobius/gameserver/ai/PlayerAI.java | 20 +++++++++++++++++++ .../model/actor/instance/PlayerInstance.java | 2 +- .../org/l2jmobius/gameserver/ai/PlayerAI.java | 20 +++++++++++++++++++ .../model/actor/instance/PlayerInstance.java | 2 +- .../org/l2jmobius/gameserver/ai/PlayerAI.java | 20 +++++++++++++++++++ .../model/actor/instance/PlayerInstance.java | 2 +- .../org/l2jmobius/gameserver/ai/PlayerAI.java | 20 +++++++++++++++++++ .../model/actor/instance/PlayerInstance.java | 2 +- .../org/l2jmobius/gameserver/ai/PlayerAI.java | 20 +++++++++++++++++++ .../model/actor/instance/PlayerInstance.java | 2 +- .../org/l2jmobius/gameserver/ai/PlayerAI.java | 20 +++++++++++++++++++ .../model/actor/instance/PlayerInstance.java | 2 +- .../org/l2jmobius/gameserver/ai/PlayerAI.java | 20 +++++++++++++++++++ .../model/actor/instance/PlayerInstance.java | 2 +- 42 files changed, 441 insertions(+), 21 deletions(-) diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/ai/PlayerAI.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/ai/PlayerAI.java index eff97a494a..045a290f35 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/ai/PlayerAI.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/ai/PlayerAI.java @@ -24,11 +24,13 @@ import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_MOVE_TO; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_PICK_UP; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_REST; +import org.l2jmobius.gameserver.enums.ShotType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.StaticObjectInstance; +import org.l2jmobius.gameserver.model.holders.SkillUseHolder; import org.l2jmobius.gameserver.model.interfaces.ILocational; import org.l2jmobius.gameserver.model.skills.Skill; import org.l2jmobius.gameserver.model.skills.targets.TargetType; @@ -260,6 +262,24 @@ public class PlayerAI extends PlayableAI private void thinkAttack() { + final SkillUseHolder queuedSkill = _actor.getActingPlayer().getQueuedSkill(); + if ((queuedSkill != null)) + { + // Abort attack. + _actor.abortAttack(); + + // Recharge shots. + if (!_actor.isChargedShot(ShotType.SOULSHOTS) && !_actor.isChargedShot(ShotType.BLESSED_SOULSHOTS)) + { + _actor.rechargeShots(true, false, false); + } + + // Use queued skill. + _actor.getActingPlayer().useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); + _actor.getActingPlayer().setQueuedSkill(null, null, false, false); + return; + } + final WorldObject target = getTarget(); if ((target == null) || !target.isCreature()) { diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 742838f307..73d742e311 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -8495,7 +8495,7 @@ public class PlayerInstance extends Playable // If a skill is currently being used, queue this one if this is not the same // In case of double casting, check if both slots are occupied, then queue skill. - if ((!doubleCast && isCastingNow(SkillCaster::isAnyNormalType)) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) + if ((!doubleCast && (isAttackingNow() || isCastingNow(SkillCaster::isAnyNormalType))) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) { // Do not queue skill if called by an item. if (item == null) diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/ai/PlayerAI.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/ai/PlayerAI.java index eff97a494a..045a290f35 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/ai/PlayerAI.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/ai/PlayerAI.java @@ -24,11 +24,13 @@ import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_MOVE_TO; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_PICK_UP; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_REST; +import org.l2jmobius.gameserver.enums.ShotType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.StaticObjectInstance; +import org.l2jmobius.gameserver.model.holders.SkillUseHolder; import org.l2jmobius.gameserver.model.interfaces.ILocational; import org.l2jmobius.gameserver.model.skills.Skill; import org.l2jmobius.gameserver.model.skills.targets.TargetType; @@ -260,6 +262,24 @@ public class PlayerAI extends PlayableAI private void thinkAttack() { + final SkillUseHolder queuedSkill = _actor.getActingPlayer().getQueuedSkill(); + if ((queuedSkill != null)) + { + // Abort attack. + _actor.abortAttack(); + + // Recharge shots. + if (!_actor.isChargedShot(ShotType.SOULSHOTS) && !_actor.isChargedShot(ShotType.BLESSED_SOULSHOTS)) + { + _actor.rechargeShots(true, false, false); + } + + // Use queued skill. + _actor.getActingPlayer().useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); + _actor.getActingPlayer().setQueuedSkill(null, null, false, false); + return; + } + final WorldObject target = getTarget(); if ((target == null) || !target.isCreature()) { diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 49ac0a83bf..824f8f8d1e 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -8502,7 +8502,7 @@ public class PlayerInstance extends Playable // If a skill is currently being used, queue this one if this is not the same // In case of double casting, check if both slots are occupied, then queue skill. - if ((!doubleCast && isCastingNow(SkillCaster::isAnyNormalType)) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) + if ((!doubleCast && (isAttackingNow() || isCastingNow(SkillCaster::isAnyNormalType))) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) { // Do not queue skill if called by an item. if (item == null) diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/ai/PlayerAI.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/ai/PlayerAI.java index eff97a494a..045a290f35 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/ai/PlayerAI.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/ai/PlayerAI.java @@ -24,11 +24,13 @@ import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_MOVE_TO; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_PICK_UP; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_REST; +import org.l2jmobius.gameserver.enums.ShotType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.StaticObjectInstance; +import org.l2jmobius.gameserver.model.holders.SkillUseHolder; import org.l2jmobius.gameserver.model.interfaces.ILocational; import org.l2jmobius.gameserver.model.skills.Skill; import org.l2jmobius.gameserver.model.skills.targets.TargetType; @@ -260,6 +262,24 @@ public class PlayerAI extends PlayableAI private void thinkAttack() { + final SkillUseHolder queuedSkill = _actor.getActingPlayer().getQueuedSkill(); + if ((queuedSkill != null)) + { + // Abort attack. + _actor.abortAttack(); + + // Recharge shots. + if (!_actor.isChargedShot(ShotType.SOULSHOTS) && !_actor.isChargedShot(ShotType.BLESSED_SOULSHOTS)) + { + _actor.rechargeShots(true, false, false); + } + + // Use queued skill. + _actor.getActingPlayer().useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); + _actor.getActingPlayer().setQueuedSkill(null, null, false, false); + return; + } + final WorldObject target = getTarget(); if ((target == null) || !target.isCreature()) { diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 7a1851338f..cc18c8bf33 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -8504,7 +8504,7 @@ public class PlayerInstance extends Playable // If a skill is currently being used, queue this one if this is not the same // In case of double casting, check if both slots are occupied, then queue skill. - if ((!doubleCast && isCastingNow(SkillCaster::isAnyNormalType)) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) + if ((!doubleCast && (isAttackingNow() || isCastingNow(SkillCaster::isAnyNormalType))) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) { // Do not queue skill if called by an item. if (item == null) diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/ai/PlayerAI.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/ai/PlayerAI.java index eff97a494a..045a290f35 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/ai/PlayerAI.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/ai/PlayerAI.java @@ -24,11 +24,13 @@ import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_MOVE_TO; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_PICK_UP; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_REST; +import org.l2jmobius.gameserver.enums.ShotType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.StaticObjectInstance; +import org.l2jmobius.gameserver.model.holders.SkillUseHolder; import org.l2jmobius.gameserver.model.interfaces.ILocational; import org.l2jmobius.gameserver.model.skills.Skill; import org.l2jmobius.gameserver.model.skills.targets.TargetType; @@ -260,6 +262,24 @@ public class PlayerAI extends PlayableAI private void thinkAttack() { + final SkillUseHolder queuedSkill = _actor.getActingPlayer().getQueuedSkill(); + if ((queuedSkill != null)) + { + // Abort attack. + _actor.abortAttack(); + + // Recharge shots. + if (!_actor.isChargedShot(ShotType.SOULSHOTS) && !_actor.isChargedShot(ShotType.BLESSED_SOULSHOTS)) + { + _actor.rechargeShots(true, false, false); + } + + // Use queued skill. + _actor.getActingPlayer().useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); + _actor.getActingPlayer().setQueuedSkill(null, null, false, false); + return; + } + final WorldObject target = getTarget(); if ((target == null) || !target.isCreature()) { diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 61140720f7..a665baf9a9 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -8499,7 +8499,7 @@ public class PlayerInstance extends Playable // If a skill is currently being used, queue this one if this is not the same // In case of double casting, check if both slots are occupied, then queue skill. - if ((!doubleCast && isCastingNow(SkillCaster::isAnyNormalType)) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) + if ((!doubleCast && (isAttackingNow() || isCastingNow(SkillCaster::isAnyNormalType))) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) { // Do not queue skill if called by an item. if (item == null) diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/ai/PlayerAI.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/ai/PlayerAI.java index eff97a494a..045a290f35 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/ai/PlayerAI.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/ai/PlayerAI.java @@ -24,11 +24,13 @@ import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_MOVE_TO; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_PICK_UP; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_REST; +import org.l2jmobius.gameserver.enums.ShotType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.StaticObjectInstance; +import org.l2jmobius.gameserver.model.holders.SkillUseHolder; import org.l2jmobius.gameserver.model.interfaces.ILocational; import org.l2jmobius.gameserver.model.skills.Skill; import org.l2jmobius.gameserver.model.skills.targets.TargetType; @@ -260,6 +262,24 @@ public class PlayerAI extends PlayableAI private void thinkAttack() { + final SkillUseHolder queuedSkill = _actor.getActingPlayer().getQueuedSkill(); + if ((queuedSkill != null)) + { + // Abort attack. + _actor.abortAttack(); + + // Recharge shots. + if (!_actor.isChargedShot(ShotType.SOULSHOTS) && !_actor.isChargedShot(ShotType.BLESSED_SOULSHOTS)) + { + _actor.rechargeShots(true, false, false); + } + + // Use queued skill. + _actor.getActingPlayer().useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); + _actor.getActingPlayer().setQueuedSkill(null, null, false, false); + return; + } + final WorldObject target = getTarget(); if ((target == null) || !target.isCreature()) { diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index ba0f97f636..4e4afa9122 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -8485,7 +8485,7 @@ public class PlayerInstance extends Playable // If a skill is currently being used, queue this one if this is not the same // In case of double casting, check if both slots are occupied, then queue skill. - if ((!doubleCast && isCastingNow(SkillCaster::isAnyNormalType)) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) + if ((!doubleCast && (isAttackingNow() || isCastingNow(SkillCaster::isAnyNormalType))) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) { // Do not queue skill if called by an item. if (item == null) diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/ai/PlayerAI.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/ai/PlayerAI.java index eff97a494a..045a290f35 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/ai/PlayerAI.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/ai/PlayerAI.java @@ -24,11 +24,13 @@ import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_MOVE_TO; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_PICK_UP; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_REST; +import org.l2jmobius.gameserver.enums.ShotType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.StaticObjectInstance; +import org.l2jmobius.gameserver.model.holders.SkillUseHolder; import org.l2jmobius.gameserver.model.interfaces.ILocational; import org.l2jmobius.gameserver.model.skills.Skill; import org.l2jmobius.gameserver.model.skills.targets.TargetType; @@ -260,6 +262,24 @@ public class PlayerAI extends PlayableAI private void thinkAttack() { + final SkillUseHolder queuedSkill = _actor.getActingPlayer().getQueuedSkill(); + if ((queuedSkill != null)) + { + // Abort attack. + _actor.abortAttack(); + + // Recharge shots. + if (!_actor.isChargedShot(ShotType.SOULSHOTS) && !_actor.isChargedShot(ShotType.BLESSED_SOULSHOTS)) + { + _actor.rechargeShots(true, false, false); + } + + // Use queued skill. + _actor.getActingPlayer().useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); + _actor.getActingPlayer().setQueuedSkill(null, null, false, false); + return; + } + final WorldObject target = getTarget(); if ((target == null) || !target.isCreature()) { diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 0e553ec9c9..412735bd0b 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -8485,7 +8485,7 @@ public class PlayerInstance extends Playable // If a skill is currently being used, queue this one if this is not the same // In case of double casting, check if both slots are occupied, then queue skill. - if ((!doubleCast && isCastingNow(SkillCaster::isAnyNormalType)) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) + if ((!doubleCast && (isAttackingNow() || isCastingNow(SkillCaster::isAnyNormalType))) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) { // Do not queue skill if called by an item. if (item == null) diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/ai/PlayerAI.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/ai/PlayerAI.java index eff97a494a..045a290f35 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/ai/PlayerAI.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/ai/PlayerAI.java @@ -24,11 +24,13 @@ import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_MOVE_TO; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_PICK_UP; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_REST; +import org.l2jmobius.gameserver.enums.ShotType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.StaticObjectInstance; +import org.l2jmobius.gameserver.model.holders.SkillUseHolder; import org.l2jmobius.gameserver.model.interfaces.ILocational; import org.l2jmobius.gameserver.model.skills.Skill; import org.l2jmobius.gameserver.model.skills.targets.TargetType; @@ -260,6 +262,24 @@ public class PlayerAI extends PlayableAI private void thinkAttack() { + final SkillUseHolder queuedSkill = _actor.getActingPlayer().getQueuedSkill(); + if ((queuedSkill != null)) + { + // Abort attack. + _actor.abortAttack(); + + // Recharge shots. + if (!_actor.isChargedShot(ShotType.SOULSHOTS) && !_actor.isChargedShot(ShotType.BLESSED_SOULSHOTS)) + { + _actor.rechargeShots(true, false, false); + } + + // Use queued skill. + _actor.getActingPlayer().useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); + _actor.getActingPlayer().setQueuedSkill(null, null, false, false); + return; + } + final WorldObject target = getTarget(); if ((target == null) || !target.isCreature()) { diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 70d7e41eed..d074e2fb04 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -8486,7 +8486,7 @@ public class PlayerInstance extends Playable // If a skill is currently being used, queue this one if this is not the same // In case of double casting, check if both slots are occupied, then queue skill. - if ((!doubleCast && isCastingNow(SkillCaster::isAnyNormalType)) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) + if ((!doubleCast && (isAttackingNow() || isCastingNow(SkillCaster::isAnyNormalType))) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) { // Do not queue skill if called by an item. if (item == null) diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/ai/PlayerAI.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/ai/PlayerAI.java index eff97a494a..045a290f35 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/ai/PlayerAI.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/ai/PlayerAI.java @@ -24,11 +24,13 @@ import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_MOVE_TO; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_PICK_UP; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_REST; +import org.l2jmobius.gameserver.enums.ShotType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.StaticObjectInstance; +import org.l2jmobius.gameserver.model.holders.SkillUseHolder; import org.l2jmobius.gameserver.model.interfaces.ILocational; import org.l2jmobius.gameserver.model.skills.Skill; import org.l2jmobius.gameserver.model.skills.targets.TargetType; @@ -260,6 +262,24 @@ public class PlayerAI extends PlayableAI private void thinkAttack() { + final SkillUseHolder queuedSkill = _actor.getActingPlayer().getQueuedSkill(); + if ((queuedSkill != null)) + { + // Abort attack. + _actor.abortAttack(); + + // Recharge shots. + if (!_actor.isChargedShot(ShotType.SOULSHOTS) && !_actor.isChargedShot(ShotType.BLESSED_SOULSHOTS)) + { + _actor.rechargeShots(true, false, false); + } + + // Use queued skill. + _actor.getActingPlayer().useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); + _actor.getActingPlayer().setQueuedSkill(null, null, false, false); + return; + } + final WorldObject target = getTarget(); if ((target == null) || !target.isCreature()) { diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index b891912ce1..f4a947ca88 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -8498,7 +8498,7 @@ public class PlayerInstance extends Playable // If a skill is currently being used, queue this one if this is not the same // In case of double casting, check if both slots are occupied, then queue skill. - if ((!doubleCast && isCastingNow(SkillCaster::isAnyNormalType)) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) + if ((!doubleCast && (isAttackingNow() || isCastingNow(SkillCaster::isAnyNormalType))) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) { // Do not queue skill if called by an item. if (item == null) diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/ai/PlayerAI.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/ai/PlayerAI.java index eff97a494a..045a290f35 100644 --- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/ai/PlayerAI.java +++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/ai/PlayerAI.java @@ -24,11 +24,13 @@ import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_MOVE_TO; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_PICK_UP; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_REST; +import org.l2jmobius.gameserver.enums.ShotType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.StaticObjectInstance; +import org.l2jmobius.gameserver.model.holders.SkillUseHolder; import org.l2jmobius.gameserver.model.interfaces.ILocational; import org.l2jmobius.gameserver.model.skills.Skill; import org.l2jmobius.gameserver.model.skills.targets.TargetType; @@ -260,6 +262,24 @@ public class PlayerAI extends PlayableAI private void thinkAttack() { + final SkillUseHolder queuedSkill = _actor.getActingPlayer().getQueuedSkill(); + if ((queuedSkill != null)) + { + // Abort attack. + _actor.abortAttack(); + + // Recharge shots. + if (!_actor.isChargedShot(ShotType.SOULSHOTS) && !_actor.isChargedShot(ShotType.BLESSED_SOULSHOTS)) + { + _actor.rechargeShots(true, false, false); + } + + // Use queued skill. + _actor.getActingPlayer().useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); + _actor.getActingPlayer().setQueuedSkill(null, null, false, false); + return; + } + final WorldObject target = getTarget(); if ((target == null) || !target.isCreature()) { diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 2d0845cf55..fa29eda5c6 100644 --- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -8601,7 +8601,7 @@ public class PlayerInstance extends Playable // If a skill is currently being used, queue this one if this is not the same // In case of double casting, check if both slots are occupied, then queue skill. - if ((!doubleCast && isCastingNow(SkillCaster::isAnyNormalType)) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) + if ((!doubleCast && (isAttackingNow() || isCastingNow(SkillCaster::isAnyNormalType))) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) { // Do not queue skill if called by an item. if (item == null) diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/ai/PlayerAI.java b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/ai/PlayerAI.java index eff97a494a..045a290f35 100644 --- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/ai/PlayerAI.java +++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/ai/PlayerAI.java @@ -24,11 +24,13 @@ import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_MOVE_TO; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_PICK_UP; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_REST; +import org.l2jmobius.gameserver.enums.ShotType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.StaticObjectInstance; +import org.l2jmobius.gameserver.model.holders.SkillUseHolder; import org.l2jmobius.gameserver.model.interfaces.ILocational; import org.l2jmobius.gameserver.model.skills.Skill; import org.l2jmobius.gameserver.model.skills.targets.TargetType; @@ -260,6 +262,24 @@ public class PlayerAI extends PlayableAI private void thinkAttack() { + final SkillUseHolder queuedSkill = _actor.getActingPlayer().getQueuedSkill(); + if ((queuedSkill != null)) + { + // Abort attack. + _actor.abortAttack(); + + // Recharge shots. + if (!_actor.isChargedShot(ShotType.SOULSHOTS) && !_actor.isChargedShot(ShotType.BLESSED_SOULSHOTS)) + { + _actor.rechargeShots(true, false, false); + } + + // Use queued skill. + _actor.getActingPlayer().useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); + _actor.getActingPlayer().setQueuedSkill(null, null, false, false); + return; + } + final WorldObject target = getTarget(); if ((target == null) || !target.isCreature()) { diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index bea580615a..4d2625c1d4 100644 --- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -8627,7 +8627,7 @@ public class PlayerInstance extends Playable // If a skill is currently being used, queue this one if this is not the same // In case of double casting, check if both slots are occupied, then queue skill. - if ((!doubleCast && isCastingNow(SkillCaster::isAnyNormalType)) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) + if ((!doubleCast && (isAttackingNow() || isCastingNow(SkillCaster::isAnyNormalType))) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) { // Do not queue skill if called by an item. if (item == null) diff --git a/L2J_Mobius_9.2_ReturnOfTheQueenAnt_Ch2/java/org/l2jmobius/gameserver/ai/PlayerAI.java b/L2J_Mobius_9.2_ReturnOfTheQueenAnt_Ch2/java/org/l2jmobius/gameserver/ai/PlayerAI.java index eff97a494a..045a290f35 100644 --- a/L2J_Mobius_9.2_ReturnOfTheQueenAnt_Ch2/java/org/l2jmobius/gameserver/ai/PlayerAI.java +++ b/L2J_Mobius_9.2_ReturnOfTheQueenAnt_Ch2/java/org/l2jmobius/gameserver/ai/PlayerAI.java @@ -24,11 +24,13 @@ import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_MOVE_TO; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_PICK_UP; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_REST; +import org.l2jmobius.gameserver.enums.ShotType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.StaticObjectInstance; +import org.l2jmobius.gameserver.model.holders.SkillUseHolder; import org.l2jmobius.gameserver.model.interfaces.ILocational; import org.l2jmobius.gameserver.model.skills.Skill; import org.l2jmobius.gameserver.model.skills.targets.TargetType; @@ -260,6 +262,24 @@ public class PlayerAI extends PlayableAI private void thinkAttack() { + final SkillUseHolder queuedSkill = _actor.getActingPlayer().getQueuedSkill(); + if ((queuedSkill != null)) + { + // Abort attack. + _actor.abortAttack(); + + // Recharge shots. + if (!_actor.isChargedShot(ShotType.SOULSHOTS) && !_actor.isChargedShot(ShotType.BLESSED_SOULSHOTS)) + { + _actor.rechargeShots(true, false, false); + } + + // Use queued skill. + _actor.getActingPlayer().useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); + _actor.getActingPlayer().setQueuedSkill(null, null, false, false); + return; + } + final WorldObject target = getTarget(); if ((target == null) || !target.isCreature()) { diff --git a/L2J_Mobius_9.2_ReturnOfTheQueenAnt_Ch2/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_9.2_ReturnOfTheQueenAnt_Ch2/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index bea580615a..4d2625c1d4 100644 --- a/L2J_Mobius_9.2_ReturnOfTheQueenAnt_Ch2/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_9.2_ReturnOfTheQueenAnt_Ch2/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -8627,7 +8627,7 @@ public class PlayerInstance extends Playable // If a skill is currently being used, queue this one if this is not the same // In case of double casting, check if both slots are occupied, then queue skill. - if ((!doubleCast && isCastingNow(SkillCaster::isAnyNormalType)) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) + if ((!doubleCast && (isAttackingNow() || isCastingNow(SkillCaster::isAnyNormalType))) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) { // Do not queue skill if called by an item. if (item == null) diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/ai/PlayerAI.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/ai/PlayerAI.java index eff97a494a..045a290f35 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/ai/PlayerAI.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/ai/PlayerAI.java @@ -24,11 +24,13 @@ import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_MOVE_TO; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_PICK_UP; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_REST; +import org.l2jmobius.gameserver.enums.ShotType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.StaticObjectInstance; +import org.l2jmobius.gameserver.model.holders.SkillUseHolder; import org.l2jmobius.gameserver.model.interfaces.ILocational; import org.l2jmobius.gameserver.model.skills.Skill; import org.l2jmobius.gameserver.model.skills.targets.TargetType; @@ -260,6 +262,24 @@ public class PlayerAI extends PlayableAI private void thinkAttack() { + final SkillUseHolder queuedSkill = _actor.getActingPlayer().getQueuedSkill(); + if ((queuedSkill != null)) + { + // Abort attack. + _actor.abortAttack(); + + // Recharge shots. + if (!_actor.isChargedShot(ShotType.SOULSHOTS) && !_actor.isChargedShot(ShotType.BLESSED_SOULSHOTS)) + { + _actor.rechargeShots(true, false, false); + } + + // Use queued skill. + _actor.getActingPlayer().useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); + _actor.getActingPlayer().setQueuedSkill(null, null, false, false); + return; + } + final WorldObject target = getTarget(); if ((target == null) || !target.isCreature()) { diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index eee634198a..72c732d7b6 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -8409,7 +8409,7 @@ public class PlayerInstance extends Playable // If a skill is currently being used, queue this one if this is not the same // In case of double casting, check if both slots are occupied, then queue skill. - if ((!doubleCast && isCastingNow(SkillCaster::isAnyNormalType)) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) + if ((!doubleCast && (isAttackingNow() || isCastingNow(SkillCaster::isAnyNormalType))) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) { // Do not queue skill if called by an item. if (item == null) diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/ai/PlayerAI.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/ai/PlayerAI.java index eff97a494a..045a290f35 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/ai/PlayerAI.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/ai/PlayerAI.java @@ -24,11 +24,13 @@ import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_MOVE_TO; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_PICK_UP; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_REST; +import org.l2jmobius.gameserver.enums.ShotType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.StaticObjectInstance; +import org.l2jmobius.gameserver.model.holders.SkillUseHolder; import org.l2jmobius.gameserver.model.interfaces.ILocational; import org.l2jmobius.gameserver.model.skills.Skill; import org.l2jmobius.gameserver.model.skills.targets.TargetType; @@ -260,6 +262,24 @@ public class PlayerAI extends PlayableAI private void thinkAttack() { + final SkillUseHolder queuedSkill = _actor.getActingPlayer().getQueuedSkill(); + if ((queuedSkill != null)) + { + // Abort attack. + _actor.abortAttack(); + + // Recharge shots. + if (!_actor.isChargedShot(ShotType.SOULSHOTS) && !_actor.isChargedShot(ShotType.BLESSED_SOULSHOTS)) + { + _actor.rechargeShots(true, false, false); + } + + // Use queued skill. + _actor.getActingPlayer().useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); + _actor.getActingPlayer().setQueuedSkill(null, null, false, false); + return; + } + final WorldObject target = getTarget(); if ((target == null) || !target.isCreature()) { diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index a099dcb337..78ca20350d 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -8409,7 +8409,7 @@ public class PlayerInstance extends Playable // If a skill is currently being used, queue this one if this is not the same // In case of double casting, check if both slots are occupied, then queue skill. - if ((!doubleCast && isCastingNow(SkillCaster::isAnyNormalType)) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) + if ((!doubleCast && (isAttackingNow() || isCastingNow(SkillCaster::isAnyNormalType))) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) { // Do not queue skill if called by an item. if (item == null) diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/ai/PlayerAI.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/ai/PlayerAI.java index eff97a494a..045a290f35 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/ai/PlayerAI.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/ai/PlayerAI.java @@ -24,11 +24,13 @@ import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_MOVE_TO; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_PICK_UP; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_REST; +import org.l2jmobius.gameserver.enums.ShotType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.StaticObjectInstance; +import org.l2jmobius.gameserver.model.holders.SkillUseHolder; import org.l2jmobius.gameserver.model.interfaces.ILocational; import org.l2jmobius.gameserver.model.skills.Skill; import org.l2jmobius.gameserver.model.skills.targets.TargetType; @@ -260,6 +262,24 @@ public class PlayerAI extends PlayableAI private void thinkAttack() { + final SkillUseHolder queuedSkill = _actor.getActingPlayer().getQueuedSkill(); + if ((queuedSkill != null)) + { + // Abort attack. + _actor.abortAttack(); + + // Recharge shots. + if (!_actor.isChargedShot(ShotType.SOULSHOTS) && !_actor.isChargedShot(ShotType.BLESSED_SOULSHOTS)) + { + _actor.rechargeShots(true, false, false); + } + + // Use queued skill. + _actor.getActingPlayer().useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); + _actor.getActingPlayer().setQueuedSkill(null, null, false, false); + return; + } + final WorldObject target = getTarget(); if ((target == null) || !target.isCreature()) { diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 6dfb9bf0dd..f9bd21ff64 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -8395,7 +8395,7 @@ public class PlayerInstance extends Playable // If a skill is currently being used, queue this one if this is not the same // In case of double casting, check if both slots are occupied, then queue skill. - if ((!doubleCast && isCastingNow(SkillCaster::isAnyNormalType)) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) + if ((!doubleCast && (isAttackingNow() || isCastingNow(SkillCaster::isAnyNormalType))) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) { // Do not queue skill if called by an item. if (item == null) diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/ai/PlayerAI.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/ai/PlayerAI.java index eff97a494a..045a290f35 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/ai/PlayerAI.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/ai/PlayerAI.java @@ -24,11 +24,13 @@ import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_MOVE_TO; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_PICK_UP; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_REST; +import org.l2jmobius.gameserver.enums.ShotType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.StaticObjectInstance; +import org.l2jmobius.gameserver.model.holders.SkillUseHolder; import org.l2jmobius.gameserver.model.interfaces.ILocational; import org.l2jmobius.gameserver.model.skills.Skill; import org.l2jmobius.gameserver.model.skills.targets.TargetType; @@ -260,6 +262,24 @@ public class PlayerAI extends PlayableAI private void thinkAttack() { + final SkillUseHolder queuedSkill = _actor.getActingPlayer().getQueuedSkill(); + if ((queuedSkill != null)) + { + // Abort attack. + _actor.abortAttack(); + + // Recharge shots. + if (!_actor.isChargedShot(ShotType.SOULSHOTS) && !_actor.isChargedShot(ShotType.BLESSED_SOULSHOTS)) + { + _actor.rechargeShots(true, false, false); + } + + // Use queued skill. + _actor.getActingPlayer().useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); + _actor.getActingPlayer().setQueuedSkill(null, null, false, false); + return; + } + final WorldObject target = getTarget(); if ((target == null) || !target.isCreature()) { diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 9496a306fa..20ae346dbf 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -8420,7 +8420,7 @@ public class PlayerInstance extends Playable // If a skill is currently being used, queue this one if this is not the same // In case of double casting, check if both slots are occupied, then queue skill. - if ((!doubleCast && isCastingNow(SkillCaster::isAnyNormalType)) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) + if ((!doubleCast && (isAttackingNow() || isCastingNow(SkillCaster::isAnyNormalType))) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) { // Do not queue skill if called by an item. if (item == null) diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/ai/PlayerAI.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/ai/PlayerAI.java index eff97a494a..045a290f35 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/ai/PlayerAI.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/ai/PlayerAI.java @@ -24,11 +24,13 @@ import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_MOVE_TO; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_PICK_UP; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_REST; +import org.l2jmobius.gameserver.enums.ShotType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.StaticObjectInstance; +import org.l2jmobius.gameserver.model.holders.SkillUseHolder; import org.l2jmobius.gameserver.model.interfaces.ILocational; import org.l2jmobius.gameserver.model.skills.Skill; import org.l2jmobius.gameserver.model.skills.targets.TargetType; @@ -260,6 +262,24 @@ public class PlayerAI extends PlayableAI private void thinkAttack() { + final SkillUseHolder queuedSkill = _actor.getActingPlayer().getQueuedSkill(); + if ((queuedSkill != null)) + { + // Abort attack. + _actor.abortAttack(); + + // Recharge shots. + if (!_actor.isChargedShot(ShotType.SOULSHOTS) && !_actor.isChargedShot(ShotType.BLESSED_SOULSHOTS)) + { + _actor.rechargeShots(true, false, false); + } + + // Use queued skill. + _actor.getActingPlayer().useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); + _actor.getActingPlayer().setQueuedSkill(null, null, false, false); + return; + } + final WorldObject target = getTarget(); if ((target == null) || !target.isCreature()) { diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index fe5ba5e4ef..a137fbc547 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -8420,7 +8420,7 @@ public class PlayerInstance extends Playable // If a skill is currently being used, queue this one if this is not the same // In case of double casting, check if both slots are occupied, then queue skill. - if ((!doubleCast && isCastingNow(SkillCaster::isAnyNormalType)) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) + if ((!doubleCast && (isAttackingNow() || isCastingNow(SkillCaster::isAnyNormalType))) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) { // Do not queue skill if called by an item. if (item == null) diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/ai/PlayerAI.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/ai/PlayerAI.java index eff97a494a..045a290f35 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/ai/PlayerAI.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/ai/PlayerAI.java @@ -24,11 +24,13 @@ import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_MOVE_TO; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_PICK_UP; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_REST; +import org.l2jmobius.gameserver.enums.ShotType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.StaticObjectInstance; +import org.l2jmobius.gameserver.model.holders.SkillUseHolder; import org.l2jmobius.gameserver.model.interfaces.ILocational; import org.l2jmobius.gameserver.model.skills.Skill; import org.l2jmobius.gameserver.model.skills.targets.TargetType; @@ -260,6 +262,24 @@ public class PlayerAI extends PlayableAI private void thinkAttack() { + final SkillUseHolder queuedSkill = _actor.getActingPlayer().getQueuedSkill(); + if ((queuedSkill != null)) + { + // Abort attack. + _actor.abortAttack(); + + // Recharge shots. + if (!_actor.isChargedShot(ShotType.SOULSHOTS) && !_actor.isChargedShot(ShotType.BLESSED_SOULSHOTS)) + { + _actor.rechargeShots(true, false, false); + } + + // Use queued skill. + _actor.getActingPlayer().useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); + _actor.getActingPlayer().setQueuedSkill(null, null, false, false); + return; + } + final WorldObject target = getTarget(); if ((target == null) || !target.isCreature()) { diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 25af3350f2..b6db213cd7 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -8371,7 +8371,7 @@ public class PlayerInstance extends Playable // If a skill is currently being used, queue this one if this is not the same // In case of double casting, check if both slots are occupied, then queue skill. - if ((!doubleCast && isCastingNow(SkillCaster::isAnyNormalType)) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) + if ((!doubleCast && (isAttackingNow() || isCastingNow(SkillCaster::isAnyNormalType))) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) { // Do not queue skill if called by an item. if (item == null) diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/ai/PlayerAI.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/ai/PlayerAI.java index eff97a494a..045a290f35 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/ai/PlayerAI.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/ai/PlayerAI.java @@ -24,11 +24,13 @@ import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_MOVE_TO; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_PICK_UP; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_REST; +import org.l2jmobius.gameserver.enums.ShotType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.StaticObjectInstance; +import org.l2jmobius.gameserver.model.holders.SkillUseHolder; import org.l2jmobius.gameserver.model.interfaces.ILocational; import org.l2jmobius.gameserver.model.skills.Skill; import org.l2jmobius.gameserver.model.skills.targets.TargetType; @@ -260,6 +262,24 @@ public class PlayerAI extends PlayableAI private void thinkAttack() { + final SkillUseHolder queuedSkill = _actor.getActingPlayer().getQueuedSkill(); + if ((queuedSkill != null)) + { + // Abort attack. + _actor.abortAttack(); + + // Recharge shots. + if (!_actor.isChargedShot(ShotType.SOULSHOTS) && !_actor.isChargedShot(ShotType.BLESSED_SOULSHOTS)) + { + _actor.rechargeShots(true, false, false); + } + + // Use queued skill. + _actor.getActingPlayer().useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); + _actor.getActingPlayer().setQueuedSkill(null, null, false, false); + return; + } + final WorldObject target = getTarget(); if ((target == null) || !target.isCreature()) { diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 21202e0900..ffafc43aee 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -8387,7 +8387,7 @@ public class PlayerInstance extends Playable // If a skill is currently being used, queue this one if this is not the same // In case of double casting, check if both slots are occupied, then queue skill. - if ((!doubleCast && isCastingNow(SkillCaster::isAnyNormalType)) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) + if ((!doubleCast && (isAttackingNow() || isCastingNow(SkillCaster::isAnyNormalType))) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) { // Do not queue skill if called by an item. if (item == null) diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/ai/PlayerAI.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/ai/PlayerAI.java index eff97a494a..045a290f35 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/ai/PlayerAI.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/ai/PlayerAI.java @@ -24,11 +24,13 @@ import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_MOVE_TO; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_PICK_UP; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_REST; +import org.l2jmobius.gameserver.enums.ShotType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.StaticObjectInstance; +import org.l2jmobius.gameserver.model.holders.SkillUseHolder; import org.l2jmobius.gameserver.model.interfaces.ILocational; import org.l2jmobius.gameserver.model.skills.Skill; import org.l2jmobius.gameserver.model.skills.targets.TargetType; @@ -260,6 +262,24 @@ public class PlayerAI extends PlayableAI private void thinkAttack() { + final SkillUseHolder queuedSkill = _actor.getActingPlayer().getQueuedSkill(); + if ((queuedSkill != null)) + { + // Abort attack. + _actor.abortAttack(); + + // Recharge shots. + if (!_actor.isChargedShot(ShotType.SOULSHOTS) && !_actor.isChargedShot(ShotType.BLESSED_SOULSHOTS)) + { + _actor.rechargeShots(true, false, false); + } + + // Use queued skill. + _actor.getActingPlayer().useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); + _actor.getActingPlayer().setQueuedSkill(null, null, false, false); + return; + } + final WorldObject target = getTarget(); if ((target == null) || !target.isCreature()) { diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 011a22fb7f..7eb7506ead 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -8517,7 +8517,7 @@ public class PlayerInstance extends Playable // If a skill is currently being used, queue this one if this is not the same // In case of double casting, check if both slots are occupied, then queue skill. - if ((!doubleCast && isCastingNow(SkillCaster::isAnyNormalType)) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) + if ((!doubleCast && (isAttackingNow() || isCastingNow(SkillCaster::isAnyNormalType))) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) { // Do not queue skill if called by an item. if (item == null) diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/ai/PlayerAI.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/ai/PlayerAI.java index eff97a494a..045a290f35 100644 --- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/ai/PlayerAI.java +++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/ai/PlayerAI.java @@ -24,11 +24,13 @@ import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_MOVE_TO; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_PICK_UP; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_REST; +import org.l2jmobius.gameserver.enums.ShotType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.StaticObjectInstance; +import org.l2jmobius.gameserver.model.holders.SkillUseHolder; import org.l2jmobius.gameserver.model.interfaces.ILocational; import org.l2jmobius.gameserver.model.skills.Skill; import org.l2jmobius.gameserver.model.skills.targets.TargetType; @@ -260,6 +262,24 @@ public class PlayerAI extends PlayableAI private void thinkAttack() { + final SkillUseHolder queuedSkill = _actor.getActingPlayer().getQueuedSkill(); + if ((queuedSkill != null)) + { + // Abort attack. + _actor.abortAttack(); + + // Recharge shots. + if (!_actor.isChargedShot(ShotType.SOULSHOTS) && !_actor.isChargedShot(ShotType.BLESSED_SOULSHOTS)) + { + _actor.rechargeShots(true, false, false); + } + + // Use queued skill. + _actor.getActingPlayer().useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); + _actor.getActingPlayer().setQueuedSkill(null, null, false, false); + return; + } + final WorldObject target = getTarget(); if ((target == null) || !target.isCreature()) { diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 7f5bc20794..cca9917b03 100644 --- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -8583,7 +8583,7 @@ public class PlayerInstance extends Playable // If a skill is currently being used, queue this one if this is not the same // In case of double casting, check if both slots are occupied, then queue skill. - if ((!doubleCast && isCastingNow(SkillCaster::isAnyNormalType)) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) + if ((!doubleCast && (isAttackingNow() || isCastingNow(SkillCaster::isAnyNormalType))) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) { // Do not queue skill if called by an item. if (item == null) diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/ai/PlayerAI.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/ai/PlayerAI.java index eff97a494a..045a290f35 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/ai/PlayerAI.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/ai/PlayerAI.java @@ -24,11 +24,13 @@ import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_MOVE_TO; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_PICK_UP; import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_REST; +import org.l2jmobius.gameserver.enums.ShotType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.StaticObjectInstance; +import org.l2jmobius.gameserver.model.holders.SkillUseHolder; import org.l2jmobius.gameserver.model.interfaces.ILocational; import org.l2jmobius.gameserver.model.skills.Skill; import org.l2jmobius.gameserver.model.skills.targets.TargetType; @@ -260,6 +262,24 @@ public class PlayerAI extends PlayableAI private void thinkAttack() { + final SkillUseHolder queuedSkill = _actor.getActingPlayer().getQueuedSkill(); + if ((queuedSkill != null)) + { + // Abort attack. + _actor.abortAttack(); + + // Recharge shots. + if (!_actor.isChargedShot(ShotType.SOULSHOTS) && !_actor.isChargedShot(ShotType.BLESSED_SOULSHOTS)) + { + _actor.rechargeShots(true, false, false); + } + + // Use queued skill. + _actor.getActingPlayer().useMagic(queuedSkill.getSkill(), queuedSkill.getItem(), queuedSkill.isCtrlPressed(), queuedSkill.isShiftPressed()); + _actor.getActingPlayer().setQueuedSkill(null, null, false, false); + return; + } + final WorldObject target = getTarget(); if ((target == null) || !target.isCreature()) { diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 7f5bc20794..cca9917b03 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -8583,7 +8583,7 @@ public class PlayerInstance extends Playable // If a skill is currently being used, queue this one if this is not the same // In case of double casting, check if both slots are occupied, then queue skill. - if ((!doubleCast && isCastingNow(SkillCaster::isAnyNormalType)) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) + if ((!doubleCast && (isAttackingNow() || isCastingNow(SkillCaster::isAnyNormalType))) || (isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL) && isCastingNow(s -> s.getCastingType() == SkillCastingType.NORMAL_SECOND))) { // Do not queue skill if called by an item. if (item == null)