Skip to main content

Damage Formula

Entity damage takes into account the enemy's various Defense stats.

The total damage of a damage event is calculated as follows:

Total damage=(Elemental Damage){1+cdmgif crit1otherwise\text{Total damage} = \left(\sum \text{Elemental Damage} \right) \cdot \begin{cases} 1 + \text{cdmg} & \text{if crit} \\ 1 & \text{otherwise} \end{cases}

Where:

  • cdmg\text{cdmg} is the critical damage stat of the attacker.

In other words, the total damage is the sum of the damage for each element, multiplied by the critical damage multiplier. This means that crit is not independent of elemental damage. For a damage event, the following formula is used per element:

Elemental Damage=edmg(1edefedef+100)(1defdef+100)\text{Elemental Damage} = \text{edmg} \cdot \left(1 - \cfrac{\text{edef}}{|\text{edef}| + 100} \right)\cdot \left(1 - \cfrac{\text{def}}{|\text{def}| + 100} \right)

Where:

  • edmg\text{edmg} is the damage stat of the attacker for that element.
  • def\text{def} is the defense stat of the defender.
  • edef\text{edef} is the defense stat of the defender for that element.

The total damage is the sum of the damage for each element. From the formula, we can see that elemental defense and regular defense are independent of each other and are applied multiplicatively.

Knockback

Knockback occurs when an entity is hit by an attack, and is described by a change in the velocity vector of the entity.

vD={vD+[00.10]if A = D12(vD+vA+AD)otherwise\overrightarrow{v_\text{D}} = \begin{cases} \overrightarrow{v_\text{D}} + \begin{bmatrix} 0 \\ 0.1 \\ 0 \end{bmatrix} & \text{if A = D} \\ \cfrac{1}{2} \cdot \left(\overrightarrow{v_\text{D}} + \overrightarrow{v_\text{A}} + \overrightarrow{AD}\right) & \text{otherwise} \end{cases}

Where:

  • A\text{A} is the attacker.
  • D\text{D} is the defender.
  • vA\overrightarrow{v_\text{A}} is the velocity vector of the attacker.
  • vD\overrightarrow{v_\text{D}} is the velocity vector of the defender.
  • AD\overrightarrow{AD} is the vector from the attacker to the defender.