# Best way to implement a to hit formula based on provided stats

There are a ton of these questions, some can get really mathy – which is fine, but I am looking for a simple way based on a few stats, I thought I came up with one, so I will share it in hopes that someone can tell me where I might be going wrong.

The goal is that the monster should, depending on how powerful you are, be able to have a chance to hit. Weaker monsters instant death to them, harder monsters possible instant death to you.

I also realize these are hard questions to answer because it is game dependant. I hope I have provided enough info for you to give some guidance.

Lets get the stats out the way:

• To Hit Stat (Character): base stat / modded stat (ie: 12/100)
• Accuracy / Dodge (Character): between 0.0001 – 1.0 (0.01% – 100% (can be higher))
• Enemy Dodge / Enemy Accuracy: Between 0.0001 – 0.85 (0.01% – 85%)
• To Hit (Monster): Dex / 10,000 – where 10k is 1k higher then max stats (9k) for monsters
• Monsters do have a max level (if that will help)

When a character levels they get 1 point into their base stat – which is then used in conjunction with all equipment and so on to increase the modded stat additively (base stat + base stat * bonuses = modded stat)

Characters can cap out (Modded stat) Higher then 10K which might pose issues for a to hit formula. How ever at that point I would assume your skills are 100% as max level is 1000 – thus you should always be hitting

``(stat / modded stat) + (((accuracy - dodge) / accuracy) * 100) ``

Some assumptions I made based on how I built the system:

• Accuracy at 100%+ means you always hit
• Dodge at 100%+ Means you always dodge.
• Enemies dodge and accuracy do not go above 85% (they can start at 0.01% for both)
• Monsters always use their dex (ie 12/max cap), monsters do not have modded stats
• All Monster stats are the same, IE: if Dex is 9k all other stats, such as str, int, chr … are also 9k

There are some issues with this formula though:

• If stat and stat mod are the same (no equipment or bonus for character only) I chose to use the stat (as opposed to stat / modded stat) so, if 11 === 11 – well, use 11. For the character (see below for example)
• Because a character might never train (I don’t know why) Accuracy or Dodge their bonus might be 0.01% (there are equipment bonuses that can increase this to a max of 30% across all equipment with another 5% for boons (135% max) how ever in the following example we will assume you have nothing)

So:

``   Level 1 (Character) = (11) + ((0.0001 - 0.0001) / 0.001) * 100) = 11 // Nothing equipped no bonuses     vs.     Rat (Enemy) = (8/10000) + ((0.0001 - 0.0001) / 0.001) * 100) = 0.0008 ``

This doesn’t seem right, so the player has a 11% to hit and the rat has a 0.0008% chance to hit?

Character : 100 – 11 = 82% chance to hit Rate : 100 – 0.0008 = 99.9992% chance to hit?

This doesn’t make sense to me. For context here’s a high level monster with a character that has a 95% dodge chance:

`` (9000/10000) + ((0.75 - 0.95) / 0.75) * 100) = -25.7666666667 ``

That does not look right.