Support Truthtrance on Atreides spice foresight

This commit is contained in:
Quintine committed 2026-10-27 23:53:13 +11:00
1 parent 24255905ed
commit 235c2eb03f
11 files changed
+255 -16

No files matched your search

+3 -1
View File
@@ -65,6 +65,7 @@ export function TruthFactFields({ value: fact, game, target, onChange }: {
predictionTurn: { kind: 'prediction', field: 'turn', compare: 'gte', value: 1 },
stormDial: { kind: 'stormDial', compare: 'gte', value: 0 },
stormForecast: { kind: 'stormForecast', compare: 'gte', value: 1 },
spicePeek: { kind: 'spicePeek', value: 'worm' },
spice: { kind: 'spice', compare: 'gte', value: 6 },
forceCount: { kind: 'forceCount', zone: { kind: 'reserves' }, counter: 'total', compare: 'gte', value: 6 },
noFieldValue: { kind: 'noFieldValue', value: 3 },
@@ -83,6 +84,7 @@ export function TruthFactFields({ value: fact, game, target, onChange }: {
<option value="predictionTurn">Stored turn prediction</option>
<option value="stormDial">Known storm dial</option>
<option value="stormForecast">Known storm forecast</option>
<option value="spicePeek">Known next Spice Blow card</option>
<option value="spice">Current personal spice</option>
<option value="forceCount">Current physical forces</option>
<option value="noFieldValue">Current concealed No-Field printed value</option>
@@ -98,7 +100,7 @@ export function TruthFactFields({ value: fact, game, target, onChange }: {
<FaceDancerFactFields value={fact} leaders={game.allLeaders} onChange={onChange} /> : fact.kind === 'noFieldValue' ?
<NoFieldValueFields value={fact} onChange={onChange} /> : fact.kind === 'forceCount' ?
<ForceCountFields value={fact} game={game} player={game.players.find(player => player.id === target)!} onChange={onChange} /> :
fact.kind === 'prediction' || fact.kind === 'stormDial' || fact.kind === 'stormForecast' ?
fact.kind === 'prediction' || fact.kind === 'stormDial' || fact.kind === 'stormForecast' || fact.kind === 'spicePeek' ?
<KnowledgeFactFields value={fact} onChange={onChange} /> : fact.kind === 'spice' ? <>
<label>
Compare current personal spice
+18 -7
View File
@@ -2,14 +2,13 @@
import { useId } from 'react';
import { FACTIONS } from '@/game/catalog';
import type { TruthFact } from '@/game/truthtrance';
import { knowledgeFactInputError } from '@/game/truthtrance-knowledge';
import { territory } from '@/game/board';
import { knowledgeFactInputError, SPICE_PEEK_VALUES, type KnowledgeFact } from '@/game/truthtrance-knowledge';
import { Input } from '@/components/ui/input';
type KnowledgeFact = Extract<TruthFact, { kind: 'prediction' | 'stormDial' | 'stormForecast' }>;
type NumericKnowledgeFact = Exclude<KnowledgeFact, { kind: 'prediction'; field: 'faction' }>;
type NumericKnowledgeFact = Exclude<KnowledgeFact, { kind: 'prediction'; field: 'faction' } | { kind: 'spicePeek' }>;
function isNumericKnowledgeFact(fact: KnowledgeFact): fact is NumericKnowledgeFact {
return fact.kind !== 'prediction' || fact.field === 'turn';
return fact.kind !== 'spicePeek' && (fact.kind !== 'prediction' || fact.field === 'turn');
}
export function KnowledgeFactFields({
@@ -20,7 +19,7 @@ export function KnowledgeFactFields({
onChange: (fact: KnowledgeFact) => void;
}) {
const id = useId();
const isFaction = !isNumericKnowledgeFact(value);
const isFaction = value.kind === 'prediction' && value.field === 'faction';
const numericValue = isNumericKnowledgeFact(value) ? value : null;
const isTurn = numericValue?.kind === 'prediction' && numericValue.field === 'turn';
const min = isTurn ? 1 : numericValue?.kind === 'stormForecast' ? 1 : 0;
@@ -28,7 +27,19 @@ export function KnowledgeFactFields({
const invalid = knowledgeFactInputError(value);
return (
<>
{isFaction ? (
{value.kind === 'spicePeek' ? (
<>
<label>
Next Spice Blow card
<select value={value.value} onChange={(event) => onChange({ kind: 'spicePeek', value: event.target.value })}>
{SPICE_PEEK_VALUES.map((option) => <option key={option} value={option}>
{option === 'worm' ? 'Sandworm' : option === 'sandtrout' ? 'Sandtrout' : territory(option).name}
</option>)}
</select>
</label>
<p className="fine">This asks about the card the target currently knows from their private Spice Blow peek. If no card is known, the answer is I don’t know. Only the answer is published.</p>
</>
) : isFaction ? (
<label>
Predicted faction
<select