[PR #6723] [MERGED] feat(game): numbers a condition changes in ruleset combat, check effects, one-use endings and levels #7297

Closed
opened 2026-10-23 04:18:23 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6723
Author: @kolacheee
Created: 9/26/2026
Status: ✅ Merged
Merged: 9/26/2026
Merged by: @kolacheee

Base: staging ← Head: feat/ruleset-combat-conditions


📝 Commits (3)

  • cbc5e06 feat(game): numbers a condition changes, check effects, one-use endings and levels
  • b47dc6d Merge remote-tracking branch 'origin/staging' into feat/ruleset-combat-conditions
  • d420587 docs(changelog): name the flat changes a condition makes to rolls and speed

📊 Changes

27 files changed (+2214 additions, -107 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 docs/development/game-rulesets-and-sheets-implementation.md (+37 -2)
📝 docs/development/ruleset-5e-2014.example.json (+16 -4)
📝 docs/examples/rulesets/ember-roads.json (+17 -0)
📝 docs/extending/ruleset.schema.json (+439 -1)
📝 docs/extending/writing-rulesets.md (+65 -14)
📝 docs/game/combat.md (+1 -1)
📝 packages/client/src/lib/ruleset-combat-log.ts (+57 -10)
📝 packages/client/src/localization/locales/en.json (+5 -0)
📝 packages/server/src/services/capability-packages/package-manager.service.ts (+45 -0)
📝 packages/server/src/services/game/ruleset-combat-director.service.ts (+1 -1)
📝 packages/shared/src/features/ruleset-combat/encounter.ts (+95 -6)
📝 packages/shared/src/features/ruleset-combat/index.ts (+16 -7)
📝 packages/shared/src/features/ruleset-combat/options.ts (+127 -19)
📝 packages/shared/src/features/ruleset-combat/resolve.ts (+107 -13)
📝 packages/shared/src/features/ruleset-combat/types.ts (+50 -4)
📝 packages/shared/src/schemas/capability-package.schema.ts (+7 -1)
📝 packages/shared/src/schemas/ruleset.schema.ts (+139 -13)
📝 scripts/generate-ruleset-schema.mjs (+65 -0)
📝 scripts/regressions/capability-package-lifecycle.regression.ts (+4 -4)

...and 7 more files

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #6719

Why this change

A ruleset's condition could only switch effects on from a closed list; it could not change a number. So Shield (+5 Armor Class), Bless and Bane (a d4 on attacks and saves), Slow and Haste (half or double speed) could not be written, and the 5e package keeps Shield off the menu for exactly that reason. Poisoned and Frightened make ability checks harder, and a fight now has checks (contests), but nothing reached them. A condition's clock only counted down at the end of its holder's turns, so "until the start of your next turn" lasted a turn too long, and "until its next attack" could not be said at all. And exhaustion, which the 5e sheet already counts on a track, did nothing in a fight. The author guide's Not yet section listed all of this. This is C5f of real ruleset combat (plan doc, § Real ruleset combat).

What changed

Capability API 1.45 (file keys: modifiers on a combat condition, levels in the combat block, the effects own-checks-advantage and own-checks-disadvantage, and duration.at and endsAfter on an applied condition). None of it names one game's words.

  • Numbers a condition changes. combat.conditions[].modifiers names what each one changes and by how much.
    • defense: a flat number, added to what an attack against the holder must reach.
    • attacks, saves, checks: a flat number, or dice rolled every time the roll is made (minus takes them away). saves on the condition narrows modifiers to saves as it already narrows the save effects.
    • speed: a flat change in the ruleset's own distance unit, or times 0.5 or 2, applied after the flat changes. Read only on a board, as speed-zero is.
    • Nothing is written into the combatant: each number is read with its modifiers where it is used, so resolving and the menu's chances agree. The log shows each modifier beside the roll it changed, with the condition's name ("5 + 7 + 3 (Blessed) = 15", "against Armor Class 23 (Shielded + 5)").
  • Checks. own-checks-advantage and own-checks-disadvantage roll the holder's side of a contest twice and keep one, where the ruleset rolls twice at all. The chance to win counts them and any modifier to checks.
  • Endings. duration: { rounds, at: "turn-start" } counts down as the holder's turns begin. endsAfter (own-attack, attacked, own-save) takes the condition off after the first of those, with its own log line. One that lasts an attack lasts the whole of it, its damage included, and a fresh one the same blow puts on stays. A turn's walk is read again after the clocks that run as it begins, so a condition that ends then no longer shortens that turn's walk (existing save-ends at turn start benefit too).
  • Levels. combat.levels: each names a plain live track, the level it starts at, and the effects, modifiers and failed saves it adds. Every level the track has reached counts as one of the holder's conditions, so they add up. A level cannot have an effect that needs a source or ends by itself, a wound track cannot have levels, one level is given once, and a level above a track's fixed top is refused as never reached.
  • Install gate: the ruleset keys, and an applied condition's new endings inline, in a catalog file or on a creature's action, each need 1.45. Published schema: regenerated, with hand patches for every new refinement.
  • Examples.
    • The 5e reference counts exhaustion's levels 1, 2, 3 and 5. Level 4 (half the hit point maximum) and level 6 (death) are not something a level can say yet. Poisoned and Frightened now make checks harder.
    • Ember Roads' Heat takes 1 off attacks from 3 and halves speed at 5, and Wounded is 1 easier to hit and 2 paces slower.
    • The 5e package adopts Bless, Bane, Vicious Mockery, Guiding Bolt, exhaustion, harder checks and Counterspell (#6712) in a Marinara-Agents release once this merges. Shield waits for the moment after a hit, the next slice, because taking it when an attack is aimed would spend it on attacks that miss.
  • Docs:
    • Author guide (docs/extending/writing-rulesets.md): the combat key list gains the new effects, "Numbers a condition changes" and levels, and the applied-condition text gains at and endsAfter. Not yet is updated: the stale bullets saying a condition cannot change a number, cannot touch checks and cannot come in levels are replaced by what is still missing (the moment after a hit, a damage bonus, a level that lowers a maximum or takes somebody out).
    • Player page (docs/game/combat.md), the plan doc's C5f notes, the shared resolver's header comment (which still said a condition could not change a number) and the CHANGELOG.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

Run by the agent on cbc5e0651 (this branch's one commit on staging 14773492f), all exit 0: pnpm check, pnpm localization:check, pnpm version:check, pnpm regression:node (403/403), pnpm ruleset:schema (no diff after regeneration), pnpm smoke:ui (7/7), and pnpm regression:ui e2e/game-combat-director.e2e.ts e2e/ruleset-wound-sheet.e2e.ts e2e/ruleset-live-states.e2e.ts --project=desktop-chromium --workers=1 (9/9, including both ruleset fights). Mobile projects were not run locally. Local CodeRabbit (CLI 0.8.1), six passes: nine findings. Seven were fixed:

  • a Not yet bullet still said no condition makes a contest easier or harder;
  • a doc comment sat on the wrong type;
  • a lane comment named the wrong die;
  • a docs example that was not valid JSON;
  • an ambiguous "used up" log line;
  • an older-gate fixture that kept the check effects;
  • a level above its track's fixed top, which is now refused.

The seventh fix changed behaviour: a one-attack condition was spent right after the attack roll, so a one-attack ward would not have covered that attack's damage. It now lasts the whole blow, and a fresh one the same blow puts on stays (a detail the suggested fix would have got wrong). Two were declined with reasons: the log reading a contest's kept dice back from its total (exact, and a new field would change every contest event C5d shipped), and the install gate also reading whileSourceInSight for the check effects (a gate list can only name effects the condition has, so effects already covers every file that imports).

  • New lane scripts/regressions/game-ruleset-combat-conditions.regression.ts covers:

    • every import refusal, and the published schema saying the same;
    • defense (the roll and the chance to hit), attacks with dice added and taken away, and saves narrowed by saves;
    • checks leaning and adding (the roll and the chance to win);
    • speed halved, and the walk back at the start of a turn when the clock says so;
    • each one-use ending;
    • levels on both examples, the log lines, and the 1.45 gate.

    Forty-six deliberate breaks were each caught, among them every refusal, the level threshold, save narrowing, both speed changes, each forecast, each roll's total, the minus sign, each one-use ending and when it is spent, the turn-start clock and the walk read again, every half of the 1.45 gate and the log's names. One first slipped through (the shortcut that skips conditions when nothing changes a number ignored levels), and a case on the shipped reference now catches it.

  • Older lanes are adjusted:

    • Lanes that prove older gates strip the 1.45 keys from the examples.
    • The lifecycle lane follows the new version, and the catalogs lane's package declares 1.45.
    • The contests lane follows the chance-to-win signature, which now reads conditions.
    • The scaled-rows lane's "no word level in Ember" guard skips the combat block's levels, which are rungs of Heat rather than a character level.

Still to verify by hand (not done by the agent):

  • In a Game Mode game on the 5e reference (or the 5e package once it adopts this) with a ruleset fight: give a party member the Poisoned condition and confirm Grapple's chance to win drops and the log shows two throws with the worse kept.
  • On Ember Roads, set a character's Heat to 3 on the sheet and confirm their attacks show "- 1 (Heat 3)" in the log, and at 5 on a Tactical board that their walk is halved. Give them Wounded and confirm an opponent's line shows the lower defense.
  • Check light and dark mode and mobile width on the log lines above.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

Docs touched:

  • docs/extending/writing-rulesets.md (not carried by docs-i18n)
  • docs/game/combat.md (carried by docs-i18n)
  • docs/extending/ruleset.schema.json
  • docs/examples/rulesets/ember-roads.json
  • docs/development/ruleset-5e-2014.example.json and docs/development/game-rulesets-and-sheets-implementation.md (internal)
  • CHANGELOG.md

Translations are batched into one [docs-i18n] issue after the last ruleset slice, by the maintainer's standing decision, so no per-PR issue is opened here.

UI evidence (if applicable)

None attached. What is new on screen is log text; the manual steps above cover it.

Summary by CodeRabbit

  • New Features
    • Conditions can modify defense, attacks, saves, checks, contests, and movement. Their effects appear in combat logs and forecasts.
    • Conditions can expire at the start of a turn or after a qualifying action. Track levels can apply cumulative effects, including escalating penalties.
    • Support added for Capability API 1.45 rulesets.
  • Documentation
    • Updated combat guides and ruleset examples to describe condition modifiers, expiration, and track-level effects.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/6723 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 9/26/2026 **Status:** ✅ Merged **Merged:** 9/26/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `feat/ruleset-combat-conditions` --- ### 📝 Commits (3) - [`cbc5e06`](https://github.com/Pasta-Devs/Marinara-Engine/commit/cbc5e06511bb922ebf4f8203ff554d8dfbd3cabc) feat(game): numbers a condition changes, check effects, one-use endings and levels - [`b47dc6d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b47dc6dcf03049d049fb2362275d84cd54395540) Merge remote-tracking branch 'origin/staging' into feat/ruleset-combat-conditions - [`d420587`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d420587247c827a2fcd23398785ef11889575306) docs(changelog): name the flat changes a condition makes to rolls and speed ### 📊 Changes **27 files changed** (+2214 additions, -107 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `docs/development/game-rulesets-and-sheets-implementation.md` (+37 -2) 📝 `docs/development/ruleset-5e-2014.example.json` (+16 -4) 📝 `docs/examples/rulesets/ember-roads.json` (+17 -0) 📝 `docs/extending/ruleset.schema.json` (+439 -1) 📝 `docs/extending/writing-rulesets.md` (+65 -14) 📝 `docs/game/combat.md` (+1 -1) 📝 `packages/client/src/lib/ruleset-combat-log.ts` (+57 -10) 📝 `packages/client/src/localization/locales/en.json` (+5 -0) 📝 `packages/server/src/services/capability-packages/package-manager.service.ts` (+45 -0) 📝 `packages/server/src/services/game/ruleset-combat-director.service.ts` (+1 -1) 📝 `packages/shared/src/features/ruleset-combat/encounter.ts` (+95 -6) 📝 `packages/shared/src/features/ruleset-combat/index.ts` (+16 -7) 📝 `packages/shared/src/features/ruleset-combat/options.ts` (+127 -19) 📝 `packages/shared/src/features/ruleset-combat/resolve.ts` (+107 -13) 📝 `packages/shared/src/features/ruleset-combat/types.ts` (+50 -4) 📝 `packages/shared/src/schemas/capability-package.schema.ts` (+7 -1) 📝 `packages/shared/src/schemas/ruleset.schema.ts` (+139 -13) 📝 `scripts/generate-ruleset-schema.mjs` (+65 -0) 📝 `scripts/regressions/capability-package-lifecycle.regression.ts` (+4 -4) _...and 7 more files_ </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue Closes #6719 ## Why this change A ruleset's condition could only switch effects on from a closed list; it could not change a number. So Shield (+5 Armor Class), Bless and Bane (a d4 on attacks and saves), Slow and Haste (half or double speed) could not be written, and the 5e package keeps Shield off the menu for exactly that reason. Poisoned and Frightened make ability checks harder, and a fight now has checks (contests), but nothing reached them. A condition's clock only counted down at the end of its holder's turns, so "until the start of your next turn" lasted a turn too long, and "until its next attack" could not be said at all. And exhaustion, which the 5e sheet already counts on a track, did nothing in a fight. The author guide's Not yet section listed all of this. This is C5f of real ruleset combat (plan doc, § Real ruleset combat). ## What changed Capability API **1.45** (file keys: `modifiers` on a combat condition, `levels` in the combat block, the effects `own-checks-advantage` and `own-checks-disadvantage`, and `duration.at` and `endsAfter` on an applied condition). None of it names one game's words. - **Numbers a condition changes.** `combat.conditions[].modifiers` names what each one changes and by how much. - `defense`: a flat number, added to what an attack against the holder must reach. - `attacks`, `saves`, `checks`: a flat number, or dice rolled every time the roll is made (`minus` takes them away). `saves` on the condition narrows modifiers to saves as it already narrows the save effects. - `speed`: a flat change in the ruleset's own distance unit, or `times` 0.5 or 2, applied after the flat changes. Read only on a board, as `speed-zero` is. - Nothing is written into the combatant: each number is read with its modifiers where it is used, so resolving and the menu's chances agree. The log shows each modifier beside the roll it changed, with the condition's name ("5 + 7 + 3 (Blessed) = 15", "against Armor Class 23 (Shielded + 5)"). - **Checks.** `own-checks-advantage` and `own-checks-disadvantage` roll the holder's side of a contest twice and keep one, where the ruleset rolls twice at all. The chance to win counts them and any modifier to checks. - **Endings.** `duration: { rounds, at: "turn-start" }` counts down as the holder's turns begin. `endsAfter` (`own-attack`, `attacked`, `own-save`) takes the condition off after the first of those, with its own log line. One that lasts an attack lasts the whole of it, its damage included, and a fresh one the same blow puts on stays. A turn's walk is read again after the clocks that run as it begins, so a condition that ends then no longer shortens that turn's walk (existing save-ends at turn start benefit too). - **Levels.** `combat.levels`: each names a plain live track, the level it starts at, and the effects, modifiers and failed saves it adds. Every level the track has reached counts as one of the holder's conditions, so they add up. A level cannot have an effect that needs a source or ends by itself, a wound track cannot have levels, one level is given once, and a level above a track's fixed top is refused as never reached. - **Install gate:** the ruleset keys, and an applied condition's new endings inline, in a catalog file or on a creature's action, each need 1.45. **Published schema:** regenerated, with hand patches for every new refinement. - **Examples.** - The 5e reference counts exhaustion's levels 1, 2, 3 and 5. Level 4 (half the hit point maximum) and level 6 (death) are not something a level can say yet. Poisoned and Frightened now make checks harder. - Ember Roads' Heat takes 1 off attacks from 3 and halves speed at 5, and Wounded is 1 easier to hit and 2 paces slower. - The 5e package adopts Bless, Bane, Vicious Mockery, Guiding Bolt, exhaustion, harder checks and Counterspell (#6712) in a Marinara-Agents release once this merges. Shield waits for the moment after a hit, the next slice, because taking it when an attack is aimed would spend it on attacks that miss. - **Docs:** - Author guide (`docs/extending/writing-rulesets.md`): the combat key list gains the new effects, "Numbers a condition changes" and `levels`, and the applied-condition text gains `at` and `endsAfter`. Not yet is updated: the stale bullets saying a condition cannot change a number, cannot touch checks and cannot come in levels are replaced by what is still missing (the moment after a hit, a damage bonus, a level that lowers a maximum or takes somebody out). - Player page (`docs/game/combat.md`), the plan doc's C5f notes, the shared resolver's header comment (which still said a condition could not change a number) and the CHANGELOG. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes Run by the agent on cbc5e0651 (this branch's one commit on staging 14773492f), all exit 0: `pnpm check`, `pnpm localization:check`, `pnpm version:check`, `pnpm regression:node` (403/403), `pnpm ruleset:schema` (no diff after regeneration), `pnpm smoke:ui` (7/7), and `pnpm regression:ui e2e/game-combat-director.e2e.ts e2e/ruleset-wound-sheet.e2e.ts e2e/ruleset-live-states.e2e.ts --project=desktop-chromium --workers=1` (9/9, including both ruleset fights). Mobile projects were not run locally. Local CodeRabbit (CLI 0.8.1), six passes: nine findings. Seven were fixed: - a Not yet bullet still said no condition makes a contest easier or harder; - a doc comment sat on the wrong type; - a lane comment named the wrong die; - a docs example that was not valid JSON; - an ambiguous "used up" log line; - an older-gate fixture that kept the check effects; - a level above its track's fixed top, which is now refused. The seventh fix changed behaviour: a one-attack condition was spent right after the attack roll, so a one-attack ward would not have covered that attack's damage. It now lasts the whole blow, and a fresh one the same blow puts on stays (a detail the suggested fix would have got wrong). Two were declined with reasons: the log reading a contest's kept dice back from its total (exact, and a new field would change every contest event C5d shipped), and the install gate also reading `whileSourceInSight` for the check effects (a gate list can only name effects the condition has, so `effects` already covers every file that imports). - New lane `scripts/regressions/game-ruleset-combat-conditions.regression.ts` covers: - every import refusal, and the published schema saying the same; - defense (the roll and the chance to hit), attacks with dice added and taken away, and saves narrowed by `saves`; - checks leaning and adding (the roll and the chance to win); - speed halved, and the walk back at the start of a turn when the clock says so; - each one-use ending; - levels on both examples, the log lines, and the 1.45 gate. Forty-six deliberate breaks were each caught, among them every refusal, the level threshold, save narrowing, both speed changes, each forecast, each roll's total, the minus sign, each one-use ending and when it is spent, the turn-start clock and the walk read again, every half of the 1.45 gate and the log's names. One first slipped through (the shortcut that skips conditions when nothing changes a number ignored levels), and a case on the shipped reference now catches it. - Older lanes are adjusted: - Lanes that prove older gates strip the 1.45 keys from the examples. - The lifecycle lane follows the new version, and the catalogs lane's package declares 1.45. - The contests lane follows the chance-to-win signature, which now reads conditions. - The scaled-rows lane's "no word level in Ember" guard skips the combat block's `levels`, which are rungs of Heat rather than a character level. Still to verify by hand (not done by the agent): - In a Game Mode game on the 5e reference (or the 5e package once it adopts this) with a ruleset fight: give a party member the Poisoned condition and confirm Grapple's chance to win drops and the log shows two throws with the worse kept. - On Ember Roads, set a character's Heat to 3 on the sheet and confirm their attacks show "- 1 (Heat 3)" in the log, and at 5 on a Tactical board that their walk is halved. Give them Wounded and confirm an opponent's line shows the lower defense. - Check light and dark mode and mobile width on the log lines above. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) Docs touched: - `docs/extending/writing-rulesets.md` (not carried by `docs-i18n`) - `docs/game/combat.md` (carried by `docs-i18n`) - `docs/extending/ruleset.schema.json` - `docs/examples/rulesets/ember-roads.json` - `docs/development/ruleset-5e-2014.example.json` and `docs/development/game-rulesets-and-sheets-implementation.md` (internal) - `CHANGELOG.md` Translations are batched into one `[docs-i18n]` issue after the last ruleset slice, by the maintainer's standing decision, so no per-PR issue is opened here. ## UI evidence (if applicable) None attached. What is new on screen is log text; the manual steps above cover it. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Conditions can modify defense, attacks, saves, checks, contests, and movement. Their effects appear in combat logs and forecasts. * Conditions can expire at the start of a turn or after a qualifying action. Track levels can apply cumulative effects, including escalating penalties. * Support added for Capability API 1.45 rulesets. * **Documentation** * Updated combat guides and ruleset examples to describe condition modifiers, expiration, and track-level effects. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:18:23 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#7297
No description provided.