# Combat Damage

Damage is calculated in several steps. It is not *essential* to understand how these numbers arise, but it is beneficial for players who want to make the most informed decisions. For determining whether an attack hits in the first place, see Saves and To-Hit.

## Contents

## Weapon damage calculation

### Step 1: Stats

Surprisingly (for people who have played other RPGs), your stats are actually the most important factor in determining your combat damage, because all the other factors go through a reducing formula first. Which stats are used depends on the weapon, and in some cases, on your talents.

For example, a longsword says *100% Str* which means it uses your Strength and nothing else. A dagger says *45% Str, 45% Dex* which means it uses your Strength (times 0.45) plus your Dexterity (times 0.45). However, if you have the Lethality talent, this overrides the *45% Str* part and forces the calculation to use your Cunning (times 0.45) instead. So a Bulwark with a longsword the damage is somewhat proportional to Str*1.0; for a Rogue with a dagger, it would be Cun*0.45+Dex*0.45.

The result of this step is stored in a variable called `totstat` (for "total stats").

As an example, let's take a Rogue with 41 Dexterity and 35 Cunning, who has the Lethality talent. His `totstat` (using a dagger) is 41*0.45 + 35*0.45, or 34.2. His Strength doesn't matter, because Lethality overrides it.

### Step 2: Base weapon damage

The second most important factor in determining your damage is your weapon's base damage. This is usually displayed as a range of numbers; we want the lower one.

ToME 4 is all about diminishing returns (except when it isn't), and so we convert the weapon's power into a multiplying factor. We use this formula:

power = (sqrt(base_dmg / 10) + 1) / 2

If weapon's base damage is 28, then power comes out to approximately 1.337.

### Step 3: Mastery Talent modifier

Each type of weapon has a talent that boosts its damage output. For most weapons, this is Weapons Mastery. For daggers, it is Dagger Mastery. Bows and slings use Bow Mastery and Sling Mastery respectively. For mindstars, it is Psiblades. Other classes, such as Temporal Wardens, Brawlers, Stone Wardens, Sawbutchers, Gunslingers, and Psyshots have their own class specific way version of these talents.

We use this formula:

talented_mod = sqrt(eff_talent_level / 5) / 2 + 1

With a raw Dagger Mastery talent level of 5, and a mastery of 1.30 in Combat training, this gives an effective talent level of 6.5. Therefore the `talented_mod` variable is about 1.570.

This can also be found in the relevant talent's description: *increases weapon damage by 57% when using daggers*.

### Step 4: Physical power

Physical power is a rescaled combat stat. We won't go into the factors that affect it here; get it from your character's tooltip.

For our example, we'll assume our Rogue has a physical power of 27.

### Step 5: Total damage before rescaling

Now we combine all our numbers together, using this formula:

dam = 0.3 * (phys_power + totstat) * power * talented_mod

The `dam` variable does not actually exist in the code. It is only used here for clarity.

Continuing our example, our Rogue has a pre-rescaling damage of 0.3 * (27 + 34.2) * 1.337 * 1.570, or about 38.539.

### Step 6: Rescale damage

This is the final step in determining the base damage shown on the character sheet. The damage figure calculated in the previous step is run through this formula:

damage = dam ^ 1.04

So, the final output in our Rogue example is 38.539 ^ 1.04, or 44.60.

This will be shown as 44 on the character sheet.

## Applying the damage

### Determining Weapon Damage

#### Step 1: Weapon damage

The base damage of a weapon attack is shown in the attack tab of your character sheet, using the calculations shown above.

Here we are going to use the example of Cornac Bulwark smacking a Shalore Mindslayer with a sword. We'll assume the basic damage calculated in the previous section comes out to 50.

Accuracy (main Hand) 45 Damage (main Hand) 50 APR (main Hand) 8 Crit (main Hand) 8% Speed (main Hand) 100.00%

Result so far: 50

#### Step 2: Armour and Armour Hardiness

Armour reduces damage at this point, making it very effective. Armour is capped by armour hardiness, and reduced by armour piercing (APR). Enemy armour and armour hardiness are shown in their tooltip.

Hardiness/Armour: 30% / 12

Armour Hardiness specifies the maximum amount that can be reduced by armour. Squishy's hardiness is 30%, which means that it can reduce a maximum of 15 base damage (30% of 50). Squishy's armour is 12, which is modified by APR before subtracting from base damage. The attacker's APR is 8, leading to an effective armour of 4. 4 is less than the maximum allowable by Hardiness (15), so it is used. This is subtracted from Smasher's base damage, which reduces it to 46.

Result so far: 46

#### Step 3: Damage Range

Damage range can only be found by dividing the second number in the power of your weapon by the first number. This is then used to increase the damage to between the base damage and the base damage multiplied by the range, randomly. Smasher is using a Dwarven-Steel Longsword, that shows up like:

Base Power: 20 - 28

By dividing (28/20), you can get the damage range of 1.4. A random number is then chosen between 46 (the damage after armour) and 64.4 (46 * 1.4). In this example, it is 57 (whole numbers only).

Result so far: 57

#### Step 4: Talents

Smasher attacked with Dirty Fighting (lvl 2) for 52% damage, which is a fairly straightforward multiplication. 57 * 52% = 29.64

Result so far: 29.64

#### Step 5: Critical Hits

Critical hits are a chance to do extra damage. The chance is found in the attack tab, near the damage and APR found previously, and is 8% in this example. The amount of damage that a critical hit does is multiplied by the "Critical mult.", found under the Damage Mods column. The default is 150%, and it can be raised by various means. Smasher got lucky, and got a critical hit. 29.64 * 150% = 44.46

Result so far: 44.46

#### Step 6: Offhand Multiplier

Offhand weapons only do 50% damage, unless the attacker has a talent that increases this, such as Dual Weapon Training or Corrupted Strength. Offhand mindstars do full damage.

Since this is not an offhand weapon, there is no adjustment in this step.

Result so far: 44.46

### Common Damage Modifiers

All sources of damage are affected the same by the following things in this order.

#### Increased Damage

Element category increases and enemy category increases are summed for the foe and then applied. If you have +25% physical damage and +25% damage against living and attack a living foe with a physical attack, the resulting damage will be multiplied by 1.5.

##### Element Categories

These are applied to any damage you do of the corresponding type. The most common sources of this is from certain egos and always on staffs.

##### Enemy Categories

These are applied to any damage you do to the corresponding type of foe. The most common sources of this is from certain egos and artifacts, such as Genocide.

#### Resistances

It is at this point that Resistances are applied.

#### Damage Reduction

It is at this point that Damage reductions are applied.