Addition of RecoverVitalityInPeaceZone effect handler.

This commit is contained in:
MobiusDev
2017-12-07 22:43:31 +00:00
parent ee948410b4
commit c2a1646032
17 changed files with 447 additions and 2 deletions

View File

@@ -260,6 +260,7 @@ public final class EffectMasterHandler
EffectHandler.getInstance().registerHandler("RealDamage", RealDamage::new);
EffectHandler.getInstance().registerHandler("RebalanceHP", RebalanceHP::new);
EffectHandler.getInstance().registerHandler("RebalanceHPSummon", RebalanceHPSummon::new);
EffectHandler.getInstance().registerHandler("RecoverVitalityInPeaceZone", RecoverVitalityInPeaceZone::new);
EffectHandler.getInstance().registerHandler("Recovery", Recovery::new);
EffectHandler.getInstance().registerHandler("ReduceDamage", ReduceDamage::new);
EffectHandler.getInstance().registerHandler("ReduceCancel", ReduceCancel::new);

View File

@@ -0,0 +1,84 @@
/*
* This file is part of the L2J Mobius project.
*
* 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 handlers.effecthandlers;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.stat.PcStat;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.skills.BuffInfo;
import com.l2jmobius.gameserver.model.zone.ZoneId;
/**
* Recover Vitality in Peace Zone effect implementation.
* @author Mobius
*/
public final class RecoverVitalityInPeaceZone extends AbstractEffect
{
private final double _amount;
private final int _ticks;
public RecoverVitalityInPeaceZone(StatsSet params)
{
_amount = params.getDouble("amount", 0);
_ticks = params.getInt("ticks", 10);
}
@Override
public int getTicks()
{
return _ticks;
}
@Override
public boolean onActionTime(BuffInfo info)
{
if ((info.getEffected() == null) //
|| info.getEffected().isDead() //
|| !info.getEffected().isPlayer() //
|| !info.getEffected().isInsideZone(ZoneId.PEACE))
{
return false;
}
long vitality = info.getEffected().getActingPlayer().getVitalityPoints();
vitality += _amount;
if (vitality >= PcStat.MAX_VITALITY_POINTS)
{
vitality = PcStat.MAX_VITALITY_POINTS;
}
info.getEffected().getActingPlayer().setVitalityPoints((int) vitality, true);
return info.getSkill().isToggle();
}
@Override
public void onExit(BuffInfo info)
{
if ((info.getEffected() != null) //
&& info.getEffected().isPlayer() //
&& !info.isRemoved())
{
long vitality = info.getEffected().getActingPlayer().getVitalityPoints();
vitality += _amount * 100;
if (vitality >= PcStat.MAX_VITALITY_POINTS)
{
vitality = PcStat.MAX_VITALITY_POINTS;
}
info.getEffected().getActingPlayer().setVitalityPoints((int) vitality, true);
}
}
}

View File

@@ -174,7 +174,11 @@
<set name="is_freightable" val="false" />
<set name="etcitem_type" val="ELIXIR" />
<set name="is_stackable" val="true" />
<set name="time" val="360" />
<set name="default_action" val="SKILL_REDUCE" />
<set name="handler" val="ItemSkills" />
<skills>
<skill id="16423" level="1" /> <!-- Noelle's Gift -->
</skills>
</item>
<item id="40312" name="Santa's Cloak" type="Armor">
<!-- Light and cozy cloak. -->

View File

@@ -292,13 +292,24 @@
<operateType>A1</operateType>
</skill>
<skill id="16423" toLevel="1" name="Noelle's Gift">
<!-- AUTO GENERATED SKILL -->
<!-- Recover Vitality for 6 hr. if you're in a peace zone. When the buff expires, you also receive a fixed boost regardless of zone. You must be alive to recover Vitality. -->
<icon>icon.etc_whiteday_choco</icon>
<operateType>A2</operateType>
<abnormalLvl>1</abnormalLvl>
<abnormalTime>21600</abnormalTime>
<itemConsumeCount>1</itemConsumeCount>
<itemConsumeId>40311</itemConsumeId>
<reuseDelay>30000</reuseDelay>
<effectPoint>100</effectPoint>
<isMagic>4</isMagic>
<targetType>SELF</targetType>
<affectScope>SINGLE</affectScope>
<effects>
<effect name="RecoverVitalityInPeaceZone">
<amount>100</amount>
<ticks>10</ticks>
</effect>
</effects>
</skill>
<skill id="16424" toLevel="1" name="Appearance Stone: Santa Hat">
<!-- AUTO GENERATED SKILL -->

View File

@@ -229,6 +229,7 @@ RandomizeHate: Target NPC stops hating you and starts hating random target with
RealDamage: Static damage.
RebalanceHP: Balances targets' current HP.
RebalanceHPSummon: Balances targets' current HP for summons.
RecoverVitalityInPeaceZone: Recover periodically vitality when player is in a peace zone. (l2jmobius)
Recovery: Decreases death penalty level.
ReduceCancel: Magic skill casting interruption stat.
ReduceDropPenalty: Reduces EXP lost and death penalty chance.