Skip to content

A trap, a fall and a poison name themselves on their roll card, where their dice read as the roll of the character they landed on, and every attack or damage roll says who or what made it (#915, ruling 2) - #1068

Open
Smoebo wants to merge 2 commits into
Lebbitheplow:mainfrom
Smoebo:refactor/roll-door-sources

Conversation

@Smoebo

@Smoebo Smoebo commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Part five of #915: your ruling 2. Built on #1063 (part four): this branch holds that pull request's commit and one more. Review the last commit, or wait for #1063 to merge and I will rebase.

What a table sees

A roll nobody at the table made was stored with no roller, so its card put the character it hurt in front. It now names its source, and the character is its target:

Before Now
A trap's damage Aria · Damage (Spiked Pit (2d10 piercing) on Aria) Spiked Pit · Damage (2d10 piercing on Aria)
A trap's attack Aria · Attack roll (Poison Darts attacks (vs AC 16) on Aria) Poison Darts · Attack roll (Attack vs Aria, AC 16)
A fall Aria · Damage (30 ft fall (3d6 bludgeoning) on Aria) The fall · Damage (30 ft, 3d6 bludgeoning on Aria)
A potion of poison Aria · Damage (Potion of Poison: it was poison) Potion of Poison · Damage (3d6 poison on Aria)
A hazard the GM names Aria · Damage (a gout of flame vs Aria) a gout of flame · Damage (2d6 fire on Aria)
Dice the AI sends for harm Aria · Damage (falling rubble vs Aria) falling rubble · Damage (2d6 bludgeoning on Aria)
Harm nothing names Aria · Damage (Effect vs Aria) The GM · Damage (2d6 fire on Aria)
  • The same holds for a creature caught by a trap or a fall, in cinematic mode's toast and chronicle line, and in GAME STATE.
  • "The fall" and "The GM" are read in the table's language ("La chute", "Le MJ"). A trap or a hazard keeps the name it was given.
  • The post-fight summary no longer counts a trap's natural 20 against a character as that character's natural 20.
  • Three cards no longer say a character's name twice (an improvised action's damage, Full Throttle ending, a spirit's turn ending inside something): "Aria · Damage (Aria: Full Throttle ends)" is "Aria · Damage (Full Throttle ends)".
  • The Grasping Arrow's brambles are the archer's roll. They named nobody.

Five things to look at first

  1. The stored shape. A roll's attacker gains a fourth kind: { kind: "hazard", id: null, name, hazard }. LastHit already had kind: "hazard" with no id for a fall. The new part is hazard, which says what the source is: fall, gm, trap, item, effect or named. No migration: old rows are untouched, and old hit records without the field still read. I added the field because test-text-comparisons refused my first version, which told "The fall" from a trap by its name.
  2. An attack or damage roll can no longer be typed with no attacker (RollInsert, recordRoll, rollCard). That is how the 47 sites in 36 files were found, and a branch in flight that passes null for one will stop compiling: it needs sheetAttacker, enemyAttacker or a source from src/lib/roll-sources.ts. insertRoll has no check at run time, so a test script can still write one.
  3. Who each site names. A character's own feature or cost (Overchannel, Violent Attraction, an improvised action) names the character, which reads as before. A trap, a potion and a hazard the GM named name themselves. A fall is the fall, a pit's fall too, and its spikes are the pit's. Harm with no creature and no name is the GM's. Later damage of a spell (Acid Arrow's second burn, a curse's rider) is its caster's roll, a creature's as well as a character's, and the spell's own once neither is at the table.
  4. request_roll with a character still names that character. That tool asks a roll of a character, and on real dice it parks as their own card. So a GM who rolls a trap's damage that way and then sends apply_damage with the amount still gets "Aria · Damage (falling rocks)". The roll cannot tell the two intents apart. I left it and would like your ruling: should a damage roll asked that way name the GM unless the call says whose it is?
  5. A hit's record and its roll. Where one site writes both, the record is handed the roll's source (a missile with no caster, a save's damage from a hazard). apply_damage's record is built by the same builder from the same arguments as its dice. Two cases still differ, both as before: a creature's save spell is on record as that spell's effect while its roll names the creature, and the two-call path in item 4.

What changes in the code

  • src/lib/roll-sources.ts (new) builds every source. A test in test-roll-labels.mjs fails if any other file under src/ writes one out.
  • Five helpers in roll-card.ts put a source's roll on record (sourceDamage, sourceDamageThrown, sourceAttack, castDamage, castersDamage). They word it in one place from what was thrown and on whom (roll-labels.ts thrownOn, attackOn), so no site writes that sentence.
  • A site that knows what its harm is hands that value on. apply_hazard builds its source once and passes it to the save it asks of a character (handleCastAtPlayer) and to the trap it springs on a creature (springOnEnemy). A test caught the reason: a trap's darts and its poison came out as two kinds of source.
  • roll-labels.ts words a fall and the GM's dice by the field. rollerName does the same in English for GAME STATE, the beats and the record line; ask.ts now reads it.
  • roll-stage-logic.ts tells sources apart by what they are and their name, so a trap's damage joins that trap's attack and no other's.
  • The sweep's roller check also holds a sourced roll: its kind is a known one, the source is not said a second time, and it names the character it lands on. A hazard's own row may not name that character as the roller.

The ledger

Before After
Sweep runs that fail a check of their record 69 35
of those, roller 34 0
of those, home 35 35

The files and counts are unchanged (7 files, the requests family). The 35 runs left are that family's.

Not covered

  • A source named in words that repeat the spell says it twice. cast_at_player with source "the hag's Fireball" and spell "Fireball" reads "the hag's Fireball · Damage (Fireball, 8d6 fire on Aria)". Dropping it would mean reading the name, which the guards refuse. Issue Roll cards build their text from a sentence each site writes by hand: a proposal to store a roll's parts instead, and what ruling 2 of #915 will do until then #1064 is the real answer.
  • An unnamed hazard's or trap's roll is "The GM". Its hit record keeps the words it had ("a trap", "the hazard", "the effect", "the harm").
  • A source's name is kept to 80 characters, where a reason kept 200 in the hit's record.
  • A hit's record of a spell cast with no source now names the spell ("from Burning Hands", was "from the effect"). The storyteller reads that line.
  • Pre-existing, found while reading, not fixed here: apply_hazard leaves two open hit records for one save's damage. The damage it applies inside counts as called on its own, so apply_damage writes a record, and the save path writes a second. I can open an issue or a pull request for it.
  • French: "Attack", "AC", "ft" and a note such as "second burn" stay English, as the old wording did.
  • Trap attack wording says attack twice: "Attack roll (Attack vs Aria, AC 16)".
  • castAtPet does not take the trap flag, so a trap at a pet is a hazard by its name.
  • No screenshots, and I did not look at a card in a browser or the app shell. The card's component is unchanged; its text is not.
  • No run against a real model.

Tests

  • scripts/test-enforce-roll-attacker.mjs: 40 cases, 13 new and two rewritten. A trap's attacks and damage on a character and on a creature; a pit's fall and its spikes; one hazard naming one source for the character and the creature it catches, named, unnamed, and as a trap; a trap cast_at_player is told of; a spell with no creature behind it, with and without a named source; a missile with no caster, whose hit record names the same source as its roll; dice the GM sends, whose hit record names the same source; an area with no creature; an improvised action; a damage card rolled on real dice; and the helpers' wording, case by case.
  • scripts/test-enforce-damage-cards.mjs: five cases rewritten. They pinned "no attacker" for Overchannel, Contact Other Plane, a fall, a potion of poison and harm to an object.
  • scripts/test-roll-labels.mjs: four new. The source in front on every surface; the two unnamed sources worded by the field in English and French, whatever their stored name says; the summary's natural 20; and the guard on who may write a source out.
  • scripts/test-enforce-ai-gates.mjs, scripts/test-roll-stage.mjs and scripts/test-enforce-sweep-clauses-martial-fighter.mjs: one case each (the AI's dice, sources on the dice stage, the brambles).
  • With the source as it was before this commit, 26 of these fail.
  • scripts/test-enforce-sweep-dice-sites.mjs: 34 runs are struck from rows.
  • test-text-comparisons and test-name-lookups pass with no entry added to either list.
  • Not held by a test: a poison's later turns, both trap escapes' bites, both fissure falls, a hazard at a pet, harm to an object with a reason, an area with a spell and no caster, request_roll attack or damage with no character, a held roll card's own insert, the departed-caster branch at each of its seven sites (the helper is tested directly), and the roller at Violent Attraction, Counter Intrusion, the cyberpunk and horror features and Full Throttle. The type checker holds that each names someone; nothing holds that it is the right one.
  • Three readers went through this cold before it was opened, one per version. The first found a wrong roller and doubled names; the second found sources still built by hand and a field set by which code path ran; the third found the loose ends listed above. The last small set of fixes was not read cold.
  • npm test on Windows: 1,262 of 1,268 files passed, run one line before this commit. The line it lacked: the sweep's own list still named hurlReturn as a site that throws its own dice, which now go through a helper, so test-enforce-sweep-dice-sites failed; with the entry struck it passes (550 enforced), run alone. Of the other five, four fail on main on my machine for its own setup: test-backup-in-app and test-backup-restore (Git Bash's tar reads C: as a host), test-enforce-last-combat and test-enforce-monster-blocks (no sqlite3 command). test-addons-parts could not rename a temporary file during the full run (EPERM) and passes alone.
  • tsc, lint on the changed files and npm run build pass on this commit. The build ran against the Next.js my checkout has installed (16.4.1), not the 16.4.6 the repository pins.

Related: #1064 proposes storing a roll's parts in place of a sentence each site writes, which would remove the wording limits above.

Checks

  • npm run lint, npm test and npm run build pass, and the change has a test that fails without it. (Lint on the changed files, tsc and the build pass. npm test: see Tests.)
  • Anything a player sees has screenshots below: the website and the app, day and night themes, phone width. (None yet. Roll cards read differently: see the table.)
  • No hostnames, IP addresses, logs, keys, .env files or players' names in the code, the tests or this description.

Settings, options and controls

  • This adds no new setting, toggle, option or other control.

🤖 Generated with Claude Code

Smoebo and others added 2 commits November 21, 2026 09:08
…le on the line they post, and a rest's hit dice, the stable wait's d4, an item's charges at dawn and the dice a call rolls as it opens a fight are on that call's turn

The opportunity, clock and initiative families of the roll-record ledger move onto recordRoll (issue Lebbitheplow#915, part four).

An opportunity strike posts a line of its own in a GM call and out of one, as a death save does, and nothing draws cards from the short turn the strike opens. So the line is the home of the strike's cards: its attack and damage are recorded with home "line", and the line lists them and then the public rolls the blow went on to make on the short turn (a rider's save). A death save's line lists the save, and the die of the stable wait a third success or a Periapt of Wound Closure rolls.

At a table a person runs, a roll that held its call is listed on the line the call posts once it lands. One that a line of its own already carries stays on that line alone (persons-record.ts, messages.ts lineCarriesRoll).

A character's opportunity swing, death save and Stealth as an ambush opens come through rollCharacterD20, so dice the player entered at the table are on record and sent as theirs.

The clock's dice (hit dice, the stable wait's d4 from stabilize, a knockout or a rage that ends at 0, an item's charges, a Ring of Regeneration) and a character's initiative and Stealth as a fight opens join the turn of the GM call that rolled them. On an AI's turn the custom rolls among them are stamped spent as that call ends, as every die of the engine's own is. Rolled where no call runs, they are on no turn, as before.

The ledger reads 7 files (store 4, send 5, join 2). 14 sweep runs are struck from its rows: 69 are left, none failing "sent".

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…card, where they read as the roll of the character they landed on, and every attack or damage roll says who or what made it

Ruling 2 of issue Lebbitheplow#915: a roll nobody at the table made names its source, and the character it lands on is its target.

A roll's attacker gains a fourth kind, "hazard", with no id, a name, and a field that says what it is: a fall, the GM's own dice for harm nothing names, a trap, an item, the effect of a spell or feature, or a hazard by the words the GM gave it. A hit's record already had that kind for a fall (last-hit.ts) and now carries the field too. Nothing reads what a source is from its name. A source that was given a name shows it in front of its rolls; a fall and the GM's own dice are worded there by the field, in the table's language.

Every source is built in one module (src/lib/roll-sources.ts), and a test holds that no other file writes one out. A site that knows what its harm is hands that value on, so it is not read back from words further in: apply_hazard builds its source once and passes it to the save it asks of a character and to the trap it springs on a creature, and a trap's darts and its poison name the same trap. Where one site writes both a roll and the hit's record, the record is handed the roll's source; apply_damage's record is built by the same builder from the same arguments as its dice. A creature's save spell stays on record as that spell's effect, as it was, while its roll names the creature.

A source's roll is put on record by five helpers in roll-card.ts (sourceDamage, sourceDamageThrown, sourceAttack, castDamage, castersDamage), which word it in one place from what was thrown and on whom, so the source goes in front of the card and is not said again: "Spiked Pit · Damage (2d10 piercing on Aria)", "The fall · Damage (30 ft, 3d6 bludgeoning on Aria)". Dice the GM sends for harm name the words given for it: "falling rubble · Damage (2d6 bludgeoning on Aria)", and name a creature they land on as the table may read it. The roll tools' free text keeps the words the GM typed.

The type of an attack or damage roll no longer allows a missing attacker (insertRoll, recordRoll, rollCard), so the type checker listed every site: 47 in 36 files. A character's own feature or spell names the character, which reads as before; three of those cards no longer say the character's name twice. A roll card's own damage dice and the roll tools' free text name the character they were asked of, else the GM. Later damage of a spell is its caster's roll, a creature's as well as a character's, and the spell's own once neither is at the table. The Grasping Arrow's brambles are the archer's roll.

The dice stage tells sources apart by what they are and their name, so a trap's damage joins that trap's attack and no other's.

The dice-site sweep's "roller" check also holds every sourced roll it reaches: the source says what it is, is not said a second time, and the roll names the character it lands on; and a hazard's own row may not name that character as the roller. The 34 runs listed as failing "roller" pass and are struck from the ledger's rows: 35 are left, all "home", the requests family's.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant