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.
98 lines
2.6 KiB
TypeScript
98 lines
2.6 KiB
TypeScript
import assert from 'node:assert/strict';
|
|
import {
|
|
applyAction,
|
|
createGame,
|
|
initializeDiscoveryGameForAudit,
|
|
joinGame,
|
|
newPlayer,
|
|
viewGame,
|
|
type Game,
|
|
} from '../game/engine';
|
|
import { botActions } from '../game/bots';
|
|
import {
|
|
placeDiscovery,
|
|
type DiscoverySpiceCardId,
|
|
type DiscoveryTokenFace,
|
|
} from '../game/discoveries';
|
|
|
|
export function discoveryLobby(
|
|
advanced = false,
|
|
ids: [string, string, string] = ['a', 'g', 'f'],
|
|
): Game {
|
|
let g = createGame(
|
|
'DISCQA01',
|
|
newPlayer(ids[0], 'Atreides', 'atreides'),
|
|
advanced,
|
|
[],
|
|
);
|
|
joinGame(g, newPlayer(ids[1], 'Guild', 'guild'));
|
|
joinGame(g, newPlayer(ids[2], 'Fremen', 'fremen'));
|
|
for (const p of g.players) g = applyAction(g, p.id, { type: 'ready' });
|
|
g.discoveryEnabled = true;
|
|
return g;
|
|
}
|
|
export function discoveryFixture(
|
|
advanced = false,
|
|
ids: [string, string, string] = ['a', 'g', 'f'],
|
|
): Game {
|
|
let g = initializeDiscoveryGameForAudit(discoveryLobby(advanced, ids));
|
|
for (let step = 0; step < 80 && g.status === 'setup'; step++) {
|
|
let next: Game | undefined;
|
|
for (const p of g.players) {
|
|
const v = viewGame(g, p.id);
|
|
v.players.find((seat) => seat.id === p.id)!.bot = 'Easy';
|
|
const action = botActions(v)[0];
|
|
if (action) {
|
|
next = applyAction(g, p.id, action);
|
|
break;
|
|
}
|
|
}
|
|
assert.ok(
|
|
next,
|
|
`Discovery setup stalled at ${g.setupStage}/${g.decision?.kind}`,
|
|
);
|
|
g = next;
|
|
}
|
|
assert.equal(g.status, 'playing');
|
|
return g;
|
|
}
|
|
export function putDiscovery(g: Game, face: DiscoveryTokenFace) {
|
|
const source = g.discoveries!.tokens.find((token) => token.face === face)!;
|
|
const card: DiscoverySpiceCardId =
|
|
source.type === 'hiereg'
|
|
? 'discovery-hagga-basin'
|
|
: 'discovery-wind-pass-north';
|
|
const eligible = g.discoveries!.tokens.filter(
|
|
(token) => token.type === source.type && token.status === 'supply',
|
|
);
|
|
const index = eligible.findIndex((token) => token.face === face);
|
|
assert.ok(index >= 0);
|
|
g.discoveries = placeDiscovery(
|
|
g.discoveries!,
|
|
card,
|
|
() => (index + 0.1) / eligible.length,
|
|
);
|
|
return g.discoveries.tokens.find((token) => token.face === face)!;
|
|
}
|
|
export function enterDiscoveryCollection(
|
|
g: Game,
|
|
face: DiscoveryTokenFace,
|
|
owner = g.players[0].id,
|
|
) {
|
|
const token = putDiscovery(g, face),
|
|
p = g.players.find((player) => player.id === owner)!;
|
|
const key = `${token.territory}:${token.sector}`;
|
|
p.reserves -= 2;
|
|
p.forces[key] = (p.forces[key] ?? 0) + 2;
|
|
Object.assign(g, {
|
|
phase: 7,
|
|
ready: [],
|
|
decision: null,
|
|
response: null,
|
|
phaseOpening: null,
|
|
storm: 18,
|
|
stormPending: null,
|
|
});
|
|
return token;
|
|
}
|