瀏覽代碼

Support for "ignoreShld" boolean (skills ignoring shield defense).
DP update required !

_DS_ 16 年之前
父節點
當前提交
e7ced48424

+ 8 - 1
L2_GameServer/java/net/sf/l2j/gameserver/model/L2Skill.java

@@ -290,6 +290,7 @@ public abstract class L2Skill implements IChanceSkillTrigger
 	private final int _learnSkillLvl;
 
 	private final boolean _useShield;
+	private final boolean _ignoreShield;
 	private final boolean _isSuicideAttack;
 	private final boolean _canBeReflected;
 	
@@ -421,6 +422,7 @@ public abstract class L2Skill implements IChanceSkillTrigger
         _ignoreResists = set.getBool("ignoreResists", false);
         _stat = set.getEnum("stat", Stats.class, null);
         _useShield = set.getBool("useShield", false);
+        _ignoreShield = set.getBool("ignoreShld", false);
         _skillType = set.getEnum("skillType", L2SkillType.class);
         _effectType = set.getEnum("effectType", L2SkillType.class, null);
         _effectId = set.getInteger("effectId", 0);
@@ -3157,7 +3159,12 @@ public abstract class L2Skill implements IChanceSkillTrigger
 	{
 		return _useShield;
 	}
-	
+
+	public boolean ignoreShield()
+	{
+		return _ignoreShield;
+	}
+
 	public int[] getTeleportCoords()
 	{
 		return _teleportCoords;

+ 3 - 3
L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2CubicInstance.java

@@ -621,7 +621,7 @@ public class L2CubicInstance
 		{
 			if (skill.isOffensive())
 			{
-				byte shld = Formulas.calcShldUse(activeCubic.getOwner(), target);
+				byte shld = Formulas.calcShldUse(activeCubic.getOwner(), target, skill);
 				boolean acted = Formulas.calcCubicSkillSuccess(activeCubic, target, skill, shld);
 				if (!acted)
 				{
@@ -660,7 +660,7 @@ public class L2CubicInstance
 			}
 			
 			boolean mcrit = Formulas.calcMCrit(activeCubic.getMCriticalHit(target, skill));
-			byte shld = Formulas.calcShldUse(activeCubic.getOwner(), target);
+			byte shld = Formulas.calcShldUse(activeCubic.getOwner(), target, skill);
 			int damage = (int) Formulas.calcMagicDam(activeCubic, target, skill, mcrit, shld);
 			
 			/*
@@ -709,7 +709,7 @@ public class L2CubicInstance
 			if (target == null || target.isDead()) // bypass if target is null or dead
 				continue;
 			
-			byte shld = Formulas.calcShldUse(activeCubic.getOwner(), target);
+			byte shld = Formulas.calcShldUse(activeCubic.getOwner(), target, skill);
 			
 			switch (type)
 			{

+ 10 - 2
L2_GameServer/java/net/sf/l2j/gameserver/skills/Formulas.java

@@ -1843,8 +1843,11 @@ public final class Formulas
 	 * @param sendSysMsg
 	 * @return
 	 */
-	public static byte calcShldUse(L2Character attacker, L2Character target, boolean sendSysMsg)
+	public static byte calcShldUse(L2Character attacker, L2Character target, L2Skill skill, boolean sendSysMsg)
 	{
+		if (skill != null && skill.ignoreShield())
+			return 0;
+
 		double shldRate = target.calcStat(Stats.SHIELD_RATE, 0, attacker, null)
 			* DEXbonus[target.getDEX()];
 		if (shldRate == 0.0) return 0;
@@ -1888,9 +1891,14 @@ public final class Formulas
 		return shldSuccess;
 	}
 	
+	public static byte calcShldUse(L2Character attacker, L2Character target, L2Skill skill)
+	{
+		return calcShldUse(attacker, target, skill, true);
+	}
+
 	public static byte calcShldUse(L2Character attacker, L2Character target)
 	{
-		return calcShldUse(attacker, target, true);
+		return calcShldUse(attacker, target, null, true);
 	}
 
 	public static boolean calcMagicAffected(L2Character actor, L2Character target, L2Skill skill)

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/skills/effects/EffectSignetMDam.java

@@ -175,7 +175,7 @@ public class EffectSignetMDam extends L2Effect
 			for (L2Character target : targets)
 			{
 				boolean mcrit = Formulas.calcMCrit(caster.getMCriticalHit(target, getSkill()));
-				byte shld = Formulas.calcShldUse(caster, target);
+				byte shld = Formulas.calcShldUse(caster, target, getSkill());
 				int mdam = (int) Formulas.calcMagicDam(caster, target, getSkill(), shld, ss, bss, mcrit);
 				
 				if (target instanceof L2Summon)

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/skills/l2skills/L2SkillChargeDmg.java

@@ -80,7 +80,7 @@ public class L2SkillChargeDmg extends L2Skill
 			// because if so, damage are lowered but we don't do anything special with dual then
 			// like in doAttackHitByDual which in fact does the calcPhysDam call twice
 			//boolean dual  = caster.isUsingDualWeapon();
-			byte shld = Formulas.calcShldUse(caster, target);
+			byte shld = Formulas.calcShldUse(caster, target, this);
 			boolean crit = false;
 			if (this.getBaseCritRate() > 0)
 				crit = Formulas.calcCrit(this.getBaseCritRate() * 10 * Formulas.getSTRBonus(caster), target);

+ 2 - 2
L2_GameServer/java/net/sf/l2j/gameserver/skills/l2skills/L2SkillDrain.java

@@ -99,7 +99,7 @@ public class L2SkillDrain extends L2Skill {
             	
 
 			boolean mcrit = Formulas.calcMCrit(activeChar.getMCriticalHit(target, this));
-			byte shld = Formulas.calcShldUse(activeChar, target);
+			byte shld = Formulas.calcShldUse(activeChar, target, this);
 			int damage = (int)Formulas.calcMagicDam(
 					activeChar, target, this, shld, ss, bss, mcrit);
 			
@@ -196,7 +196,7 @@ public class L2SkillDrain extends L2Skill {
 				continue;
 
 			boolean mcrit = Formulas.calcMCrit(activeCubic.getMCriticalHit(target, this));
-			byte shld = Formulas.calcShldUse(activeCubic.getOwner(), target);
+			byte shld = Formulas.calcShldUse(activeCubic.getOwner(), target, this);
 			
 			int damage = (int)Formulas.calcMagicDam(activeCubic, target, this, mcrit, shld);
 			if (Config.DEBUG)

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/skills/l2skills/L2SkillElemental.java

@@ -135,7 +135,7 @@ public class L2SkillElemental extends L2Skill {
 			}
 
 			boolean mcrit = Formulas.calcMCrit(activeChar.getMCriticalHit(target, this));
-			byte shld = Formulas.calcShldUse(activeChar, target);
+			byte shld = Formulas.calcShldUse(activeChar, target, this);
 			
 			int damage = (int)Formulas.calcMagicDam(
 					activeChar, target, this, shld, ss, bss, mcrit);

+ 2 - 2
L2_GameServer/java/net/sf/l2j/gameserver/templates/item/L2Weapon.java

@@ -338,7 +338,7 @@ public final class L2Weapon extends L2Item
 		if (!_skillsOnCritCondition.test(env))
 			return _emptyEffectSet; // Skill condition not met
 			
-		byte shld = Formulas.calcShldUse(caster, target);
+		byte shld = Formulas.calcShldUse(caster, target, _skillsOnCrit);
 		if (!Formulas.calcSkillSuccess(caster, target, _skillsOnCrit, shld, false, false, false))
 			return _emptyEffectSet; // These skills should not work on RaidBoss
 		if (target.getFirstEffect(_skillsOnCrit.getId()) != null)
@@ -374,7 +374,7 @@ public final class L2Weapon extends L2Item
 		if (!_skillsOnCastCondition.test(env))
 			return _emptyEffectSet;
 		
-		byte shld = Formulas.calcShldUse(caster, target);
+		byte shld = Formulas.calcShldUse(caster, target, _skillsOnCast);
 		if (_skillsOnCast.isOffensive() && !Formulas.calcSkillSuccess(caster, target, _skillsOnCast, shld, false, false, false))
 			return _emptyEffectSet;