Browse Source

item physical resists refactored

combat-2
MagicBot 8 months ago
parent
commit
3048f86f5b
  1. 15
      src/engine/gameManager/NPCManager.java
  2. 27
      src/engine/objects/ItemBase.java
  3. 14
      src/engine/objects/Resists.java

15
src/engine/gameManager/NPCManager.java

@ -421,14 +421,15 @@ public enum NPCManager {
} }
public static void applyEquipmentResists(Mob mob){ public static void applyEquipmentResists(Mob mob){
if(mob.equip != null){
if (mob.equip == null)
return;
for (MobEquipment equipped : mob.equip.values()) { for (MobEquipment equipped : mob.equip.values()) {
ItemBase itemBase = equipped.getItemBase(); if (equipped.template.item_type.equals(Enum.ItemType.ARMOR)) {
if(itemBase.isHeavyArmor() || itemBase.isLightArmor() || itemBase.isMediumArmor()){ 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.SLASHING, mob.resists.getResist(Enum.SourceType.SLASHING, 0) + itemBase.getSlashResist()); 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.CRUSHING, mob.resists.getResist(Enum.SourceType.CRUSHING, 0) + itemBase.getCrushResist()); mob.resists.setResist(Enum.SourceType.PIERCING, mob.resists.getResist(Enum.SourceType.PIERCING, 0) + equipped.template.combat_attack_resist.get("Piercing"));
mob.resists.setResist(Enum.SourceType.PIERCING, mob.resists.getResist(Enum.SourceType.PIERCING, 0) + itemBase.getPierceResist());
}
} }
} }
} }

27
src/engine/objects/ItemBase.java

@ -57,9 +57,6 @@ public class ItemBase {
private final int restrictFlag; private final int restrictFlag;
private final String skillRequired; private final String skillRequired;
private final short percentRequired; private final short percentRequired;
private final float slashResist;
private final float crushResist;
private final float pierceResist;
private final float blockMod; private final float blockMod;
private final short defense; private final short defense;
private final float dexPenalty; private final float dexPenalty;
@ -104,9 +101,6 @@ public class ItemBase {
this.restrictFlag = rs.getInt("restrictFlag"); this.restrictFlag = rs.getInt("restrictFlag");
this.skillRequired = rs.getString("skillRequired"); this.skillRequired = rs.getString("skillRequired");
this.percentRequired = rs.getShort("percentRequired"); 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.blockMod = rs.getFloat("blockMod");
this.defense = rs.getShort("defense"); this.defense = rs.getShort("defense");
this.dexPenalty = rs.getFloat("dexPenalty"); this.dexPenalty = rs.getFloat("dexPenalty");
@ -759,27 +753,6 @@ public class ItemBase {
return restrictFlag; 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 * @return the skillRequired
*/ */

14
src/engine/objects/Resists.java

@ -159,14 +159,16 @@ public class Resists {
} }
private static float[] getArmorResists(Item armor, float[] phys) { private static float[] getArmorResists(Item armor, float[] phys) {
if (armor == null) if (armor == null)
return phys; return phys;
ItemBase ab = armor.getItemBase();
if (ab == null) if (armor.template.item_type.equals(Enum.ItemType.ARMOR)) {
return phys; phys[0] += armor.template.combat_attack_resist.get("Slashing");
phys[0] += ab.getSlashResist(); phys[1] += armor.template.combat_attack_resist.get("Crushing");
phys[1] += ab.getCrushResist(); phys[2] += armor.template.combat_attack_resist.get("Piercing");
phys[2] += ab.getPierceResist(); }
return phys; return phys;
} }

Loading…
Cancel
Save