Damage

## Character Damage

A Character's damage is the main factor all other damage scales off.

A multiplier is built and added together:

1. +10% for each instance of BoostDamage the character has.
2. +10% for each Irradiant Pearl.
3. -5% for each beetlejuice debuff. *Presumed to be the flying bugs from Beetle Queen.*
4. The multiplier from the item Shaped Glass

This multiplier is applied to the character's base damage plus their level's damage resulting in the character's damage.

After this, the following reduction and increases are applied in order:

1. If the character is weakened, multiply their damage by 0.6. This means a 40% reduction.
2. If the Spinel Tonic is active, multiply the damage by 2.
3. If the Spinel Tonic isn't active and the character has at least 1 Tonic Affliction, reduce their damage by `0.95^x` where X is the amount of Tonic Afflictions the character has.

## Hit Damage

Each hit has damage info. This is scaled (possibly indirectly) from the character's damage. It holds the following properties: the attacker, the damage, if it is a critical strike, the damage type, the Proc Coefficient, the Proc chain(, position and force for knockback related calculations, the damage color and if the damage was rejected for displaying the damage). Upon hitting a character, the following things are done in order:

1. The character applies the damage to themselves. (see: *Receiving Damage)*
2. The game checks if on hit items need to trigger and DoTs need to be applied. (see: *Handling Hits)*
3. The game checks if the attack needs to explode. (see: *Handling Hits*)

## Receiving Damage

Note that this is both true for players and enemies.

The game begins by creating a copy of the incoming damage amount, let's call this 'amount', whereas we'll call the old damage 'original amount'.

1. If the character has succeeded the roll for Tougher Times, has just spawned in, or is otherwise invincible, set the damage rejected flag and stop applying any further damage.
2. If the attacker has crowbars and the character is above 90% from their maximum combined health, multiply *amount* by `(1+0.5*Crowbars)`.
3. If the attacker has Armor-Piercing Rounds and the character is a boss, multiply *amount* by `(1+0.2*Armor Piercing Rounds)`.
4. If the attacker has a Focus Crystal and is within 13 meters of the character, multiply *amount* by `(1+0.15*Focus Crystals)`.
5. If the hit was a critical hit, multiply *amount* by 2.
6. If the damage doesn't bypass Armor (such as damage from a Shrine of Blood), apply the armor reduction/increase to *amount*. This can't reduce the *amount* to less than 1.
7. If the character is a player and *amount* is bigger than 90% of the character's combined health, reduce the *amount* to 90% of the character's combined health instead. This is commonly known as **One Shot Protection** or **OSP** for short.
8. If applicable, apply certain slows and roots to the character based on the damage type.
9. If the character holds a Brittle Crown, take away money equal to the maximum between `original amount*Crowns` and `Crowns*Money*(combined health/amount)`.
10. Reduce barrier by *amount*, and *amount* by the barrier actually removed.
11. Reduce shield by *amount*, and *amount* by the shield actually removed.
12. Reduce the health by *amount*. If this would reduce a character's health below 1 and the damage is of the nonlethal type, such as hellfire tincture self damage and fall damage, set the health to 1 instead.
13. Apply the knockback.
14. (There's possibly a few steps in between here that this editor has not exactly traced to their entire conclusions.)[Verify]
15. If the character isn't player controlled and is frozen, set the execution threshold to 0.3
16. If the character is an elite and the execution threshold is below the execution threshold set by Old Guillotines of the attacker, set the execution threshold to the threshold of the Guillotines.
17. If the character's combined health is below the amount dictated by the execution threshold, set their health to **minus** 1.
18. If the character is now dead (health less than or equal to 0), tell the game to check for on death effects.
19. If the character has an Old War Stealthkit, roll it with total damage dealt.

## Critical Strike

All Survivors have a base of 1% critical chance. Upon Critical strike, damage dealt is twice the amount of a normal attack. See **Receiving Damage**.

## One Shot Protection

A single hit taken can not deal more than `(maxHealth + maxShield) * 0.9 + Barrier` damage. This is checked after damage-reducing effects such as armor are applied. (See: *Receiving Damage) (it might be possible that it was patched completely)*

## Trivia

* If you enable Damage Number in Gameplay Settings, the damage will be displayed after rounding up to the nearest integer for a maximum of 990,000,000, truncated as 990M.

## History

1. ↑ 1.0 1.1 Most enemy skills have a Proc Coefficient of 1. A notable exception is the Stone Titan's Laser.
2. ↑ 50% chance to ignite for the flamethrower. This chance is affected by luck.