Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  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 net.sf.l2j.gameserver.skills.effects;
  16.  
  17. import net.sf.l2j.gameserver.model.L2Attackable;
  18. import net.sf.l2j.gameserver.model.L2Effect;
  19. import net.sf.l2j.gameserver.model.L2Skill.SkillTargetType;
  20. import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
  21. import net.sf.l2j.gameserver.skills.Env;
  22.  
  23. class EffectDamOverTime extends L2Effect
  24. {
  25. public EffectDamOverTime(Env env, EffectTemplate template)
  26. {
  27. super(env, template);
  28. }
  29.  
  30. @Override
  31. public EffectType getEffectType()
  32. {
  33. return EffectType.DMG_OVER_TIME;
  34. }
  35.  
  36. @Override
  37. public boolean onActionTime()
  38. {
  39. if (getEffected().isDead())
  40. {
  41. return false;
  42. }
  43.  
  44. double damage = calc();
  45. if (damage >= (getEffected().getCurrentHp() - 1))
  46. {
  47. if (getSkill().isToggle())
  48. {
  49. getEffected().sendPacket(new SystemMessage(610));
  50. return false;
  51. }
  52.  
  53. if (getEffected().getCurrentHp() <= 1)
  54. {
  55. return true;
  56. }
  57.  
  58. damage = getEffected().getCurrentHp() - 1;
  59. }
  60.  
  61. if (damage >= (getEffected().getCurrentHp() - 1) && (getEffected() instanceof L2Attackable))
  62. {
  63. damage = 1;
  64. }
  65.  
  66. boolean awake = !(getEffected() instanceof L2Attackable) && !((getSkill().getTargetType() == SkillTargetType.TARGET_SELF) && getSkill().isToggle());
  67.  
  68. getEffected().reduceCurrentHp(damage, getEffector(), awake, true);
  69. return true;
  70. }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement