# Damage System

This describes how damage is done in the game. This is not a detailed math guide. For more in-depth math analysis, please navigate to damage system - math

This is sub-layout for documentation pages

## Contents

[hide]
Top

#### 1 Damage dealing

The damage dealing is divided to 2 cases. First one being damage that is dealt right away, called immediate damage (in case of melee attacks), and the other is delayed damage which is when it is dealt with some delay (in case of magic attack)

An example of player using delayed attack principle

#### 2 Immediate damage

In moment of player's attack (on the server), atack and defence is calculated. Then, damage is dealt to the target, and then damage after effects phase is initiated.

#### 3 Delayed damage

For delayed damage to work, the damage number is generated in moment of actual attack action. The number is, however, saved into an array held in the target character, along with a timer.
When timer's time is up, then the damage number is taken and dealt to the character (if he is still alive).
After that, damage after effects phase is initiated

#### 4 Attack / defence calculation

• input: attacker (Character), defender (Character)
• output: damage to be dealt to the defender (number, can be negative)
!NEGATIVE DAMAGE NUMBER is only encoding for telling, that the damage is from poison!
In this phase, both characters (attacker and defender) are taken WITH CURENT SETUP AND BONUSES, and roll for attacks / defences is done, with respect to the attack styles and game rules.
This results in number representing the damage to be dealt, and boolean which is telling, whether the damage was critical.

#### 5 Damage after effects

• input: damage (number), was damage critical (boolean)
• output: