From 08060cf06fd3d0e3b7417d105e1dfde931ac6224 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Thu, 28 Mar 2024 21:46:54 -0500 Subject: [PATCH] mob baseline stats --- src/engine/gameManager/CombatManager.java | 2 + src/engine/mobileAI/MobAI.java | 1 + src/engine/objects/AbstractCharacter.java | 71 ++++++++++------------- src/engine/objects/Mob.java | 3 +- 4 files changed, 35 insertions(+), 42 deletions(-) diff --git a/src/engine/gameManager/CombatManager.java b/src/engine/gameManager/CombatManager.java index c53b0285..c905c825 100644 --- a/src/engine/gameManager/CombatManager.java +++ b/src/engine/gameManager/CombatManager.java @@ -139,6 +139,8 @@ public enum CombatManager { //calculate hit chance based off ATR and DEF int hitChance; + if(def == 0) + def = 1; float dif = atr / def; if (dif <= 0.8f) diff --git a/src/engine/mobileAI/MobAI.java b/src/engine/mobileAI/MobAI.java index 3a40c612..725fd9bc 100644 --- a/src/engine/mobileAI/MobAI.java +++ b/src/engine/mobileAI/MobAI.java @@ -120,6 +120,7 @@ public class MobAI { return; CombatManager.combatCycle(mob,mob.combatTarget); + mob.lastAttackTime = System.currentTimeMillis(); } if (target.getPet() != null) diff --git a/src/engine/objects/AbstractCharacter.java b/src/engine/objects/AbstractCharacter.java index aaef3730..88727eb0 100644 --- a/src/engine/objects/AbstractCharacter.java +++ b/src/engine/objects/AbstractCharacter.java @@ -597,34 +597,8 @@ public abstract class AbstractCharacter extends AbstractWorldObject { } - /** - * @param abstractCharacter - * @ Calculates Atr (both hands) Defense, and Damage for pc - */ - public static void calculateAtrDefenseDamage(AbstractCharacter abstractCharacter) { - if (abstractCharacter.charItemManager == null || abstractCharacter.charItemManager.getEquipped() == null || abstractCharacter.skills == null) { - Logger.error("Player " + abstractCharacter.getObjectUUID() + " missing skills or equipment"); - defaultAtrAndDamage(abstractCharacter, true); - defaultAtrAndDamage(abstractCharacter, false); - abstractCharacter.defenseRating = 0; - return; - } + public static void AssignDefenseValue(AbstractCharacter abstractCharacter){ ConcurrentHashMap equipped = abstractCharacter.charItemManager.getEquipped(); - - // // Reset passives - // if (this.bonuses != null) { - // this.bonuses.setBool("Block", false); - // this.bonuses.setBool("Parry", false); - // if (this.baseClass != null && this.baseClass.getUUID() == 2502) - // this.bonuses.setBool("Dodge", true); - // else - // this.bonuses.setBool("Dodge", false); - // } - // calculate atr and damage for each hand - calculateAtrDamageForWeapon(abstractCharacter, equipped.get(EquipSlotType.RHELD), true, equipped.get(EquipSlotType.RHELD)); - calculateAtrDamageForWeapon(abstractCharacter, equipped.get(EquipSlotType.LHELD), false, equipped.get(EquipSlotType.LHELD)); - - // No Defense while in DeathShroud if (abstractCharacter.effects != null && abstractCharacter.effects.containsKey("DeathShroud")) abstractCharacter.defenseRating = (short) 0; else { @@ -664,11 +638,39 @@ public abstract class AbstractCharacter extends AbstractWorldObject { abstractCharacter.defenseRating = (short) (defense + 0.5f); } } + /** + * @param abstractCharacter + * @ Calculates Atr (both hands) Defense, and Damage for pc + */ + public static void calculateAtrDefenseDamage(AbstractCharacter abstractCharacter) { + if (abstractCharacter.charItemManager == null || abstractCharacter.charItemManager.getEquipped() == null || abstractCharacter.skills == null) { + Logger.error("Player " + abstractCharacter.getObjectUUID() + " missing skills or equipment"); + defaultAtrAndDamage(abstractCharacter, true); + defaultAtrAndDamage(abstractCharacter, false); + abstractCharacter.defenseRating = 0; + return; + } + AssignDefenseValue(abstractCharacter); + // calculate atr and damage for each hand + ConcurrentHashMap equipped = abstractCharacter.charItemManager.getEquipped(); + AssignDamageAtrForPlayers(abstractCharacter, equipped.get(EquipSlotType.RHELD), true, equipped.get(EquipSlotType.RHELD)); + AssignDamageAtrForPlayers(abstractCharacter, equipped.get(EquipSlotType.LHELD), false, equipped.get(EquipSlotType.LHELD)); + if(abstractCharacter.getObjectType().equals(GameObjectType.Mob)){ + Mob mob = (Mob) abstractCharacter; + abstractCharacter.minDamageHandOne += (int)mob.mobBase.getDamageMin(); + abstractCharacter.minDamageHandTwo += (int)mob.mobBase.getDamageMin(); + abstractCharacter.maxDamageHandOne += (int)mob.mobBase.getDamageMax(); + abstractCharacter.maxDamageHandTwo += (int)mob.mobBase.getDamageMax(); + abstractCharacter.atrHandOne += mob.mobBase.getAttackRating(); + abstractCharacter.atrHandTwo += mob.mobBase.getAttackRating(); + abstractCharacter.defenseRating += mob.mobBase.getDefenseRating(); + } + } /** * @ Calculates Atr, and Damage for each weapon */ - public static void calculateAtrDamageForWeapon(AbstractCharacter abstractCharacter, Item weapon, boolean mainHand, Item otherHand) { + public static void AssignDamageAtrForPlayers(AbstractCharacter abstractCharacter, Item weapon, boolean mainHand, Item otherHand) { // make sure weapon exists boolean noWeapon = false; @@ -719,6 +721,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject { // TODO Correct these min = 1; max = 3; + } else { if (mainHand) abstractCharacter.rangeHandOne = weapon.template.item_weapon_max_range * (1 + (abstractCharacter.statStrBase / 600)); @@ -749,18 +752,6 @@ public abstract class AbstractCharacter extends AbstractWorldObject { max = damages[1]; strBased = weaponTemplate.item_primary_attr.equals(AttributeType.Strength); - - // - // Add parry bonus for weapon and allow parry if needed - - // // Only Fighters and Thieves can Parry - // if ((this.baseClass != null && this.baseClass.getUUID() == 2500) - // || (this.promotionClass != null && this.promotionClass.getUUID() == 2520)) { - // if (wbMain == null || wbMain.getRange() < MBServerStatics.RANGED_WEAPON_RANGE) - // if (wbOff == null || wbOff.getRange() < MBServerStatics.RANGED_WEAPON_RANGE) - // this.bonuses.setBool("Parry", true); - // } - // } } if (abstractCharacter.effects != null && abstractCharacter.effects.containsKey("DeathShroud")) diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 9d88228e..97ec4492 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -71,7 +71,7 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed { public AbstractWorldObject fearedObject = null; protected int dbID; //the database ID private int currentID; - private long lastAttackTime = 0; + public long lastAttackTime = 0; private int lastMobPowerToken = 0; private DeferredPowerJob weaponPower; private DateTime upgradeDateTime = null; @@ -1045,7 +1045,6 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed { NPCManager.setDamageAndSpeedForGuard(this); NPCManager.applyGuardStanceModifiers(this); } else { - AbstractCharacter.calculateAtrDamageForWeapon(this, this.charItemManager.equipped.get(EquipSlotType.RHELD), true, this.charItemManager.equipped.get(EquipSlotType.LHELD)); AbstractCharacter.calculateAtrDefenseDamage(this); calculateMaxHealthManaStamina(); }