From 4edf74017978f4e8943a98630b9bcffeb13e6ac2 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sat, 9 Sep 2023 19:57:17 -0500 Subject: [PATCH] finished modifications for guards --- src/engine/gameManager/NPCManager.java | 23 ++++++++++++++++++++--- src/engine/objects/ItemBase.java | 17 +++++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) 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; + } }