Choice Effects (Choose: A OR B)
When to use
- •Adding an event card whose
effectstarts withChoose: - •Debugging a Choose card where meters didn’t change
- •Refactoring the effect parser or
PlayCardModal
Outcome
After applying this skill, a Choose-based event card will:
- •prompt the player to pick one option in the modal,
- •pass the chosen option through the UI callback chain,
- •apply the meter delta in
useGameState.playCard, - •record narration that includes the chosen option.
Contract (hard rules)
Effect string encoding
Encode choices like:
- •
Choose: +1 Tension OR +1 Coherence. <optional flavor sentence>
Rules:
- •Use literal
Choose: - •Use uppercase
ORas the delimiter - •Each option must be parseable by the engine’s substring checks (e.g.,
+1 Tension,-1 Coherence)
Plumbing contract
- •
PlayCardModalmust passchosenEffectto itsonConfirm - •
GameplayScreenmust passchosenEffecttoonPlayCard - •
useGameState.playCardmust acceptchosenEffectand apply it for Choose events
Procedure
- •
Find Choose cards
- •Search
src/data/gameContent.tsforChoose:.
- •Search
- •
Verify effect format
- •Ensure it matches:
Choose: <opt> OR <opt>. ... - •If not, fix content first.
- •Ensure it matches:
- •
Confirm modal prompts for choice
- •In
src/components/game/PlayCardModal.tsx, derivechoiceOptionsfromcard.effect. - •Render a selection control (radio group) and block confirm until selected.
- •In
- •
Plumb the chosen option
- •Update callback signatures:
- •
PlayCardModal.onConfirm(..., chosenEffect) - •
GameplayScreen.onPlayCard(..., chosenEffect) - •
useGameState.playCard(..., chosenEffect)
- •
- •Update callback signatures:
- •
Apply the chosen effect
- •In
useGameState.playCard, ifcard.type === 'event'andcard.effect.includes('Choose:'), parse deltas fromchosenEffect. - •Keep meter caps $[0,10]$.
- •In
- •
Update documentation
- •Update
.github/instructions/game-content.instructions.mdand.github/instructions/game-state.instructions.md. - •Update
docs/PROJECT_REFERENCE.mdif it describes choice behavior.
- •Update
- •
Verify
- •
npm run lint(warnings OK; no errors) - •
npm run build - •Manual smoke: play a Choose event and confirm the selected meter changes.
- •
Helper script
- •Run scripts/check-choose-effects.cjs to validate
Choose:effect strings insrc/data/gameContent.ts.