Melee combat

Melee combat is a common form of fighting in. Players and other creatures can attack one another with fists, weapons, items, or other natural weapons. Almost any item in the entire game can be wielded by a creature and used for melee fighting. Items that aren't specifically designed to be used as melee weapons use the Cudgel skill, have a default PV of 4, and a default damage of 1d2.

= Overview =

Combat attributes
The primary attributes that affect melee combat are agility and strength.
 * Agility affects one's accuracy, increasing the to-hit chance of striking an opponent.
 * Agility also affects one's DV, or dodge value, making it easier to avoid being hit.
 * Strength affects one's PV, or ability to penetrate the defenses of a hit opponent, causing more damage.

Defensive combat stats
= Melee Attack Calculations =

Number of Attacks
By base, the primary hand and weapons wielded at least in part with them is the attack that is guaranteed to be made by a creature when bump-attacking; the offhand has only a 15% chance to make an attack by base.

The Dual Wield tree increases the chance of offhand attacks made with the regular offhand only; Flurry however make use of all available weapons wielded in any slot (Stingers being an exception due to technically not being true weapons).

Stingers have a 20% chance of hitting whenever a regular melee attack is made; however, other limbs will never hit when the "Sting" action the mutations grant is used.

Helping hands and weapons wielded in them have a static 8% to attack, which is not modified by the Dual Wield tree.

Jab doubles the chance of offhand attacks made with short blades, except when the short blade is wielded by helping hands.

Attacks made with weapons wielded in Multiple Arms slots (or made with the bare hands provided by it) are unaffected by Dual Wield: their base chance for attacking is determined solely by the mutation level; they are however affected by Jab and wielding a two-handed weapon so the weapon is held with one hand from Multiple Arms and one regular off hand will result in Dual Wield's chance being used (and if one hand is from Multiple Arms and the other is the primary hand, the chance of attacking with the weapon will be 100%).

Horns have a 20% chance to attack when bump-attacking, boosted to 100% when using Charge, and despite qualifying as short blades are specifically excluded from Jab's effect, as are all other natural short blades.

A Bilge Sphincter has a static 15% chance to attack.

Hit Roll
The game begins processing an individual weapon attack by making a simple hit roll to determine if the attack hits the target:

If the attacker's hit roll is higher than the opponent's DV, the attack hits.

At this point, all on-hit effects are applied to the target. Unlike physical damage from the melee attack, on-hit effects do not need to penetrate to be applied, they simply require the Hit Roll to succeed. On-hit effects include just about anything besides direct weapon damage, such as:
 * Elemental damage from the weapon or its mods.
 * Status effects, such as bleeding or poison.
 * Physical effects, such as disarm, trip, or forced movement.
 * Special effects, such as the those caused by, , , , , and many other creatures and items.

Guaranteed Hits
Certain scenarios result in guaranteed or near-guaranteed successful hit rolls against a target:
 * If the target is Stuck or Overburdened, the target's DV is automatically reduced to, which can effectively guarantee success with all attack hit rolls against them.
 * Targets affected by the attacker's Hook and Drag are automatically hit by the attacker when the attacker moves.
 * If the attacker has latched on to the target (an effect unique to and ), the attacker is guaranteed to hit the target.

Penetration and Damage
After an attack is determined to have hit the target, penetration rolls are made to calculate the damage.

To begin, the game calculates the defender's armor value (AV) and the attacker's penetration value (PV).

AV Calculation
AV is calculated by adding together all of the following values. Your AV value (not including additional AV from shield block) can also be seen in-game on the sidebar or overlay bar.
 * The AV value of all of the character's equipped armor (not counting shields).
 * Additional AV from sources such as the Calloused skill or the density effect.
 * The AV value of one equipped shield if the attack is determined to be blocked by that shield.

PV Calculation
Penetration is calculated by adding together all of the following values.
 * Base penetration bonus.
 * For non-vibro weapons, the base penetration bonus is equal to the weapon penetration value shown on the equipment screen in-game, minus 4. For example, if the weapon shows 7, your base penetration bonus is 3. Typically this bonus is the same as your strength modifier (or your strength modifier + 1 for two-handed weapons), but it can be capped to a lower value depending on the weapon.
 * For vibro weapons, the base penetration bonus is always equal to the defender's AV.
 * +1 bonus penetration if the weapon has the Sharp modification.
 * +4 bonus penetration if the enemy is asleep.
 * +1 bonus penetration to swarmer attackers for each additional swarmer enemy that surrounds their opponent.
 * Additional bonus penetration from the Charge, Lunge, Long Blade Proficiency, Improved Aggressive Stance, Shank, or Slam skills.

