Indie Dev

Hello Guest!. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, sell your games, upload content, as well as connect with other members through your own private inbox!

Reprogramming Crit calculation

Karakui

Villager
Xy$
0.00
As I'm sure many of you are aware, whether or not any given attack is a critical hit is determined by multiplying the attacker's crit by the result of 1 - target's crit evade. So for example, a unit attacking with a Crit chance of 90 against a target with a crit evade of 20 has a 72% chance of actually landing a critical hit (0.9 * 0.8). A difference of just 2% isn't particularly major so it doesn't immediately seem like a problem, but once Crit and Crit Evade are closer together, the change becomes a lot worse.

For example:

An attacker with a 10% crit rate against a target with a 10% crit evade rate still has a 9% chance of inflicting a critical hit (0.1 * 0.9).

An attacker with a 50% crit rate against a target with a 75% crit evade rate still has a 12.5% chance of inflicting a critical hit (0.5 * 0.25)


Since my game currently bases both Crit and Crit Evade rate on base parameters (so higher level characters have higher crit and crit evade stats), this breaks a lot of classes.

Is there a way of forcing the game to calculate an attack's critical chance by simply subtracting the target's crit evade from the attacker's crit (and then rounding up to zero if negative)? So that 10% crit vs 10% crit evade would have a 0% crit chance, the 50% crit vs 75% crit evade would also have a 0% crit chance (because the -25% would round up to 0), and a 70% crit rate vs a 40% crit evade would have a 30% crit chance?
 
Top