[GH-ISSUE #6528] [Feature]: an opponent and the Game Master cannot pay a ruleset ability out of a higher pool #3658

Closed
opened 2026-10-21 06:05:39 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @kolacheee on GitHub (Sep 22, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6528

Originally assigned to: @kolacheee on GitHub.

What problem does this solve?

In a Game Mode fight resolved by a ruleset's own numbers, an ability may be paid for out of a higher pool than the one it names: a spell cast with a bigger slot, and the ruleset's own perCostStep saying what the extra buys. A player gets that choice on the menu, because RulesetCombatOption.payWith lists every pool the use could be paid from and the client asks which one.

Nobody else ever gets it. rulesetCandidatesFrom in packages/server/src/services/game/ruleset-combat-director.service.ts builds one candidate per option and never sets choice.payWith, so every candidate is the base cost. That is what the Engine's own picker chooses from when it plays an opponent, and it is also what the Game Master is shown when a boss is asked what to do. Neither can ever upcast.

The effect is quiet rather than broken: the action still resolves, at its base cost. An opponent written with a scaling spell simply never uses the scaling, and a Game Master told a boss has four third-level slots cannot spend one on a spell written at first.

Proposed solution

Give the candidate builder one candidate per eligible pool, so the picker and the Game Master choose between "cast it" and "cast it bigger" the way a player does.

Two things to settle while doing it:

  • The candidate cap. RULESET_WINDOW_CANDIDATE_LIMIT already cuts a Game Master's list at 24 by score, and a caster with four pools would multiply its own entries. The cut is by score, so the cheap version and the big version of the same spell compete on their forecast, which is probably right, but it deserves a look rather than an assumption.
  • What the score does with the price. rulesetCandidatesFrom already sums option.cost into cost, and an upcast candidate has to carry the price of the pool it actually spends rather than the base one, or the bigger version looks free.

Alternatives considered

Pick the largest affordable pool automatically. Rejected: a caster that always upcasts burns its best slots on its first turn, and the choice is exactly the kind of judgement the picker exists to make.

Leave it to the Game Master's own text. Rejected: the menu is the single source of legality in this system, so an answer naming a pool that is not on the menu is refused. The option has to exist before anybody can pick it.

Additional context

Found while reviewing #6525, which forwards at and payWith from a picked option into the answer the Game Master gives to a reaction window. The forwarding is correct and stays; the payWith half of it is inert today for the reason above, so that PR takes the inert line back out rather than leaving code that promises something which never arrives.

This is not specific to windows: it is the same gap on an ordinary turn.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @kolacheee on GitHub (Sep 22, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6528 Originally assigned to: @kolacheee on GitHub. ## What problem does this solve? In a Game Mode fight resolved by a ruleset's own numbers, an ability may be paid for out of a higher pool than the one it names: a spell cast with a bigger slot, and the ruleset's own `perCostStep` saying what the extra buys. A player gets that choice on the menu, because `RulesetCombatOption.payWith` lists every pool the use could be paid from and the client asks which one. Nobody else ever gets it. `rulesetCandidatesFrom` in `packages/server/src/services/game/ruleset-combat-director.service.ts` builds one candidate per option and never sets `choice.payWith`, so every candidate is the base cost. That is what the Engine's own picker chooses from when it plays an opponent, and it is also what the Game Master is shown when a boss is asked what to do. Neither can ever upcast. The effect is quiet rather than broken: the action still resolves, at its base cost. An opponent written with a scaling spell simply never uses the scaling, and a Game Master told a boss has four third-level slots cannot spend one on a spell written at first. ## Proposed solution Give the candidate builder one candidate per eligible pool, so the picker and the Game Master choose between "cast it" and "cast it bigger" the way a player does. Two things to settle while doing it: - **The candidate cap.** `RULESET_WINDOW_CANDIDATE_LIMIT` already cuts a Game Master's list at 24 by score, and a caster with four pools would multiply its own entries. The cut is by score, so the cheap version and the big version of the same spell compete on their forecast, which is probably right, but it deserves a look rather than an assumption. - **What the score does with the price.** `rulesetCandidatesFrom` already sums `option.cost` into `cost`, and an upcast candidate has to carry the price of the pool it actually spends rather than the base one, or the bigger version looks free. ## Alternatives considered **Pick the largest affordable pool automatically.** Rejected: a caster that always upcasts burns its best slots on its first turn, and the choice is exactly the kind of judgement the picker exists to make. **Leave it to the Game Master's own text.** Rejected: the menu is the single source of legality in this system, so an answer naming a pool that is not on the menu is refused. The option has to exist before anybody can pick it. ## Additional context Found while reviewing [#6525](https://github.com/Pasta-Devs/Marinara-Engine/pull/6525), which forwards `at` and `payWith` from a picked option into the answer the Game Master gives to a reaction window. The forwarding is correct and stays; the `payWith` half of it is inert today for the reason above, so that PR takes the inert line back out rather than leaving code that promises something which never arrives. This is not specific to windows: it is the same gap on an ordinary turn. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
Author
Owner

@kolacheee commented on GitHub (Sep 22, 2026):

Being folded into the slice that follows https://github.com/Pasta-Devs/Marinara-Engine/pull/6525 rather than handled on its own, at the maintainer's direction.

That slice's candidate builder now emits one candidate per way of paying: the base cost, and one for each pool the ability could be upcast out of. Each carries the pool in choice.payWith, the forecast the extra steps actually buy (perCostStep times the steps), a label naming the pool so a Game Master reading the menu can tell two entries apart, and a price that counts the steps as well as the amount, because one pool of a higher rung is worth more than one of a lower and without that the bigger version reads as free.

<!-- gh-comment-id:5774394679 --> @kolacheee commented on GitHub (Sep 22, 2026): Being folded into the slice that follows https://github.com/Pasta-Devs/Marinara-Engine/pull/6525 rather than handled on its own, at the maintainer's direction. That slice's candidate builder now emits one candidate per way of paying: the base cost, and one for each pool the ability could be upcast out of. Each carries the pool in `choice.payWith`, the forecast the extra steps actually buy (`perCostStep` times the steps), a label naming the pool so a Game Master reading the menu can tell two entries apart, and a price that counts the steps as well as the amount, because one pool of a higher rung is worth more than one of a lower and without that the bigger version reads as free.
Author
Owner

@kolacheee commented on GitHub (Sep 24, 2026):

A correction to this issue's premise, found in review of https://github.com/Pasta-Devs/Marinara-Engine/pull/6608.

The title says an opponent and the Game Master cannot pay a ruleset ability out of a higher pool. That is true, but not for the reason this issue gives, and #6608 does not change it. An opponent is a stat block, and a block's actions cost nothing off any pool: planRulesetCombatCost returns null for any combatant without a sheet when a pool is named. So an opponent, and a Game Master's boss, has no bigger way of paying to be offered at all.

The gap that was real is a party member handed to the Engine to play. That character has a sheet and pools, and the Engine's own picker only ever offered it the base cost, so it never cast a spell that grows any bigger. That is what #6608 fixes, with a candidate per way of paying, and a regression now pins that an opponent's actions cannot be paid out of any pool.

Giving stat blocks pools of their own would be a change to the ruleset format rather than a picker fix, and nothing here asks for it. If that is wanted, it deserves its own issue.

<!-- gh-comment-id:5812764237 --> @kolacheee commented on GitHub (Sep 24, 2026): A correction to this issue's premise, found in review of https://github.com/Pasta-Devs/Marinara-Engine/pull/6608. The title says an opponent and the Game Master cannot pay a ruleset ability out of a higher pool. That is true, but not for the reason this issue gives, and #6608 does not change it. An opponent is a stat block, and a block's actions cost nothing off any pool: `planRulesetCombatCost` returns `null` for any combatant without a sheet when a pool is named. So an opponent, and a Game Master's boss, has no bigger way of paying to be offered at all. The gap that was real is a **party member handed to the Engine to play**. That character has a sheet and pools, and the Engine's own picker only ever offered it the base cost, so it never cast a spell that grows any bigger. That is what #6608 fixes, with a candidate per way of paying, and a regression now pins that an opponent's actions cannot be paid out of any pool. Giving stat blocks pools of their own would be a change to the ruleset format rather than a picker fix, and nothing here asks for it. If that is wanted, it deserves its own issue.
Author
Owner

@kolacheee commented on GitHub (Sep 24, 2026):

Follow-up filed as https://github.com/Pasta-Devs/Marinara-Engine/issues/6610: let a stat block carry the ruleset's own parameters (pools, tracks, fields, skills, and whatever the ruleset declares as health and defense) instead of a fixed shape. That is what would let an opponent pay out of a pool at all, whoever plays it, and it takes the wound-track and several-defenses limits with it.

<!-- gh-comment-id:5813150651 --> @kolacheee commented on GitHub (Sep 24, 2026): Follow-up filed as https://github.com/Pasta-Devs/Marinara-Engine/issues/6610: let a stat block carry the ruleset's own parameters (pools, tracks, fields, skills, and whatever the ruleset declares as health and defense) instead of a fixed shape. That is what would let an opponent pay out of a pool at all, whoever plays it, and it takes the wound-track and several-defenses limits with it.
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#3658
No description provided.