fix: lit-light transfer, torch sprite dialogs and Momentum first term (#134, #137, #138) - #139
Conversation
With world Momentum on, SDX pre-explodes every damage die except the one stock Shadowdark 4.0.6 will explode itself. That term was located with SDX's DICE_TERM, which also matches non-numeric faces (1dF, 1d(6+2)); the system's pattern skips them. When a formula led with such a term the two disagreed about which die was first, so '1d(6+2) + 1d6' came out as '1d(6+2) + 1d6xx' — a doubled explode and inflated damage. The boundary now uses the system's regex, and terms on both sides of it are exploded, so a leading paren-faced die explodes too. Live-verified against stock 4.0.6 through rollFromConfig. Also rewrites the Combat-and-Damage Momentum section, which still said SDX does not fix the system's first-die-only behaviour (it has since v6.14.0), and notes that the fix-up rides the Weapon Bonuses feature. Refs #134
Foundry caps every window at the viewport and clips .window-content, so a tall Equipped Sprite or Torch Sprite form hid its Save button. The fields now scroll with the buttons pinned, both windows are resizable, and the Equipped Sprite window re-clamps its top when the image browser, a category or the enable checkbox makes it taller.
Prop and flame are stored as separate token-relative offsets, so moving or rescaling the prop left the flame behind. Prop edits now move the flame to the same spot on the prop art and scale it with the prop; flame edits re-anchor it. Dialog-only: the saved torchSprite flag format is unchanged.
nativeTransferItems copied a lit item to the receiver and deleted the original, but never moved the token light. The giver kept a light with no item left to put it out, and the receiver's lit item cast none. It now hands the light over the way the system's sheet drop does: put out the receiver's own light, create the copy, then turnLightOff on the giver and turnLightOn on the receiver. The torch sprite follows through the existing createItem and updateToken hooks. A lit item no longer merges into an existing stack, and a split of a lit stack arrives unlit.
…bound Carrying the flame with the prop could push a flame value past its range-picker bounds (default torch, prop X 1 carries the flame to 1.15), and the picker clamped it off its spot on the prop. fitProp finds how far the edited prop field can go before any carried flame value leaves its slider, stops the prop there, and snaps inward to the prop slider's step because the picker rounds to the nearest step.
Fixed in 7729c38. The flame sliders can't be widened to fit a carried value, because
With the default torch, prop X now stops at 0.85, and the flame lands at exactly 1 on the same spot of the prop. Tests: 3 new cases in Live check in the real dialog, on an unlit Torch:
Behaviour change: when the flame is near an edge, a prop slider now stops before its end. Moving the flame first frees it. |
What
Four fixes, one commit each:
57d8cdbc1d(6+2)no longer get exploded twice.1e75bbced251a8c8b95908cdHow
DICE_TERMalso matched terms the system's pattern skips (1dF,1d(6+2)), so the two could disagree about which term comes first.SYSTEM_DICE_TERMcopies the SD 4.0.6 pattern, and the dice terms on both sides of the system's first term get exploded.docs/wiki/Combat-and-Damage.mdno longer says the Momentum toggle doesn't fix the system bug..applicationheight and hides overflow, so the tail of a tall form was cut off with no scrollbar. The fix is a flex scroll area with the footer outside it. The Weapon config window also callssetPosition()again when it grows, because Foundry only keeps a window on screen when its position is set, not when its content grows.torchSpritevalues keep their meaning, so there's no migration and the code that draws the sprite in play is unchanged.nativeTransferItemscopied the lit item and deleted the original but never moved the light. It now hands the light over the way the system's sheet drop does:turnLightOffon the giver andturnLightOnon the receivercreateItem/updateTokenhooks move the spriteTest plan
weapon-momentum.test.mjs(first-term boundary),torch-sprite-flame-follow.test.mjs, andtransfer-lit-light.test.mjs. On the code before the fix, three of the transfer file's four cases fail.npm test: 1644 pass, 0 failnpm run verify:verify: OK1d4 + 1d6became1d4x + 1d6x, and1d(6+2) + 1d6became1d(6+2)x + 1d6x.Known gaps, not fixed here
SYSTEM_DICE_TERMis a hand copy of the system's regex. A future system change to that pattern could make them disagree again.Fixes #138. Refs #134, #137.
🤖 Generated with Claude Code