custom hit chance formula

This commit is contained in:
2024-09-05 21:30:01 -05:00
parent db5a4195ad
commit 2eb58eb719
+11 -4
View File
@@ -1444,11 +1444,18 @@ public enum CombatManager {
}
public static boolean LandHit(int atr, int defense){
int roll = ThreadLocalRandom.current().nextInt(101);
float chance = (float)((atr-((atr+defense)*0.315))/((defense-((atr+defense)*0.315))+(atr-((atr+defense)*0.315))));
boolean hit = false;
if((chance * 100) > roll)
hit = true;
return hit;
int connvertedChance = (int)(chance * 100);
if(connvertedChance < 5)
connvertedChance = 5;
if(connvertedChance > 95)
connvertedChance = 95;
return connvertedChance > roll;
}
}