Support Advanced No-Field reveal during foreign movement
Verify and publish checkpoint container / container (push) Successful in 13m13s
Verify and publish checkpoint container / container (push) Successful in 13m13s
This commit is contained in:
1 parent
ee8ec0a84e
commit
51c48e371b
8 files changed
+316
-9
No files matched your search
+12
-1
@@ -17,6 +17,15 @@ open mode gates.
|
||||
|
||||
## Current checkpoint and work
|
||||
|
||||
**Advanced No-Field reveal during foreign movement — 16 November. Prototyped /
|
||||
Partial.** Supported foreign Fremen and Ixian movement responses and CHOAM
|
||||
movement decisions retain their original physical move while Richese reveals.
|
||||
Genuine Advanced journeys cover zero/three markers, response cancellation and
|
||||
legal bots; five related unit files pass 41 cases. A Bene Gesserit destination
|
||||
stance case, other nested arrivals, modules, complete games and deployed
|
||||
acceptance remain open. The existing Basic bribe profile remains unchanged.
|
||||
[Scope](RICHESE_NO_FIELD_RULES.md#advanced-foreign-movement-reveal--16-november-2026).
|
||||
|
||||
**Advanced No-Field reveal interruptions — 16 November. Prototyped / Partial.**
|
||||
Supported Advanced economic, Revival and independent response windows now
|
||||
admit Richese's voluntary before-Battle reveal. Current reserves and original
|
||||
@@ -57,7 +66,9 @@ open. [Scope](RICHESE_NO_FIELD_RULES.md#basic-reveal-at-emperor-auction-gifts--1
|
||||
|
||||
The latest bounded scan found first versions of the standalone Basic native
|
||||
faction powers inspected, with interaction and complete-game boundaries still
|
||||
open.
|
||||
open. Advanced Emperor gifts before Richese cache sales and selected-expansion
|
||||
ordinary auction payments remain a source-clear candidate; their Advanced
|
||||
funding and bank routing still need implementation and evidence.
|
||||
|
||||
**Basic Emperor gifts while Sandtrout waits — 16 November. Prototyped /
|
||||
Partial.** Supported opening, ordinary auction and Richese cache gift windows
|
||||
|
||||
@@ -2,6 +2,27 @@
|
||||
|
||||
Audit date: 2026-09-06. This document distinguishes the printed token lifecycle from engine integration and unresolved combinations. It does not certify Richese, Homeworlds, or any other gated game mode.
|
||||
|
||||
## Advanced foreign-movement reveal — 16 November 2026
|
||||
|
||||
**Prototyped / Partial.** A supported foreign ordinary move waiting for a
|
||||
Fremen or Ixian response, or for CHOAM's movement decision, now permits the
|
||||
existing No-Field reveal in Advanced as well as Basic. The original movement,
|
||||
reaction, costs and force groups remain pending. A zero marker may disappear
|
||||
from the movement destination without repeating the move. The shared movement
|
||||
classifier requires an explicit Advanced opt-in, so Basic-only bribe behavior
|
||||
is unchanged.
|
||||
|
||||
An Advanced Bene Gesserit move into the marker's own territory remains guarded
|
||||
for all concealed values: revealing zero could change the destination presence
|
||||
used to select the already committed advisor/fighter stance. This is a
|
||||
software boundary, not a new publisher restriction. Other arrival parents,
|
||||
modules, commitments, complete games and deployed acceptance remain open.
|
||||
[Public-start journeys](../tests/richese-reveal-advanced-foreign-movement.test.ts)
|
||||
use original movement actions, selected unopened Spice order and conserved
|
||||
staged force/card placement. The revised Advanced rules physical p. 5 /
|
||||
printed p. 3 permit the reveal before Battle; the online interruption order is
|
||||
provisional.
|
||||
|
||||
## Advanced before-Battle interruptions — 16 November 2026
|
||||
|
||||
**Prototyped / Partial.** The existing supported independent interruption
|
||||
@@ -9,9 +30,9 @@ parents now admit the voluntary reveal in Advanced games too, using the same
|
||||
native response, cost and force handling. This includes ordered CHOAM free
|
||||
Revival, economic decisions, and the existing individually checked responses.
|
||||
The reveal draws from current reserves and leaves the original request or
|
||||
response pending. Ordinary foreign-movement interruptions still use their
|
||||
Basic-only parent helper; nested children, optional modules and existing
|
||||
Truthtrance commitment boundaries remain guarded. The native Advanced
|
||||
response pending. The section above records the later extension to supported
|
||||
foreign movement; nested children, optional modules and existing Truthtrance
|
||||
commitment boundaries remain guarded. The native Advanced
|
||||
Atreides Spice forecast may coexist with the original Guild timing choice;
|
||||
both are retained during the reveal.
|
||||
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# Rule decision index
|
||||
|
||||
## Advanced No-Field reveal during foreign movement — 16 November 2026
|
||||
|
||||
The existing provisional reveal ordering extends to supported Advanced foreign
|
||||
Fremen/Ixian moves and CHOAM movement decisions, preserving original physical
|
||||
movement. A Bene Gesserit arrival-stance case remains guarded for every marker
|
||||
value. [Scope](RICHESE_NO_FIELD_RULES.md#advanced-foreign-movement-reveal--16-november-2026).
|
||||
|
||||
## Advanced No-Field reveal interruptions — 16 November 2026
|
||||
|
||||
The existing provisional before-Battle reveal ordering extends to the
|
||||
|
||||
@@ -5,9 +5,10 @@ import { presenceAt } from './force-presence';
|
||||
export type MovementPending = 'pendingFremenMove' | 'pendingIxMove' | 'pendingChoamMove';
|
||||
type MovementOrder = NonNullable<Game['pendingIxMove']>;
|
||||
|
||||
/** Identify a single, well-formed ordinary Basic movement awaiting its native reaction. */
|
||||
export function basicPendingMovement(g: Game): { key: MovementPending; player: string } | null {
|
||||
if (g.status !== 'playing' || g.advanced || g.phase !== 5 ||
|
||||
/** Identify a single, well-formed ordinary movement awaiting its native reaction.
|
||||
* Existing Basic callers retain their mode fence unless they explicitly opt in. */
|
||||
export function basicPendingMovement(g: Game, options?: {allowAdvanced?: boolean}): { key: MovementPending; player: string } | null {
|
||||
if (g.status !== 'playing' || (g.advanced && !options?.allowAdvanced) || g.phase !== 5 ||
|
||||
!Number.isSafeInteger(g.turn) || g.turn < 1 || g.phaseOpening || g.truthtrance ||
|
||||
g.ornithopter || g.choamMarket || !Array.isArray(g.players)) return null;
|
||||
|
||||
|
||||
+1
-1
@@ -1143,7 +1143,7 @@ export const RULE_TOPICS: RuleTopic[] = [
|
||||
'In supported Basic native games, voluntary revelation is also available during an Ix phase opening or selected auction and market decisions without replacing that decision. Other interruption windows remain unfinished.',
|
||||
'In supported Basic games, your voluntary reveal can also interrupt a clean Emperor allied spice gift or extra-revival response, Tleilaxu revival-income response, Atreides Movement-phase Spice forecast without Bene Gesserit, or Guild’s own ordinary reserve-shipment rate response when the shipment enters a different territory from the marker. If Richese receives the extra revival, reveal from current reserves before that return. The original response and payment continue once; other interruptions remain guarded.',
|
||||
'An active public agreement does not by itself prevent a supported reveal. Existing current-turn travel and other binding commitments still retain their separate safeguards, and a reveal does not settle or cancel a payment.',
|
||||
'During supported Basic games you can also reveal while another faction’s ordinary movement waits for a Fremen or Ixian response or a CHOAM decision. The original move and its response remain pending; a zero No-Field disappears without creating physical forces.',
|
||||
'During supported Basic or Advanced games you can also reveal while another faction’s ordinary movement waits for a Fremen or Ixian response or a CHOAM decision. The original move and its response remain pending; a zero No-Field disappears without creating physical forces. An Advanced Bene Gesserit movement into the marker’s own territory remains guarded while its arrival stance is unresolved.',
|
||||
'These supported clean Basic interruptions also work with the Ecaz/Moritani deck and native factions. A token already present does not enter again when it is revealed; pending Ambassador and Terror reactions keep their own controls.',
|
||||
'Provisional Guild transport treats your owned concealed marker as one billable force alongside any same-origin physical counters. Native Guild allies may cross-ship it through the normal permission and rate responses. The actual absent-Guild Secret Ally may cross-ship or return it face down, spending its Nexus once and paying the Bank. Cross keeps concealment; return creates no denomination-sized reserve deposit and retains the same-token next-shipment ban. Ordinary Guild allies cannot return. Select the marker separately from physical counters; ordinary movement remains available.',
|
||||
'In supported native Homeworld games, you may provisionally ship one concealed No-Field from your supply to a foreign non-allied Homeworld, alone or with physical forces from those reserves. Advanced also permits a fresh marker-only placement on your own Homeworld for one spice; physical reserves are already there and cannot accompany it. On a later turn, you may ship that same concealed marker between distinct eligible Homeworlds, alone or with selected physical Richese counters from the marker’s current World; its own Homeworld is an eligible endpoint only in Advanced. Price the whole moving group as one plus those counters; a purchased Guild rate halves the total, rounding up once. The marker retains its identity and last-shipment history, and its value does not materialize until reveal; available reserves are placed there unless it is already on its own World, where the physical pool stays unchanged. Only one marker may be deployed globally. Optional-module combinations remain unavailable. The supplied revised rulebook permits World-to-World shipment (physical p. 22) and counts a concealed marker as one force for effects (physical p. 36), but does not settle its off-board source or native-world physical representation; this placement is provisional.',
|
||||
|
||||
@@ -12,6 +12,12 @@ export function richeseRevealForeignMovementPending(g: Game): MovementPending |
|
||||
const deployed = richese?.noField?.deployed;
|
||||
if (!richese || !deployed || deployed.controller !== richese.id ||
|
||||
!deployed.location || !('territory' in deployed.location)) return null;
|
||||
const movement = basicPendingMovement(g);
|
||||
const movement = basicPendingMovement(g, {allowAdvanced:true});
|
||||
// A zero marker can remove the only other faction at a BG destination.
|
||||
// Preserve the already selected Advanced arrival stance for all hidden
|
||||
// marker values until that special continuation can be re-quoted.
|
||||
if (g.advanced && movement?.key === 'pendingChoamMove' &&
|
||||
g.players.find(player => player.id === movement.player)?.faction === 'beneGesserit' &&
|
||||
g.pendingChoamMove?.to === deployed.location.territory) return null;
|
||||
return movement && movement.player !== richese.id ? movement.key : null;
|
||||
}
|
||||
@@ -0,0 +1,240 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { createGame, joinGame, newPlayer, viewGame, type Action, type Game } from '../game/engine';
|
||||
import { botActions } from '../game/bots';
|
||||
import { DIFFICULTIES } from '../game/bot-profiles';
|
||||
import { TERRITORIES, gameDistance, location, splitLocation } from '../game/board';
|
||||
import { presenceAt } from '../game/force-presence';
|
||||
import { actTruthMovementNativeEarly as act, nextTruthMovementNativeEarlyStep } from './fixture-truth-movement-native-early';
|
||||
import { truthMovementInventory } from './fixture-truth-movement';
|
||||
|
||||
type Kind = 'fremenMovement' | 'ixMovement' | 'choamMovement';
|
||||
const seat = (g: Game, id: string) => { const p = g.players.find(p => p.id === id); assert.ok(p); return p; };
|
||||
const clean = (g: Game) => !g.response && !g.decision && !g.phaseOpening && !g.truthtrance && !g.pendingTreacheryDiscard;
|
||||
const reload = (g: Game): Game => JSON.parse(JSON.stringify(g));
|
||||
const cards = (g: Game) => truthMovementInventory(g);
|
||||
|
||||
/** Select an existing physical card by a custody-preserving swap after the
|
||||
* actual starting deal. This controls only who can answer the test window. */
|
||||
function swapHeld(g: Game, id: string, predicate: (c: Game['deck'][number]) => boolean): string {
|
||||
const target = seat(g, id);
|
||||
const held = target.hand.find(predicate);
|
||||
if (held) return held.id;
|
||||
assert.ok(target.hand.length);
|
||||
const index = g.deck.findIndex(predicate);
|
||||
if (index >= 0) {
|
||||
[target.hand[0], g.deck[index]] = [g.deck[index], target.hand[0]];
|
||||
return target.hand[0].id;
|
||||
}
|
||||
for (const other of g.players) {
|
||||
if (other.id === id) continue;
|
||||
const at = other.hand.findIndex(predicate);
|
||||
if (at >= 0) {
|
||||
[target.hand[0], other.hand[at]] = [other.hand[at], target.hand[0]];
|
||||
return target.hand[0].id;
|
||||
}
|
||||
}
|
||||
throw Error('The original card must exist in the native deal or deck');
|
||||
}
|
||||
|
||||
/** All pending movement/decisions come from actual player actions. The only
|
||||
* controlled inputs are unopened Spice cards, first Storm dials and conserved
|
||||
* card swaps. Richese's marker is actually shipped on its own turn. */
|
||||
function fixture(kind: Kind, value: 0 | 3 = 3, markerAtDestination = false) {
|
||||
assert.ok(!markerAtDestination || kind === 'fremenMovement');
|
||||
const mover = kind === 'fremenMovement' ? 'fremen' : kind === 'ixMovement' ? 'ixians' : 'emperor';
|
||||
const expansions = kind === 'ixMovement' ? ['choam', 'ix'] : ['choam'];
|
||||
let g = createGame(`ADV-REVEAL-${kind}-${value}`, newPlayer('richese', 'Richese', 'richese'), true, expansions);
|
||||
if (kind === 'choamMovement') joinGame(g, newPlayer('choam', 'CHOAM', 'choam'));
|
||||
else joinGame(g, newPlayer(mover, mover, mover));
|
||||
joinGame(g, newPlayer('emperor', 'Emperor', 'emperor'));
|
||||
for (const p of g.players) g = act(g, p.id, {type:'ready'});
|
||||
g = act(g, g.host, {type:'start', advancedPreview:true});
|
||||
assert.equal(g.status, 'setup');
|
||||
if (kind === 'ixMovement') {
|
||||
// The native Ix setup driver chooses a Shield from the inspected packet.
|
||||
// Move the original unopened card to its first draw position.
|
||||
const shield = g.deck.findIndex(card => card.kind === 'shield');
|
||||
assert.ok(shield >= 0);
|
||||
[g.deck[0], g.deck[shield]] = [g.deck[shield], g.deck[0]];
|
||||
}
|
||||
const next = (state: Game) => {
|
||||
const fremen = state.players.find(p => p.faction === 'fremen');
|
||||
if (state.status === 'setup' && state.setupStage === 'forces' && fremen?.reserves === 20 &&
|
||||
viewGame(state, fremen.id).setupPending.includes(fremen.id))
|
||||
return {actor:fremen.id, action:{type:'fremenSetup', placements:{'sietch_tabr:14':10}} satisfies Action};
|
||||
if (state.phase === 5 && state.active === 'richese' && clean(state) && !seat(state,'richese').shipped &&
|
||||
!seat(state,'richese').noField?.deployed) {
|
||||
const owner = seat(state,'richese'), marker = owner.noField!.tokens.find(t => t.value === value);
|
||||
assert.ok(marker && owner.noFieldEvent);
|
||||
const target = markerAtDestination
|
||||
? TERRITORIES.filter(t => t.type === 'sand').flatMap(t => t.sectors.map(s => location(t.id,s)))
|
||||
.find(key => splitLocation(key).sector > 7 && state.players.every(p => !(p.forces[key] > 0)) &&
|
||||
gameDistance(state,'sietch_tabr:14',key,k => splitLocation(k).sector === state.storm) === 2 &&
|
||||
gameDistance(state,'sietch_tabr:14',key,k => splitLocation(k).sector === (state.storm % 18) + 1) === 2)
|
||||
: 'polar_sink:0';
|
||||
assert.ok(target, 'The original Fremen position has a safe distance-two marker destination');
|
||||
return {actor:'richese', action:{type:'ship', noField:marker.id, event:owner.noFieldEvent,
|
||||
...splitLocation(target), allyPayment:0} satisfies Action};
|
||||
}
|
||||
if (kind === 'choamMovement' && state.turn === 1 && state.phase === 5 && state.active === 'choam' &&
|
||||
clean(state) && !seat(state,'choam').shipped)
|
||||
return {actor:'choam', action:{type:'ship', territory:'arrakeen', sector:10, amount:1, elite:0, allyPayment:0} satisfies Action};
|
||||
if (state.phase === 5 && state.active === 'emperor' && clean(state))
|
||||
return {actor:'emperor', action:{type:'endMovement'} satisfies Action};
|
||||
const step = nextTruthMovementNativeEarlyStep(state);
|
||||
assert.ok(step, `Missing native continuation ${state.status}/${state.turn}/${state.phase}/${state.decision?.kind}`);
|
||||
if (step.action.type === 'stormDial' && state.turn === 1)
|
||||
return {...step, action:{...step.action, amount:0}};
|
||||
return step;
|
||||
};
|
||||
const reach = (until: (s: Game) => boolean) => {
|
||||
for (let n = 0; n < 2400 && !until(g); n++) {
|
||||
assert.notEqual(g.status, 'finished');
|
||||
const step = next(g); g = act(g, step.actor, step.action);
|
||||
}
|
||||
assert.ok(until(g), 'The real game reached the requested native boundary');
|
||||
};
|
||||
reach(state => state.status === 'playing');
|
||||
const karama = swapHeld(g, 'emperor', c => c.effect === 'karama');
|
||||
const baliset = kind === 'choamMovement' ? swapHeld(g, 'choam', c => c.name === 'Baliset') : undefined;
|
||||
for (let pos = 0; pos < 4; pos++) {
|
||||
const at = g.spiceDeck.findIndex((c, index) => index >= pos && 'territory' in c && !c.discovery);
|
||||
assert.ok(at >= pos); [g.spiceDeck[pos], g.spiceDeck[at]] = [g.spiceDeck[at], g.spiceDeck[pos]];
|
||||
}
|
||||
reach(state => state.turn === 2 && state.phase === 5 && state.active === mover && clean(state) &&
|
||||
!!seat(state,'richese').noField?.deployed);
|
||||
const marker = seat(g,'richese').noField!.deployed!.tokenId;
|
||||
const event = seat(g,'richese').noFieldEvent; assert.ok(event);
|
||||
let origin: string;
|
||||
if (kind === 'fremenMovement') {
|
||||
origin = 'sietch_tabr:14';
|
||||
assert.ok((seat(g,mover).forces[origin] ?? 0) > 0);
|
||||
} else if (kind === 'choamMovement') {
|
||||
origin = 'carthag:11';
|
||||
g = act(g,mover,{type:'ship', territory:'carthag', sector:11, amount:1, elite:0, allyPayment:0});
|
||||
reach(clean);
|
||||
assert.ok((seat(g,'choam').forces['arrakeen:10'] ?? 0) > 0);
|
||||
} else {
|
||||
origin = TERRITORIES.filter(t => t.type === 'sand').flatMap(t => t.sectors.map(s => location(t.id,s)))
|
||||
.find(key => splitLocation(key).sector !== g.storm && g.players.every(p => !(p.forces[key] > 0)) &&
|
||||
TERRITORIES.some(t => t.type === 'sand' && t.sectors.some(s => s !== g.storm &&
|
||||
gameDistance(g,key,location(t.id,s),k => splitLocation(k).sector === g.storm) === 2)))!;
|
||||
assert.ok(origin);
|
||||
g = act(g,mover,{type:'ship', ...splitLocation(origin), amount:1, elite:1, allyPayment:0});
|
||||
reach(clean);
|
||||
}
|
||||
const markerLocation = seat(g,'richese').noField!.deployed!.location;
|
||||
const destination = markerAtDestination && 'territory' in markerLocation
|
||||
? location(markerLocation.territory,markerLocation.sector)
|
||||
: kind === 'choamMovement' ? 'arrakeen:10' :
|
||||
TERRITORIES.filter(t => t.type === 'sand').flatMap(t => t.sectors.map(s => location(t.id,s)))
|
||||
.find(key => splitLocation(key).sector !== g.storm && g.players.every(p => !(p.forces[key] > 0)) &&
|
||||
gameDistance(g,origin,key,k => splitLocation(k).sector === g.storm) === 2)!;
|
||||
assert.ok(destination);
|
||||
const beforeMove = structuredClone(g);
|
||||
const move: Action = {type:'move', forces:{[origin]:1},
|
||||
...(kind === 'ixMovement' ? {eliteForces:{[origin]:1}} : {}), ...splitLocation(destination)};
|
||||
g = act(g,mover,move);
|
||||
assert.equal(kind === 'choamMovement' ? g.decision?.kind : g.response?.kind, kind);
|
||||
assert.deepEqual(seat(g,mover).forces, seat(beforeMove,mover).forces);
|
||||
return {game:g, mover, marker, event, karama, baliset, value, origin, destination, beforeMove};
|
||||
}
|
||||
|
||||
void test('a foreign movement into a zero No-Field destination still commits after the marker vanishes', () => {
|
||||
const f = fixture('fremenMovement',0,true), original = structuredClone(f.game);
|
||||
const territory = splitLocation(f.destination).territory;
|
||||
assert.equal(presenceAt(seat(original,'richese'),territory),1);
|
||||
assert.equal(original.response?.kind,'fremenMovement');
|
||||
assert.equal(viewGame(original,'richese').richeseNoField?.canReveal,true);
|
||||
const response = structuredClone(original.response), order = structuredClone(original.pendingFremenMove);
|
||||
const after = act(original,'richese',{type:'revealNoField',token:f.marker,event:f.event});
|
||||
assert.equal(presenceAt(seat(after,'richese'),territory),0);
|
||||
assert.deepEqual(after.response,response);
|
||||
assert.deepEqual(after.pendingFremenMove,order);
|
||||
assert.deepEqual(seat(after,f.mover).forces,seat(f.beforeMove,f.mover).forces);
|
||||
const control = finishPending(reload(original)), done = finishPending(reload(after));
|
||||
assert.equal(presenceAt(seat(control,'richese'),territory),1);
|
||||
assert.equal(presenceAt(seat(done,'richese'),territory),0);
|
||||
assert.deepEqual(seat(done,f.mover),seat(control,f.mover));
|
||||
assert.equal(seat(done,f.mover).forces[f.destination],1);
|
||||
assert.equal(seat(done,f.mover).moved,seat(f.beforeMove,f.mover).moved+1);
|
||||
});
|
||||
const cached = new Map<string, ReturnType<typeof fixture>>();
|
||||
function source(kind: Kind, value: 0 | 3 = 3) {
|
||||
const key = `${kind}:${value}`;
|
||||
if (!cached.has(key)) cached.set(key,fixture(kind,value));
|
||||
return cached.get(key)!;
|
||||
}
|
||||
function reveal(kind: Kind, value: 0 | 3 = 3) {
|
||||
const f = source(kind,value), g = structuredClone(f.game);
|
||||
const pending = structuredClone(kind === 'choamMovement' ? g.pendingChoamMove :
|
||||
kind === 'fremenMovement' ? g.pendingFremenMove : g.pendingIxMove);
|
||||
const control = structuredClone(kind === 'choamMovement' ? g.decision : g.response);
|
||||
const before = structuredClone(seat(g,'richese')), inventory = cards(g);
|
||||
assert.equal(viewGame(g,'richese').richeseNoField?.canReveal,true);
|
||||
const action: Action = {type:'revealNoField', token:f.marker, event:f.event};
|
||||
const invalid = structuredClone(g);
|
||||
assert.throws(() => act(invalid,f.mover,action)); assert.deepEqual(invalid,g);
|
||||
const after = act(g,'richese',action);
|
||||
assert.deepEqual(kind === 'choamMovement' ? after.pendingChoamMove :
|
||||
kind === 'fremenMovement' ? after.pendingFremenMove : after.pendingIxMove,pending);
|
||||
assert.deepEqual(kind === 'choamMovement' ? after.decision : after.response,control);
|
||||
assert.deepEqual(seat(after,f.mover).forces,seat(g,f.mover).forces);
|
||||
assert.equal(seat(after,'richese').noField?.deployed,null);
|
||||
assert.equal(seat(after,'richese').reserves,before.reserves-value);
|
||||
assert.equal(seat(after,'richese').forces['polar_sink:0'] ?? 0,(before.forces['polar_sink:0'] ?? 0)+value);
|
||||
assert.deepEqual(cards(after),inventory);
|
||||
assert.throws(() => act(after,'richese',action));
|
||||
return after;
|
||||
}
|
||||
function finishPending(g: Game) {
|
||||
for (let n = 0; n < 40; n++) {
|
||||
if (g.pendingKull?.stage === 'offer') {
|
||||
g = act(g,g.pendingKull.player,{type:'kullDecision',event:g.pendingKull.event,decline:true}); continue;
|
||||
}
|
||||
if (g.pendingTreacheryDiscard) {
|
||||
const reaction = g.pendingTreacheryDiscard.reaction; assert.ok(reaction?.stage === 'offer');
|
||||
const actor = g.players.find(p => !reaction.passed.includes(p.id)); assert.ok(actor);
|
||||
g = act(g,actor.id,{type:'semutaPass',event:g.pendingTreacheryDiscard.batch.event}); continue;
|
||||
}
|
||||
if (g.response) {
|
||||
const actor = g.players.find(p => !g.response!.passed.includes(p.id)); assert.ok(actor);
|
||||
g = act(g,actor.id,{type:'passResponse'}); continue;
|
||||
}
|
||||
if (g.decision?.kind === 'choamMovement') {
|
||||
g = act(g,g.decision.player,{type:'decision',decline:true}); continue;
|
||||
}
|
||||
return g;
|
||||
}
|
||||
throw Error('The original movement response did not finish');
|
||||
}
|
||||
for (const kind of ['fremenMovement','ixMovement','choamMovement'] as const) {
|
||||
for (const value of [0,3] as const) void test(`Advanced ${kind} retains its original physical move through No-Field ${value} reveal`, () => {
|
||||
const f = source(kind,value), after = reveal(kind,value);
|
||||
const control = finishPending(reload(f.game)), done = finishPending(reload(after));
|
||||
assert.deepEqual(seat(done,f.mover),seat(control,f.mover));
|
||||
assert.equal(seat(done,f.mover).forces[f.destination],(seat(f.beforeMove,f.mover).forces[f.destination] ?? 0)+1);
|
||||
assert.equal(seat(done,f.mover).forces[f.origin] ?? 0,(seat(f.beforeMove,f.mover).forces[f.origin] ?? 0)-1);
|
||||
assert.equal(seat(done,f.mover).moved,seat(f.beforeMove,f.mover).moved+1);
|
||||
assert.equal(seat(done,'richese').forces['polar_sink:0'] ?? 0,value);
|
||||
});
|
||||
void test(`Advanced ${kind} cancellation after reveal preserves unspent movement`, () => {
|
||||
const f = source(kind), after = reveal(kind);
|
||||
let pending = kind === 'choamMovement'
|
||||
? act(after,'choam',{type:'card',card:f.baliset,mode:'choam',target:f.mover,territory:splitLocation(f.destination).territory})
|
||||
: act(after,'emperor',{type:'card',card:f.karama,mode:'cancel'});
|
||||
pending = finishPending(pending);
|
||||
assert.deepEqual(seat(pending,f.mover).forces,seat(f.beforeMove,f.mover).forces);
|
||||
assert.equal(seat(pending,f.mover).moved,seat(f.beforeMove,f.mover).moved);
|
||||
assert.equal(seat(pending,'richese').forces['polar_sink:0'],3);
|
||||
});
|
||||
void test(`all bot profiles have a legal response to preserved Advanced ${kind}`, () => {
|
||||
const after = reveal(kind), actor = kind === 'choamMovement' ? 'choam' : 'emperor';
|
||||
for (const difficulty of DIFFICULTIES) {
|
||||
const view = viewGame(after,actor); view.players.find(p => p.id === actor)!.bot = difficulty;
|
||||
const action = botActions(view)[0]; assert.ok(action,difficulty);
|
||||
assert.doesNotThrow(() => act(reload(after),actor,action));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import test from 'node:test';
|
||||
import { createGame, newPlayer, type Game } from '../game/engine';
|
||||
import { createRicheseNoField, deployRicheseNoField } from '../game/richese-no-field';
|
||||
import { richeseRevealForeignMovementPending } from '../game/richese-reveal-foreign-movement';
|
||||
import { basicPendingMovement } from '../game/basic-pending-movement';
|
||||
|
||||
/** Staged response packets exercise only the classifier. Native actions and
|
||||
* actual reveal/continuation are covered by the separate runtime programme. */
|
||||
@@ -47,6 +48,26 @@ void test('all three ordinary foreign-movement parents are classified without mu
|
||||
}
|
||||
});
|
||||
|
||||
void test('Advanced foreign movement is admitted only through the reveal-specific opt-in', () => {
|
||||
for (const [kind, expected] of [
|
||||
['fremen', 'pendingFremenMove'], ['ixians', 'pendingIxMove'], ['choam', 'pendingChoamMove'],
|
||||
] as const) {
|
||||
const g = movement(kind); g.advanced = true;
|
||||
assert.equal(basicPendingMovement(g), null);
|
||||
assert.equal(richeseRevealForeignMovementPending(g), expected);
|
||||
}
|
||||
});
|
||||
|
||||
void test('Advanced BG movement into the marker territory retains its existing arrival stance', () => {
|
||||
for (const token of ['zero', 'three'] as const) {
|
||||
const g = movement('choam'); g.advanced = true; g.players[1].faction = 'beneGesserit';
|
||||
g.players[0].noField = deployRicheseNoField(createRicheseNoField(['zero', 'three', 'five']), {
|
||||
tokenId: token, controller: 'r', location: {territory:'carthag', sector:11},
|
||||
});
|
||||
assert.equal(richeseRevealForeignMovementPending(g), null);
|
||||
}
|
||||
});
|
||||
|
||||
void test('foreign movement requires the original actor, source, response and no unrelated child', () => {
|
||||
for (const kind of ['fremen', 'ixians', 'choam'] as const) {
|
||||
const g = movement(kind);
|
||||
|
||||
Reference in new issue
Block a user