Advertisement
warc222

Share] A real Anti-Buff Shield

Oct 11th, 2015
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.82 KB | None | 0 0
  1. L2Effect.java
  2. CHARMOFCOURAGE,
  3. SIGNET_EFFECT,
  4. SIGNET_GROUND,
  5. + PREVENT_BUFF,
  6. PREVENT_MAGIC,
  7. TRANSFERDMG,
  8. CANCEL,
  9. WARP
  10. }
  11.  
  12.  
  13.  
  14.  
  15. L2Character.java
  16. private boolean _isAfraid = false; // Flee in a random direction
  17.  
  18. + private boolean _isBuffProtected = false;
  19. private boolean _isConfused = false; // Attack anyone randomly
  20.  
  21. private boolean _isFakeDeath = false; // Fake death
  22. private boolean _isFlying = false; //Is flying Wyvern?
  23. + public final void setIsBuffProtected(boolean value)
  24. + {
  25. + _isBuffProtected = value;
  26. + }
  27. +
  28. + public boolean isBuffProtected()
  29. + {
  30. + return _isBuffProtected;
  31. + }
  32. }
  33.  
  34.  
  35.  
  36.  
  37. Continuous.java
  38. // Walls and Door should not be buffed
  39. if (target instanceof L2DoorInstance && (skill.getSkillType() == L2Skill.SkillType.BUFF || skill.getSkillType() == L2Skill.SkillType.HOT))
  40. continue;
  41.  
  42. + // Anti-Buff Protection prevents you from getting buffs by other players
  43. + if (activeChar instanceof L2PlayableInstance && target != activeChar && target.isBuffProtected() && !skill.isHeroSkill()
  44. + && (skill.getSkillType() == L2Skill.SkillType.BUFF
  45. + || skill.getSkillType() == L2Skill.SkillType.HEAL_PERCENT
  46. + || skill.getSkillType() == L2Skill.SkillType.FORCE_BUFF
  47. + || skill.getSkillType() == L2Skill.SkillType.MANAHEAL_PERCENT
  48. + || skill.getSkillType() == L2Skill.SkillType.COMBATPOINTHEAL
  49. + || skill.getSkillType() == L2Skill.SkillType.REFLECT))
  50. + continue;
  51. EffectDeflectBuff.java
  52. package net.sf.l2j.gameserver.skills.effects;
  53.  
  54. import net.sf.l2j.gameserver.model.L2Effect;
  55. import net.sf.l2j.gameserver.model.L2Effect.EffectType;
  56. import net.sf.l2j.gameserver.model.L2Skill.SkillType;
  57. import net.sf.l2j.gameserver.network.SystemMessageId;
  58. import net.sf.l2j.gameserver.serverpackets.SystemMessage;
  59. import net.sf.l2j.gameserver.skills.Env;
  60.  
  61. /**
  62. * @author Java
  63. */
  64. public final class EffectDeflectBuff extends L2Effect
  65. {
  66. /**
  67. * @param env
  68. * @param template
  69. */
  70. public EffectDeflectBuff(Env env, EffectTemplate template)
  71. {
  72. super(env, template);
  73. }
  74.  
  75. /*
  76. * (non-Javadoc)
  77. *
  78. * @see net.sf.l2j.gameserver.model.L2Effect#getEffectType()
  79. */
  80. @Override
  81. public EffectType getEffectType()
  82. {
  83. return EffectType.PREVENT_BUFF;
  84. }
  85.  
  86. /*
  87. * (non-Javadoc)
  88. *
  89. * @see net.sf.l2j.gameserver.model.L2Effect#onActionTime()
  90. */
  91. @Override
  92. public boolean onActionTime()
  93. {
  94. // Only cont skills shouldn't end
  95. if(getSkill().getSkillType() != SkillType.CONT)
  96. return false;
  97.  
  98. double manaDam = calc();
  99.  
  100. if(manaDam > getEffected().getCurrentMp())
  101. {
  102. SystemMessage sm = new SystemMessage(SystemMessageId.SKILL_REMOVED_DUE_LACK_MP);
  103. getEffected().sendPacket(sm);
  104. return false;
  105. }
  106.  
  107. getEffected().reduceCurrentMp(manaDam);
  108. return true;
  109. }
  110.  
  111. /*
  112. * (non-Javadoc)
  113. *
  114. * @see net.sf.l2j.gameserver.model.L2Effect#onStart()
  115. */
  116. @Override
  117. public void onStart()
  118. {
  119. getEffected().setIsBuffProtected(true);
  120. return;
  121. }
  122.  
  123. /*
  124. * (non-Javadoc)
  125. *
  126. * @see net.sf.l2j.gameserver.model.L2Effect#onExit()
  127. */
  128. @Override
  129. public void onExit()
  130. {
  131. getEffected().setIsBuffProtected(false);
  132. }
  133. }
  134. And this is how the skill should be in DP:
  135. <skill id="add the skill id here" levels="1" name="AntiBuff-Shield">
  136. <set name="target" val="TARGET_SELF"/>
  137. <set name="skillType" val="CONT"/>
  138. <set name="operateType" val="OP_TOGGLE"/>
  139. <set name="castRange" val="-1"/>
  140. <set name="effectRange" val="-1"/>
  141. <for>
  142. <effect count="0x7fffffff" name="DeflectBuff" time="3" val="0"/>
  143. </for>
  144. </skill>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement