Parry, Dodge, and Multi-Attack Mechanics
Overview
- The combat loop only evaluates defensive reactions when a physical hit (damage type
TYPE_HITor higher) would land on an opponent other than the attacker and the defender is not paralyzed; a successful parry, shield block, or dodge ends the attack early and prevents the strike from dealing damage.【F:src/fight.c†L1009-L1023】 - Player characters rely on their learned skill percentages for parry, shield block, and dodge, while non-player characters use level-based caps or offensive flags to determine their defensive and offensive multipliers.【F:src/fight.c†L1755-L1913】【F:src/handler.c†L300-L360】
Defensive reactions
Parry
- A defender must be awake and, if a player, have a weapon wielded to attempt a parry; NPCs can parry bare-handed. The success chance is half the parry skill (for PCs) or
min(30, level)(for NPCs), further adjusted by the level difference between defender and attacker.【F:src/fight.c†L1763-L1778】 - Successful parries display combat feedback when either participant has
PLR_SHOWDEFENSEenabled, and the defender gets a skill-improvement check using the parry multiplier of 6.【F:src/fight.c†L1780-L1793】 - Learning parry requires level 22/20/13/1 for mage, cleric, thief, and warrior respectively; its practice rating of 8/8/6/4 means warriors pay the least training cost.【F:src/const.c†L2756-L2762】
Shield block
- Shield block also requires the defender to be awake and to have a shield equipped. Players roll against half their shield-block skill, NPCs against
min(30, level); failure ends the routine early.【F:src/fight.c†L1805-L1823】 - Certain incoming weapons limit the block: flails automatically bypass shields, whips require an additional halved roll, and axes run a full-skill contest that can fail if the attacker’s check succeeds.【F:src/fight.c†L1824-L1857】
- Like parry, shield block emits optional defense messages and offers practice improvement, and it is available to every class from level 1 with practice ratings 6/4/6/2 for mage through warrior.【F:src/fight.c†L1861-L1875】【F:src/const.c†L2631-L2636】
Dodge
- Dodge has no equipment requirement beyond being conscious. Players use half their learned dodge skill, NPCs use
min(30, level), and success prevents all damage from the attack.【F:src/fight.c†L1888-L1898】 - As with the other defenses, participants can opt-in to visible messages through
showdefense, which toggles thePLR_SHOWDEFENSEflag for parry/block/dodge announcements.【F:src/fight.c†L1899-L1913】【F:src/act_info.c†L1032-L1045】 - Dodge is learned at levels 20/22/1/13 for mage, cleric, thief, and warrior, with practice ratings of 8/8/4/6.【F:src/const.c†L2721-L2726】
Skill growth
- Whenever a defensive check succeeds, the defender runs
check_improvewith a multiplier of 6, giving an Intelligence-scaled chance to raise the skill on success or failure if prerequisites are met.【F:src/fight.c†L1788-L1911】【F:src/skills.c†L856-L905】
Additional attacks per round
Player attack sequence
- The
multi_hitroutine handles all extra swings for player characters: after the initial attack, haste grants an immediate extra hit, then second attack triggers with probabilityskill/2, and third attack withskill/4, each terminated if the victim is no longer fighting the attacker or if the action was a backstab.【F:src/fight.c†L372-L421】 - Successful rolls call
check_improvewith multipliers 5 (second attack) and 6 (third attack), allowing steady advancement for frequently used skills.【F:src/fight.c†L403-L417】
NPC attack sequence
- NPCs use the same base logic inside
mob_hit, including area attacks and haste/OFF_FASTbonuses before evaluating second and third attack chances.【F:src/fight.c†L424-L476】 - The
get_skillhelper supplies synthetic skill percentages for NPCs based on level and offensive flags: parry and dodge grantlevel*2, shield block10 + 2*level, second attack10 + 3*levelfor warrior/thief mobs, and third attack4*level - 40for warrior mobs.【F:src/handler.c†L300-L319】
About a “fourth attack”
- The codebase defines no fourth-attack skill (
gsn_fourth_attackdoes not exist), so additional strikes come only from haste, kick, or other specials. Builder documentation hints that using kick can functionally add a fourth blow per round, reflecting the lack of a dedicated passive skill.【F:area/pirat.are†L1444-L1452】
Skill availability and training costs
The skill table stores both the minimum level and the practice rating (higher numbers mean more practices per percent) for each class. HI_LVL (60) marks levels beyond what standard classes can normally reach, so a HI_LVL entry effectively denies the skill to that class.【F:src/const.c†L2631-L2799】【F:src/merc.h†L144-L171】
| Skill | Mage | Cleric | Thief | Warrior | Practice cost (Mage/Cleric/Thief/Warrior) |
|---|---|---|---|---|---|
| Shield block | 1 | 1 | 1 | 1 | 6 / 4 / 6 / 2【F:src/const.c†L2631-L2636】 |
| Dodge | 20 | 22 | 1 | 13 | 8 / 8 / 4 / 6【F:src/const.c†L2721-L2726】 |
| Parry | 22 | 20 | 13 | 1 | 8 / 8 / 6 / 4【F:src/const.c†L2756-L2762】 |
| Second attack | 30 | 24 | 12 | 5 | 10 / 8 / 5 / 3【F:src/const.c†L2784-L2789】 |
| Third attack | HI_LVL | HI_LVL | 24 | 12 | 0 / 0 / 10 / 4 (0 = untrainable)【F:src/const.c†L2792-L2798】 |
- Because shield block has universal access at level 1, new warriors can combine it with parry (available immediately) to cover weapon and shield defenses before investing in dodge, which requires level 13 for them.【F:src/const.c†L2631-L2762】
- Mages and clerics reach defensive parity later; their access to second attack is also delayed (levels 30 and 24) compared with martial classes, reflecting their support focus.【F:src/const.c†L2721-L2789】