Devlog #3 Hit chance, damage, armor, the way you can make your enemies disappear

In this devlog I'm going to talk about how hit chances and damage is calculated in Slaves of Magic.

Posted by on

### Devlog #3 Hit chance, damage, armor, the way you can make your enemies disappear.

I thought its time to talk a little bit about how combat is calculated in our game, as this is a very prominent system that the players will try to manipulate to their advantage in a tactical game. No component of it is particularly unique, so I'm sure you, the reader, will be able to bring up other games that had one component or another. But I think the mix of those components and their effect on each other is interesting. Before I go into it though I want to leave a note that the exact values could change, as we are in development!

### Hit chance calculation:

hit chance = base_hit_chance + attacking_character_accuracy_bonus - defending_character_defense_bonus

Here, the base hit chance is 50%, so if everything being equal, a character has a 50% chance of hitting the enemy. One important point, it can't go under 5 % or over 95%. But what about the attacking and defending bonuses? There are multiple ways to gain both. For starters, every character has an innate defending bonus, which depends on their level. In addition, weapons are giving an additional bonus to attack (for example a mace) or defense (shield) or both (sword), depending on the user skills.

In melee combat, another big factor is facing. If you are facing dead ahead of the attack, or the attack comes from just 1 tile from the left or to the right, the attacker does not get a bonus to their accuracy. But if they attack from the sides, they get 10 %, and if they attack from the back 40 % bonus. So no matter how good of a fighter you are, if someone can attack you from your back, he/she will have a good chance of hitting you.

### Crit Chance calculation:

We only roll for crit chance, if we managed to hit the enemy. The formula as follows:

crit chance = base_crit_chance + attacking_character_accuracy_bonus - defending_character_defense_bonus

Basically the same formula as before, but with one big difference. The base crit chance is 10 %. Very similarly it has the same 5%, 95% bounds as well. So if your character has an accuracy advantage, it will affect it's crit chance as well.

Now we need to talk about the critical hit effect because it is a little bit different than in most games. In Slaves of Magic, a critical hit will mean you managed to circumvent the armor (for example, managed to stab into a weak point in plate mail). As such, it gives you 100% armor penetration. But it's pretty much useless against people with very low-to-no armor. Before I go into why it is designed as such, I should talk about how damage is calculated, and how armor affects it.

### Damage calculation:

Every skill has a damage range, for example, 10-15, and we roll to see the actual damage. The formula: