I’m trying to achieve a simple but effective formula for the skills that the player and ai use.
For my player i have this; Which works absolutely fine…
var probability = Random.Range(1 / ((player.Attack / opponent.defence) * 0.515), 0.0 );
print(probability);
if(probability < 0.5){
/// Applydamage code///
}
But then you come to the ai code, which is the same as above. If i have 3 values higher than the ai’s attack it returns as infinity. The calculation works fine in a calculator and i cant seem to find any faults.
var probability = Random.Range(1 / ((ai.Attack / player.Defence) * 0.515), 0.0 );
if(hitReady){
print(probability);
if(probability < 0.5){
//damage code///
}
Am i doing something wrong? Is there a better formula?