Advertisement
Nik

EffectDrawAggression

Nik
Sep 13th, 2011
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 5.66 KB | None | 0 0
  1. Index: java/com/l2jserver/gameserver/ai/L2AttackableAI.java
  2. ===================================================================
  3. --- java/com/l2jserver/gameserver/ai/L2AttackableAI.java    (revision 85)
  4. +++ java/com/l2jserver/gameserver/ai/L2AttackableAI.java    (working copy)
  5. @@ -29,7 +29,9 @@
  6.  import com.l2jserver.gameserver.ThreadPoolManager;
  7.  import com.l2jserver.gameserver.datatables.NpcTable;
  8.  import com.l2jserver.gameserver.instancemanager.DimensionalRiftManager;
  9. +import com.l2jserver.gameserver.model.CharEffectList;
  10.  import com.l2jserver.gameserver.model.L2CharPosition;
  11. +import com.l2jserver.gameserver.model.L2Effect;
  12.  import com.l2jserver.gameserver.model.L2Object;
  13.  import com.l2jserver.gameserver.model.L2Skill;
  14.  import com.l2jserver.gameserver.model.L2Skill.SkillTargetType;
  15. @@ -467,17 +469,38 @@
  16.                         continue;
  17.                 }
  18.                
  19. +               boolean drawsAggression = target.isAffected(CharEffectList.EFFECT_DRAW_AGGRESSION);
  20. +              
  21.                 // TODO: The AI Script ought to handle aggro behaviors in onSee.  Once implemented, aggro behaviors ought
  22.                 // to be removed from here.  (Fulminus)
  23.                 // For each L2Character check if the target is autoattackable
  24. -               if (autoAttackCondition(target)) // check aggression
  25. +               if (autoAttackCondition(target) || drawsAggression) // check aggression
  26.                 {
  27.                     // Get the hate level of the L2Attackable against this L2Character target contained in _aggroList
  28.                     int hating = npc.getHating(target);
  29.                    
  30.                     // Add the attacker to the L2Attackable _aggroList with 0 damage and 1 hate
  31.                     if (hating == 0)
  32. -                       npc.addDamageHate(target, 0, 0);
  33. +                   {
  34. +                       // EffectDrawAggression handling
  35. +                       if (drawsAggression)
  36. +                       {
  37. +                           for (L2Effect eff : target.getAllEffects())
  38. +                           {
  39. +                               if (eff == null)
  40. +                                   continue;
  41. +                              
  42. +                               // If the target has draw aggression effect and the npc is inside the skill radius, add hate depending on the effect power.
  43. +                               if (eff.getEffectType() == L2EffectType.DRAW_AGGRESSION && npc.isInsideRadius(target, eff.getSkill().getSkillRadius(), false, true))
  44. +                               {
  45. +                                   npc.addDamageHate(target, 0, (int)eff.getEffectPower());
  46. +                                   break;
  47. +                               }
  48. +                           }
  49. +                       }
  50. +                       else
  51. +                           npc.addDamageHate(target, 0, 0);
  52. +                   }
  53.                 }
  54.             }
  55.            
  56. Index: java/com/l2jserver/gameserver/model/CharEffectList.java
  57. ===================================================================
  58. --- java/com/l2jserver/gameserver/model/CharEffectList.java (revision 85)
  59. +++ java/com/l2jserver/gameserver/model/CharEffectList.java (working copy)
  60. @@ -66,6 +66,7 @@
  61.     public static final int EFFECT_FLAG_INVUL = 0x40000;
  62.     public static final int EFFECT_FLAG_PARALYZED = 0x80000;
  63.     public static final int EFFECT_FLAG_BLOCK_RESURRECTION = 0x100000;
  64. +   public static final int EFFECT_DRAW_AGGRESSION = 0x200000;
  65.    
  66.     private FastList<L2Effect> _buffs;
  67.     private FastList<L2Effect> _debuffs;
  68. Index: java/com/l2jserver/gameserver/skills/effects/EffectDrawAggression.java
  69. ===================================================================
  70. --- java/com/l2jserver/gameserver/skills/effects/EffectDrawAggression.java  (revision 0)
  71. +++ java/com/l2jserver/gameserver/skills/effects/EffectDrawAggression.java  (revision 0)
  72. @@ -0,0 +1,76 @@
  73. +/*
  74. + * This program is free software: you can redistribute it and/or modify it under
  75. + * the terms of the GNU General Public License as published by the Free Software
  76. + * Foundation, either version 3 of the License, or (at your option) any later
  77. + * version.
  78. + *
  79. + * This program is distributed in the hope that it will be useful, but WITHOUT
  80. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  81. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  82. + * details.
  83. + *
  84. + * You should have received a copy of the GNU General Public License along with
  85. + * this program. If not, see <http://www.gnu.org/licenses/>.
  86. + */
  87. +package com.l2jserver.gameserver.skills.effects;
  88. +
  89. +import com.l2jserver.gameserver.model.CharEffectList;
  90. +import com.l2jserver.gameserver.model.L2Effect;
  91. +import com.l2jserver.gameserver.skills.Env;
  92. +import com.l2jserver.gameserver.templates.effects.EffectTemplate;
  93. +import com.l2jserver.gameserver.templates.skills.L2EffectType;
  94. +
  95. +public class EffectDrawAggression extends L2Effect
  96. +{
  97. +   public EffectDrawAggression(Env env, EffectTemplate template)
  98. +   {
  99. +       super(env, template);
  100. +   }
  101. +  
  102. +   /**
  103. +    *
  104. +    * @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
  105. +    */
  106. +   @Override
  107. +   public L2EffectType getEffectType()
  108. +   {
  109. +       return L2EffectType.DRAW_AGGRESSION;
  110. +   }
  111. +  
  112. +   @Override
  113. +   public int getEffectFlags()
  114. +   {
  115. +       return CharEffectList.EFFECT_DRAW_AGGRESSION;
  116. +   }
  117. +  
  118. +   /**
  119. +    *
  120. +    * @see com.l2jserver.gameserver.model.L2Effect#onStart()
  121. +    */
  122. +   @Override
  123. +   public boolean onStart()
  124. +   {
  125. +       return super.onStart();
  126. +   }
  127. +  
  128. +   /**
  129. +    *
  130. +    * @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
  131. +    */
  132. +   @Override
  133. +   public boolean onActionTime()
  134. +   {
  135. +       // Simply stop the effect
  136. +       return false;
  137. +   }
  138. +  
  139. +   /**
  140. +    *
  141. +    * @see com.l2jserver.gameserver.model.L2Effect#onExit()
  142. +    */
  143. +   @Override
  144. +   public void onExit()
  145. +   {
  146. +       super.onExit();
  147. +   }
  148. +}
  149. Index: java/com/l2jserver/gameserver/templates/skills/L2EffectType.java
  150. ===================================================================
  151. --- java/com/l2jserver/gameserver/templates/skills/L2EffectType.java    (revision 85)
  152. +++ java/com/l2jserver/gameserver/templates/skills/L2EffectType.java    (working copy)
  153. @@ -79,5 +79,6 @@
  154.     ABORT_CAST,
  155.     INCREASE_CHARGES,
  156.     BLOCK_RESURRECTION,
  157. -   DAMAGE_TRANSFER
  158. +   DAMAGE_TRANSFER,
  159. +   DRAW_AGGRESSION
  160.  }
  161. \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement