Addition of HpLimit effect handler.
Contributed by dontknowdontcare.
This commit is contained in:
@@ -266,6 +266,10 @@ MaxMAtkSpeed = 1999
|
||||
# Default: 250
|
||||
MaxEvasion = 250
|
||||
|
||||
# Maximum character HP.
|
||||
# Default: 150000
|
||||
MaxHP = 150000
|
||||
|
||||
# Minimum and Maximum Abnormal State Success Rate.
|
||||
# This affect all skills/effects chances, except in skills where minChance or maxChance parameters are defined.
|
||||
# Default: H5 minimum of 10% and maximum of 90%.
|
||||
|
@@ -184,6 +184,7 @@ public class EffectMasterHandler
|
||||
EffectHandler.getInstance().registerHandler("HpCpHeal", HpCpHeal::new);
|
||||
EffectHandler.getInstance().registerHandler("HpCpHealCritical", HpCpHealCritical::new);
|
||||
EffectHandler.getInstance().registerHandler("HpDrain", HpDrain::new);
|
||||
EffectHandler.getInstance().registerHandler("HpLimit", HpLimit::new);
|
||||
EffectHandler.getInstance().registerHandler("HpRegen", HpRegen::new);
|
||||
EffectHandler.getInstance().registerHandler("HpToOwner", HpToOwner::new);
|
||||
EffectHandler.getInstance().registerHandler("IgnoreDeath", IgnoreDeath::new);
|
||||
|
31
L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/effecthandlers/HpLimit.java
vendored
Normal file
31
L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/effecthandlers/HpLimit.java
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* 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 org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
|
||||
/**
|
||||
* @author dontknowdontcare
|
||||
*/
|
||||
public class HpLimit extends AbstractStatEffect
|
||||
{
|
||||
public HpLimit(StatSet params)
|
||||
{
|
||||
super(params, Stat.HP_LIMIT);
|
||||
}
|
||||
}
|
@@ -155,6 +155,7 @@ HpCpHealCritical: HpCp heal effects always trigger Magic Critical Hit.
|
||||
HpCpHeal: Increases current HP by a given amount. If the given amount exceeds maximum HP, it increases current CP with the rest value as well.
|
||||
HpDrain: Magical attack that absorbs given percentage of the damage inflicted as HP.
|
||||
Hp: Increases current HP by a static value.
|
||||
HpLimit: Increase a character's max hp limit (l2jmobius)
|
||||
HpRegen: HP Regeneration stat.
|
||||
HpToOwner: DOT effect that absorbs HP over time.
|
||||
IgnoreDeath: Become undying. Hp cannot decrease below 1.
|
||||
|
@@ -217,6 +217,7 @@ public class Config
|
||||
public static int MAX_PATK_SPEED;
|
||||
public static int MAX_MATK_SPEED;
|
||||
public static int MAX_EVASION;
|
||||
public static int MAX_HP;
|
||||
public static int MIN_ABNORMAL_STATE_SUCCESS_RATE;
|
||||
public static int MAX_ABNORMAL_STATE_SUCCESS_RATE;
|
||||
public static long MAX_SP;
|
||||
@@ -1752,6 +1753,7 @@ public class Config
|
||||
MAX_PATK_SPEED = characterConfig.getInt("MaxPAtkSpeed", 1500);
|
||||
MAX_MATK_SPEED = characterConfig.getInt("MaxMAtkSpeed", 1999);
|
||||
MAX_EVASION = characterConfig.getInt("MaxEvasion", 250);
|
||||
MAX_HP = characterConfig.getInt("MaxHP", 150000);
|
||||
MIN_ABNORMAL_STATE_SUCCESS_RATE = characterConfig.getInt("MinAbnormalStateSuccessRate", 10);
|
||||
MAX_ABNORMAL_STATE_SUCCESS_RATE = characterConfig.getInt("MaxAbnormalStateSuccessRate", 90);
|
||||
MAX_SP = characterConfig.getLong("MaxSp", 50000000000L) >= 0 ? characterConfig.getLong("MaxSp", 50000000000L) : Long.MAX_VALUE;
|
||||
|
@@ -58,6 +58,7 @@ import org.l2jmobius.gameserver.util.MathUtil;
|
||||
public enum Stat
|
||||
{
|
||||
// HP, MP & CP
|
||||
HP_LIMIT("hpLimit"),
|
||||
MAX_HP("maxHp", new MaxHpFinalizer()),
|
||||
MAX_MP("maxMp", new MaxMpFinalizer()),
|
||||
MAX_CP("maxCp", new MaxCpFinalizer()),
|
||||
|
@@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.model.stats.finalizers;
|
||||
|
||||
import java.util.OptionalDouble;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.xml.EnchantItemHPBonusData;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Player;
|
||||
@@ -62,30 +63,57 @@ public class MaxHpFinalizer implements IStatFunction
|
||||
|
||||
private static double defaultValue(Creature creature, Stat stat, double baseValue)
|
||||
{
|
||||
final double mul = creature.getStat().getMul(stat);
|
||||
final double add = creature.getStat().getAdd(stat);
|
||||
double addItem = 0;
|
||||
double mul = creature.getStat().getMul(stat);
|
||||
double add = creature.getStat().getAdd(stat);
|
||||
|
||||
double maxHp = (mul * baseValue) + add + creature.getStat().getMoveTypeValue(stat, creature.getMoveType());
|
||||
final boolean isPlayer = creature.isPlayer();
|
||||
|
||||
final Inventory inv = creature.getInventory();
|
||||
if (inv != null)
|
||||
if (inv == null)
|
||||
{
|
||||
// Add maxHP bonus from items
|
||||
for (Item item : inv.getPaperdollItems())
|
||||
if (isPlayer)
|
||||
{
|
||||
addItem += item.getTemplate().getStats(stat, 0);
|
||||
|
||||
// Apply enchanted item bonus HP
|
||||
if (item.isArmor() && item.isEnchanted())
|
||||
if (creature.getActingPlayer().isCursedWeaponEquipped())
|
||||
{
|
||||
final long bodyPart = item.getTemplate().getBodyPart();
|
||||
if ((bodyPart != ItemTemplate.SLOT_NECK) && (bodyPart != ItemTemplate.SLOT_LR_EAR) && (bodyPart != ItemTemplate.SLOT_LR_FINGER))
|
||||
{
|
||||
addItem += EnchantItemHPBonusData.getInstance().getHPBonus(item);
|
||||
}
|
||||
return Double.MAX_VALUE;
|
||||
}
|
||||
|
||||
mul = creature.getStat().getMul(Stat.HP_LIMIT);
|
||||
add = creature.getStat().getAdd(Stat.HP_LIMIT);
|
||||
return Math.min(maxHp, (Config.MAX_HP * mul) + add);
|
||||
}
|
||||
return maxHp;
|
||||
}
|
||||
|
||||
// Add maxHP bonus from items
|
||||
for (Item item : inv.getPaperdollItems())
|
||||
{
|
||||
maxHp += item.getTemplate().getStats(stat, 0);
|
||||
|
||||
// Apply enchanted item bonus HP
|
||||
if (item.isArmor() && item.isEnchanted())
|
||||
{
|
||||
final long bodyPart = item.getTemplate().getBodyPart();
|
||||
if ((bodyPart != ItemTemplate.SLOT_NECK) && (bodyPart != ItemTemplate.SLOT_LR_EAR) && (bodyPart != ItemTemplate.SLOT_LR_FINGER))
|
||||
{
|
||||
maxHp += EnchantItemHPBonusData.getInstance().getHPBonus(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (mul * baseValue) + add + addItem + creature.getStat().getMoveTypeValue(stat, creature.getMoveType());
|
||||
final double hpLimit;
|
||||
if (isPlayer && !creature.getActingPlayer().isCursedWeaponEquipped())
|
||||
{
|
||||
mul = creature.getStat().getMul(Stat.HP_LIMIT);
|
||||
add = creature.getStat().getAdd(Stat.HP_LIMIT);
|
||||
hpLimit = (Config.MAX_HP * mul) + add;
|
||||
}
|
||||
else
|
||||
{
|
||||
hpLimit = Double.MAX_VALUE;
|
||||
}
|
||||
|
||||
return Math.min(maxHp, hpLimit);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user