Support owned Box and Kulon movement-promise preparation
Extend bounded Basic ground-movement reachability to held native CHOAM Kulon and owned paid Box recovery. Before payment, use only known current-discard identities. Preserve actual paid event, full inspection, one two-spice fee, original physical card replay and existing provisional full-hand exchange. Reject a Yes-breaking selection before the server shuffle without losing the paid search. Keep No-only searches on their normal decision before movement can end. Record movement-relevant current-discard certainty at actual disposal, paid search, mixed claim and deck rebuild boundaries without projecting raw metadata or erasing historical memory. Use deterministic preparation on private copies, include preparation state in search memoization, protect fee-funded routes from voluntary spending and keep native Kulon counter semantics. Persistent busy-safe guidance and existing legal profiles use the actual next paid action; no strategy tuning. Verify 17 files231/231, types/lint/build, three original-action control/table-rendering programmes and four existing profiles with40 accepted actions including neutral passes. Original public sources44/25 retain actual purchases1+1, shipment costs6/1, exhausted Hajr and native Kulon route4. Separate full-hand, legacy certainty, fee-loss and acquired-counter edges disclose conserved staging. Two prior-engine Auditor fixture failures are repaired by actual battle-result acknowledgements; test-only const lint is corrected. Other timing, preparations/counter mitigation, unknown private possibilities, optional/Advanced, full modes, comprehensive assurance and deployed acceptance remain open. No saved-room/reset/restart/deployment operation.
This commit is contained in:
1 parent
edbcbe28de
commit
b5a53da712
16 files changed
+772
-41
No files matched your search
@@ -4,7 +4,7 @@ import { liveMovementPromises, movementEventAllowed, settleMovementEvent, type M
|
||||
|
||||
export type MovementPromiseAdapter = {
|
||||
allowance: (game: Game, player: Player) => number;
|
||||
prepareHajr: (game: Game, player: string) => Game | null;
|
||||
preparations: (game: Game, player: string) => Iterable<{ game: Game; actions: Action[] }>;
|
||||
reachable: (game: Game, player: Player, origin: string, destination: string, sector: number) => boolean;
|
||||
project: (game: Game, player: string, action: Action) => { game: Game; event: MovementEvent } | null;
|
||||
};
|
||||
@@ -31,7 +31,8 @@ function* groups(player: Player, keys: string[], amount: number, index = 0,
|
||||
}
|
||||
|
||||
/** Finite owned-action reachability. Each move consumes a real entitlement;
|
||||
* Hajr and Ornithopter are existing physical cards, never invented future draws.
|
||||
* Hajr, Ornithopter, Kulon and Box use owned physical cards and known or
|
||||
* already-paid recovery choices, never invented unknown future draws.
|
||||
* The adapter shares authoritative movement validation/physical commitment.
|
||||
* Opposing arrival outcomes are not simulated or assumed. */
|
||||
export function findMovementCompletion(source: Game, actor: string,
|
||||
@@ -44,13 +45,15 @@ export function findMovementCompletion(source: Game, actor: string,
|
||||
const physical = Object.values(player.forces).reduce((sum, amount) => sum + amount, 0);
|
||||
if (live.some(promise => promise.answer && promise.minimum > physical)) return null;
|
||||
const key = JSON.stringify([player.forces, player.elites, player.moved, player.hand.map(card => card.id),
|
||||
player.hajrPlays, player.ornithopterExtraMoves, game.hajr, game.ornithopter ? [game.ornithopter.mode, game.ornithopter.startingMove, game.ornithopter.completed, game.ornithopter.cohort] : null,
|
||||
player.hajrPlays, player.ornithopterExtraMoves, player.spice, game.choamMovement,
|
||||
game.discard.map(card => card.id), game.movementDiscardKnowledge?.[actor], game.pendingNullentropy,
|
||||
game.choamWorthlessBlocked, game.hajr, game.ornithopter ? [game.ornithopter.mode, game.ornithopter.startingMove, game.ornithopter.completed, game.ornithopter.cohort] : null,
|
||||
live.map(promise => [promise.territory, promise.minimum, promise.answer])]);
|
||||
if (failed.has(key)) return null;
|
||||
const destinations = gameTerritories(game).filter(destination => !destination.id.startsWith('homeworld:'));
|
||||
destinations.sort((a, b) => Number(live.some(p => p.answer && p.territory === b.id)) -
|
||||
Number(live.some(p => p.answer && p.territory === a.id)));
|
||||
if (player.moved < adapter.allowance(game, player)) {
|
||||
if (!game.pendingNullentropy && player.moved < adapter.allowance(game, player)) {
|
||||
const origins = [...new Set(Object.keys(player.forces).filter(key => player.forces[key] > 0)
|
||||
.map(key => splitLocation(key).territory))];
|
||||
const card = !game.ornithopter ? player.hand.find(card => card.effect === 'ornithopter') : null;
|
||||
@@ -80,10 +83,8 @@ export function findMovementCompletion(source: Game, actor: string,
|
||||
}
|
||||
}
|
||||
}
|
||||
const prepared = adapter.prepareHajr(game, actor);
|
||||
if (prepared) {
|
||||
const card = player.hand.find(card => card.effect === 'hajr')!;
|
||||
const result = search(prepared, live, [...actions, { type: 'card', card: card.id }]);
|
||||
for (const prepared of adapter.preparations(game, actor)) {
|
||||
const result = search(prepared.game, live, [...actions, ...prepared.actions]);
|
||||
if (result) return result;
|
||||
}
|
||||
failed.add(key); return null;
|
||||
|
||||
Reference in new issue
Block a user