Advertisement
Guest User

Untitled

a guest
Sep 7th, 2018
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1. /*
  2. * This program is free software; you can redistribute it and/or modify
  3. * it under the terms of the GNU General Public License as published by
  4. * the Free Software Foundation; either version 2, or (at your option)
  5. * any later version.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. * You should have received a copy of the GNU General Public License
  13. * along with this program; if not, write to the Free Software
  14. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  15. * 02111-1307, USA.
  16. *
  17. * http://www.gnu.org/copyleft/gpl.html
  18. */
  19. package com.l2jfrozen.gameserver.skills.effects;
  20.  
  21. import com.l2jfrozen.gameserver.model.L2Effect;
  22. import com.l2jfrozen.gameserver.model.L2Skill.SkillType;
  23. import com.l2jfrozen.gameserver.network.SystemMessageId;
  24. import com.l2jfrozen.gameserver.network.serverpackets.SystemMessage;
  25. import com.l2jfrozen.gameserver.skills.Env;
  26.  
  27. /**
  28. * @author Java
  29. */
  30. public final class EffectDeflectBuff extends L2Effect
  31. {
  32. /**
  33. * @param env
  34. * @param template
  35. */
  36. public EffectDeflectBuff(Env env, EffectTemplate template)
  37. {
  38. super(env, template);
  39. }
  40.  
  41. /*
  42. * (non-Javadoc)
  43. *
  44. * @see com.l2jfrozen.gameserver.model.L2Effect#getEffectType()
  45. */
  46. @Override
  47. public EffectType getEffectType()
  48. {
  49. return EffectType.PREVENT_BUFF;
  50. }
  51.  
  52. /*
  53. * (non-Javadoc)
  54. *
  55. * @see com.l2jfrozen.gameserver.model.L2Effect#onActionTime()
  56. */
  57. @Override
  58. public boolean onActionTime()
  59. {
  60. // Only cont skills shouldn't end
  61. if(getSkill().getSkillType() != SkillType.CONT)
  62. return false;
  63.  
  64. double manaDam = calc();
  65.  
  66. if(manaDam > getEffected().getCurrentMp())
  67. {
  68. SystemMessage sm = new SystemMessage(SystemMessageId.SKILL_REMOVED_DUE_LACK_MP);
  69. getEffected().sendPacket(sm);
  70. return false;
  71. }
  72.  
  73. getEffected().reduceCurrentMp(manaDam);
  74. return true;
  75. }
  76.  
  77. /*
  78. * (non-Javadoc)
  79. *
  80. * @see com.l2jfrozen.gameserver.model.L2Effect#onStart()
  81. */
  82. @Override
  83. public void onStart()
  84. {
  85. getEffected().setIsBuffProtected(true);
  86. return;
  87. }
  88.  
  89. /*
  90. * (non-Javadoc)
  91. *
  92. * @see com.l2jfrozen.gameserver.model.L2Effect#onExit()
  93. */
  94. @Override
  95. public void onExit()
  96. {
  97. getEffected().setIsBuffProtected(false);
  98. }
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement