diff --git a/src/engine/gameManager/NPCManager.java b/src/engine/gameManager/NPCManager.java index 1a9757bc..b3bcc485 100644 --- a/src/engine/gameManager/NPCManager.java +++ b/src/engine/gameManager/NPCManager.java @@ -421,15 +421,16 @@ public enum NPCManager { } public static void applyEquipmentResists(Mob mob){ - if(mob.equip != null){ - for(MobEquipment equipped : mob.equip.values()){ - ItemBase itemBase = equipped.getItemBase(); - if(itemBase.isHeavyArmor() || itemBase.isLightArmor() || itemBase.isMediumArmor()){ - mob.resists.setResist(Enum.SourceType.SLASHING, mob.resists.getResist(Enum.SourceType.SLASHING, 0) + itemBase.getSlashResist()); - mob.resists.setResist(Enum.SourceType.CRUSHING, mob.resists.getResist(Enum.SourceType.CRUSHING, 0) + itemBase.getCrushResist()); - mob.resists.setResist(Enum.SourceType.PIERCING, mob.resists.getResist(Enum.SourceType.PIERCING, 0) + itemBase.getPierceResist()); - } - } + + if (mob.equip == null) + return; + + for (MobEquipment equipped : mob.equip.values()) { + if (equipped.template.item_type.equals(Enum.ItemType.ARMOR)) { + mob.resists.setResist(Enum.SourceType.SLASHING, mob.resists.getResist(Enum.SourceType.SLASHING, 0) + equipped.template.combat_attack_resist.get("Slashing")); + mob.resists.setResist(Enum.SourceType.CRUSHING, mob.resists.getResist(Enum.SourceType.CRUSHING, 0) + equipped.template.combat_attack_resist.get("Crushing")); + mob.resists.setResist(Enum.SourceType.PIERCING, mob.resists.getResist(Enum.SourceType.PIERCING, 0) + equipped.template.combat_attack_resist.get("Piercing")); + } } } diff --git a/src/engine/objects/ItemBase.java b/src/engine/objects/ItemBase.java index 31e175b1..907f3629 100644 --- a/src/engine/objects/ItemBase.java +++ b/src/engine/objects/ItemBase.java @@ -57,9 +57,6 @@ public class ItemBase { private final int restrictFlag; private final String skillRequired; private final short percentRequired; - private final float slashResist; - private final float crushResist; - private final float pierceResist; private final float blockMod; private final short defense; private final float dexPenalty; @@ -104,9 +101,6 @@ public class ItemBase { this.restrictFlag = rs.getInt("restrictFlag"); this.skillRequired = rs.getString("skillRequired"); this.percentRequired = rs.getShort("percentRequired"); - this.slashResist = rs.getFloat("slashResist"); - this.crushResist = rs.getFloat("crushResist"); - this.pierceResist = rs.getFloat("pierceResist"); this.blockMod = rs.getFloat("blockMod"); this.defense = rs.getShort("defense"); this.dexPenalty = rs.getFloat("dexPenalty"); @@ -759,27 +753,6 @@ public class ItemBase { return restrictFlag; } - /** - * @return the slashResist - */ - public float getSlashResist() { - return slashResist; - } - - /** - * @return the crushResist - */ - public float getCrushResist() { - return crushResist; - } - - /** - * @return the pierceResist - */ - public float getPierceResist() { - return pierceResist; - } - /** * @return the skillRequired */ diff --git a/src/engine/objects/Resists.java b/src/engine/objects/Resists.java index 0db1cdd1..562b6eb1 100644 --- a/src/engine/objects/Resists.java +++ b/src/engine/objects/Resists.java @@ -159,14 +159,16 @@ public class Resists { } private static float[] getArmorResists(Item armor, float[] phys) { + if (armor == null) return phys; - ItemBase ab = armor.getItemBase(); - if (ab == null) - return phys; - phys[0] += ab.getSlashResist(); - phys[1] += ab.getCrushResist(); - phys[2] += ab.getPierceResist(); + + if (armor.template.item_type.equals(Enum.ItemType.ARMOR)) { + phys[0] += armor.template.combat_attack_resist.get("Slashing"); + phys[1] += armor.template.combat_attack_resist.get("Crushing"); + phys[2] += armor.template.combat_attack_resist.get("Piercing"); + } + return phys; }