diff --git a/src/engine/gameManager/CombatManager.java b/src/engine/gameManager/CombatManager.java index 40eeb7f7..135a2f30 100644 --- a/src/engine/gameManager/CombatManager.java +++ b/src/engine/gameManager/CombatManager.java @@ -646,24 +646,32 @@ public enum CombatManager { //Get hit chance - int chance; + //int chance; float dif = atr - defense; - if (dif > 100) - chance = 94; - else if (dif < -100) - chance = 4; - else - chance = (int) ((0.45 * dif) + 49); + //if (dif > 100) + // chance = 94; + //else if (dif < -100) + // chance = 4; + //else + // chance = (int) ((0.45 * dif) + 49); errorTrack = 5; //calculate hit/miss - int roll = ThreadLocalRandom.current().nextInt(100); + //int roll = ThreadLocalRandom.current().nextInt(100); DeferredPowerJob dpj = null; - if (roll < chance) { + int atrRoll = ThreadLocalRandom.current().nextInt(ac.level * 10,(int)atr); + int defRoll = 0; + if(AbstractCharacter.IsAbstractCharacter(target)){ + AbstractCharacter tar = (AbstractCharacter) target; + defRoll = ThreadLocalRandom.current().nextInt(tar.level * 10,tar.defenseRating); + } + + + if (atrRoll < defRoll) { if (ac.getObjectType().equals(GameObjectType.PlayerCharacter)) updateAttackTimers((PlayerCharacter) ac, target, true); diff --git a/src/engine/gameManager/PowersManager.java b/src/engine/gameManager/PowersManager.java index 9e15abc2..8ded28ec 100644 --- a/src/engine/gameManager/PowersManager.java +++ b/src/engine/gameManager/PowersManager.java @@ -2241,28 +2241,34 @@ public enum PowersManager { defense = 0f; // Get hit chance - if (pc.getDebug(16)) { - String smsg = "ATR: " + atr + ", Defense: " + defense; - ChatManager.chatSystemInfo(pc, smsg); - } - - int chance; - - if (atr > defense || defense == 0) - chance = 94; - else { - float dif = atr / defense; - if (dif <= 0.8f) - chance = 4; - else - chance = ((int) (450 * (dif - 0.8f)) + 4); - } + //if (pc.getDebug(16)) { + // String smsg = "ATR: " + atr + ", Defense: " + defense; + // ChatManager.chatSystemInfo(pc, smsg); + //} + + //int chance; + + //if (atr > defense || defense == 0) + // chance = 94; + //else { + // float dif = atr / defense; + // if (dif <= 0.8f) + // chance = 4; + // else + // chance = ((int) (450 * (dif - 0.8f)) + 4); + //} // calculate hit/miss - int roll = ThreadLocalRandom.current().nextInt(100); + //int roll = ThreadLocalRandom.current().nextInt(100); boolean disable = true; - if (roll < chance) { + int atrRoll = ThreadLocalRandom.current().nextInt(pc.level * 10,(int)atr); + int defRoll = 0; + if(AbstractCharacter.IsAbstractCharacter(awo)){ + AbstractCharacter tar = (AbstractCharacter) awo; + defRoll = ThreadLocalRandom.current().nextInt(tar.level * 10,tar.defenseRating); + } + if (atrRoll < defRoll) { // Hit, check if dodge kicked in if (awo instanceof AbstractCharacter) { AbstractCharacter tarAc = (AbstractCharacter) awo;