From 0ab5827ee5da27fc3c155346fdf6a4b699fedbab Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Fri, 1 Sep 2023 21:34:48 -0500 Subject: [PATCH] mobs to load equipment resists --- src/engine/objects/Mob.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 1999cba5..e189e5b6 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -1664,7 +1664,8 @@ public class Mob extends AbstractIntelligenceAgent { this.enemy.addAll(this.getMobBase().enemy); } this.applyMobbaseEffects(); - recalculateStats(); + this.applyEquipmentResists(); + this.recalculateStats(); this.setHealth(this.healthMax); // Set bounds for this mobile @@ -1682,6 +1683,18 @@ public class Mob extends AbstractIntelligenceAgent { } + public void applyEquipmentResists(){ + if(this.equip != null){ + for(MobEquipment equipped : this.equip.values()){ + ItemBase itemBase = equipped.getItemBase(); + if(itemBase.isHeavyArmor() || itemBase.isLightArmor() || itemBase.isMediumArmor()){ + this.resists.setResist(DamageType.Crush, this.resists.getResist(DamageType.Crush,0) + itemBase.getCrushResist()); + this.resists.setResist(DamageType.Slash, this.resists.getResist(DamageType.Slash,0) + itemBase.getCrushResist()); + this.resists.setResist(DamageType.Pierce, this.resists.getResist(DamageType.Pierce,0) + itemBase.getCrushResist()); + } + } + } + } @Override protected ConcurrentHashMap initializePowers() { return new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);