Exact Formula:
Unit has equipment that has attack values that gives the unit an overall attack rating.
Every type of equipment has an attack type: Normal, Cutting, Blunt, Piercing.
Whichever type of non-normal attack contributes the most to your attack rating defines your overall attack type. (Realistically, your primary weapon).
..
Unit has equipment that has defense values that gives the unit an overall defense rating.
Every type of equipment has a defense against certain types of attack. Whatever contributes the most to your overall defense results in your unit's overall defense type.
..
In combat:
Attacker rolls a value 0 to attack max value.
Defender rolls a value 0 to defense max value.
If Defender defense type = Attacker's attack type then defender's roll = max value.
Thus, a player armed with a club (blunt damage) with an attack of 5 goes up against a guy with a helmet (protection from blunt) of defense of 3 then the defender will always roll a 3 against the attacker. They'll still take 2 damage potentially but they'll be a lot safer.
By contrast, no helmet but instead has Leather armor with a defense value of 4, they'll be rolling 0 to 4 against that club.
Some equipment has defensive values that allow a dodge % (shields) that have a chance that a player will simply avoid certain types of attack but that's a different discussion.
It's important to remember this: IT IS NOT A ROLE PLAYING GAME. We have to, between turns, simulate potentially hundreds of battles so we can't have D&D level complexity in individual battles but we can get a pretty good approximation.