Browse Source

BETA: Changing checkDoCastConditions to public so we can check externally if the npc can cast the skill instead of attempting to cast it and end up aborting the skill that is currently casting, also moving setCastingNow(false) after notification to scripts to prevent from breaking animation for some bosses that uses onSkillSee to cast a skill.
* Reported by: St3eT

Rumen Nikiforov 11 years ago
parent
commit
b759091603

+ 5 - 5
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/L2Character.java

@@ -1981,7 +1981,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
 	 * @param skill
 	 * @return True if casting is possible
 	 */
-	protected boolean checkDoCastConditions(L2Skill skill)
+	public boolean checkDoCastConditions(L2Skill skill)
 	{
 		if ((skill == null) || isSkillDisabled(skill) || (((skill.getFlyRadius() > 0) || (skill.getFlyType() != null)) && isMovementDisabled()))
 		{
@@ -5751,10 +5751,6 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
 			return;
 		}
 		
-		_skillCast = null;
-		setIsCastingNow(false);
-		_castInterruptTime = 0;
-		
 		final L2Skill skill = mut.getSkill();
 		final L2Object target = mut.getTargets().length > 0 ? mut.getTargets()[0] : null;
 		
@@ -5790,6 +5786,10 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
 		
 		notifyQuestEventSkillFinished(skill, target);
 		
+		_skillCast = null;
+		setIsCastingNow(false);
+		_castInterruptTime = 0;
+		
 		// 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 (isPlayer())

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java

@@ -4276,7 +4276,7 @@ public final class L2PcInstance extends L2Playable
 	}
 	
 	@Override
-	protected boolean checkDoCastConditions(L2Skill skill)
+	public boolean checkDoCastConditions(L2Skill skill)
 	{
 		if (!super.checkDoCastConditions(skill))
 		{