Proper calculation for item HP and MP added stats.
Contributed by Trance.
This commit is contained in:
parent
20158b2803
commit
bd70fb6056
@ -22,6 +22,7 @@ import org.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.items.Item;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.BaseStat;
|
||||
@ -50,24 +51,42 @@ public class MaxHpFinalizer implements IStatFunction
|
||||
if (player != null)
|
||||
{
|
||||
baseValue = player.getTemplate().getBaseHpMax(player.getLevel());
|
||||
}
|
||||
}
|
||||
|
||||
final double chaBonus = creature.isPlayer() ? BaseStat.CHA.calcBonus(creature) : 1.;
|
||||
final double conBonus = creature.getCON() > 0 ? BaseStat.CON.calcBonus(creature) : 1.;
|
||||
baseValue *= conBonus * chaBonus;
|
||||
|
||||
return defaultValue(creature, stat, baseValue);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
final Inventory inv = creature.getInventory();
|
||||
if (inv != null)
|
||||
{
|
||||
// Add maxHP bonus from items
|
||||
for (ItemInstance item : inv.getPaperdollItems())
|
||||
{
|
||||
addItem += item.getItem().getStats(stat, 0);
|
||||
|
||||
// Apply enchanted item's bonus HP
|
||||
for (ItemInstance item : player.getInventory().getPaperdollItems(ItemInstance::isEnchanted))
|
||||
// Apply enchanted item bonus HP
|
||||
if (item.isArmor() && item.isEnchanted())
|
||||
{
|
||||
if (item.isArmor())
|
||||
final int bodyPart = item.getItem().getBodyPart();
|
||||
if ((bodyPart != Item.SLOT_NECK) && (bodyPart != Item.SLOT_LR_EAR) && (bodyPart != Item.SLOT_LR_FINGER))
|
||||
{
|
||||
final int bodyPart = item.getItem().getBodyPart();
|
||||
if ((bodyPart != Item.SLOT_NECK) && (bodyPart != Item.SLOT_LR_EAR) && (bodyPart != Item.SLOT_LR_FINGER))
|
||||
{
|
||||
baseValue += EnchantItemHPBonusData.getInstance().getHPBonus(item);
|
||||
}
|
||||
addItem += EnchantItemHPBonusData.getInstance().getHPBonus(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
final double chaBonus = creature.isPlayer() ? BaseStat.CHA.calcBonus(creature) : 1.;
|
||||
final double conBonus = creature.getCON() > 0 ? BaseStat.CON.calcBonus(creature) : 1.;
|
||||
baseValue *= conBonus * chaBonus;
|
||||
return Stat.defaultValue(creature, stat, baseValue);
|
||||
|
||||
return (mul * baseValue) + add + addItem + creature.getStat().getMoveTypeValue(stat, creature.getMoveType());
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,8 @@ import java.util.OptionalDouble;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.BaseStat;
|
||||
import org.l2jmobius.gameserver.model.stats.IStatFunction;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
@ -49,9 +51,30 @@ public class MaxMpFinalizer implements IStatFunction
|
||||
baseValue = player.getTemplate().getBaseMpMax(player.getLevel());
|
||||
}
|
||||
}
|
||||
|
||||
final double chaBonus = creature.isPlayer() ? BaseStat.CHA.calcBonus(creature) : 1.;
|
||||
final double menBonus = creature.getMEN() > 0 ? BaseStat.MEN.calcBonus(creature) : 1.;
|
||||
baseValue *= menBonus * chaBonus;
|
||||
return Stat.defaultValue(creature, stat, baseValue);
|
||||
|
||||
return defaultValue(creature, stat, baseValue);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
final Inventory inv = creature.getInventory();
|
||||
if (inv != null)
|
||||
{
|
||||
// Add maxMP bonus from items
|
||||
for (ItemInstance item : inv.getPaperdollItems())
|
||||
{
|
||||
addItem += item.getItem().getStats(stat, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return (mul * baseValue) + add + addItem + creature.getStat().getMoveTypeValue(stat, creature.getMoveType());
|
||||
}
|
||||
}
|
@ -22,6 +22,7 @@ import org.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.items.Item;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.BaseStat;
|
||||
@ -50,24 +51,42 @@ public class MaxHpFinalizer implements IStatFunction
|
||||
if (player != null)
|
||||
{
|
||||
baseValue = player.getTemplate().getBaseHpMax(player.getLevel());
|
||||
}
|
||||
}
|
||||
|
||||
final double chaBonus = creature.isPlayer() ? BaseStat.CHA.calcBonus(creature) : 1.;
|
||||
final double conBonus = creature.getCON() > 0 ? BaseStat.CON.calcBonus(creature) : 1.;
|
||||
baseValue *= conBonus * chaBonus;
|
||||
|
||||
return defaultValue(creature, stat, baseValue);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
final Inventory inv = creature.getInventory();
|
||||
if (inv != null)
|
||||
{
|
||||
// Add maxHP bonus from items
|
||||
for (ItemInstance item : inv.getPaperdollItems())
|
||||
{
|
||||
addItem += item.getItem().getStats(stat, 0);
|
||||
|
||||
// Apply enchanted item's bonus HP
|
||||
for (ItemInstance item : player.getInventory().getPaperdollItems(ItemInstance::isEnchanted))
|
||||
// Apply enchanted item bonus HP
|
||||
if (item.isArmor() && item.isEnchanted())
|
||||
{
|
||||
if (item.isArmor())
|
||||
final int bodyPart = item.getItem().getBodyPart();
|
||||
if ((bodyPart != Item.SLOT_NECK) && (bodyPart != Item.SLOT_LR_EAR) && (bodyPart != Item.SLOT_LR_FINGER))
|
||||
{
|
||||
final int bodyPart = item.getItem().getBodyPart();
|
||||
if ((bodyPart != Item.SLOT_NECK) && (bodyPart != Item.SLOT_LR_EAR) && (bodyPart != Item.SLOT_LR_FINGER))
|
||||
{
|
||||
baseValue += EnchantItemHPBonusData.getInstance().getHPBonus(item);
|
||||
}
|
||||
addItem += EnchantItemHPBonusData.getInstance().getHPBonus(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
final double chaBonus = creature.isPlayer() ? BaseStat.CHA.calcBonus(creature) : 1.;
|
||||
final double conBonus = creature.getCON() > 0 ? BaseStat.CON.calcBonus(creature) : 1.;
|
||||
baseValue *= conBonus * chaBonus;
|
||||
return Stat.defaultValue(creature, stat, baseValue);
|
||||
|
||||
return (mul * baseValue) + add + addItem + creature.getStat().getMoveTypeValue(stat, creature.getMoveType());
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,8 @@ import java.util.OptionalDouble;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.BaseStat;
|
||||
import org.l2jmobius.gameserver.model.stats.IStatFunction;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
@ -49,9 +51,30 @@ public class MaxMpFinalizer implements IStatFunction
|
||||
baseValue = player.getTemplate().getBaseMpMax(player.getLevel());
|
||||
}
|
||||
}
|
||||
|
||||
final double chaBonus = creature.isPlayer() ? BaseStat.CHA.calcBonus(creature) : 1.;
|
||||
final double menBonus = creature.getMEN() > 0 ? BaseStat.MEN.calcBonus(creature) : 1.;
|
||||
baseValue *= menBonus * chaBonus;
|
||||
return Stat.defaultValue(creature, stat, baseValue);
|
||||
|
||||
return defaultValue(creature, stat, baseValue);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
final Inventory inv = creature.getInventory();
|
||||
if (inv != null)
|
||||
{
|
||||
// Add maxMP bonus from items
|
||||
for (ItemInstance item : inv.getPaperdollItems())
|
||||
{
|
||||
addItem += item.getItem().getStats(stat, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return (mul * baseValue) + add + addItem + creature.getStat().getMoveTypeValue(stat, creature.getMoveType());
|
||||
}
|
||||
}
|
@ -22,6 +22,7 @@ import org.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.items.Item;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.BaseStat;
|
||||
@ -50,24 +51,42 @@ public class MaxHpFinalizer implements IStatFunction
|
||||
if (player != null)
|
||||
{
|
||||
baseValue = player.getTemplate().getBaseHpMax(player.getLevel());
|
||||
}
|
||||
}
|
||||
|
||||
final double chaBonus = creature.isPlayer() ? BaseStat.CHA.calcBonus(creature) : 1.;
|
||||
final double conBonus = creature.getCON() > 0 ? BaseStat.CON.calcBonus(creature) : 1.;
|
||||
baseValue *= conBonus * chaBonus;
|
||||
|
||||
return defaultValue(creature, stat, baseValue);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
final Inventory inv = creature.getInventory();
|
||||
if (inv != null)
|
||||
{
|
||||
// Add maxHP bonus from items
|
||||
for (ItemInstance item : inv.getPaperdollItems())
|
||||
{
|
||||
addItem += item.getItem().getStats(stat, 0);
|
||||
|
||||
// Apply enchanted item's bonus HP
|
||||
for (ItemInstance item : player.getInventory().getPaperdollItems(ItemInstance::isEnchanted))
|
||||
// Apply enchanted item bonus HP
|
||||
if (item.isArmor() && item.isEnchanted())
|
||||
{
|
||||
if (item.isArmor())
|
||||
final int bodyPart = item.getItem().getBodyPart();
|
||||
if ((bodyPart != Item.SLOT_NECK) && (bodyPart != Item.SLOT_LR_EAR) && (bodyPart != Item.SLOT_LR_FINGER))
|
||||
{
|
||||
final int bodyPart = item.getItem().getBodyPart();
|
||||
if ((bodyPart != Item.SLOT_NECK) && (bodyPart != Item.SLOT_LR_EAR) && (bodyPart != Item.SLOT_LR_FINGER))
|
||||
{
|
||||
baseValue += EnchantItemHPBonusData.getInstance().getHPBonus(item);
|
||||
}
|
||||
addItem += EnchantItemHPBonusData.getInstance().getHPBonus(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
final double chaBonus = creature.isPlayer() ? BaseStat.CHA.calcBonus(creature) : 1.;
|
||||
final double conBonus = creature.getCON() > 0 ? BaseStat.CON.calcBonus(creature) : 1.;
|
||||
baseValue *= conBonus * chaBonus;
|
||||
return Stat.defaultValue(creature, stat, baseValue);
|
||||
|
||||
return (mul * baseValue) + add + addItem + creature.getStat().getMoveTypeValue(stat, creature.getMoveType());
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,8 @@ import java.util.OptionalDouble;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.BaseStat;
|
||||
import org.l2jmobius.gameserver.model.stats.IStatFunction;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
@ -49,9 +51,30 @@ public class MaxMpFinalizer implements IStatFunction
|
||||
baseValue = player.getTemplate().getBaseMpMax(player.getLevel());
|
||||
}
|
||||
}
|
||||
|
||||
final double chaBonus = creature.isPlayer() ? BaseStat.CHA.calcBonus(creature) : 1.;
|
||||
final double menBonus = creature.getMEN() > 0 ? BaseStat.MEN.calcBonus(creature) : 1.;
|
||||
baseValue *= menBonus * chaBonus;
|
||||
return Stat.defaultValue(creature, stat, baseValue);
|
||||
|
||||
return defaultValue(creature, stat, baseValue);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
final Inventory inv = creature.getInventory();
|
||||
if (inv != null)
|
||||
{
|
||||
// Add maxMP bonus from items
|
||||
for (ItemInstance item : inv.getPaperdollItems())
|
||||
{
|
||||
addItem += item.getItem().getStats(stat, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return (mul * baseValue) + add + addItem + creature.getStat().getMoveTypeValue(stat, creature.getMoveType());
|
||||
}
|
||||
}
|
@ -22,6 +22,7 @@ import org.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.items.Item;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.BaseStat;
|
||||
@ -50,24 +51,42 @@ public class MaxHpFinalizer implements IStatFunction
|
||||
if (player != null)
|
||||
{
|
||||
baseValue = player.getTemplate().getBaseHpMax(player.getLevel());
|
||||
}
|
||||
}
|
||||
|
||||
final double chaBonus = creature.isPlayer() ? BaseStat.CHA.calcBonus(creature) : 1.;
|
||||
final double conBonus = creature.getCON() > 0 ? BaseStat.CON.calcBonus(creature) : 1.;
|
||||
baseValue *= conBonus * chaBonus;
|
||||
|
||||
return defaultValue(creature, stat, baseValue);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
final Inventory inv = creature.getInventory();
|
||||
if (inv != null)
|
||||
{
|
||||
// Add maxHP bonus from items
|
||||
for (ItemInstance item : inv.getPaperdollItems())
|
||||
{
|
||||
addItem += item.getItem().getStats(stat, 0);
|
||||
|
||||
// Apply enchanted item's bonus HP
|
||||
for (ItemInstance item : player.getInventory().getPaperdollItems(ItemInstance::isEnchanted))
|
||||
// Apply enchanted item bonus HP
|
||||
if (item.isArmor() && item.isEnchanted())
|
||||
{
|
||||
if (item.isArmor())
|
||||
final int bodyPart = item.getItem().getBodyPart();
|
||||
if ((bodyPart != Item.SLOT_NECK) && (bodyPart != Item.SLOT_LR_EAR) && (bodyPart != Item.SLOT_LR_FINGER))
|
||||
{
|
||||
final int bodyPart = item.getItem().getBodyPart();
|
||||
if ((bodyPart != Item.SLOT_NECK) && (bodyPart != Item.SLOT_LR_EAR) && (bodyPart != Item.SLOT_LR_FINGER))
|
||||
{
|
||||
baseValue += EnchantItemHPBonusData.getInstance().getHPBonus(item);
|
||||
}
|
||||
addItem += EnchantItemHPBonusData.getInstance().getHPBonus(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
final double chaBonus = creature.isPlayer() ? BaseStat.CHA.calcBonus(creature) : 1.;
|
||||
final double conBonus = creature.getCON() > 0 ? BaseStat.CON.calcBonus(creature) : 1.;
|
||||
baseValue *= conBonus * chaBonus;
|
||||
return Stat.defaultValue(creature, stat, baseValue);
|
||||
|
||||
return (mul * baseValue) + add + addItem + creature.getStat().getMoveTypeValue(stat, creature.getMoveType());
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,8 @@ import java.util.OptionalDouble;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.BaseStat;
|
||||
import org.l2jmobius.gameserver.model.stats.IStatFunction;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
@ -49,9 +51,30 @@ public class MaxMpFinalizer implements IStatFunction
|
||||
baseValue = player.getTemplate().getBaseMpMax(player.getLevel());
|
||||
}
|
||||
}
|
||||
|
||||
final double chaBonus = creature.isPlayer() ? BaseStat.CHA.calcBonus(creature) : 1.;
|
||||
final double menBonus = creature.getMEN() > 0 ? BaseStat.MEN.calcBonus(creature) : 1.;
|
||||
baseValue *= menBonus * chaBonus;
|
||||
return Stat.defaultValue(creature, stat, baseValue);
|
||||
|
||||
return defaultValue(creature, stat, baseValue);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
final Inventory inv = creature.getInventory();
|
||||
if (inv != null)
|
||||
{
|
||||
// Add maxMP bonus from items
|
||||
for (ItemInstance item : inv.getPaperdollItems())
|
||||
{
|
||||
addItem += item.getItem().getStats(stat, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return (mul * baseValue) + add + addItem + creature.getStat().getMoveTypeValue(stat, creature.getMoveType());
|
||||
}
|
||||
}
|
@ -22,6 +22,7 @@ import org.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.items.Item;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.BaseStat;
|
||||
@ -50,24 +51,42 @@ public class MaxHpFinalizer implements IStatFunction
|
||||
if (player != null)
|
||||
{
|
||||
baseValue = player.getTemplate().getBaseHpMax(player.getLevel());
|
||||
}
|
||||
}
|
||||
|
||||
final double chaBonus = creature.isPlayer() ? BaseStat.CHA.calcBonus(creature) : 1.;
|
||||
final double conBonus = creature.getCON() > 0 ? BaseStat.CON.calcBonus(creature) : 1.;
|
||||
baseValue *= conBonus * chaBonus;
|
||||
|
||||
return defaultValue(creature, stat, baseValue);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
final Inventory inv = creature.getInventory();
|
||||
if (inv != null)
|
||||
{
|
||||
// Add maxHP bonus from items
|
||||
for (ItemInstance item : inv.getPaperdollItems())
|
||||
{
|
||||
addItem += item.getItem().getStats(stat, 0);
|
||||
|
||||
// Apply enchanted item's bonus HP
|
||||
for (ItemInstance item : player.getInventory().getPaperdollItems(ItemInstance::isEnchanted))
|
||||
// Apply enchanted item bonus HP
|
||||
if (item.isArmor() && item.isEnchanted())
|
||||
{
|
||||
if (item.isArmor())
|
||||
final long bodyPart = item.getItem().getBodyPart();
|
||||
if ((bodyPart != Item.SLOT_NECK) && (bodyPart != Item.SLOT_LR_EAR) && (bodyPart != Item.SLOT_LR_FINGER))
|
||||
{
|
||||
final long bodyPart = item.getItem().getBodyPart();
|
||||
if ((bodyPart != Item.SLOT_NECK) && (bodyPart != Item.SLOT_LR_EAR) && (bodyPart != Item.SLOT_LR_FINGER))
|
||||
{
|
||||
baseValue += EnchantItemHPBonusData.getInstance().getHPBonus(item);
|
||||
}
|
||||
addItem += EnchantItemHPBonusData.getInstance().getHPBonus(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
final double chaBonus = creature.isPlayer() ? BaseStat.CHA.calcBonus(creature) : 1.;
|
||||
final double conBonus = creature.getCON() > 0 ? BaseStat.CON.calcBonus(creature) : 1.;
|
||||
baseValue *= conBonus * chaBonus;
|
||||
return Stat.defaultValue(creature, stat, baseValue);
|
||||
|
||||
return (mul * baseValue) + add + addItem + creature.getStat().getMoveTypeValue(stat, creature.getMoveType());
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,8 @@ import java.util.OptionalDouble;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.BaseStat;
|
||||
import org.l2jmobius.gameserver.model.stats.IStatFunction;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
@ -39,19 +41,40 @@ public class MaxMpFinalizer implements IStatFunction
|
||||
if (creature.isPet())
|
||||
{
|
||||
final PetInstance pet = (PetInstance) creature;
|
||||
baseValue += pet.getPetLevelData().getPetMaxMP();
|
||||
baseValue = pet.getPetLevelData().getPetMaxMP();
|
||||
}
|
||||
else if (creature.isPlayer())
|
||||
{
|
||||
final PlayerInstance player = creature.getActingPlayer();
|
||||
if (player != null)
|
||||
{
|
||||
baseValue += player.getTemplate().getBaseMpMax(player.getLevel());
|
||||
baseValue = player.getTemplate().getBaseMpMax(player.getLevel());
|
||||
}
|
||||
}
|
||||
|
||||
final double chaBonus = creature.isPlayer() ? BaseStat.CHA.calcBonus(creature) : 1.;
|
||||
final double menBonus = creature.getMEN() > 0 ? BaseStat.MEN.calcBonus(creature) : 1.;
|
||||
baseValue *= menBonus * chaBonus;
|
||||
return Stat.defaultValue(creature, stat, baseValue);
|
||||
|
||||
return defaultValue(creature, stat, baseValue);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
final Inventory inv = creature.getInventory();
|
||||
if (inv != null)
|
||||
{
|
||||
// Add maxMP bonus from items
|
||||
for (ItemInstance item : inv.getPaperdollItems())
|
||||
{
|
||||
addItem += item.getItem().getStats(stat, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return (mul * baseValue) + add + addItem + creature.getStat().getMoveTypeValue(stat, creature.getMoveType());
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ import org.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.items.Item;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.BaseStat;
|
||||
@ -50,24 +51,42 @@ public class MaxHpFinalizer implements IStatFunction
|
||||
if (player != null)
|
||||
{
|
||||
baseValue = player.getTemplate().getBaseHpMax(player.getLevel());
|
||||
}
|
||||
}
|
||||
|
||||
final double chaBonus = creature.isPlayer() ? BaseStat.CHA.calcBonus(creature) : 1.;
|
||||
final double conBonus = creature.getCON() > 0 ? BaseStat.CON.calcBonus(creature) : 1.;
|
||||
baseValue *= conBonus * chaBonus;
|
||||
|
||||
return defaultValue(creature, stat, baseValue);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
final Inventory inv = creature.getInventory();
|
||||
if (inv != null)
|
||||
{
|
||||
// Add maxHP bonus from items
|
||||
for (ItemInstance item : inv.getPaperdollItems())
|
||||
{
|
||||
addItem += item.getItem().getStats(stat, 0);
|
||||
|
||||
// Apply enchanted item's bonus HP
|
||||
for (ItemInstance item : player.getInventory().getPaperdollItems(ItemInstance::isEnchanted))
|
||||
// Apply enchanted item bonus HP
|
||||
if (item.isArmor() && item.isEnchanted())
|
||||
{
|
||||
if (item.isArmor())
|
||||
final long bodyPart = item.getItem().getBodyPart();
|
||||
if ((bodyPart != Item.SLOT_NECK) && (bodyPart != Item.SLOT_LR_EAR) && (bodyPart != Item.SLOT_LR_FINGER))
|
||||
{
|
||||
final long bodyPart = item.getItem().getBodyPart();
|
||||
if ((bodyPart != Item.SLOT_NECK) && (bodyPart != Item.SLOT_LR_EAR) && (bodyPart != Item.SLOT_LR_FINGER))
|
||||
{
|
||||
baseValue += EnchantItemHPBonusData.getInstance().getHPBonus(item);
|
||||
}
|
||||
addItem += EnchantItemHPBonusData.getInstance().getHPBonus(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
final double chaBonus = creature.isPlayer() ? BaseStat.CHA.calcBonus(creature) : 1.;
|
||||
final double conBonus = creature.getCON() > 0 ? BaseStat.CON.calcBonus(creature) : 1.;
|
||||
baseValue *= conBonus * chaBonus;
|
||||
return Stat.defaultValue(creature, stat, baseValue);
|
||||
|
||||
return (mul * baseValue) + add + addItem + creature.getStat().getMoveTypeValue(stat, creature.getMoveType());
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,8 @@ import java.util.OptionalDouble;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.BaseStat;
|
||||
import org.l2jmobius.gameserver.model.stats.IStatFunction;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
@ -49,9 +51,30 @@ public class MaxMpFinalizer implements IStatFunction
|
||||
baseValue = player.getTemplate().getBaseMpMax(player.getLevel());
|
||||
}
|
||||
}
|
||||
|
||||
final double chaBonus = creature.isPlayer() ? BaseStat.CHA.calcBonus(creature) : 1.;
|
||||
final double menBonus = creature.getMEN() > 0 ? BaseStat.MEN.calcBonus(creature) : 1.;
|
||||
baseValue *= menBonus * chaBonus;
|
||||
return Stat.defaultValue(creature, stat, baseValue);
|
||||
|
||||
return defaultValue(creature, stat, baseValue);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
final Inventory inv = creature.getInventory();
|
||||
if (inv != null)
|
||||
{
|
||||
// Add maxMP bonus from items
|
||||
for (ItemInstance item : inv.getPaperdollItems())
|
||||
{
|
||||
addItem += item.getItem().getStats(stat, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return (mul * baseValue) + add + addItem + creature.getStat().getMoveTypeValue(stat, creature.getMoveType());
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ import org.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.items.Item;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.BaseStat;
|
||||
@ -50,24 +51,42 @@ public class MaxHpFinalizer implements IStatFunction
|
||||
if (player != null)
|
||||
{
|
||||
baseValue = player.getTemplate().getBaseHpMax(player.getLevel());
|
||||
}
|
||||
}
|
||||
|
||||
final double chaBonus = creature.isPlayer() ? BaseStat.CHA.calcBonus(creature) : 1.;
|
||||
final double conBonus = creature.getCON() > 0 ? BaseStat.CON.calcBonus(creature) : 1.;
|
||||
baseValue *= conBonus * chaBonus;
|
||||
|
||||
return defaultValue(creature, stat, baseValue);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
final Inventory inv = creature.getInventory();
|
||||
if (inv != null)
|
||||
{
|
||||
// Add maxHP bonus from items
|
||||
for (ItemInstance item : inv.getPaperdollItems())
|
||||
{
|
||||
addItem += item.getItem().getStats(stat, 0);
|
||||
|
||||
// Apply enchanted item's bonus HP
|
||||
for (ItemInstance item : player.getInventory().getPaperdollItems(ItemInstance::isEnchanted))
|
||||
// Apply enchanted item bonus HP
|
||||
if (item.isArmor() && item.isEnchanted())
|
||||
{
|
||||
if (item.isArmor())
|
||||
final long bodyPart = item.getItem().getBodyPart();
|
||||
if ((bodyPart != Item.SLOT_NECK) && (bodyPart != Item.SLOT_LR_EAR) && (bodyPart != Item.SLOT_LR_FINGER))
|
||||
{
|
||||
final long bodyPart = item.getItem().getBodyPart();
|
||||
if ((bodyPart != Item.SLOT_NECK) && (bodyPart != Item.SLOT_LR_EAR) && (bodyPart != Item.SLOT_LR_FINGER))
|
||||
{
|
||||
baseValue += EnchantItemHPBonusData.getInstance().getHPBonus(item);
|
||||
}
|
||||
addItem += EnchantItemHPBonusData.getInstance().getHPBonus(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
final double chaBonus = creature.isPlayer() ? BaseStat.CHA.calcBonus(creature) : 1.;
|
||||
final double conBonus = creature.getCON() > 0 ? BaseStat.CON.calcBonus(creature) : 1.;
|
||||
baseValue *= conBonus * chaBonus;
|
||||
return Stat.defaultValue(creature, stat, baseValue);
|
||||
|
||||
return (mul * baseValue) + add + addItem + creature.getStat().getMoveTypeValue(stat, creature.getMoveType());
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,8 @@ import java.util.OptionalDouble;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.BaseStat;
|
||||
import org.l2jmobius.gameserver.model.stats.IStatFunction;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
@ -49,9 +51,30 @@ public class MaxMpFinalizer implements IStatFunction
|
||||
baseValue = player.getTemplate().getBaseMpMax(player.getLevel());
|
||||
}
|
||||
}
|
||||
|
||||
final double chaBonus = creature.isPlayer() ? BaseStat.CHA.calcBonus(creature) : 1.;
|
||||
final double menBonus = creature.getMEN() > 0 ? BaseStat.MEN.calcBonus(creature) : 1.;
|
||||
baseValue *= menBonus * chaBonus;
|
||||
return Stat.defaultValue(creature, stat, baseValue);
|
||||
|
||||
return defaultValue(creature, stat, baseValue);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
final Inventory inv = creature.getInventory();
|
||||
if (inv != null)
|
||||
{
|
||||
// Add maxMP bonus from items
|
||||
for (ItemInstance item : inv.getPaperdollItems())
|
||||
{
|
||||
addItem += item.getItem().getStats(stat, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return (mul * baseValue) + add + addItem + creature.getStat().getMoveTypeValue(stat, creature.getMoveType());
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ import org.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.items.Item;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.BaseStat;
|
||||
@ -50,24 +51,42 @@ public class MaxHpFinalizer implements IStatFunction
|
||||
if (player != null)
|
||||
{
|
||||
baseValue = player.getTemplate().getBaseHpMax(player.getLevel());
|
||||
}
|
||||
}
|
||||
|
||||
final double chaBonus = creature.isPlayer() ? BaseStat.CHA.calcBonus(creature) : 1.;
|
||||
final double conBonus = creature.getCON() > 0 ? BaseStat.CON.calcBonus(creature) : 1.;
|
||||
baseValue *= conBonus * chaBonus;
|
||||
|
||||
return defaultValue(creature, stat, baseValue);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
final Inventory inv = creature.getInventory();
|
||||
if (inv != null)
|
||||
{
|
||||
// Add maxHP bonus from items
|
||||
for (ItemInstance item : inv.getPaperdollItems())
|
||||
{
|
||||
addItem += item.getItem().getStats(stat, 0);
|
||||
|
||||
// Apply enchanted item's bonus HP
|
||||
for (ItemInstance item : player.getInventory().getPaperdollItems(ItemInstance::isEnchanted))
|
||||
// Apply enchanted item bonus HP
|
||||
if (item.isArmor() && item.isEnchanted())
|
||||
{
|
||||
if (item.isArmor())
|
||||
final long bodyPart = item.getItem().getBodyPart();
|
||||
if ((bodyPart != Item.SLOT_NECK) && (bodyPart != Item.SLOT_LR_EAR) && (bodyPart != Item.SLOT_LR_FINGER))
|
||||
{
|
||||
final long bodyPart = item.getItem().getBodyPart();
|
||||
if ((bodyPart != Item.SLOT_NECK) && (bodyPart != Item.SLOT_LR_EAR) && (bodyPart != Item.SLOT_LR_FINGER))
|
||||
{
|
||||
baseValue += EnchantItemHPBonusData.getInstance().getHPBonus(item);
|
||||
}
|
||||
addItem += EnchantItemHPBonusData.getInstance().getHPBonus(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
final double chaBonus = creature.isPlayer() ? BaseStat.CHA.calcBonus(creature) : 1.;
|
||||
final double conBonus = creature.getCON() > 0 ? BaseStat.CON.calcBonus(creature) : 1.;
|
||||
baseValue *= conBonus * chaBonus;
|
||||
return Stat.defaultValue(creature, stat, baseValue);
|
||||
|
||||
return (mul * baseValue) + add + addItem + creature.getStat().getMoveTypeValue(stat, creature.getMoveType());
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,8 @@ import java.util.OptionalDouble;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.BaseStat;
|
||||
import org.l2jmobius.gameserver.model.stats.IStatFunction;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
@ -49,9 +51,30 @@ public class MaxMpFinalizer implements IStatFunction
|
||||
baseValue = player.getTemplate().getBaseMpMax(player.getLevel());
|
||||
}
|
||||
}
|
||||
|
||||
final double chaBonus = creature.isPlayer() ? BaseStat.CHA.calcBonus(creature) : 1.;
|
||||
final double menBonus = creature.getMEN() > 0 ? BaseStat.MEN.calcBonus(creature) : 1.;
|
||||
baseValue *= menBonus * chaBonus;
|
||||
return Stat.defaultValue(creature, stat, baseValue);
|
||||
|
||||
return defaultValue(creature, stat, baseValue);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
final Inventory inv = creature.getInventory();
|
||||
if (inv != null)
|
||||
{
|
||||
// Add maxMP bonus from items
|
||||
for (ItemInstance item : inv.getPaperdollItems())
|
||||
{
|
||||
addItem += item.getItem().getStats(stat, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return (mul * baseValue) + add + addItem + creature.getStat().getMoveTypeValue(stat, creature.getMoveType());
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ import org.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.items.Item;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.BaseStat;
|
||||
@ -50,23 +51,41 @@ public class MaxHpFinalizer implements IStatFunction
|
||||
if (player != null)
|
||||
{
|
||||
baseValue = player.getTemplate().getBaseHpMax(player.getLevel());
|
||||
}
|
||||
}
|
||||
|
||||
final double conBonus = creature.getCON() > 0 ? BaseStat.CON.calcBonus(creature) : 1.;
|
||||
baseValue *= conBonus;
|
||||
|
||||
return defaultValue(creature, stat, baseValue);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
final Inventory inv = creature.getInventory();
|
||||
if (inv != null)
|
||||
{
|
||||
// Add maxHP bonus from items
|
||||
for (ItemInstance item : inv.getPaperdollItems())
|
||||
{
|
||||
addItem += item.getItem().getStats(stat, 0);
|
||||
|
||||
// Apply enchanted item's bonus HP
|
||||
for (ItemInstance item : player.getInventory().getPaperdollItems(ItemInstance::isEnchanted))
|
||||
// Apply enchanted item bonus HP
|
||||
if (item.isArmor() && item.isEnchanted())
|
||||
{
|
||||
if (item.isArmor())
|
||||
final int bodyPart = item.getItem().getBodyPart();
|
||||
if ((bodyPart != Item.SLOT_NECK) && (bodyPart != Item.SLOT_LR_EAR) && (bodyPart != Item.SLOT_LR_FINGER))
|
||||
{
|
||||
final int bodyPart = item.getItem().getBodyPart();
|
||||
if ((bodyPart != Item.SLOT_NECK) && (bodyPart != Item.SLOT_LR_EAR) && (bodyPart != Item.SLOT_LR_FINGER))
|
||||
{
|
||||
baseValue += EnchantItemHPBonusData.getInstance().getHPBonus(item);
|
||||
}
|
||||
addItem += EnchantItemHPBonusData.getInstance().getHPBonus(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
final double conBonus = creature.getCON() > 0 ? BaseStat.CON.calcBonus(creature) : 1.;
|
||||
baseValue *= conBonus;
|
||||
return Stat.defaultValue(creature, stat, baseValue);
|
||||
|
||||
return (mul * baseValue) + add + addItem + creature.getStat().getMoveTypeValue(stat, creature.getMoveType());
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,8 @@ import java.util.OptionalDouble;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.BaseStat;
|
||||
import org.l2jmobius.gameserver.model.stats.IStatFunction;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
@ -49,8 +51,29 @@ public class MaxMpFinalizer implements IStatFunction
|
||||
baseValue = player.getTemplate().getBaseMpMax(player.getLevel());
|
||||
}
|
||||
}
|
||||
|
||||
final double menBonus = creature.getMEN() > 0 ? BaseStat.MEN.calcBonus(creature) : 1.;
|
||||
baseValue *= menBonus;
|
||||
return Stat.defaultValue(creature, stat, baseValue);
|
||||
|
||||
return defaultValue(creature, stat, baseValue);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
final Inventory inv = creature.getInventory();
|
||||
if (inv != null)
|
||||
{
|
||||
// Add maxMP bonus from items
|
||||
for (ItemInstance item : inv.getPaperdollItems())
|
||||
{
|
||||
addItem += item.getItem().getStats(stat, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return (mul * baseValue) + add + addItem + creature.getStat().getMoveTypeValue(stat, creature.getMoveType());
|
||||
}
|
||||
}
|
@ -22,6 +22,7 @@ import org.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.items.Item;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.BaseStat;
|
||||
@ -50,23 +51,41 @@ public class MaxHpFinalizer implements IStatFunction
|
||||
if (player != null)
|
||||
{
|
||||
baseValue = player.getTemplate().getBaseHpMax(player.getLevel());
|
||||
}
|
||||
}
|
||||
|
||||
final double conBonus = creature.getCON() > 0 ? BaseStat.CON.calcBonus(creature) : 1.;
|
||||
baseValue *= conBonus;
|
||||
|
||||
return defaultValue(creature, stat, baseValue);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
final Inventory inv = creature.getInventory();
|
||||
if (inv != null)
|
||||
{
|
||||
// Add maxHP bonus from items
|
||||
for (ItemInstance item : inv.getPaperdollItems())
|
||||
{
|
||||
addItem += item.getItem().getStats(stat, 0);
|
||||
|
||||
// Apply enchanted item's bonus HP
|
||||
for (ItemInstance item : player.getInventory().getPaperdollItems(ItemInstance::isEnchanted))
|
||||
// Apply enchanted item bonus HP
|
||||
if (item.isArmor() && item.isEnchanted())
|
||||
{
|
||||
if (item.isArmor())
|
||||
final int bodyPart = item.getItem().getBodyPart();
|
||||
if ((bodyPart != Item.SLOT_NECK) && (bodyPart != Item.SLOT_LR_EAR) && (bodyPart != Item.SLOT_LR_FINGER))
|
||||
{
|
||||
final int bodyPart = item.getItem().getBodyPart();
|
||||
if ((bodyPart != Item.SLOT_NECK) && (bodyPart != Item.SLOT_LR_EAR) && (bodyPart != Item.SLOT_LR_FINGER))
|
||||
{
|
||||
baseValue += EnchantItemHPBonusData.getInstance().getHPBonus(item);
|
||||
}
|
||||
addItem += EnchantItemHPBonusData.getInstance().getHPBonus(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
final double conBonus = creature.getCON() > 0 ? BaseStat.CON.calcBonus(creature) : 1.;
|
||||
baseValue *= conBonus;
|
||||
return Stat.defaultValue(creature, stat, baseValue);
|
||||
|
||||
return (mul * baseValue) + add + addItem + creature.getStat().getMoveTypeValue(stat, creature.getMoveType());
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,8 @@ import java.util.OptionalDouble;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.BaseStat;
|
||||
import org.l2jmobius.gameserver.model.stats.IStatFunction;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
@ -49,8 +51,29 @@ public class MaxMpFinalizer implements IStatFunction
|
||||
baseValue = player.getTemplate().getBaseMpMax(player.getLevel());
|
||||
}
|
||||
}
|
||||
|
||||
final double menBonus = creature.getMEN() > 0 ? BaseStat.MEN.calcBonus(creature) : 1.;
|
||||
baseValue *= menBonus;
|
||||
return Stat.defaultValue(creature, stat, baseValue);
|
||||
|
||||
return defaultValue(creature, stat, baseValue);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
final Inventory inv = creature.getInventory();
|
||||
if (inv != null)
|
||||
{
|
||||
// Add maxMP bonus from items
|
||||
for (ItemInstance item : inv.getPaperdollItems())
|
||||
{
|
||||
addItem += item.getItem().getStats(stat, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return (mul * baseValue) + add + addItem + creature.getStat().getMoveTypeValue(stat, creature.getMoveType());
|
||||
}
|
||||
}
|
@ -22,6 +22,7 @@ import org.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.items.Item;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.BaseStat;
|
||||
@ -50,23 +51,41 @@ public class MaxHpFinalizer implements IStatFunction
|
||||
if (player != null)
|
||||
{
|
||||
baseValue = player.getTemplate().getBaseHpMax(player.getLevel());
|
||||
}
|
||||
}
|
||||
|
||||
final double conBonus = creature.getCON() > 0 ? BaseStat.CON.calcBonus(creature) : 1.;
|
||||
baseValue *= conBonus;
|
||||
|
||||
return defaultValue(creature, stat, baseValue);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
final Inventory inv = creature.getInventory();
|
||||
if (inv != null)
|
||||
{
|
||||
// Add maxHP bonus from items
|
||||
for (ItemInstance item : inv.getPaperdollItems())
|
||||
{
|
||||
addItem += item.getItem().getStats(stat, 0);
|
||||
|
||||
// Apply enchanted item's bonus HP
|
||||
for (ItemInstance item : player.getInventory().getPaperdollItems(ItemInstance::isEnchanted))
|
||||
// Apply enchanted item bonus HP
|
||||
if (item.isArmor() && item.isEnchanted())
|
||||
{
|
||||
if (item.isArmor())
|
||||
final long bodyPart = item.getItem().getBodyPart();
|
||||
if ((bodyPart != Item.SLOT_NECK) && (bodyPart != Item.SLOT_LR_EAR) && (bodyPart != Item.SLOT_LR_FINGER))
|
||||
{
|
||||
final long bodyPart = item.getItem().getBodyPart();
|
||||
if ((bodyPart != Item.SLOT_NECK) && (bodyPart != Item.SLOT_LR_EAR) && (bodyPart != Item.SLOT_LR_FINGER))
|
||||
{
|
||||
baseValue += EnchantItemHPBonusData.getInstance().getHPBonus(item);
|
||||
}
|
||||
addItem += EnchantItemHPBonusData.getInstance().getHPBonus(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
final double conBonus = creature.getCON() > 0 ? BaseStat.CON.calcBonus(creature) : 1.;
|
||||
baseValue *= conBonus;
|
||||
return Stat.defaultValue(creature, stat, baseValue);
|
||||
|
||||
return (mul * baseValue) + add + addItem + creature.getStat().getMoveTypeValue(stat, creature.getMoveType());
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,8 @@ import java.util.OptionalDouble;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.BaseStat;
|
||||
import org.l2jmobius.gameserver.model.stats.IStatFunction;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
@ -49,8 +51,29 @@ public class MaxMpFinalizer implements IStatFunction
|
||||
baseValue = player.getTemplate().getBaseMpMax(player.getLevel());
|
||||
}
|
||||
}
|
||||
|
||||
final double menBonus = creature.getMEN() > 0 ? BaseStat.MEN.calcBonus(creature) : 1.;
|
||||
baseValue *= menBonus;
|
||||
return Stat.defaultValue(creature, stat, baseValue);
|
||||
|
||||
return defaultValue(creature, stat, baseValue);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
final Inventory inv = creature.getInventory();
|
||||
if (inv != null)
|
||||
{
|
||||
// Add maxMP bonus from items
|
||||
for (ItemInstance item : inv.getPaperdollItems())
|
||||
{
|
||||
addItem += item.getItem().getStats(stat, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return (mul * baseValue) + add + addItem + creature.getStat().getMoveTypeValue(stat, creature.getMoveType());
|
||||
}
|
||||
}
|
@ -22,6 +22,7 @@ import org.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.items.Item;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.BaseStat;
|
||||
@ -50,23 +51,41 @@ public class MaxHpFinalizer implements IStatFunction
|
||||
if (player != null)
|
||||
{
|
||||
baseValue = player.getTemplate().getBaseHpMax(player.getLevel());
|
||||
}
|
||||
}
|
||||
|
||||
final double conBonus = creature.getCON() > 0 ? BaseStat.CON.calcBonus(creature) : 1.;
|
||||
baseValue *= conBonus;
|
||||
|
||||
return defaultValue(creature, stat, baseValue);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
final Inventory inv = creature.getInventory();
|
||||
if (inv != null)
|
||||
{
|
||||
// Add maxHP bonus from items
|
||||
for (ItemInstance item : inv.getPaperdollItems())
|
||||
{
|
||||
addItem += item.getItem().getStats(stat, 0);
|
||||
|
||||
// Apply enchanted item's bonus HP
|
||||
for (ItemInstance item : player.getInventory().getPaperdollItems(ItemInstance::isEnchanted))
|
||||
// Apply enchanted item bonus HP
|
||||
if (item.isArmor() && item.isEnchanted())
|
||||
{
|
||||
if (item.isArmor())
|
||||
final long bodyPart = item.getItem().getBodyPart();
|
||||
if ((bodyPart != Item.SLOT_NECK) && (bodyPart != Item.SLOT_LR_EAR) && (bodyPart != Item.SLOT_LR_FINGER))
|
||||
{
|
||||
final long bodyPart = item.getItem().getBodyPart();
|
||||
if ((bodyPart != Item.SLOT_NECK) && (bodyPart != Item.SLOT_LR_EAR) && (bodyPart != Item.SLOT_LR_FINGER))
|
||||
{
|
||||
baseValue += EnchantItemHPBonusData.getInstance().getHPBonus(item);
|
||||
}
|
||||
addItem += EnchantItemHPBonusData.getInstance().getHPBonus(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
final double conBonus = creature.getCON() > 0 ? BaseStat.CON.calcBonus(creature) : 1.;
|
||||
baseValue *= conBonus;
|
||||
return Stat.defaultValue(creature, stat, baseValue);
|
||||
|
||||
return (mul * baseValue) + add + addItem + creature.getStat().getMoveTypeValue(stat, creature.getMoveType());
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,8 @@ import java.util.OptionalDouble;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.BaseStat;
|
||||
import org.l2jmobius.gameserver.model.stats.IStatFunction;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
@ -49,8 +51,29 @@ public class MaxMpFinalizer implements IStatFunction
|
||||
baseValue = player.getTemplate().getBaseMpMax(player.getLevel());
|
||||
}
|
||||
}
|
||||
|
||||
final double menBonus = creature.getMEN() > 0 ? BaseStat.MEN.calcBonus(creature) : 1.;
|
||||
baseValue *= menBonus;
|
||||
return Stat.defaultValue(creature, stat, baseValue);
|
||||
|
||||
return defaultValue(creature, stat, baseValue);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
final Inventory inv = creature.getInventory();
|
||||
if (inv != null)
|
||||
{
|
||||
// Add maxMP bonus from items
|
||||
for (ItemInstance item : inv.getPaperdollItems())
|
||||
{
|
||||
addItem += item.getItem().getStats(stat, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return (mul * baseValue) + add + addItem + creature.getStat().getMoveTypeValue(stat, creature.getMoveType());
|
||||
}
|
||||
}
|
@ -22,6 +22,7 @@ import org.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.items.Item;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.BaseStat;
|
||||
@ -50,23 +51,41 @@ public class MaxHpFinalizer implements IStatFunction
|
||||
if (player != null)
|
||||
{
|
||||
baseValue = player.getTemplate().getBaseHpMax(player.getLevel());
|
||||
}
|
||||
}
|
||||
|
||||
final double conBonus = creature.getCON() > 0 ? BaseStat.CON.calcBonus(creature) : 1.;
|
||||
baseValue *= conBonus;
|
||||
|
||||
return defaultValue(creature, stat, baseValue);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
final Inventory inv = creature.getInventory();
|
||||
if (inv != null)
|
||||
{
|
||||
// Add maxHP bonus from items
|
||||
for (ItemInstance item : inv.getPaperdollItems())
|
||||
{
|
||||
addItem += item.getItem().getStats(stat, 0);
|
||||
|
||||
// Apply enchanted item's bonus HP
|
||||
for (ItemInstance item : player.getInventory().getPaperdollItems(ItemInstance::isEnchanted))
|
||||
// Apply enchanted item bonus HP
|
||||
if (item.isArmor() && item.isEnchanted())
|
||||
{
|
||||
if (item.isArmor())
|
||||
final long bodyPart = item.getItem().getBodyPart();
|
||||
if ((bodyPart != Item.SLOT_NECK) && (bodyPart != Item.SLOT_LR_EAR) && (bodyPart != Item.SLOT_LR_FINGER))
|
||||
{
|
||||
final long bodyPart = item.getItem().getBodyPart();
|
||||
if ((bodyPart != Item.SLOT_NECK) && (bodyPart != Item.SLOT_LR_EAR) && (bodyPart != Item.SLOT_LR_FINGER))
|
||||
{
|
||||
baseValue += EnchantItemHPBonusData.getInstance().getHPBonus(item);
|
||||
}
|
||||
addItem += EnchantItemHPBonusData.getInstance().getHPBonus(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
final double conBonus = creature.getCON() > 0 ? BaseStat.CON.calcBonus(creature) : 1.;
|
||||
baseValue *= conBonus;
|
||||
return Stat.defaultValue(creature, stat, baseValue);
|
||||
|
||||
return (mul * baseValue) + add + addItem + creature.getStat().getMoveTypeValue(stat, creature.getMoveType());
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,8 @@ import java.util.OptionalDouble;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.BaseStat;
|
||||
import org.l2jmobius.gameserver.model.stats.IStatFunction;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
@ -49,8 +51,29 @@ public class MaxMpFinalizer implements IStatFunction
|
||||
baseValue = player.getTemplate().getBaseMpMax(player.getLevel());
|
||||
}
|
||||
}
|
||||
|
||||
final double menBonus = creature.getMEN() > 0 ? BaseStat.MEN.calcBonus(creature) : 1.;
|
||||
baseValue *= menBonus;
|
||||
return Stat.defaultValue(creature, stat, baseValue);
|
||||
|
||||
return defaultValue(creature, stat, baseValue);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
final Inventory inv = creature.getInventory();
|
||||
if (inv != null)
|
||||
{
|
||||
// Add maxMP bonus from items
|
||||
for (ItemInstance item : inv.getPaperdollItems())
|
||||
{
|
||||
addItem += item.getItem().getStats(stat, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return (mul * baseValue) + add + addItem + creature.getStat().getMoveTypeValue(stat, creature.getMoveType());
|
||||
}
|
||||
}
|
@ -22,6 +22,7 @@ import org.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.items.Item;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.BaseStat;
|
||||
@ -50,23 +51,41 @@ public class MaxHpFinalizer implements IStatFunction
|
||||
if (player != null)
|
||||
{
|
||||
baseValue = player.getTemplate().getBaseHpMax(player.getLevel());
|
||||
}
|
||||
}
|
||||
|
||||
final double conBonus = creature.getCON() > 0 ? BaseStat.CON.calcBonus(creature) : 1.;
|
||||
baseValue *= conBonus;
|
||||
|
||||
return defaultValue(creature, stat, baseValue);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
final Inventory inv = creature.getInventory();
|
||||
if (inv != null)
|
||||
{
|
||||
// Add maxHP bonus from items
|
||||
for (ItemInstance item : inv.getPaperdollItems())
|
||||
{
|
||||
addItem += item.getItem().getStats(stat, 0);
|
||||
|
||||
// Apply enchanted item's bonus HP
|
||||
for (ItemInstance item : player.getInventory().getPaperdollItems(ItemInstance::isEnchanted))
|
||||
// Apply enchanted item bonus HP
|
||||
if (item.isArmor() && item.isEnchanted())
|
||||
{
|
||||
if (item.isArmor())
|
||||
final long bodyPart = item.getItem().getBodyPart();
|
||||
if ((bodyPart != Item.SLOT_NECK) && (bodyPart != Item.SLOT_LR_EAR) && (bodyPart != Item.SLOT_LR_FINGER))
|
||||
{
|
||||
final long bodyPart = item.getItem().getBodyPart();
|
||||
if ((bodyPart != Item.SLOT_NECK) && (bodyPart != Item.SLOT_LR_EAR) && (bodyPart != Item.SLOT_LR_FINGER))
|
||||
{
|
||||
baseValue += EnchantItemHPBonusData.getInstance().getHPBonus(item);
|
||||
}
|
||||
addItem += EnchantItemHPBonusData.getInstance().getHPBonus(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
final double conBonus = creature.getCON() > 0 ? BaseStat.CON.calcBonus(creature) : 1.;
|
||||
baseValue *= conBonus;
|
||||
return Stat.defaultValue(creature, stat, baseValue);
|
||||
|
||||
return (mul * baseValue) + add + addItem + creature.getStat().getMoveTypeValue(stat, creature.getMoveType());
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,8 @@ import java.util.OptionalDouble;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.BaseStat;
|
||||
import org.l2jmobius.gameserver.model.stats.IStatFunction;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
@ -49,8 +51,29 @@ public class MaxMpFinalizer implements IStatFunction
|
||||
baseValue = player.getTemplate().getBaseMpMax(player.getLevel());
|
||||
}
|
||||
}
|
||||
|
||||
final double menBonus = creature.getMEN() > 0 ? BaseStat.MEN.calcBonus(creature) : 1.;
|
||||
baseValue *= menBonus;
|
||||
return Stat.defaultValue(creature, stat, baseValue);
|
||||
|
||||
return defaultValue(creature, stat, baseValue);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
final Inventory inv = creature.getInventory();
|
||||
if (inv != null)
|
||||
{
|
||||
// Add maxMP bonus from items
|
||||
for (ItemInstance item : inv.getPaperdollItems())
|
||||
{
|
||||
addItem += item.getItem().getStats(stat, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return (mul * baseValue) + add + addItem + creature.getStat().getMoveTypeValue(stat, creature.getMoveType());
|
||||
}
|
||||
}
|
@ -22,6 +22,7 @@ import org.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.items.Item;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.BaseStat;
|
||||
@ -50,23 +51,41 @@ public class MaxHpFinalizer implements IStatFunction
|
||||
if (player != null)
|
||||
{
|
||||
baseValue = player.getTemplate().getBaseHpMax(player.getLevel());
|
||||
}
|
||||
}
|
||||
|
||||
final double conBonus = creature.getCON() > 0 ? BaseStat.CON.calcBonus(creature) : 1.;
|
||||
baseValue *= conBonus;
|
||||
|
||||
return defaultValue(creature, stat, baseValue);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
final Inventory inv = creature.getInventory();
|
||||
if (inv != null)
|
||||
{
|
||||
// Add maxHP bonus from items
|
||||
for (ItemInstance item : inv.getPaperdollItems())
|
||||
{
|
||||
addItem += item.getItem().getStats(stat, 0);
|
||||
|
||||
// Apply enchanted item's bonus HP
|
||||
for (ItemInstance item : player.getInventory().getPaperdollItems(ItemInstance::isEnchanted))
|
||||
// Apply enchanted item bonus HP
|
||||
if (item.isArmor() && item.isEnchanted())
|
||||
{
|
||||
if (item.isArmor())
|
||||
final int bodyPart = item.getItem().getBodyPart();
|
||||
if ((bodyPart != Item.SLOT_NECK) && (bodyPart != Item.SLOT_LR_EAR) && (bodyPart != Item.SLOT_LR_FINGER))
|
||||
{
|
||||
final int bodyPart = item.getItem().getBodyPart();
|
||||
if ((bodyPart != Item.SLOT_NECK) && (bodyPart != Item.SLOT_LR_EAR) && (bodyPart != Item.SLOT_LR_FINGER))
|
||||
{
|
||||
baseValue += EnchantItemHPBonusData.getInstance().getHPBonus(item);
|
||||
}
|
||||
addItem += EnchantItemHPBonusData.getInstance().getHPBonus(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
final double conBonus = creature.getCON() > 0 ? BaseStat.CON.calcBonus(creature) : 1.;
|
||||
baseValue *= conBonus;
|
||||
return Stat.defaultValue(creature, stat, baseValue);
|
||||
|
||||
return (mul * baseValue) + add + addItem + creature.getStat().getMoveTypeValue(stat, creature.getMoveType());
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,8 @@ import java.util.OptionalDouble;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.stats.BaseStat;
|
||||
import org.l2jmobius.gameserver.model.stats.IStatFunction;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
@ -49,8 +51,29 @@ public class MaxMpFinalizer implements IStatFunction
|
||||
baseValue = player.getTemplate().getBaseMpMax(player.getLevel());
|
||||
}
|
||||
}
|
||||
|
||||
final double menBonus = creature.getMEN() > 0 ? BaseStat.MEN.calcBonus(creature) : 1.;
|
||||
baseValue *= menBonus;
|
||||
return Stat.defaultValue(creature, stat, baseValue);
|
||||
|
||||
return defaultValue(creature, stat, baseValue);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
final Inventory inv = creature.getInventory();
|
||||
if (inv != null)
|
||||
{
|
||||
// Add maxMP bonus from items
|
||||
for (ItemInstance item : inv.getPaperdollItems())
|
||||
{
|
||||
addItem += item.getItem().getStats(stat, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return (mul * baseValue) + add + addItem + creature.getStat().getMoveTypeValue(stat, creature.getMoveType());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user