Browse Source

item physical resists refactored

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

17
src/engine/gameManager/NPCManager.java

@ -421,14 +421,15 @@ public enum NPCManager { @@ -421,14 +421,15 @@ 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"));
}
}
}

27
src/engine/objects/ItemBase.java

@ -57,9 +57,6 @@ public class ItemBase { @@ -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 { @@ -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 { @@ -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
*/

14
src/engine/objects/Resists.java

@ -159,14 +159,16 @@ public class Resists { @@ -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;
}

Loading…
Cancel
Save