forked from MagicBane/Server
item physical resists refactored
This commit is contained in:
@@ -421,15 +421,16 @@ public enum NPCManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void applyEquipmentResists(Mob mob){
|
public static void applyEquipmentResists(Mob mob){
|
||||||
if(mob.equip != null){
|
|
||||||
for(MobEquipment equipped : mob.equip.values()){
|
if (mob.equip == null)
|
||||||
ItemBase itemBase = equipped.getItemBase();
|
return;
|
||||||
if(itemBase.isHeavyArmor() || itemBase.isLightArmor() || itemBase.isMediumArmor()){
|
|
||||||
mob.resists.setResist(Enum.SourceType.SLASHING, mob.resists.getResist(Enum.SourceType.SLASHING, 0) + itemBase.getSlashResist());
|
for (MobEquipment equipped : mob.equip.values()) {
|
||||||
mob.resists.setResist(Enum.SourceType.CRUSHING, mob.resists.getResist(Enum.SourceType.CRUSHING, 0) + itemBase.getCrushResist());
|
if (equipped.template.item_type.equals(Enum.ItemType.ARMOR)) {
|
||||||
mob.resists.setResist(Enum.SourceType.PIERCING, mob.resists.getResist(Enum.SourceType.PIERCING, 0) + itemBase.getPierceResist());
|
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"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user