Add freeform No-Field and auction facts
Verify and publish checkpoint container / container (push) Canceled after 0s

This commit is contained in:
Quintine committed 2026-10-29 18:53:48 +11:00
1 parent 593ff33ca8
commit 152476c348
10 files changed
+387 -4

No files matched your search

+14 -2
View File
@@ -74,6 +74,7 @@ import { parseFreeformFactV4 } from './truthtrance-freeform-facts-v4';
import { parseTruthFreeformFactsV5 } from './truthtrance-freeform-facts-v5';
import { parseFreeformFactV6 } from './truthtrance-freeform-facts-v6';
import { parseTruthFreeformFactsV7 } from './truthtrance-freeform-facts-v7';
import { parseTruthFreeformFactsV8 } from './truthtrance-freeform-facts-v8';
import { CHEAP_HERO_TRAITOR } from './traitors';
import {
TRUTH_FACT_MAX_NODES, TRUTH_FACT_MAX_DEPTH, TRUTH_FACT_MAX_TERMS,
@@ -139,7 +140,7 @@ export type TruthQuestion =
text: string;
scope: 'fact' | 'currentTurn';
/** Only newly asked, explicitly recognized facts carry this stable interpretation. */
interpreted?: { version: 1; fact: Extract<TruthFact, { kind: 'hand' | 'spice' }> } | { version: 2 | 3 | 4 | 5 | 6 | 7; fact: TruthFact };
interpreted?: { version: 1; fact: Extract<TruthFact, { kind: 'hand' | 'spice' }> } | { version: 2 | 3 | 4 | 5 | 6 | 7 | 8; fact: TruthFact };
};
export type TruthAnswer = 'yes' | 'no' | 'unknown';
export type TruthQueueEntry = {
@@ -734,13 +735,19 @@ function parseQuestion(g: Game, asker: string, value: unknown): TruthQuestion {
!parseFreeformFactV2(question.text) && !parseFreeformFactV3(question.text) &&
!parseFreeformFactV4(question.text) && !parseTruthFreeformFactsV5(question.text) &&
!parseFreeformFactV6(question.text) ? parseTruthFreeformFactsV7(question.text) : null;
const inspectedFact = question.scope === 'fact' && marker.version === 8 &&
!parseFreeformFactV2(question.text) && !parseFreeformFactV3(question.text) &&
!parseFreeformFactV4(question.text) && !parseTruthFreeformFactsV5(question.text) &&
!parseFreeformFactV6(question.text) && !parseTruthFreeformFactsV7(question.text)
? parseTruthFreeformFactsV8(question.text) : null;
const expected = oldFact ? { version: 1 as const, fact: oldFact }
: newFact ? { version: 2 as const, fact: newFact }
: categoryFact ? { version: 3 as const, fact: categoryFact }
: negativeFact ? { version: 4 as const, fact: negativeFact }
: compoundFact ? { version: 5 as const, fact: compoundFact }
: currentFact ? { version: 6 as const, fact: parseFact(g, currentFact, g.players.find(player => player.id === question.target)!) }
: aggregateFact ? { version: 7 as const, fact: parseFact(g, aggregateFact, g.players.find(player => player.id === question.target)!) } : null;
: aggregateFact ? { version: 7 as const, fact: parseFact(g, aggregateFact, g.players.find(player => player.id === question.target)!) }
: inspectedFact ? { version: 8 as const, fact: parseFact(g, inspectedFact, g.players.find(player => player.id === question.target)!) } : null;
check(expected !== null && JSON.stringify(v.interpreted) === JSON.stringify(expected),
'The saved freeform interpretation does not match its original question.');
question.interpreted = expected;
@@ -1235,6 +1242,11 @@ export function resolveTruthAction(
const aggregateFact = parseTruthFreeformFactsV7(w.question.text);
if (aggregateFact) w.question.interpreted = { version: 7,
fact: parseFact(g, aggregateFact, g.players.find(player => player.id === w.question!.target)!) };
else {
const inspectedFact = parseTruthFreeformFactsV8(w.question.text);
if (inspectedFact) w.question.interpreted = { version: 8,
fact: parseFact(g, inspectedFact, g.players.find(player => player.id === w.question!.target)!) };
}
}
}
}