Procházet zdrojové kódy

BETA: Adding ssUncharge() method which is similar to spsUncharge(). Also cleaning-up the soulshot use of some skills.
Oh, and I removed the "shots on daggers dont affect skill damage" check, because its outdated and invalid.

Nik před 13 roky
rodič
revize
2cca7f743f

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

@@ -7914,12 +7914,12 @@ public abstract class L2Character extends L2Object
 	 * Sets the character's spiritshot charge to none.
 	 */
 	public void spsUncharge()
-	{
-		L2ItemInstance weaponInst = getActiveWeaponInstance();
-		
-		if (weaponInst != null && isPlayer())
+	{	
+		if (isPlayer())
 		{
-			weaponInst.setChargedSpiritshot(L2ItemInstance.CHARGED_NONE);
+			L2ItemInstance weaponInst = getActiveWeaponInstance();
+			if (weaponInst != null)
+				weaponInst.setChargedSpiritshot(L2ItemInstance.CHARGED_NONE);
 		}
 		else if (isSummon()) // If there is no weapon equipped, check for an active summon.
 		{
@@ -7933,6 +7933,39 @@ public abstract class L2Character extends L2Object
 			activeNpc._spiritshotcharged = false;
 		}
 	}
+	
+	/**
+	 * Sets the character's soulshot charge to none, if the skill allows it.
+	 * @param skill 
+	 */
+	public void ssUncharge(L2Skill skill)
+	{
+		if (!skill.isStatic())
+			ssUncharge();
+	}
+	
+	/**
+	 * Sets the character's soulshot charge to none.
+	 */
+	public void ssUncharge()
+	{
+		if (isPlayer())
+		{
+			L2ItemInstance weaponInst = getActiveWeaponInstance();
+			if (weaponInst != null)
+				weaponInst.setChargedSoulshot(L2ItemInstance.CHARGED_NONE);
+		}
+		else if (isSummon()) // If there is no weapon equipped, check for an active summon.
+		{
+			L2Summon activeSummon = (L2Summon) this;
+			activeSummon.setChargedSoulShot(L2ItemInstance.CHARGED_NONE);
+		}
+		else if (isNpc())
+		{
+			L2Npc activeNpc = (L2Npc) this;
+			activeNpc._soulshotcharged = false;
+		}
+	}
 		
 	public boolean isSoulshotCharged(L2Skill skill)
 	{

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

@@ -23,8 +23,6 @@ import com.l2jserver.gameserver.model.L2Object;
 import com.l2jserver.gameserver.model.StatsSet;
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.effects.L2Effect;
-import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
-import com.l2jserver.gameserver.model.items.type.L2WeaponType;
 import com.l2jserver.gameserver.model.skills.L2Skill;
 import com.l2jserver.gameserver.model.stats.BaseStats;
 import com.l2jserver.gameserver.model.stats.Env;
@@ -55,10 +53,7 @@ public class L2SkillChargeDmg extends L2Skill
 			// thanks Diego Vargas of L2Guru: 70*((0.8+0.201*No.Charges) * (PATK+POWER)) / PDEF
 			modifier = 0.8 + 0.201 * (getNumCharges() + caster.getActingPlayer().getCharges());
 		}
-		L2ItemInstance weapon = caster.getActiveWeaponInstance();
-		boolean soul = (weapon != null
-				&& weapon.getChargedSoulshot() == L2ItemInstance.CHARGED_SOULSHOT
-				&& weapon.getItemType() != L2WeaponType.DAGGER );
+		boolean soul = caster.isSoulshotCharged(this);
 		
 		for (L2Character target: (L2Character[]) targets)
 		{
@@ -176,8 +171,6 @@ public class L2SkillChargeDmg extends L2Skill
 				caster.sendDamageMessage(target, 0, false, false, true);
 			}
 		}
-		if (soul && weapon!= null)
-			weapon.setChargedSoulshot(L2ItemInstance.CHARGED_NONE);
 		
 		// effect self :]
 		if (hasSelfEffects())
@@ -191,5 +184,7 @@ public class L2SkillChargeDmg extends L2Skill
 			// cast self effect if any
 			getEffectsSelf(caster);
 		}
+		
+		caster.ssUncharge(this);
 	}
 }