Allow recovered Sapho at Testing Station
Verify and publish checkpoint container / container (push) Successful in 11m20s

This commit is contained in:
Quintine committed 2026-11-16 19:50:58 +11:00
1 parent 1ff520a9fc
commit 05f7fc8f20
12 files changed
+371 -33

No files matched your search

+50 -25
View File
@@ -16,6 +16,13 @@ export type StormMovementSource = {
distance: number;
signature: string;
};
type SaphoStationReceipt = {
event: string;
nextEvent: string;
originalOrder: string[];
holder: string;
mode: 'first' | 'last';
};
export type DiscoveryStorm = {
event: string;
turn: number;
@@ -30,14 +37,10 @@ export type DiscoveryStorm = {
order: string[];
choices: { owner: string; delta: -1 | 0 | 1 }[];
};
/** One provisional Sapho reorder, bound to the original physical order. */
sapho?: {
event: string;
nextEvent: string;
originalOrder: string[];
holder: string;
mode: 'first' | 'last';
};
/** Latest provisional reorder. Earlier saved single-use receipts keep this shape. */
sapho?: SaphoStationReceipt;
/** Earlier receipts, present only after an actual subsequent physical play. */
saphoHistory?: SaphoStationReceipt[];
};
export type DiscoveryStormContext = Pick<
Game,
@@ -94,6 +97,7 @@ export function discoveryStormSignature(
];
if (frame.queue) values.push(frame.queue.order, frame.queue.choices);
if (frame.sapho) values.push(frame.sapho);
if (frame.saphoHistory) values.push(frame.saphoHistory);
return JSON.stringify(values);
}
export function discoveryStormDistance(frame: DiscoveryStorm): number {
@@ -174,7 +178,9 @@ export function validateDiscoveryStorm(
record(frame) &&
Object.keys(frame).sort().join(',') === (frame.queue
? (frame.sapho
? 'base,delta,event,from,owner,queue,sapho,signature,stage,token,turn'
? (frame.saphoHistory
? 'base,delta,event,from,owner,queue,sapho,saphoHistory,signature,stage,token,turn'
: 'base,delta,event,from,owner,queue,sapho,signature,stage,token,turn')
: 'base,delta,event,from,owner,queue,signature,stage,token,turn')
: 'base,delta,event,from,owner,signature,stage,token,turn') &&
typeof frame.event === 'string' &&
@@ -223,18 +229,33 @@ export function validateDiscoveryStorm(
need(distance >= 0 && distance <= 40, 'Every station choice must retain a legal current distance.');
}
if (frame.sapho) {
const sapho = frame.sapho;
need(record(sapho) && Object.keys(sapho).sort().join(',') === 'event,holder,mode,nextEvent,originalOrder' &&
typeof sapho.event === 'string' && sapho.event.length > 0 &&
typeof sapho.nextEvent === 'string' && sapho.nextEvent.length > 0 && sapho.nextEvent !== sapho.event &&
Array.isArray(sapho.originalOrder) && sapho.originalOrder.length === 2 &&
new Set(sapho.originalOrder).size === 2 &&
sapho.originalOrder.every(id => typeof id === 'string' && g.players.some(p => p.id === id)) &&
sapho.originalOrder.includes(sapho.holder) && ['first', 'last'].includes(sapho.mode) &&
(sapho.mode === 'first' ? sapho.originalOrder[1] === sapho.holder : sapho.originalOrder[0] === sapho.holder) &&
JSON.stringify(queue.order) === JSON.stringify([...sapho.originalOrder].reverse()) &&
frame.event === (queue.choices.length ? `${sapho.nextEvent}:1` : sapho.nextEvent),
'The station must retain the original Sapho ordering and event.');
need(frame.saphoHistory === undefined ||
Array.isArray(frame.saphoHistory) && frame.saphoHistory.length > 0,
'The station must retain its preceding Sapho orderings.');
const receipts = [...(frame.saphoHistory ?? []), frame.sapho];
const events = new Set<string>();
let previous: SaphoStationReceipt | undefined;
for (const sapho of receipts) {
need(record(sapho) && Object.keys(sapho).sort().join(',') === 'event,holder,mode,nextEvent,originalOrder' &&
typeof sapho.event === 'string' && sapho.event.length > 0 &&
typeof sapho.nextEvent === 'string' && sapho.nextEvent.length > 0 && sapho.nextEvent !== sapho.event &&
Array.isArray(sapho.originalOrder) && sapho.originalOrder.length === 2 &&
new Set(sapho.originalOrder).size === 2 &&
sapho.originalOrder.every(id => typeof id === 'string' && g.players.some(p => p.id === id)) &&
sapho.originalOrder.includes(sapho.holder) && ['first', 'last'].includes(sapho.mode) &&
(sapho.mode === 'first' ? sapho.originalOrder[1] === sapho.holder : sapho.originalOrder[0] === sapho.holder) &&
(!previous || sapho.event === previous.nextEvent &&
JSON.stringify(sapho.originalOrder) === JSON.stringify([...previous.originalOrder].reverse())) &&
!events.has(sapho.nextEvent),
'The station must retain each original Sapho ordering and event.');
events.add(sapho.event);
events.add(sapho.nextEvent);
previous = sapho;
}
const latest = frame.sapho;
need(JSON.stringify(queue.order) === JSON.stringify([...latest.originalOrder].reverse()) &&
frame.event === (queue.choices.length ? `${latest.nextEvent}:1` : latest.nextEvent),
'The station must retain the latest Sapho ordering and event.');
}
}
need(
@@ -275,7 +296,8 @@ export function validateDiscoveryStorm(
if (frame.stage === 'choose') {
const occupants = stationOccupants(g);
need(
JSON.stringify(occupants) === JSON.stringify(frame.sapho?.originalOrder ?? frame.queue?.order ?? [frame.owner]) &&
JSON.stringify(occupants) === JSON.stringify(frame.saphoHistory?.[0]?.originalOrder ??
frame.sapho?.originalOrder ?? frame.queue?.order ?? [frame.owner]) &&
g.stormPending === discoveryStormDistance(frame),
'The station choice no longer belongs to its original occupant and storm.',
);
@@ -294,12 +316,12 @@ export function discoveryStormSaphoModes(
holder: string,
): Array<'first' | 'last'> {
validateDiscoveryStorm(g, frame);
if (frame.stage !== 'choose' || !frame.queue || frame.queue.choices.length || frame.sapho) return [];
if (frame.stage !== 'choose' || !frame.queue || frame.queue.choices.length) return [];
const index = frame.queue.order.indexOf(holder);
return index === 0 ? ['last'] : index === 1 ? ['first'] : [];
}
/** Bind a single meaningful reorder and invalidate all old station actions. */
/** Bind each meaningful physical play to a fresh event; choices never replay. */
export function reorderDiscoveryStorm(
g: DiscoveryStormContext,
frame: DiscoveryStorm,
@@ -307,7 +329,9 @@ export function reorderDiscoveryStorm(
): DiscoveryStorm {
const modes = discoveryStormSaphoModes(g, frame, input.holder);
need(input.event === frame.event && modes.includes(input.mode) &&
typeof input.nextEvent === 'string' && input.nextEvent.length > 0 && input.nextEvent !== frame.event,
typeof input.nextEvent === 'string' && input.nextEvent.length > 0 && input.nextEvent !== frame.event &&
![...(frame.saphoHistory ?? []), ...(frame.sapho ? [frame.sapho] : [])]
.some(receipt => receipt.event === input.nextEvent || receipt.nextEvent === input.nextEvent),
'Choose an available Sapho ordering for the current station event.');
const originalOrder = [...frame.queue!.order];
const order = [...originalOrder].reverse();
@@ -315,6 +339,7 @@ export function reorderDiscoveryStorm(
...frame, event: input.nextEvent, owner: order[0],
queue: {order, choices: []},
sapho: {event: frame.event, nextEvent: input.nextEvent, originalOrder, holder: input.holder, mode: input.mode},
...(frame.sapho ? {saphoHistory:[...(frame.saphoHistory ?? []), frame.sapho]} : {}),
signature: '',
};
next.signature = discoveryStormSignature(next);
+8
View File
@@ -1829,6 +1829,8 @@ export type Game = {
card: string;
event: string;
mode: 'first' | 'last';
/** New reactions reopen the neutral order window after the discard. */
stationReplayPriority?: true;
resume: NonNullable<Game['pendingNullentropy']>['resume'];
stateSignature: string;
}
@@ -6695,6 +6697,7 @@ type SaphoStationDiscardContinuation = Extract<
>;
function saphoStationDiscardSignature(g: Game, c: SaphoStationDiscardContinuation) {
return JSON.stringify({player:c.player, card:c.card, event:c.event, mode:c.mode,
...(c.stationReplayPriority ? {stationReplayPriority:true} : {}),
parent:nullentropyParentSignature(g,c.resume,c.event), turn:g.turn, phase:g.phase,
order:g.order, ready:g.ready, storm:g.storm, stormPending:g.stormPending,
source:g.stormMovementSource, station:g.ecologicalStorm, discoveries:g.discoveries,
@@ -10006,6 +10009,7 @@ function semutaOfferSupported(
if (continuation.kind === 'saphoStationDiscard') {
const frame = g.ecologicalStorm, decision = continuation.resume.decision, receipt = frame?.sapho;
return g.semutaPreview === true && g.discoveryEnabled === true && !!g.discoveries &&
(continuation.stationReplayPriority === undefined || continuation.stationReplayPriority === true) &&
discoveryModeSupported(g) && g.status === 'playing' && g.phase === 0 &&
frame?.stage === 'choose' && frame.queue?.choices.length === 0 &&
receipt?.event === continuation.event && receipt.holder === continuation.player &&
@@ -10856,6 +10860,9 @@ function finishTreacheryDiscard(g: Game, claim?: { player: string; card: string
g.decision = next.resume.decision;
g.pendingKarama = next.resume.pendingKarama;
g.phaseOpening = next.resume.phaseOpening;
if (next.stationReplayPriority && g.ecologicalStorm?.stage === 'choose' &&
g.ecologicalStorm.queue?.choices.length === 0)
g.saphoStationPriority = {event:g.ecologicalStorm.event,passed:[]};
} else if (next.kind === 'saphoMovementDiscard') {
g.response = next.resume.response;
g.decision = next.resume.decision;
@@ -30982,6 +30989,7 @@ function playSapho(g: Game, p: Player, action: Action) {
if (g.semutaPreview) {
const continuation: SaphoStationDiscardContinuation = {
kind:'saphoStationDiscard', player:p.id, card:used.id, event:option.event, mode:option.mode,
stationReplayPriority:true,
resume:{response:g.response, decision:g.decision, pendingKarama:g.pendingKarama, phaseOpening:g.phaseOpening},
stateSignature:'',
};
+1 -1
View File
@@ -516,7 +516,7 @@ export const RULE_TOPICS: RuleTopic[] = [
'In a fresh Richese battle, use unreserved Sapho at a clean boundary before both combatants finish final battle actions, including after sealed plans and revealed declarations. Habbanya still precedes ordinary aggressor tie priority. Participants, plans, promises, weapon choices and votes do not swap or replay. Older battles retain their pre-plan opportunity.',
'When two or more players declared Truthtrance in a supported clean parent, each queued holder may continue or use their held Sapho to move their entire pending question group first or last. Physical storm order and each holder’s card order stay unchanged. Supported Semuta claim/pass restores the same question queue, including the selected Homeworld, Leader Skills and Discovery profiles. Clean ordinary auction lots also preserve their standing bid and remaining clock. Richese cache Once Around and Silent lots and Advanced Black Market lots preserve their original bidding and funding. Fresh Advanced CHOAM-only Richese games offer Semuta on this Sapho discard and supported definite factual or bid-question Truthtrance discards in those auctions. Other question families and combinations remain unfinished.',
'During a clean native Extortion payer decision, use Sapho to take your optional choice first/last among unanswered non-Moritani players. Earlier declines, collected bank5 and the one-payment3 limit remain. The next payer event changes even when that player stays next. You may decline instead of paying.',
'Before either of two Ecological Testing Station occupants chooses, use Sapho to take your adjustment first or last if that changes the order. Fresh choices with Richese seated give both occupants a shared opportunity to use an available order change or continue; an automated occupant cannot advance the station choice while another player is deciding. Each occupant still adjusts the cumulative storm distance once. Physical storm order and its original source stay unchanged. In supported Semuta games, claim or pass resumes the same next choice. Replay of a recovered Sapho remains unfinished; this online priority is provisional.',
'Before either of two Ecological Testing Station occupants chooses, use Sapho to take your adjustment first or last if that changes the order. Fresh choices with Richese seated give both occupants a shared opportunity to use an available order change or continue; an automated occupant cannot advance the station choice while another player is deciding. Each occupant still adjusts the cumulative storm distance once. Physical storm order and its original source stay unchanged. In supported Semuta games, claim or pass reopens the shared opportunity; an occupant may use a recovered Sapho again before either choice. This online priority is provisional.',
'During ordered Advanced Charity, take your remaining turn first or last, then discard Sapho. An accepted current claim provisionally protects that actor while another holder reorders only later unstarted turns. At a clean boundary, the holder may pause its own claimed turn and resume last without repeating the claim or payment. Completed turns stay closed and physical First Player order is unchanged. Basic and older concurrent phases have no ordered scope.',
'During ordered Advanced Revival, take your unfinished opportunity first or last, then discard Sapho. If another player has started, provisional queued timing lets that player finish unchanged. At a clean boundary, you may instead pause your own started turn and resume last, retaining used allowances. Pending requests must finish first. Completed turns and already-held positions cannot be repeated. Basic and older concurrent Revival phases have no ordered scope.',
'When two or more players declare simultaneous Truthtrances in a quiet unrevealed battle, their public question-order window can use Sapho to move the holder’s group first or last. The current battle and committed plans remain in place. In the supported Basic Semuta preview, the discard and any exchange finish before the reordered questions resume.',