1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- /*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
- package net.sf.l2j.gameserver.skills.effects;
- import net.sf.l2j.gameserver.model.L2Effect;
- import net.sf.l2j.gameserver.model.actor.instance.L2DoorInstance;
- import net.sf.l2j.gameserver.serverpackets.ExRegMax;
- import net.sf.l2j.gameserver.serverpackets.StatusUpdate;
- import net.sf.l2j.gameserver.skills.Env;
- class EffectHealOverTime extends L2Effect
- {
- public EffectHealOverTime(Env env, EffectTemplate template)
- {
- super(env, template);
- }
- @Override
- public EffectType getEffectType()
- {
- return EffectType.HEAL_OVER_TIME;
- }
- /** Notify started */
- @Override
- public void onStart() {
- getEffected().sendPacket(new ExRegMax(calc(), getTotalCount() * getPeriod(), getPeriod()));
- }
- @Override
- public boolean onActionTime()
- {
- if(getEffected().isDead())
- return false;
- if(getEffected() instanceof L2DoorInstance)
- return false;
- double hp = getEffected().getCurrentHp();
- double maxhp = getEffected().getMaxHp();
- hp += calc();
- if(hp > maxhp)
- {
- hp = maxhp;
- }
- getEffected().setCurrentHp(hp);
- StatusUpdate suhp = new StatusUpdate(getEffected().getObjectId());
- suhp.addAttribute(StatusUpdate.CUR_HP, (int)hp);
- getEffected().sendPacket(suhp);
- return true;
- }
- }
|