From b8daa0e6d52949516609f825e6784e221cdcde17 Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Wed, 2 Dec 2015 06:17:24 +0000 Subject: [PATCH] Noelle's Gift implementation. --- .../scripts/handlers/EffectMasterHandler.java | 1 + .../RecoverVitalityInPeaceZone.java | 76 +++++++++++++++++++ .../game/data/stats/items/40300-40399.xml | 2 + .../game/data/stats/skills/16400-16499.xml | 9 ++- trunk/dist/game/data/xsd/skills.xsd | 1 + 5 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 trunk/dist/game/data/scripts/handlers/effecthandlers/RecoverVitalityInPeaceZone.java diff --git a/trunk/dist/game/data/scripts/handlers/EffectMasterHandler.java b/trunk/dist/game/data/scripts/handlers/EffectMasterHandler.java index 8b3f557e09..9892179bd6 100644 --- a/trunk/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/trunk/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -150,6 +150,7 @@ public final class EffectMasterHandler ProtectionBlessing.class, RandomizeHate.class, RebalanceHP.class, + RecoverVitalityInPeaceZone.class, Recovery.class, Reeling.class, RefuelAirship.class, diff --git a/trunk/dist/game/data/scripts/handlers/effecthandlers/RecoverVitalityInPeaceZone.java b/trunk/dist/game/data/scripts/handlers/effecthandlers/RecoverVitalityInPeaceZone.java new file mode 100644 index 0000000000..71f8930938 --- /dev/null +++ b/trunk/dist/game/data/scripts/handlers/effecthandlers/RecoverVitalityInPeaceZone.java @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2004-2015 L2J DataPack + * + * This file is part of L2J DataPack. + * + * L2J DataPack 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. + * + * L2J DataPack 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 . + */ +package handlers.effecthandlers; + +import com.l2jserver.gameserver.model.StatsSet; +import com.l2jserver.gameserver.model.actor.stat.PcStat; +import com.l2jserver.gameserver.model.conditions.Condition; +import com.l2jserver.gameserver.model.effects.AbstractEffect; +import com.l2jserver.gameserver.model.skills.BuffInfo; +import com.l2jserver.gameserver.model.zone.ZoneId; + +/** + * Recover Vitality in Peace Zone effect implementation. + * @author Mobius + */ +public final class RecoverVitalityInPeaceZone extends AbstractEffect +{ + private final double _power; + + public RecoverVitalityInPeaceZone(Condition attachCond, Condition applyCond, StatsSet set, StatsSet params) + { + super(attachCond, applyCond, set, params); + + _power = params.getDouble("power", 0); + } + + @Override + public boolean onActionTime(BuffInfo info) + { + if (!info.getEffected().isPlayer() || info.getEffected().isDead() || !info.getEffected().isInsideZone(ZoneId.PEACE)) + { + return false; + } + + long vitality = info.getEffected().getActingPlayer().getVitalityPoints(); + vitality += _power; + if (vitality >= PcStat.MAX_VITALITY_POINTS) + { + vitality = PcStat.MAX_VITALITY_POINTS; + } + info.getEffected().getActingPlayer().setVitalityPoints((int) vitality); + + return info.getSkill().isToggle(); + } + + @Override + public void onExit(BuffInfo info) + { + if (info.getEffected().isPlayer() && !info.isRemoved()) + { + long vitality = info.getEffected().getActingPlayer().getVitalityPoints(); + vitality += 10000; + if (vitality >= PcStat.MAX_VITALITY_POINTS) + { + vitality = PcStat.MAX_VITALITY_POINTS; + } + info.getEffected().getActingPlayer().setVitalityPoints((int) vitality); + } + } +} diff --git a/trunk/dist/game/data/stats/items/40300-40399.xml b/trunk/dist/game/data/stats/items/40300-40399.xml index 9732311517..e20b82c49c 100644 --- a/trunk/dist/game/data/stats/items/40300-40399.xml +++ b/trunk/dist/game/data/stats/items/40300-40399.xml @@ -137,7 +137,9 @@ + + diff --git a/trunk/dist/game/data/stats/skills/16400-16499.xml b/trunk/dist/game/data/stats/skills/16400-16499.xml index a911a20a06..6308564074 100644 --- a/trunk/dist/game/data/stats/skills/16400-16499.xml +++ b/trunk/dist/game/data/stats/skills/16400-16499.xml @@ -262,13 +262,18 @@ - + - + + + + + + diff --git a/trunk/dist/game/data/xsd/skills.xsd b/trunk/dist/game/data/xsd/skills.xsd index 516296ae1e..6e9ef71600 100644 --- a/trunk/dist/game/data/xsd/skills.xsd +++ b/trunk/dist/game/data/xsd/skills.xsd @@ -662,6 +662,7 @@ +