From ee9b64285e7d1a288071d745364b82390d00906a Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 16 Mar 2024 18:31:21 -0400 Subject: [PATCH] Itembase refactor work --- src/engine/gameManager/NPCManager.java | 28 ++++++++++++++------------ 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/engine/gameManager/NPCManager.java b/src/engine/gameManager/NPCManager.java index 1460287a..dc1fe97b 100644 --- a/src/engine/gameManager/NPCManager.java +++ b/src/engine/gameManager/NPCManager.java @@ -300,26 +300,28 @@ public enum NPCManager { }else{ if (guard.equip.containsKey(Enum.EquipSlotType.RHELD)) { //has main hand weapon - ItemBase weapon = guard.equip.get(Enum.EquipSlotType.RHELD).getItemBase(); - if (weapon.isStrBased()) + MobEquipment weapon = guard.equip.get(Enum.EquipSlotType.RHELD); + + if (weapon.template.item_primary_attr.equals(Enum.AttributeType.Strength)) primaryStat = guard.getStatStrCurrent(); else primaryStat = guard.getStatDexCurrent(); - guard.minDamageHandOne = (int) ((guard.mobBase.getDamageMin() + weapon.getMinDamage()) * rankModifier) + primaryStat; - guard.maxDamageHandOne = (int) ((guard.mobBase.getDamageMax() + weapon.getMaxDamage()) * rankModifier) + primaryStat; - guard.speedHandOne = weapon.getSpeed(); - guard.rangeHandOne = weapon.getRange(); + + guard.minDamageHandOne = (int) ((guard.mobBase.getDamageMin() + weapon.template.item_weapon_damage.values().iterator().next()[0]) * rankModifier) + primaryStat; + guard.maxDamageHandOne = (int) ((guard.mobBase.getDamageMax() + weapon.template.item_weapon_damage.values().iterator().next()[1]) * rankModifier) + primaryStat; + guard.speedHandOne = weapon.template.item_weapon_wepspeed; + guard.rangeHandOne = weapon.template.item_weapon_max_range; } else if (guard.equip.containsKey(Enum.EquipSlotType.LHELD) && !ItemTemplate.isShield(guard.equip.get(Enum.EquipSlotType.LHELD).template)) { //has off hand weapon - ItemBase weapon = guard.equip.get(Enum.EquipSlotType.LHELD).getItemBase(); - if (weapon.isStrBased()) + MobEquipment weapon = guard.equip.get(Enum.EquipSlotType.LHELD); + if (weapon.template.item_primary_attr.equals(Enum.AttributeType.Strength)) primaryStat = guard.getStatStrCurrent(); else primaryStat = guard.getStatDexCurrent(); - guard.minDamageHandTwo = (int) ((guard.mobBase.getDamageMin() + weapon.getMinDamage()) * rankModifier) + primaryStat; - guard.maxDamageHandTwo = (int) ((guard.mobBase.getDamageMax() + weapon.getMaxDamage()) * rankModifier) + primaryStat; - guard.speedHandTwo = weapon.getSpeed(); - guard.rangeHandTwo = weapon.getRange(); + guard.minDamageHandOne = (int) ((guard.mobBase.getDamageMin() + weapon.template.item_weapon_damage.values().iterator().next()[0]) * rankModifier) + primaryStat; + guard.maxDamageHandOne = (int) ((guard.mobBase.getDamageMax() + weapon.template.item_weapon_damage.values().iterator().next()[1]) * rankModifier) + primaryStat; + guard.speedHandOne = weapon.template.item_weapon_wepspeed; + guard.rangeHandOne = weapon.template.item_weapon_max_range; } else { primaryStat = guard.getStatStrCurrent(); guard.minDamageHandOne = (int)((guard.mobBase.getDamageMin()) * rankModifier) + primaryStat; @@ -338,7 +340,7 @@ public enum NPCManager { int armorDefense = 0; for(MobEquipment equipped : guard.equip.values()) if (equipped.template.item_type.equals(Enum.ItemType.ARMOR) || ItemTemplate.isShield(equipped.template)) - armorDefense += equipped.getItemBase().getDefense(); + armorDefense += equipped.template.item_defense_rating; guard.defenseRating = dexterity + baseDef + armorDefense; }