I am creating the combat system of a simple RPG. The only two factors in this system are damage and accuracy.
Accuracy in this game simply means either the attacker HITS or MISSES. There is no partial damage or partial hits. The target has no chance of dodging the attack if the attacker HITS. A player's accuracy is represented with a percentage, e.g. 75% of the time the player will HIT.
In combat, the damage formula determines the damage inflicted on a target, but the damage will only be inflicted if the player HITS the target.
I have already created a damage formula; however, I do not know how to create a simple and practical accuracy formula. I have thought of this, but it's quite impractical because of how it will need to be manipulated if the player's accuracy improves/increases:
- An array is filled (Player's accuracy)% with 1's, remaining percent with 0's
- At random, one index of the array is chosen
- If it's a 1, the player HITS; if it's a 0, the player MISSES
I have looked around this network at accuracy/hit or miss formulas but they involve other factors such as dexterity and evasion. I've also looked elsewhere online, but again the formulas involve other factors.
Is there a simple and practical formula to accomplish this?