diff --git a/src/engine/gameManager/NPCManager.java b/src/engine/gameManager/NPCManager.java index d05add65..99687019 100644 --- a/src/engine/gameManager/NPCManager.java +++ b/src/engine/gameManager/NPCManager.java @@ -342,12 +342,28 @@ public enum NPCManager { } } } - public static void setDefenseForGuard(Mob guard){ + public static void setDefenseForGuard(Mob guard){ + int dexterity = guard.getStatDexCurrent(); + if(dexterity < 1) + dexterity = 1; + int baseDef = guard.mobBase.getDefenseRating(); + int armorDefense = 0; + for(MobEquipment equipped : guard.equip.values()) + if(equipped.getItemBase().isArmor() || equipped.getItemBase().isShield()) + armorDefense += equipped.getItemBase().getDefense(); + guard.defenseRating = dexterity + baseDef + armorDefense; } - public static void setAttackRatingForGuard(Mob guard){ - + public static void setAttackRatingForGuard(Mob guard) { + int strength = guard.getStatStrCurrent(); + int baseAtr = guard.mobBase.getAttackRating(); + if (guard.equip.get(1) != null) + guard.atrHandOne = baseAtr + (int) ((strength * 0.5f) + (guard.equip.get(1).getItemBase().getPercentRequired() * 4) + (guard.equip.get(1).getItemBase().getPercentRequired() * 3)); + else if (guard.equip.get(2) != null && !guard.equip.get(2).getItemBase().isShield()) + guard.atrHandTwo = baseAtr + (int) ((strength * 0.5f) + (guard.equip.get(2).getItemBase().getPercentRequired() * 4) + (guard.equip.get(2).getItemBase().getPercentRequired() * 3)); + else + guard.atrHandOne = baseAtr; } public static void setMaxHealthForGuard(Mob guard){ @@ -376,6 +392,7 @@ public enum NPCManager { break; } } + public static void applyMobbaseEffects(Mob mob) { EffectsBase effectsBase; for (MobBaseEffects mbe : mob.mobBase.effectsList) { diff --git a/src/engine/objects/ItemBase.java b/src/engine/objects/ItemBase.java index 17c5a00c..dfc3c03b 100644 --- a/src/engine/objects/ItemBase.java +++ b/src/engine/objects/ItemBase.java @@ -914,4 +914,21 @@ public class ItemBase { public void setAutoID(boolean autoID) { this.autoID = autoID; } + + public boolean isArmor(){ + + if(this.isHeavyArmor()) + return true; + + if(this.isMediumArmor()) + return true; + + if(this.isLightArmor()) + return true; + + if(this.isClothArmor()) + return true; + + return false; + } }