Advertisement
Guest User

Untitled

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