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.
41 lines
1.9 KiB
TypeScript
41 lines
1.9 KiB
TypeScript
import type { Action, GameView } from './engine';
|
|
|
|
/** Human and AI choices use only the requesting seat's quoted physical tokens. */
|
|
export function discoveryAction(game: GameView, token: string, reveal: boolean): Action | null {
|
|
const offer = game.discoveries;
|
|
if (!offer || offer.blocked || game.status !== 'playing' || game.phase !== 7 ||
|
|
game.automaticContinuationPending || game.truthtrance || game.response || game.decision ||
|
|
typeof reveal !== 'boolean' ||
|
|
!(reveal ? offer.canReveal : offer.canInspect).some(id => id === token)) return null;
|
|
return { type: 'discovery', token, reveal };
|
|
}
|
|
|
|
/** The stash has already drawn its card. Any card in this seat's hand may leave. */
|
|
export function discoveryDiscardAction(game: GameView, card: string): Action | null {
|
|
const decision = game.decision;
|
|
if (game.status !== 'playing' || decision?.kind !== 'discoveryDiscard' ||
|
|
decision.player !== game.me || game.truthtrance || game.response ||
|
|
game.automaticContinuationPending ||
|
|
!game.players.find(player => player.id === game.me)?.hand?.some(held => held.id === card)) return null;
|
|
return { type: 'decision', event: decision.event, card };
|
|
}
|
|
|
|
/** Inspect first, then reconsider the newly visible face through a fresh view. */
|
|
export function discoveryBotActions(game: GameView): Action[] {
|
|
if (game.decision?.kind === 'discoveryDiscard') {
|
|
const hand = game.players.find(player => player.id === game.me)?.hand ?? [];
|
|
return [...hand]
|
|
.sort((a, b) => Number(b.kind === 'worthless') - Number(a.kind === 'worthless'))
|
|
.flatMap(card => {
|
|
const action = discoveryDiscardAction(game, card.id);
|
|
return action ? [action] : [];
|
|
});
|
|
}
|
|
const offer = game.discoveries;
|
|
if (!offer) return [];
|
|
return [
|
|
...offer.canInspect.map(token => discoveryAction(game, token, false)),
|
|
...offer.canReveal.map(token => discoveryAction(game, token, true)),
|
|
].filter((action): action is Action => action !== null);
|
|
}
|