Gain HP bonus only from enchanted armor items.

This commit is contained in:
MobiusDev
2019-01-24 13:43:28 +00:00
parent 25ff6eca69
commit e57da86a58
14 changed files with 90 additions and 22 deletions

View File

@@ -22,6 +22,7 @@ import com.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.stats.BaseStats;
import com.l2jmobius.gameserver.model.stats.IStatsFunction;
@@ -52,11 +53,18 @@ public class MaxHpFinalizer implements IStatsFunction
// Apply enchanted item's bonus HP
for (L2ItemInstance item : player.getInventory().getPaperdollItems(L2ItemInstance::isEnchanted))
{
if (item.isArmor())
{
final int bodyPart = item.getItem().getBodyPart();
if ((bodyPart != L2Item.SLOT_NECK) && (bodyPart != L2Item.SLOT_LR_EAR) && (bodyPart != L2Item.SLOT_LR_FINGER))
{
baseValue += EnchantItemHPBonusData.getInstance().getHPBonus(item);
}
}
}
}
}
final double chaBonus = creature.isPlayer() ? BaseStats.CHA.calcBonus(creature) : 1.;
final double conBonus = creature.getCON() > 0 ? BaseStats.CON.calcBonus(creature) : 1.;
baseValue *= conBonus * chaBonus;

View File

@@ -22,6 +22,7 @@ import com.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.stats.BaseStats;
import com.l2jmobius.gameserver.model.stats.IStatsFunction;
@@ -52,11 +53,18 @@ public class MaxHpFinalizer implements IStatsFunction
// Apply enchanted item's bonus HP
for (L2ItemInstance item : player.getInventory().getPaperdollItems(L2ItemInstance::isEnchanted))
{
if (item.isArmor())
{
final int bodyPart = item.getItem().getBodyPart();
if ((bodyPart != L2Item.SLOT_NECK) && (bodyPart != L2Item.SLOT_LR_EAR) && (bodyPart != L2Item.SLOT_LR_FINGER))
{
baseValue += EnchantItemHPBonusData.getInstance().getHPBonus(item);
}
}
}
}
}
final double chaBonus = creature.isPlayer() ? BaseStats.CHA.calcBonus(creature) : 1.;
final double conBonus = creature.getCON() > 0 ? BaseStats.CON.calcBonus(creature) : 1.;
baseValue *= conBonus * chaBonus;

View File

@@ -22,6 +22,7 @@ import com.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.stats.BaseStats;
import com.l2jmobius.gameserver.model.stats.IStatsFunction;
@@ -52,11 +53,18 @@ public class MaxHpFinalizer implements IStatsFunction
// Apply enchanted item's bonus HP
for (L2ItemInstance item : player.getInventory().getPaperdollItems(L2ItemInstance::isEnchanted))
{
if (item.isArmor())
{
final int bodyPart = item.getItem().getBodyPart();
if ((bodyPart != L2Item.SLOT_NECK) && (bodyPart != L2Item.SLOT_LR_EAR) && (bodyPart != L2Item.SLOT_LR_FINGER))
{
baseValue += EnchantItemHPBonusData.getInstance().getHPBonus(item);
}
}
}
}
}
final double chaBonus = creature.isPlayer() ? BaseStats.CHA.calcBonus(creature) : 1.;
final double conBonus = creature.getCON() > 0 ? BaseStats.CON.calcBonus(creature) : 1.;
baseValue *= conBonus * chaBonus;

View File

