Ver código fonte

BETA: Fixing broken spiritshot behaviour in some skills. It turns out that in those skills, the sps charge is removed before the skill's effects are applied, thus the effects are executed without a sps charge.
Also reworked a bit the spiritshot uncharge method, no need to check the charge if its not NONE in order to change it to NONE.

Nik 13 anos atrás
pai
commit
635996115b

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

@@ -7900,41 +7900,37 @@ public abstract class L2Character extends L2Object
 		globalSkillUseListeners.remove(listener);
 	}
 	
-	public void spsChecker(L2Skill skill)
+	/**
+	 * Sets the character's spiritshot charge to none, if the skill allows it.
+	 * @param skill 
+	 */
+	public void spsUncharge(L2Skill skill)
+	{
+		if (!skill.isStatic())
+			spsUncharge();
+	}
+	
+	/**
+	 * Sets the character's spiritshot charge to none.
+	 */
+	public void spsUncharge()
 	{
 		L2ItemInstance weaponInst = getActiveWeaponInstance();
 		
-		if (!skill.isStatic())
+		if (weaponInst != null && isPlayer())
 		{
-			if (weaponInst != null && isPlayer())
-			{
-				if (weaponInst.getChargedSpiritshot() != L2ItemInstance.CHARGED_NONE)
-				{
-					weaponInst.setChargedSpiritshot(L2ItemInstance.CHARGED_NONE);
-				}
-			}
-			// If there is no weapon equipped, check for an active summon.
-			else if (isSummon())
-			{
-				L2Summon activeSummon = (L2Summon) this;
-				
-				if (activeSummon.getChargedSpiritShot() != L2ItemInstance.CHARGED_NONE)
-				{
-					activeSummon.setChargedSpiritShot(L2ItemInstance.CHARGED_NONE);
-				}
-			}
-			else if (isNpc())
-			{
-				L2Npc activeNpc = (L2Npc) this;
-				if (activeNpc._soulshotcharged)
-				{
-					activeNpc._soulshotcharged = false;
-				}
-				else if(activeNpc._spiritshotcharged)
-				{
-					activeNpc._spiritshotcharged = false;
-				}
-			}
+			weaponInst.setChargedSpiritshot(L2ItemInstance.CHARGED_NONE);
+		}
+		else if (isSummon()) // If there is no weapon equipped, check for an active summon.
+		{
+			L2Summon activeSummon = (L2Summon) this;
+			activeSummon.setChargedSpiritShot(L2ItemInstance.CHARGED_NONE);
+		}
+		else if (isNpc())
+		{
+			L2Npc activeNpc = (L2Npc) this;
+			//activeNpc._soulshotcharged = false; Should this be uncommented for some unreasonable reason?
+			activeNpc._spiritshotcharged = false;
 		}
 	}
 		

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/l2skills/L2SkillDrain.java

@@ -180,7 +180,7 @@ public class L2SkillDrain extends L2Skill
 		}
 		// cast self effect if any
 		getEffectsSelf(activeChar);
-		activeChar.spsChecker(this);
+		activeChar.spsUncharge(this);
 	}
 	
 	public void useCubicSkill(L2CubicInstance activeCubic, L2Object[] targets)

+ 2 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/l2skills/L2SkillElemental.java

@@ -117,7 +117,8 @@ public class L2SkillElemental extends L2Skill {
 			// activate attacked effects, if any
 			target.stopSkillEffects(getId());
 			getEffects(activeChar, target, new Env(shld, activeChar.isSpiritshotCharged(this), false, activeChar.isBlessedSpiritshotCharged(this)));
-			activeChar.spsChecker(this);
 		}
+		
+		activeChar.spsUncharge(this);
 	}
 }

+ 3 - 3
L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/l2skills/L2SkillTeleport.java

@@ -53,9 +53,7 @@ public class L2SkillTeleport extends L2Skill
 	
 	@Override
 	public void useSkill(L2Character activeChar, L2Object[] targets)
-	{
-		activeChar.spsChecker(this);
-		
+	{	
 		if (activeChar.isPlayer())
 		{
 			// Thanks nbd
@@ -165,6 +163,8 @@ public class L2SkillTeleport extends L2Skill
 					target.teleToLocation(loc, true);
 				}
 			}
+			
+			activeChar.spsUncharge(this);
 		}
 		catch (Exception e)
 		{