Advertisement
Nik

EffectDrawAggression

Nik
Sep 13th, 2011
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 5.13 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,31 @@
  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. +                           L2Effect eff = target.getFirstEffect(L2EffectType.DRAW_AGGRESSION);
  38. +                          
  39. +                           // If the target has draw aggression effect and the npc is inside the skill radius, add hate depending on the effect power.
  40. +                           if (eff != null && npc.isInsideRadius(target, eff.getSkill().getSkillRadius(), false, true))
  41. +                               npc.addDamageHate(target, 0, (int)eff.getEffectPower());
  42. +                       }
  43. +                       else
  44. +                           npc.addDamageHate(target, 0, 0);
  45. +                   }
  46.                 }
  47.             }
  48.            
  49. Index: java/com/l2jserver/gameserver/model/CharEffectList.java
  50. ===================================================================
  51. --- java/com/l2jserver/gameserver/model/CharEffectList.java (revision 85)
  52. +++ java/com/l2jserver/gameserver/model/CharEffectList.java (working copy)
  53. @@ -66,6 +66,7 @@
  54.     public static final int EFFECT_FLAG_INVUL = 0x40000;
  55.     public static final int EFFECT_FLAG_PARALYZED = 0x80000;
  56.     public static final int EFFECT_FLAG_BLOCK_RESURRECTION = 0x100000;
  57. +   public static final int EFFECT_DRAW_AGGRESSION = 0x200000;
  58.    
  59.     private FastList<L2Effect> _buffs;
  60.     private FastList<L2Effect> _debuffs;
  61. Index: java/com/l2jserver/gameserver/skills/effects/EffectDrawAggression.java
  62. ===================================================================
  63. --- java/com/l2jserver/gameserver/skills/effects/EffectDrawAggression.java  (revision 0)
  64. +++ java/com/l2jserver/gameserver/skills/effects/EffectDrawAggression.java  (revision 0)
  65. @@ -0,0 +1,52 @@
  66. +/*
  67. + * This program is free software: you can redistribute it and/or modify it under
  68. + * the terms of the GNU General Public License as published by the Free Software
  69. + * Foundation, either version 3 of the License, or (at your option) any later
  70. + * version.
  71. + *
  72. + * This program is distributed in the hope that it will be useful, but WITHOUT
  73. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  74. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  75. + * details.
  76. + *
  77. + * You should have received a copy of the GNU General Public License along with
  78. + * this program. If not, see <http://www.gnu.org/licenses/>.
  79. + */
  80. +package com.l2jserver.gameserver.skills.effects;
  81. +
  82. +import com.l2jserver.gameserver.model.CharEffectList;
  83. +import com.l2jserver.gameserver.model.L2Effect;
  84. +import com.l2jserver.gameserver.skills.Env;
  85. +import com.l2jserver.gameserver.templates.effects.EffectTemplate;
  86. +import com.l2jserver.gameserver.templates.skills.L2EffectType;
  87. +
  88. +public class EffectDrawAggression extends L2Effect
  89. +{
  90. +   public EffectDrawAggression(Env env, EffectTemplate template)
  91. +   {
  92. +       super(env, template);
  93. +   }
  94. +  
  95. +   /**
  96. +    *
  97. +    * @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
  98. +    */
  99. +   @Override
  100. +   public L2EffectType getEffectType()
  101. +   {
  102. +       return L2EffectType.DRAW_AGGRESSION;
  103. +   }
  104. +  
  105. +   @Override
  106. +   public int getEffectFlags()
  107. +   {
  108. +       return CharEffectList.EFFECT_DRAW_AGGRESSION;
  109. +   }
  110. +  
  111. +   @Override
  112. +   public boolean onActionTime()
  113. +   {
  114. +       // Simply stop the effect
  115. +       return false;
  116. +   }
  117. +}
  118. Index: java/com/l2jserver/gameserver/templates/skills/L2EffectType.java
  119. ===================================================================
  120. --- java/com/l2jserver/gameserver/templates/skills/L2EffectType.java    (revision 85)
  121. +++ java/com/l2jserver/gameserver/templates/skills/L2EffectType.java    (working copy)
  122. @@ -79,5 +79,6 @@
  123.     ABORT_CAST,
  124.     INCREASE_CHARGES,
  125.     BLOCK_RESURRECTION,
  126. -   DAMAGE_TRANSFER
  127. +   DAMAGE_TRANSFER,
  128. +   DRAW_AGGRESSION
  129.  }
  130. \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement