What’s the best way to calculate random damage based on a power variable and enemy defense variable
So lets say these are the stats
My Attack - 12
Enemy Def - 4
What would be the best formula? I don’t want it to be inbetween 0 and another. This is the only formula I can get
//The minimal damage
min_damage = playerAttack -= enemyDef;
randomDam = random(playerAttack);
if(randomDam < min_damage){
randomDam = min_damage
}
But this will return with 8 (the minium damage based on our variables) a lot since it is more likely to land below 8.
Something more like a random number between the minimum damage and the player’s attack