@@ -22,6 +22,7 @@ import com.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.stats.BaseStats;
import com.l2jmobius.gameserver.model.stats.IStatsFunction;
@@ -52,11 +53,18 @@ public class MaxHpFinalizer implements IStatsFunction
// Apply enchanted item's bonus HP
for (L2ItemInstance item : player.getInventory().getPaperdollItems(L2ItemInstance::isEnchanted))
{
if (item.isArmor())
{
final int bodyPart = item.getItem().getBodyPart();
if ((bodyPart != L2Item.SLOT_NECK) && (bodyPart != L2Item.SLOT_LR_EAR) && (bodyPart != L2Item.SLOT_LR_FINGER))
{
baseValue += EnchantItemHPBonusData.getInstance().getHPBonus(item);
}
}
}
}
}
final double chaBonus = creature.isPlayer() ? BaseStats.CHA.calcBonus(creature) : 1.;
final double conBonus = creature.getCON() > 0 ? BaseStats.CON.calcBonus(creature) : 1.;
baseValue *= conBonus * chaBonus;

View File

@@ -22,6 +22,7 @@ import com.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.stats.BaseStats;
import com.l2jmobius.gameserver.model.stats.IStatsFunction;
@@ -52,11 +53,18 @@ public class MaxHpFinalizer implements IStatsFunction
// Apply enchanted item's bonus HP
for (L2ItemInstance item : player.getInventory().getPaperdollItems(L2ItemInstance::isEnchanted))
{
if (item.isArmor())
{
final long bodyPart = item.getItem().getBodyPart();
if ((bodyPart != L2Item.SLOT_NECK) && (bodyPart != L2Item.SLOT_LR_EAR) && (bodyPart != L2Item.SLOT_LR_FINGER))
{
baseValue += EnchantItemHPBonusData.getInstance().getHPBonus(item);
}
}
}
}
}
final double chaBonus = creature.isPlayer() ? BaseStats.CHA.calcBonus(creature) : 1.;
final double conBonus = creature.getCON() > 0 ? BaseStats.CON.calcBonus(creature) : 1.;
baseValue *= conBonus * chaBonus;

View File

@@ -22,6 +22,7 @@ import com.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.stats.BaseStats;
import com.l2jmobius.gameserver.model.stats.IStatsFunction;
@@ -52,11 +53,18 @@ public class MaxHpFinalizer implements IStatsFunction
// Apply enchanted item's bonus HP
for (L2ItemInstance item : player.getInventory().getPaperdollItems(L2ItemInstance::isEnchanted))
{
if (item.isArmor())
{
final long bodyPart = item.getItem().getBodyPart();
if ((bodyPart != L2Item.SLOT_NECK) && (bodyPart != L2Item.SLOT_LR_EAR) && (bodyPart != L2Item.SLOT_LR_FINGER))
{
baseValue += EnchantItemHPBonusData.getInstance().getHPBonus(item);
}
}
}
}
}
final double chaBonus = creature.isPlayer() ? BaseStats.CHA.calcBonus(creature) : 1.;
final double conBonus = creature.getCON() > 0 ? BaseStats.CON.calcBonus(creature) : 1.;
baseValue *= conBonus * chaBonus;

View File

@@ -26,9 +26,6 @@ public enum ArmorType implements ItemType
HEAVY,
MAGIC,
SIGIL,
RING,
EARRING,
NECKLACE,
// L2J CUSTOM
SHIELD;

View File

@@ -22,6 +22,7 @@ import com.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.stats.BaseStats;
import com.l2jmobius.gameserver.model.stats.IStatsFunction;
@@ -52,11 +53,18 @@ public class MaxHpFinalizer implements IStatsFunction
// Apply enchanted item's bonus HP
for (L2ItemInstance item : player.getInventory().getPaperdollItems(L2ItemInstance::isEnchanted))
{
if (item.isArmor())
{
final int bodyPart = item.getItem().getBodyPart();
if ((bodyPart != L2Item.SLOT_NECK) && (bodyPart != L2Item.SLOT_LR_EAR) && (bodyPart != L2Item.SLOT_LR_FINGER))
{
baseValue += EnchantItemHPBonusData.getInstance().getHPBonus(item);
}
}
}
}
}
final double conBonus = creature.getCON() > 0 ? BaseStats.CON.calcBonus(creature) : 1.;
baseValue *= conBonus;
return Stats.defaultValue(creature, stat, baseValue);

View File

@@ -26,9 +26,6 @@ public enum ArmorType implements ItemType
HEAVY,
MAGIC,
SIGIL,
RING,
EARRING,
NECKLACE,
// L2J CUSTOM
SHIELD;

View File

@@ -22,6 +22,7 @@ import com.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.stats.BaseStats;
import com.l2jmobius.gameserver.model.stats.IStatsFunction;
@@ -52,11 +53,18 @@ public class MaxHpFinalizer implements IStatsFunction
// Apply enchanted item's bonus HP
for (L2ItemInstance item : player.getInventory().getPaperdollItems(L2ItemInstance::isEnchanted))
{
if (item.isArmor())
{
final int bodyPart = item.getItem().getBodyPart();
if ((bodyPart != L2Item.SLOT_NECK) && (bodyPart != L2Item.SLOT_LR_EAR) && (bodyPart != L2Item.SLOT_LR_FINGER))
{
baseValue += EnchantItemHPBonusData.getInstance().getHPBonus(item);
}
}
}
}
}
final double conBonus = creature.getCON() > 0 ? BaseStats.CON.calcBonus(creature) : 1.;
baseValue *= conBonus;
return Stats.defaultValue(creature, stat, baseValue);

View File

@@ -26,9 +26,6 @@ public enum ArmorType implements ItemType
HEAVY,
MAGIC,
SIGIL,
RING,
EARRING,
NECKLACE,
// L2J CUSTOM
SHIELD;

View File

@@ -22,6 +22,7 @@ import com.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.stats.BaseStats;
import com.l2jmobius.gameserver.model.stats.IStatsFunction;
@@ -52,11 +53,18 @@ public class MaxHpFinalizer implements IStatsFunction
// Apply enchanted item's bonus HP
for (L2ItemInstance item : player.getInventory().getPaperdollItems(L2ItemInstance::isEnchanted))
{
if (item.isArmor())
{
final long bodyPart = item.getItem().getBodyPart();
if ((bodyPart != L2Item.SLOT_NECK) && (bodyPart != L2Item.SLOT_LR_EAR) && (bodyPart != L2Item.SLOT_LR_FINGER))
{
baseValue += EnchantItemHPBonusData.getInstance().getHPBonus(item);
}
}
}
}
}
final double conBonus = creature.getCON() > 0 ? BaseStats.CON.calcBonus(creature) : 1.;
baseValue *= conBonus;
return Stats.defaultValue(creature, stat, baseValue);

View File

@@ -26,9 +26,6 @@ public enum ArmorType implements ItemType
HEAVY,
MAGIC,
SIGIL,
RING,
EARRING,
NECKLACE,
// L2J CUSTOM
SHIELD;

View File

@@ -22,6 +22,7 @@ import com.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PetInstance;
import com.l2jmobius.gameserver.model.items.L2Item;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.stats.BaseStats;
import com.l2jmobius.gameserver.model.stats.IStatsFunction;
@@ -52,11 +53,18 @@ public class MaxHpFinalizer implements IStatsFunction
// Apply enchanted item's bonus HP
for (L2ItemInstance item : player.getInventory().getPaperdollItems(L2ItemInstance::isEnchanted))
{
if (item.isArmor())
{
final long bodyPart = item.getItem().getBodyPart();
if ((bodyPart != L2Item.SLOT_NECK) && (bodyPart != L2Item.SLOT_LR_EAR) && (bodyPart != L2Item.SLOT_LR_FINGER))
{
baseValue += EnchantItemHPBonusData.getInstance().getHPBonus(item);
}
}
}
}
}
final double conBonus = creature.getCON() > 0 ? BaseStats.CON.calcBonus(creature) : 1.;
baseValue *= conBonus;
return Stats.defaultValue(creature, stat, baseValue);