Browse Source

hit chance issue resolved

lakebane-master
FatBoy-DOTC 9 months ago
parent
commit
505f8fdd90
  1. 12
      src/engine/gameManager/CombatManager.java

12
src/engine/gameManager/CombatManager.java

@ -645,13 +645,21 @@ public enum CombatManager { @@ -645,13 +645,21 @@ public enum CombatManager {
errorTrack = 4;
//Get hit chance
int chance = (int)(((atr-((atr+defense)*0.33f))/((defense-((atr+defense)*0.33f))+(atr-((atr+defense)*0.33f))))) * 100;
float smallChance = ((atr-((atr+defense)*0.33f))/((defense-((atr+defense)*0.33f))+(atr-((atr+defense)*0.33f))));
int chance = (int)(smallChance * 100);
errorTrack = 5;
if(chance < 5){
chance = 5;
}
if(chance > 95){
chance = 95;
}
//calculate hit/miss
int roll = ThreadLocalRandom.current().nextInt(100);
int roll = ThreadLocalRandom.current().nextInt(1,101);
DeferredPowerJob dpj = null;
if (roll < chance) {

Loading…
Cancel
Save