Browse Source

mob baseline stats

combat-2
FatBoy-DOTC 8 months ago
parent
commit
08060cf06f
  1. 2
      src/engine/gameManager/CombatManager.java
  2. 1
      src/engine/mobileAI/MobAI.java
  3. 71
      src/engine/objects/AbstractCharacter.java
  4. 3
      src/engine/objects/Mob.java

2
src/engine/gameManager/CombatManager.java

@ -139,6 +139,8 @@ public enum CombatManager { @@ -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)

1
src/engine/mobileAI/MobAI.java

@ -120,6 +120,7 @@ public class MobAI { @@ -120,6 +120,7 @@ public class MobAI {
return;
CombatManager.combatCycle(mob,mob.combatTarget);
mob.lastAttackTime = System.currentTimeMillis();
}
if (target.getPet() != null)

71
src/engine/objects/AbstractCharacter.java

@ -597,34 +597,8 @@ public abstract class AbstractCharacter extends AbstractWorldObject { @@ -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<EquipSlotType, Item> 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 { @@ -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<EquipSlotType, Item> 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 { @@ -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 { @@ -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"))

3
src/engine/objects/Mob.java

@ -71,7 +71,7 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed { @@ -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 { @@ -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();
}

Loading…
Cancel
Save