# Defense

*1,007*pages on

this wiki

Defense is a Skill that reduces the chance an enemy will deal Physical Damage, directly reduces Magic Damage and is a requirement for Equipment, primarily for Armors.

## Effect on Combat Edit

Taking less damage is key for sustained combat, saving time by not refilling on food as often and money by consuming less food.

Equipment's armor is added to your defense stat, at a rate of 3 armor for 1 defense.

## Physical Damage Formula Edit

(Note: formula based on source code on 16/05/2015)

Using the following variables:

- str = attacker's strength
- acc = attacker's accuracy
- pow = attacker's power
- aim = attacker's aim
- def = target defense
- arm = target armor

And the following functions:

- Random() - gives a random number between 0 and 1
- Max(a, b) - equal to "a" or "b", whichever is larger
- Ceiling(a) - gives the smallest integer equal or larger than "a"

Damage is calculated as follows:

- tot_str = str + pow / 2
- tot_acc = acc + aim / 2
- tot_def = def + arm / 3
- if combat style is aggressive, tot_str = tot_str + 1
- if combat style is defensive, tot_def = tot_def + 1
- if combat style is accurate, tot_acc = tot_acc + 1
- temp_damage = 1 + (tot_str / 5) * Random()
- temp_defense = Max(0, tot_def - tot_acc) * Random()
- final_damage = Max(0, Ceiling(temp_damage - temp_defense))