Files
Quintine f0256c1b38 Prototype Discovery spice encounters, private tokens and stash rewards
Connect real Basic/Advanced base-faction audit setup to all seven Discovery
Spice Cards and eight physical tokens. Add Great Maker's ordered majority
vote and Fremen reserve ride, destructive Discovery blows, private faction
peeks and Collection inspection/reveal, stash rewards and mandatory saved
card overflow, and revealed nested board locations. Share private legal
choices with human controls and all four AI profiles. Preserve normal gates.

Independent review repairs orphaned worm/vote/ride controls, retargeted
reserve arrivals, actor bindings and incomplete overflow discard receipts.
Harden room-aware admission against unrevealed nested locations. Extend the
backed-up local prototype starter with a Discovery profile; preserve seats.

Still missing: next-turn free entry, five special location benefits and
Ornithopter movement spending. Current prototype playthroughs do not certify
those effects or complete module/expansion compliance.

Verification: npm run check passed 4264 offline tests plus types/lint;
npm run build passed; npm run test:integration passed 40 tests. The single
source-bound broad run took 129358ms / 6782ms / 23918ms respectively.
Report: /home/quintine/.local/share/dune/checkpoints/20260913-discovery-prototype/verification/report.json
Source fingerprint: 4ea7b5209a58c369b0b1f8dc239b5dd2f3302bb759d83c32ba5406e80d8ae154

Two seeded Basic/Advanced games complete with component custody intact.
SQLite races pay stashes once and resume committed discards without replay.
Browser 3RJBH26Y verifies genuine human Fremen setup, a Discovery blow from
one reordered physical card, native private Hiereg visibility, enlarged
card/rules reading and refresh. Room remains paused at spice acceptance.
All 125 opening saved rooms unchanged; 31 added, 156 total. No server restart.

Efficiency: three reused bounded helpers; aggregate counter 60591430 to
61812513 after verification, 1221083 tokens before final Git/push overhead.
47 added offline tests. One stable broad run after focused review fixes;
no calibration or exhaustive optional-module interaction matrix.
2026-09-13 13:27:58 +10:00

125 lines
3.9 KiB
TypeScript

'use client';
import { useState } from 'react';
import type { Action, GameView } from '@/game/engine';
import { greatMakerRideAction } from '@/game/great-maker-options';
import { Button } from './ui/button';
type Props = { game: GameView; act: (action: Action) => void; busy: boolean };
export function GreatMakerDecision({ game, act, busy }: Props) {
const [destination, setDestination] = useState(''),
[amount, setAmount] = useState(1),
[elite, setElite] = useState(0);
const d = game.decision,
frame = game.greatMaker;
if (!frame || !d || d.player !== game.me) return null;
if (d.kind === 'greatMakerVote')
return (
<section aria-label="Great Maker vote" className="space-y-3">
<h3>Great Maker · Nexus vote</h3>
<p>
Vote in storm order. A majority must vote yes for this encounter to
create a Nexus; a tie means no Nexus.
</p>
{frame.votes.map((vote) => (
<p key={vote.player}>
{game.players.find((p) => p.id === vote.player)?.name}:{' '}
{vote.yes ? 'Yes' : 'No'}
</p>
))}
<div className="flex flex-wrap gap-2">
{[true, false].map((yes) => (
<Button
key={String(yes)}
disabled={busy}
onClick={() => act({ type: 'decision', event: d.event, yes })}
>
{yes ? 'Yes — create a Nexus' : 'No Nexus'}
</Button>
))}
</div>
</section>
);
const offer = frame.ride;
if (d.kind !== 'greatMakerRide' || !offer) return null;
const to =
offer.destinations.find(
(to) => `${to.territory}:${to.sector}` === destination,
) ?? offer.destinations[0];
const n = Math.max(1, Math.min(amount, offer.max)),
minimumElite = Math.max(0, n - (offer.max - offer.eliteMax));
const e = Math.max(minimumElite, Math.min(elite, n, offer.eliteMax));
const action = to
? greatMakerRideAction(game, to.territory, to.sector, n, e)
: null;
return (
<section aria-label="Great Maker reserve ride" className="space-y-3">
<h3>Ride the Great Maker</h3>
<p>
Move any number of reserve forces to one legal destination. This uses no
spice, shipment or movement. Forces already on the board stay where they
are.
</p>
<label className="block">
Destination
<select
value={to ? `${to.territory}:${to.sector}` : ''}
disabled={busy}
onChange={(event) => setDestination(event.target.value)}
>
{offer.destinations.map((to) => (
<option
key={`${to.territory}:${to.sector}`}
value={`${to.territory}:${to.sector}`}
>
{to.name} · sector {to.sector}
</option>
))}
</select>
</label>
<label className="block">
Forces
<input
type="number"
min={1}
max={offer.max}
value={n}
disabled={busy}
onChange={(event) => setAmount(Number(event.target.value))}
/>
</label>
{offer.eliteMax > 0 && (
<label className="block">
Fedaykin included
<input
type="number"
min={minimumElite}
max={Math.min(n, offer.eliteMax)}
value={e}
disabled={busy}
onChange={(event) => setElite(Number(event.target.value))}
/>
</label>
)}
<div className="flex flex-wrap gap-2">
<Button
disabled={busy || !action}
onClick={() => {
if (action) act(action);
}}
>
Ride with {n} forces
</Button>
<Button
variant="outline"
disabled={busy}
onClick={() =>
act({ type: 'decision', event: d.event, accept: false })
}
>
Leave forces in reserves
</Button>
</div>
</section>
);
}