hit chance issue resolved
This commit is contained in:
@@ -645,13 +645,21 @@ public enum CombatManager {
|
|||||||
errorTrack = 4;
|
errorTrack = 4;
|
||||||
|
|
||||||
//Get hit chance
|
//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;
|
errorTrack = 5;
|
||||||
|
|
||||||
|
if(chance < 5){
|
||||||
|
chance = 5;
|
||||||
|
}
|
||||||
|
if(chance > 95){
|
||||||
|
chance = 95;
|
||||||
|
}
|
||||||
|
|
||||||
//calculate hit/miss
|
//calculate hit/miss
|
||||||
|
|
||||||
int roll = ThreadLocalRandom.current().nextInt(100);
|
int roll = ThreadLocalRandom.current().nextInt(1,101);
|
||||||
DeferredPowerJob dpj = null;
|
DeferredPowerJob dpj = null;
|
||||||
|
|
||||||
if (roll < chance) {
|
if (roll < chance) {
|
||||||
|
|||||||
Reference in New Issue
Block a user