Advertisement
Nik

Skills ignoreSkillMute support

Nik
Oct 18th, 2011
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 10.54 KB | None | 0 0
  1. Index: java/com/l2jserver/gameserver/ai/L2AttackableAI.java
  2. ===================================================================
  3. --- java/com/l2jserver/gameserver/ai/L2AttackableAI.java    (revision 5011)
  4. +++ java/com/l2jserver/gameserver/ai/L2AttackableAI.java    (working copy)
  5. @@ -924,10 +924,8 @@
  6.                         {
  7.                             if (sk.getTargetType() == L2TargetType.TARGET_SELF)
  8.                                 continue;
  9. -                           if ((sk.getMpConsume() >= npc.getCurrentMp() || npc.isSkillDisabled(sk) || (sk.isMagic() && npc.isMuted()) || (!sk.isMagic() && npc.isPhysicalMuted())))
  10. -                           {
  11. +                           if (!checkSkillCastConditions(sk))
  12.                                 continue;
  13. -                           }
  14.                             if (!Util.checkIfInRange((sk.getCastRange() + collision + leader.getTemplate().getCollisionRadius()), npc, leader, false) && !isParty(sk) && !npc.isMovementDisabled())
  15.                             {
  16.                                 moveToPawn(leader, sk.getCastRange() + collision + leader.getTemplate().getCollisionRadius());
  17. @@ -946,10 +944,8 @@
  18.                 if (Rnd.get(100) < (100 - percentage) / 3)
  19.                     for (L2Skill sk : _skillrender._healskills)
  20.                     {
  21. -                       if ((sk.getMpConsume() >= npc.getCurrentMp() || npc.isSkillDisabled(sk) || (sk.isMagic() && npc.isMuted())) || (!sk.isMagic() && npc.isPhysicalMuted()))
  22. -                       {
  23. +                       if (!checkSkillCastConditions(sk))
  24.                             continue;
  25. -                       }
  26.                         clientStopMoving(null);
  27.                         npc.setTarget(npc);
  28.                         npc.doCast(sk);
  29. @@ -957,10 +953,8 @@
  30.                     }
  31.                 for (L2Skill sk : _skillrender._healskills)
  32.                 {
  33. -                   if ((sk.getMpConsume() >= npc.getCurrentMp() || npc.isSkillDisabled(sk) || (sk.isMagic() && npc.isMuted())) || (!sk.isMagic() && npc.isPhysicalMuted()))
  34. -                   {
  35. +                   if (!checkSkillCastConditions(sk))
  36.                         continue;
  37. -                   }
  38.                     if (sk.getTargetType() == L2TargetType.TARGET_ONE)
  39.                         for (L2Character obj : npc.getKnownList().getKnownCharactersInRadius(sk.getCastRange() + collision))
  40.                         {
  41. @@ -1002,10 +996,8 @@
  42.                         {
  43.                             if (sk.getTargetType() == L2TargetType.TARGET_SELF)
  44.                                 continue;
  45. -                           if ((sk.getMpConsume() >= npc.getCurrentMp() || npc.isSkillDisabled(sk) || (sk.isMagic() && npc.isMuted()) || (!sk.isMagic() && npc.isPhysicalMuted())))
  46. -                           {
  47. +                           if (!checkSkillCastConditions(sk))
  48.                                 continue;
  49. -                           }
  50.                             if (!Util.checkIfInRange((sk.getCastRange() + collision + leader.getTemplate().getCollisionRadius()), npc, leader, false) && !isParty(sk) && !npc.isMovementDisabled())
  51.                             {
  52.                                 moveToPawn(leader, sk.getCastRange() + collision + leader.getTemplate().getCollisionRadius());
  53. @@ -1022,10 +1014,8 @@
  54.                 }
  55.                 for (L2Skill sk : _skillrender._resskills)
  56.                 {
  57. -                   if ((sk.getMpConsume() >= npc.getCurrentMp() || npc.isSkillDisabled(sk) || (sk.isMagic() && npc.isMuted())) || (!sk.isMagic() && npc.isPhysicalMuted()))
  58. -                   {
  59. +                   if (!checkSkillCastConditions(sk))
  60.                         continue;
  61. -                   }
  62.                     if (sk.getTargetType() == L2TargetType.TARGET_ONE)
  63.                         for (L2Character obj : npc.getKnownList().getKnownCharactersInRadius(sk.getCastRange() + collision))
  64.                         {
  65. @@ -1221,7 +1211,7 @@
  66.         if (caster.isCastingNow() && !sk.isSimultaneousCast())
  67.             return false;
  68.        
  69. -       if (sk.getMpConsume() >= caster.getCurrentMp() || caster.isSkillDisabled(sk) || (sk.isMagic() && caster.isMuted()) || (!sk.isMagic() && caster.isPhysicalMuted()))
  70. +       if (!checkSkillCastConditions(sk))
  71.             return false;
  72.         if (getAttackTarget() == null)
  73.             if (caster.getMostHated() != null)
  74. @@ -1757,10 +1747,8 @@
  75.                 {
  76.                     for (L2Skill sk : _skillrender._immobiliseskills)
  77.                     {
  78. -                       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()))
  79. -                       {
  80. +                       if (!checkSkillCastConditions(sk) || (sk.getCastRange() + npc.getTemplate().getCollisionRadius() + getAttackTarget().getTemplate().getCollisionRadius() <= dist2 && !canAura(sk)))
  81.                             continue;
  82. -                       }
  83.                         if (!GeoData.getInstance().canSeeTarget(npc, getAttackTarget()))
  84.                             continue;
  85.                         if (getAttackTarget().getFirstEffect(sk) == null)
  86. @@ -1780,10 +1768,8 @@
  87.                 {
  88.                     for (L2Skill sk : _skillrender._cotskills)
  89.                     {
  90. -                       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()))
  91. -                       {
  92. +                       if (!checkSkillCastConditions(sk) || (sk.getCastRange() + npc.getTemplate().getCollisionRadius() + getAttackTarget().getTemplate().getCollisionRadius() <= dist2 && !canAura(sk)))
  93.                             continue;
  94. -                       }
  95.                         if (!GeoData.getInstance().canSeeTarget(npc, getAttackTarget()))
  96.                             continue;
  97.                         if (getAttackTarget().getFirstEffect(sk) == null)
  98. @@ -1802,10 +1788,8 @@
  99.                 {
  100.                     for (L2Skill sk : _skillrender._debuffskills)
  101.                     {
  102. -                       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()))
  103. -                       {
  104. +                       if (!checkSkillCastConditions(sk) || (sk.getCastRange() + npc.getTemplate().getCollisionRadius() + getAttackTarget().getTemplate().getCollisionRadius() <= dist2 && !canAura(sk)))
  105.                             continue;
  106. -                       }
  107.                         if (!GeoData.getInstance().canSeeTarget(npc, getAttackTarget()))
  108.                             continue;
  109.                         if (getAttackTarget().getFirstEffect(sk) == null)
  110. @@ -1825,10 +1809,8 @@
  111.                 {
  112.                     for (L2Skill sk : _skillrender._negativeskills)
  113.                     {
  114. -                       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()))
  115. -                       {
  116. +                       if (!checkSkillCastConditions(sk) || (sk.getCastRange() + npc.getTemplate().getCollisionRadius() + getAttackTarget().getTemplate().getCollisionRadius() <= dist2 && !canAura(sk)))
  117.                             continue;
  118. -                       }
  119.                         if (!GeoData.getInstance().canSeeTarget(npc, getAttackTarget()))
  120.                             continue;
  121.                         if (getAttackTarget().getFirstEffect(L2EffectType.BUFF) != null)
  122. @@ -1849,10 +1831,8 @@
  123.                 {
  124.                     for (L2Skill sk : _skillrender._atkskills)
  125.                     {
  126. -                       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()))
  127. -                       {
  128. +                       if (!checkSkillCastConditions(sk) || (sk.getCastRange() + npc.getTemplate().getCollisionRadius() + getAttackTarget().getTemplate().getCollisionRadius() <= dist2 && !canAura(sk)))
  129.                             continue;
  130. -                       }
  131.                         if (!GeoData.getInstance().canSeeTarget(npc, getAttackTarget()))
  132.                             continue;
  133.                         clientStopMoving(null);
  134. @@ -1927,6 +1907,29 @@
  135.         }
  136.     }
  137.    
  138. +   private boolean checkSkillCastConditions(L2Skill skill)
  139. +   {
  140. +       if (skill.getMpConsume() >= getActiveChar().getCurrentMp())
  141. +           return false;
  142. +       else if (getActiveChar().isSkillDisabled(skill))
  143. +           return false;
  144. +       else if (!skill.ignoreSkillMute())
  145. +       {
  146. +           if (skill.isMagic())
  147. +           {
  148. +               if (getActiveChar().isMuted())
  149. +                   return false;
  150. +           }
  151. +           else
  152. +           {
  153. +               if (getActiveChar().isPhysicalMuted())
  154. +                   return false;
  155. +           }
  156. +       }
  157. +      
  158. +       return true;
  159. +   }
  160. +  
  161.     private L2Character effectTargetReconsider(L2Skill sk, boolean positive)
  162.     {
  163.         if (sk == null)
  164. Index: java/com/l2jserver/gameserver/model/L2Skill.java
  165. ===================================================================
  166. --- java/com/l2jserver/gameserver/model/L2Skill.java    (revision 5011)
  167. +++ java/com/l2jserver/gameserver/model/L2Skill.java    (working copy)
  168. @@ -1,4 +1,5 @@
  169.  /*
  170. +
  171.   * This program is free software: you can redistribute it and/or modify it under
  172.   * the terms of the GNU General Public License as published by the Free Software
  173.   * Foundation, either version 3 of the License, or (at your option) any later
  174. @@ -266,9 +267,10 @@
  175.     private final String _attribute;
  176.    
  177.     private final boolean _ignoreShield;
  178. +   private final boolean _ignoreSkillMute;
  179. +  
  180.     private final boolean _isSuicideAttack;
  181.     private final boolean _canBeReflected;
  182. -  
  183.     private final boolean _canBeDispeled;
  184.    
  185.     private final boolean _isClanSkill;
  186. @@ -453,6 +455,7 @@
  187.         _maxChance = set.getInteger("maxChance", Config.MAX_DEBUFF_CHANCE);
  188.         _stat = set.getEnum("stat", Stats.class, null);
  189.         _ignoreShield = set.getBool("ignoreShld", false);
  190. +       _ignoreSkillMute = set.getBool("ignoreSkillMute", false);
  191.         _skillType = set.getEnum("skillType", L2SkillType.class);
  192.         _effectType = set.getEnum("effectType", L2SkillType.class, null);
  193.         _effectId = set.getInteger("effectId", 0);
  194. @@ -1985,6 +1988,11 @@
  195.         return _ignoreShield;
  196.     }
  197.    
  198. +   public boolean ignoreSkillMute()
  199. +   {
  200. +       return _ignoreShield;
  201. +   }
  202. +  
  203.     public boolean canBeReflected()
  204.     {
  205.         return _canBeReflected;
  206. Index: java/com/l2jserver/gameserver/model/actor/L2Attackable.java
  207. ===================================================================
  208. --- java/com/l2jserver/gameserver/model/actor/L2Attackable.java (revision 5011)
  209. +++ java/com/l2jserver/gameserver/model/actor/L2Attackable.java (working copy)
  210. @@ -408,16 +408,19 @@
  211.         if (getCurrentHp() <= skill.getHpConsume())
  212.             return;
  213.        
  214. -       if (skill.isMagic())
  215. +       if (!skill.ignoreSkillMute())
  216.         {
  217. -           if (isMuted())
  218. -               return;
  219. +           if (skill.isMagic())
  220. +           {
  221. +               if (isMuted())
  222. +                   return;
  223. +           }
  224. +           else
  225. +           {
  226. +               if (isPhysicalMuted())
  227. +                   return;
  228. +           }
  229.         }
  230. -       else
  231. -       {
  232. -           if (isPhysicalMuted())
  233. -               return;
  234. -       }
  235.        
  236.         L2Object target = skill.getFirstOfTargetList(this);
  237.         if (target == null)
  238. Index: java/com/l2jserver/gameserver/model/actor/L2Character.java
  239. ===================================================================
  240. --- java/com/l2jserver/gameserver/model/actor/L2Character.java  (revision 5011)
  241. +++ java/com/l2jserver/gameserver/model/actor/L2Character.java  (working copy)
  242. @@ -2078,7 +2078,7 @@
  243.             return false;
  244.         }
  245.        
  246. -       if (!skill.isPotion())
  247. +       if (!skill.isPotion() || !skill.ignoreSkillMute()) // Skill mute checks.
  248.         {
  249.             // Check if the skill is a magic spell and if the L2Character is not muted
  250.             if (skill.isMagic())
  251.  
  252.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement