EffectSilentMove.java 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * This program is free software: you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation, either version 3 of the License, or (at your option) any later
  5. * version.
  6. *
  7. * This program is distributed in the hope that it will be useful, but WITHOUT
  8. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10. * details.
  11. *
  12. * You should have received a copy of the GNU General Public License along with
  13. * this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. package com.l2jserver.gameserver.skills.effects;
  16. import com.l2jserver.gameserver.model.CharEffectList;
  17. import com.l2jserver.gameserver.model.L2Effect;
  18. import com.l2jserver.gameserver.network.SystemMessageId;
  19. import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
  20. import com.l2jserver.gameserver.skills.Env;
  21. import com.l2jserver.gameserver.templates.effects.EffectTemplate;
  22. import com.l2jserver.gameserver.templates.skills.L2EffectType;
  23. import com.l2jserver.gameserver.templates.skills.L2SkillType;
  24. public class EffectSilentMove extends L2Effect
  25. {
  26. public EffectSilentMove(Env env, EffectTemplate template)
  27. {
  28. super(env, template);
  29. }
  30. // Special constructor to steal this effect
  31. public EffectSilentMove(Env env, L2Effect effect)
  32. {
  33. super(env, effect);
  34. }
  35. /**
  36. *
  37. * @see com.l2jserver.gameserver.model.L2Effect#onStart()
  38. */
  39. @Override
  40. public boolean onStart()
  41. {
  42. super.onStart();
  43. return true;
  44. }
  45. /**
  46. *
  47. * @see com.l2jserver.gameserver.model.L2Effect#onExit()
  48. */
  49. @Override
  50. public void onExit()
  51. {
  52. super.onExit();
  53. }
  54. /**
  55. *
  56. * @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
  57. */
  58. @Override
  59. public L2EffectType getEffectType()
  60. {
  61. return L2EffectType.SILENT_MOVE;
  62. }
  63. /**
  64. *
  65. * @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
  66. */
  67. @Override
  68. public boolean onActionTime()
  69. {
  70. // Only cont skills shouldn't end
  71. if (getSkill().getSkillType() != L2SkillType.CONT)
  72. return false;
  73. if (getEffected().isDead())
  74. return false;
  75. double manaDam = calc();
  76. if (manaDam > getEffected().getCurrentMp())
  77. {
  78. getEffected().sendPacket(SystemMessage.getSystemMessage(SystemMessageId.SKILL_REMOVED_DUE_LACK_MP));
  79. return false;
  80. }
  81. getEffected().reduceCurrentMp(manaDam);
  82. return true;
  83. }
  84. /* (non-Javadoc)
  85. * @see com.l2jserver.gameserver.model.L2Effect#getEffectFlags()
  86. */
  87. @Override
  88. public int getEffectFlags()
  89. {
  90. return CharEffectList.EFFECT_FLAG_SILENT_MOVE;
  91. }
  92. }