Hotfix: fear's new metric leaked into old vintages and broke replay

QD3S failed to restore ('replay failed at seq 76: an unnatural dread
keeps you away'): the walkingDistance switch ran at every rev, refusing
a move that was legal under the crow-flies rule when it was played.
fearRepels now measures walked spaces at rev 32+ and as the crow flies
below, so every stored ledger replays its own vintage. No data was
lost; the room's ledger was intact throughout.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0138A8CjeQRpvzKxuMfz1Bqc
This commit is contained in:
Eric Wagoner
2026-08-19 21:40:48 -04:00
co-authored by Claude Fable 5
parent 410ebc0135
commit 724d178636
+9 -3
View File
@@ -3727,9 +3727,15 @@ function fearRepels(state: GameState, moverId: PlayerId | null, from: Cell, to:
if (!other.alive || other.id === moverId) continue;
if (sustainedOn(state, other.id, "fear").length === 0) continue;
// "Spaces" are counted through the maze — warps included, walls
// respected — exactly as feet would walk them.
const d = walkingDistance(state, other.position, to);
const dBefore = walkingDistance(state, other.position, from);
// respected — exactly as feet would walk them (rules rev 32). Earlier
// games measured as the crow flies, and their ledgers replay so.
const walked = (state.config.deckRev ?? 1) >= 32;
const d = walked
? walkingDistance(state, other.position, to)
: Math.abs(other.position.x - to.x) + Math.abs(other.position.y - to.y);
const dBefore = walked
? walkingDistance(state, other.position, from)
: Math.abs(other.position.x - from.x) + Math.abs(other.position.y - from.y);
if (d <= 3 && d < dBefore) return true;
}
return false;