Penetration Rolls
The penetration rolls are now processed using the AV and PV values that were calculated in the previous two sections. Penetration rolls are the most complex and peculiar part of combat calculations. Penetration rolls determine the total amount of physical damage caused by the melee weapon.

- Roll the attacker's PV value against the defender's AV value 3 times (let's call this a triplet).
 * - Each individual roll within the triplet works as follows (let's call each roll a singlet):
 * - Roll . Each time that the maximum result of   is rolled, perform the   roll again and continue adding the results together.
 * - Add the attacker's PV value to the total roll calculated in.
 * - Note whether the total PV roll from is greater than the target's AV.
 * - If at least one singlet roll was greater than the target's AV, the attack penetrates one time (or one more time if this is a subsequent triplet). If all three singlet rolls were greater than the target's AV, reduce the PV value by 2, return to, and perform another triplet of rolls to determine if the attack penetrates an additional time. (Continue this loop, reducing PV by 2 each time, until at least one singlet fails to roll higher than the target's AV.)

In summary, the attack penetrates once for each triplet of rolls where at least one singlet was higher than the target's AV.

If all three rolls in the first triplet are equal to or lower than the target's AV, the attack fails to penetrate at all.

Damage Rolls
Melee physical damage is calculated by rolling the weapon damage times the total number of penetrations.

For example, if an attacker penetrates two times with a (4 2d2), the total damage is

If the weapon did not penetrate at least once, no damage is applied, and a message appears in the message log.

Example Attack Calculation
The creature being attacked is a with 2 AV and 9 DV. Our attacker is a with 14 (-1) strength, 18 (+1) agility and its bite, a 1d3 axe with no strength cap and no base penetration, as its only weapon; this bite, due to the strength modifier of the salamander, has a PV of -1. The salamander rolls a 15 for its bite’s hit roll, and the hit roll gets a +1 bonus from the salamander’s agility modifier; 16 is higher than the snapjaw’s 9 DV, so the attack hits.


 * Now the first triplet of penetration rolls occurs:
 * The first singlet within the triplet rolls 6 out of 10, which becomes 4 after the -2 is applied, and 3 after the -1 PV from the bite is applied; 3 is higher than the 2 AV the snapjaw has.
 * The next singlet rolls 10, which becomes 8 after the -2, prompting another roll, which is 6 and which after the -2 becomes 4, so the total is 12, and 11 after the -1 PV, which is more than the 2 AV.
 * The final singlet in the triplet rolls 7, which becomes 5 due to the -2 and 4 due to the -1 PV, which is more than the 2 AV.
 * All three singlets in the triplet exceeded the target’s AV, thus the attack penetrates at least once, and a new triplet is rolled with the -1 PV decreased to -3.


 * The second triplet occurs as follows:
 * The first singlet rolls 7, which becomes 5 due to the -2 and 2 due to the -3 PV, which is not more than the 2 AV of the target.
 * The second singlet rolls 9, which becomes 7 due to the -2 and 4 due to the -3 PV, which is more than the 2 AV of the target.
 * The final singlet rolls 4, which becomes 2 due to the -2 and -1 due to the -3 PV, which is not more than the 2 AV of the target.
 * Thus the attack penetrates an additional time, but not more.

As such, the attack penetrates twice, and the 1d3 of the bite is rolled twice; a 2 and a 3 are rolled, so the attack deals 2+3=5 damage.

= Critical Hits =

If the initial  roll that is part of the attacker's Hit Roll is a natural 20 (or if the weapon has the Masterwork mod and the Hit Roll is a natural 19 or 20), the attack is considered a critical hit. Critical hits have the following special qualities:
 * A critical hit always hits the target, even if the total Hit Roll is not greater than the target's DV.
 * This ensures that any attacker always has at least a 5% of hitting the opponent and applying on-hit effects.
 * The cap on strength's bonus to penetration is increased by 1 for this attack.
 * A critical hit performed specifically by the player (not any other creature) is guaranteed to penetrate at least one time and apply its damage, even if the penetration roll fails.

= Psionic Weapons =

Psionic weapons have the same to-hit calculation as normal weapons. However, their penetration mechanics differ in the following ways:
 * The attacker's penetration bonus is affected by the attacker's ego modifier instead of the attacker's strength modifier.
 * The attack penetration is rolled against the defender's mental armor (MA) instead of the defender's armor value (AV).
 * The one exception is AV provided by a shield. If the psionic attack is shield blocked, the shield's AV is added to the defender's MA for the purposes of calculating penetration defense.

= References =