MeleeProcedure
MeleeProcedure orchestrates attacker-side melee strikes. It composes a basic TN from the composer, exports a two-choice defender prompt (Standard vs Full Defense), and renders contested outcomes plus resistance prep on hit.
Role in the system
- Attacker-side melee action; defender is a MeleeDefenseProcedure.
- Uses MeleeService to pre-plan a strike and to prepare damage resistance steps.
- Exports a responder UI that asks the defender to choose Standard or Full defense.
- Uses lockPriority: "advanced"; only one melee flow per actor at a time.
Responsibilities
- Precompute (optional): MeleeService.planStrike to snapshot a DamagePacket.
- Execute: standard lifecycle; expires local contests after roll.
- Defense hint: provides UI label and default TN hint for the defender.
- Contest export: builds next step with
next.kind: "melee-standard"(UI may switch to full). - Resistance prep: builds ResistanceProcedure input via MeleeService.prepareDamageResolution.
Typical flow
- Setup: attacker + melee weapon bound.
- Optional precompute:
precompute({ defender?, situational? }). - Compose: user adjusts TN and dice; no recoil/range automation here.
- Execute: attacker rolls; results published.
- Contest: export asks defender to pick Standard or Full defense.
- Resolution: on success, build damage resistance prep for the target.
API reference
precompute({ defender?, situational? }): Snapshot a DamagePacket for later resistance.getDefenseHint(): Returns{ type: "skill", key: "melee", tnMod: 0, tnLabel: "Melee difficulty" }.async getResponderPromptHTML(exportCtx): Renders defender choice buttons.buildDefenseProcedure(exportCtx, { defender, contestId, responderKey, defenseHint? }):- Hydrates basis from
defenseHint(attribute or skill) via StoreManager. - Creates
MeleeDefenseProcedurewith mode"standard" | "full".
- Hydrates basis from
exportForContest(): Returns{ familyKey: "melee", weaponId, weaponName, damage?, tnBase, tnMods, next: { kind: "melee-standard", ui, args } }.buildResistancePrep(exportCtx, { initiator, target }): Returns{ familyKey: "melee", weaponId, weaponName, ... }from MeleeService.async renderContestOutcome(exportCtx, ctx): Attacker/defender summaries + roll HTML + winner message.