Disabling the input via the disabled attribute blocks keydown events
entirely, so players couldn't type 'restart' or 'undo' after reaching an
ending. Switch to a CSS class for the faded visual state; the keydown
handler already restricts post-end input to those two commands.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Ending-kind lines get a separator and italic styling. Once endedWith is
set, the terminal disables the input and rejects all commands except
restart and undo.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
After each state-mutating dispatch, evaluate world.endings in priority
order (true > wrong > bad). The first whose whenFlags are all satisfied
sets state.endedWith and appends a kind:'ending' transcript line. Once
ended, further dispatches return a "story has ended" narration.
Also update test-world fixtures and placeholder ending markdown files
to use whenFlags: { _never: true } instead of {} so that vacuously-true
empty flags don't accidentally fire on every successful turn.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Verifies blocked movement, key-permitted passage, and that the key is
not consumed by passing through.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
light X with Y validates the named instrument and reuses handleLight.
use X / use X on Y route through the encounter dispatcher; if no encounter
consumes it, the dispatcher narrates the fallback. The encounter matcher
also rejects transitions whose required item doesn't match the typed
instrument, so a mistyped instrument fails cleanly.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
\`light X\` finds a lighter (item with lighter:true and remaining state.uses)
in inventory, decrements its charges, and toggles target.state.lit. The
target's litText / extinguishedText / the lighter's lighterEmptyText
provide narration. Refuses politely on each error path.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Adds the new schema flags and per-state body sections so the dispatcher's
new verb handlers have content to narrate.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Existing items with no body sections continue to load unchanged. New items
can author per-state prose in dedicated sections; the dispatcher will read
these in subsequent commits.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Optional fields used by the new read/light/extinguish dispatcher branches.
Loader updates and dispatcher logic follow.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sets pendingDisambiguation on state and emits "Which X — A, or B?" using
each candidate item's short text. The existing disambiguation reply path
then re-issues the original verb against the chosen target.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Enables `light lamp with matches`, `use shears on vines`, and similar
multi-noun forms. Both the target and indirect noun must resolve;
otherwise the command falls back to unknown-noun.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Replaces the previous behavior of returning unknown-noun. The dispatcher
will use this in the next commit to prompt the player to disambiguate.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Allows `look at lamp`, `examine the letter`, `take a key`, `take an oil lamp`.
Stop-words are only removed from the head of the noun phrase, not from
anywhere in the middle.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Previously, clicking the theme button updated localStorage and the DOM but
not state.theme, so the engine's `theme` meta-verb toggled from stale state.
Theme is now exclusively UI/storage concern. Old saves with the field still
load; the field is silently ignored.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Drops redundant string[] casts in dispatcher paths and prepares the
TranscriptLine kind for the ending-screen render path.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Hard prereqs from halfstreet-followon-notes plus should-fix items.
Polish items deferred. Phase 2 (full bible content draft) follows after
this lands.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>