Browse Source

BETA: Core support for ignoreSkillMute => when set to true, the skill can be casted even if it should be blocked by phys/magic skill block (shield bash, silence etc.)

Nik 13 years ago
parent
commit
663c3b3a52

+ 34 - 31
L2J_Server_BETA/java/com/l2jserver/gameserver/ai/L2AttackableAI.java

@@ -934,10 +934,8 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
 						{
 							if (sk.getTargetType() == L2TargetType.TARGET_SELF)
 								continue;
-							if ((sk.getMpConsume() >= npc.getCurrentMp() || npc.isSkillDisabled(sk) || (sk.isMagic() && npc.isMuted()) || (!sk.isMagic() && npc.isPhysicalMuted())))
-							{
+							if (!checkSkillCastConditions(sk))
 								continue;
-							}
 							if (!Util.checkIfInRange((sk.getCastRange() + collision + leader.getTemplate().getCollisionRadius()), npc, leader, false) && !isParty(sk) && !npc.isMovementDisabled())
 							{
 								moveToPawn(leader, sk.getCastRange() + collision + leader.getTemplate().getCollisionRadius());
@@ -956,10 +954,8 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
 				if (Rnd.get(100) < (100 - percentage) / 3)
 					for (L2Skill sk : _skillrender.getHealSkills())
 					{
-						if ((sk.getMpConsume() >= npc.getCurrentMp() || npc.isSkillDisabled(sk) || (sk.isMagic() && npc.isMuted())) || (!sk.isMagic() && npc.isPhysicalMuted()))
-						{
+						if (!checkSkillCastConditions(sk))
 							continue;
-						}
 						clientStopMoving(null);
 						npc.setTarget(npc);
 						npc.doCast(sk);
@@ -967,10 +963,8 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
 					}
 				for (L2Skill sk : _skillrender.getHealSkills())
 				{
-					if ((sk.getMpConsume() >= npc.getCurrentMp() || npc.isSkillDisabled(sk) || (sk.isMagic() && npc.isMuted())) || (!sk.isMagic() && npc.isPhysicalMuted()))
-					{
+					if (!checkSkillCastConditions(sk))
 						continue;
-					}
 					if (sk.getTargetType() == L2TargetType.TARGET_ONE)
 						for (L2Character obj : npc.getKnownList().getKnownCharactersInRadius(sk.getCastRange() + collision))
 						{
@@ -1012,10 +1006,8 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
 						{
 							if (sk.getTargetType() == L2TargetType.TARGET_SELF)
 								continue;
-							if ((sk.getMpConsume() >= npc.getCurrentMp() || npc.isSkillDisabled(sk) || (sk.isMagic() && npc.isMuted()) || (!sk.isMagic() && npc.isPhysicalMuted())))
-							{
+							if (!checkSkillCastConditions(sk))
 								continue;
-							}
 							if (!Util.checkIfInRange((sk.getCastRange() + collision + leader.getTemplate().getCollisionRadius()), npc, leader, false) && !isParty(sk) && !npc.isMovementDisabled())
 							{
 								moveToPawn(leader, sk.getCastRange() + collision + leader.getTemplate().getCollisionRadius());
@@ -1032,10 +1024,8 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
 				}
 				for (L2Skill sk : _skillrender.getResSkills())
 				{
-					if ((sk.getMpConsume() >= npc.getCurrentMp() || npc.isSkillDisabled(sk) || (sk.isMagic() && npc.isMuted())) || (!sk.isMagic() && npc.isPhysicalMuted()))
-					{
+					if (!checkSkillCastConditions(sk))
 						continue;
-					}
 					if (sk.getTargetType() == L2TargetType.TARGET_ONE)
 						for (L2Character obj : npc.getKnownList().getKnownCharactersInRadius(sk.getCastRange() + collision))
 						{
@@ -1226,7 +1216,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
 		if (caster.isCastingNow() && !sk.isSimultaneousCast())
 			return false;
 		
-		if (sk.getMpConsume() >= caster.getCurrentMp() || caster.isSkillDisabled(sk) || (sk.isMagic() && caster.isMuted()) || (!sk.isMagic() && caster.isPhysicalMuted()))
+		if (!checkSkillCastConditions(sk))
 			return false;
 		if (getAttackTarget() == null)
 			if (caster.getMostHated() != null)
@@ -1762,10 +1752,8 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
 				{
 					for (L2Skill sk : _skillrender.getImmobiliseSkills())
 					{
-						if (sk.getMpConsume() >= npc.getCurrentMp() || npc.isSkillDisabled(sk) || (sk.getCastRange() + npc.getTemplate().getCollisionRadius() + getAttackTarget().getTemplate().getCollisionRadius() <= dist2 && !canAura(sk)) || (sk.isMagic() && npc.isMuted()) || (!sk.isMagic() && npc.isPhysicalMuted()))
-						{
+						if (!checkSkillCastConditions(sk) || (sk.getCastRange() + npc.getTemplate().getCollisionRadius() + getAttackTarget().getTemplate().getCollisionRadius() <= dist2 && !canAura(sk)))
 							continue;
-						}
 						if (!GeoData.getInstance().canSeeTarget(npc, getAttackTarget()))
 							continue;
 						if (getAttackTarget().getFirstEffect(sk) == null)
@@ -1785,10 +1773,8 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
 				{
 					for (L2Skill sk : _skillrender.getCostOverTimeSkills())
 					{
-						if (sk.getMpConsume() >= npc.getCurrentMp() || npc.isSkillDisabled(sk) || (sk.getCastRange() + npc.getTemplate().getCollisionRadius() + getAttackTarget().getTemplate().getCollisionRadius() <= dist2 && !canAura(sk)) || (sk.isMagic() && npc.isMuted()) || (!sk.isMagic() && npc.isPhysicalMuted()))
-						{
+						if (!checkSkillCastConditions(sk) || (sk.getCastRange() + npc.getTemplate().getCollisionRadius() + getAttackTarget().getTemplate().getCollisionRadius() <= dist2 && !canAura(sk)))
 							continue;
-						}
 						if (!GeoData.getInstance().canSeeTarget(npc, getAttackTarget()))
 							continue;
 						if (getAttackTarget().getFirstEffect(sk) == null)
@@ -1807,10 +1793,8 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
 				{
 					for (L2Skill sk : _skillrender.getDebuffSkills())
 					{
-						if (sk.getMpConsume() >= npc.getCurrentMp() || npc.isSkillDisabled(sk) || (sk.getCastRange() + npc.getTemplate().getCollisionRadius() + getAttackTarget().getTemplate().getCollisionRadius() <= dist2 && !canAura(sk)) || (sk.isMagic() && npc.isMuted()) || (!sk.isMagic() && npc.isPhysicalMuted()))
-						{
+						if (!checkSkillCastConditions(sk) || (sk.getCastRange() + npc.getTemplate().getCollisionRadius() + getAttackTarget().getTemplate().getCollisionRadius() <= dist2 && !canAura(sk)))
 							continue;
-						}
 						if (!GeoData.getInstance().canSeeTarget(npc, getAttackTarget()))
 							continue;
 						if (getAttackTarget().getFirstEffect(sk) == null)
@@ -1830,10 +1814,8 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
 				{
 					for (L2Skill sk : _skillrender.getNegativeSkills())
 					{
-						if (sk.getMpConsume() >= npc.getCurrentMp() || npc.isSkillDisabled(sk) || (sk.getCastRange() + npc.getTemplate().getCollisionRadius() + getAttackTarget().getTemplate().getCollisionRadius() <= dist2 && !canAura(sk)) || (sk.isMagic() && npc.isMuted()) || (!sk.isMagic() && npc.isPhysicalMuted()))
-						{
+						if (!checkSkillCastConditions(sk) || (sk.getCastRange() + npc.getTemplate().getCollisionRadius() + getAttackTarget().getTemplate().getCollisionRadius() <= dist2 && !canAura(sk)))
 							continue;
-						}
 						if (!GeoData.getInstance().canSeeTarget(npc, getAttackTarget()))
 							continue;
 						if (getAttackTarget().getFirstEffect(L2EffectType.BUFF) != null)
@@ -1854,10 +1836,8 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
 				{
 					for (L2Skill sk : _skillrender.getAtkSkills())
 					{
-						if (sk.getMpConsume() >= npc.getCurrentMp() || npc.isSkillDisabled(sk) || (sk.getCastRange() + npc.getTemplate().getCollisionRadius() + getAttackTarget().getTemplate().getCollisionRadius() <= dist2 && !canAura(sk)) || (sk.isMagic() && npc.isMuted()) || (!sk.isMagic() && npc.isPhysicalMuted()))
-						{
+						if (!checkSkillCastConditions(sk) || (sk.getCastRange() + npc.getTemplate().getCollisionRadius() + getAttackTarget().getTemplate().getCollisionRadius() <= dist2 && !canAura(sk)))
 							continue;
-						}
 						if (!GeoData.getInstance().canSeeTarget(npc, getAttackTarget()))
 							continue;
 						clientStopMoving(null);
@@ -1928,6 +1908,29 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
 		}
 	}
 	
+	private boolean checkSkillCastConditions(L2Skill skill)
+	{
+		if (skill.getMpConsume() >= getActiveChar().getCurrentMp())
+			return false;
+		else if (getActiveChar().isSkillDisabled(skill))
+			return false;
+		else if (!skill.ignoreSkillMute())
+		{
+			if (skill.isMagic())
+			{
+				if (getActiveChar().isMuted())
+					return false;
+			}
+			else
+			{
+				if (getActiveChar().isPhysicalMuted())
+					return false;
+			}
+		}
+		
+		return true;
+	}
+	
 	private L2Character effectTargetReconsider(L2Skill sk, boolean positive)
 	{
 		if (sk == null)

+ 8 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/model/L2Skill.java

@@ -267,9 +267,10 @@ public abstract class L2Skill implements IChanceSkillTrigger
 	private final String _attribute;
 	
 	private final boolean _ignoreShield;
+	private final boolean _ignoreSkillMute;
+	
 	private final boolean _isSuicideAttack;
 	private final boolean _canBeReflected;
-	
 	private final boolean _canBeDispeled;
 	
 	private final boolean _isClanSkill;
@@ -454,6 +455,7 @@ public abstract class L2Skill implements IChanceSkillTrigger
 		_maxChance = set.getInteger("maxChance", Config.MAX_DEBUFF_CHANCE);
 		_stat = set.getEnum("stat", Stats.class, null);
 		_ignoreShield = set.getBool("ignoreShld", false);
+		_ignoreSkillMute = set.getBool("ignoreSkillMute", false);
 		_skillType = set.getEnum("skillType", L2SkillType.class);
 		_effectType = set.getEnum("effectType", L2SkillType.class, null);
 		_effectId = set.getInteger("effectId", 0);
@@ -1986,6 +1988,11 @@ public abstract class L2Skill implements IChanceSkillTrigger
 		return _ignoreShield;
 	}
 	
+	public boolean ignoreSkillMute()
+	{
+		return _ignoreSkillMute;
+	}
+	
 	public boolean canBeReflected()
 	{
 		return _canBeReflected;

+ 11 - 8
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/L2Attackable.java

@@ -408,15 +408,18 @@ public class L2Attackable extends L2Npc
 		if (getCurrentHp() <= skill.getHpConsume())
 			return;
 		
-		if (skill.isMagic())
+		if (!skill.ignoreSkillMute())
 		{
-			if (isMuted())
-				return;
-		}
-		else
-		{
-			if (isPhysicalMuted())
-				return;
+			if (skill.isMagic())
+			{
+				if (isMuted())
+					return;
+			}
+			else
+			{
+				if (isPhysicalMuted())
+					return;
+			}
 		}
 		
 		L2Object target = skill.getFirstOfTargetList(this);

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

@@ -2078,7 +2078,7 @@ public abstract class L2Character extends L2Object
 			return false;
 		}
 		
-		if (!skill.isPotion())
+		if (!skill.isPotion() || !skill.ignoreSkillMute()) // Skill mute checks.
 		{
 			// Check if the skill is a magic spell and if the L2Character is not muted
 			if (skill.isMagic())