Allow Advanced Emperor gifts during Guild rate responses
Verify and publish checkpoint container / container (push) Successful in 11m3s

This commit is contained in:
Quintine committed 2026-11-16 17:48:41 +11:00
1 parent b3843bf18e
commit 5e7f7b45e4
14 files changed
+475 -6

No files matched your search

@@ -0,0 +1,27 @@
'use client';
import type {Action, GameView} from '@/game/engine';
/** A public, balance-independent opportunity for the Emperor's ally gift. */
export function EmperorGuildRatePriority({game, act, busy}: {
game: Pick<GameView, 'emperorGuildRatePriority' | 'players'>;
act: (action:Action) => void;
busy: boolean;
}) {
const priority = game.emperorGuildRatePriority;
if (!priority) return null;
const event = priority.event;
const recipient = game.players.find(player => player.id === priority.recipient)?.name ?? 'their ally';
const canContinue = () => !busy && game.emperorGuildRatePriority === priority &&
priority.canContinue && priority.event === event && typeof event === 'string' && event.length > 0;
return <section className="notice space-y-3" aria-label="Emperor Guild rate opportunity" aria-live="polite">
<h3>Emperor alliance opportunity</h3>
<p>Before the Guild rate response continues, the Emperor may share spice with {recipient}.</p>
{priority.canContinue
? <button type="button" className="game-action" disabled={!canContinue()}
onClick={() => {if (canContinue()) act({type:'emperorGuildRateContinue', event});}}>
Continue to Guild rate
</button>
: <p>Waiting for the Emperor to continue.</p>}
</section>;
}
+5 -2
View File
@@ -14,7 +14,8 @@ export function EmperorTimingGift({ game, act, busy }: {
const [raw, setRaw] = useState('1'); const [raw, setRaw] = useState('1');
const phaseOpening = game.emperorPhaseOpeningGift; const phaseOpening = game.emperorPhaseOpeningGift;
const extortion = game.emperorExtortionGift; const extortion = game.emperorExtortionGift;
const offer = phaseOpening ?? extortion ?? game.emperorGuildTimingGift; const guildRate = game.emperorGuildRateGift;
const offer = phaseOpening ?? extortion ?? guildRate ?? game.emperorGuildTimingGift;
if (!offer) return null; if (!offer) return null;
const amount = /^[1-9]\d*$/.test(raw) ? Number(raw) : NaN; const amount = /^[1-9]\d*$/.test(raw) ? Number(raw) : NaN;
const canShare = !busy && Number.isSafeInteger(amount) && amount >= 1 && amount <= offer.maximum; const canShare = !busy && Number.isSafeInteger(amount) && amount >= 1 && amount <= offer.maximum;
@@ -26,7 +27,9 @@ export function EmperorTimingGift({ game, act, busy }: {
? 'Phase opening resumes after the Karama response to your gift.' ? 'Phase opening resumes after the Karama response to your gift.'
: extortion : extortion
? 'The Moritani Extortion decision resumes after the Karama response to your gift.' ? 'The Moritani Extortion decision resumes after the Karama response to your gift.'
: 'The Guild timing decision resumes after the Karama response to your gift.'}</p> : guildRate
? 'The original Guild rate response resumes after the Karama response to your gift.'
: 'The Guild timing decision resumes after the Karama response to your gift.'}</p>
<label htmlFor={`${id}-amount`}>Spice to share</label> <label htmlFor={`${id}-amount`}>Spice to share</label>
<input id={`${id}-amount`} type="number" inputMode="numeric" min={1} max={offer.maximum} <input id={`${id}-amount`} type="number" inputMode="numeric" min={1} max={offer.maximum}
step={1} value={raw} disabled={busy} onChange={event => setRaw(event.target.value)} /> step={1} value={raw} disabled={busy} onChange={event => setRaw(event.target.value)} />
+3
View File
@@ -297,6 +297,7 @@ import { RosterAlliance } from './roster-alliance';
import { CoalitionFunding, coalitionFundingContributions, type CoalitionFundingContribution } from './coalition-funding'; import { CoalitionFunding, coalitionFundingContributions, type CoalitionFundingContribution } from './coalition-funding';
import { CoalitionEmperorAid } from './coalition-emperor-aid'; import { CoalitionEmperorAid } from './coalition-emperor-aid';
import { EmperorTimingGift } from './emperor-timing-gift'; import { EmperorTimingGift } from './emperor-timing-gift';
import { EmperorGuildRatePriority } from './emperor-guild-rate-priority';
import { EmperorAuctionGift } from './emperor-auction-gift'; import { EmperorAuctionGift } from './emperor-auction-gift';
import { NexusEmperorPayment } from './nexus-emperor-payment'; import { NexusEmperorPayment } from './nexus-emperor-payment';
import { NexusEmperorSellerPurchase } from './nexus-emperor-seller-purchase'; import { NexusEmperorSellerPurchase } from './nexus-emperor-seller-purchase';
@@ -2607,6 +2608,8 @@ export function GameTable({
) : g.response ? ( ) : g.response ? (
<> <>
<span className="eyebrow">Power response</span> <span className="eyebrow">Power response</span>
<EmperorTimingGift game={g} act={act} busy={busy} />
<EmperorGuildRatePriority game={g} act={act} busy={busy} />
<h2> <h2>
{ {
{ {
+11 -2
View File
@@ -17,6 +17,16 @@ open mode gates.
## Current checkpoint and work ## Current checkpoint and work
**Advanced Emperor gift at a Guild rate response — 16 November. Prototyped /
Partial.** A neutral Emperor opportunity precedes a supported classic Advanced
rate response's automatic or bot completion. A gift or Continue retains the
original shipment, rate, passes and funding; the gift has its own cancelable
response. The public wait is independent of private balances and hands, while
only the Emperor sees the available amount. Eight related unit files pass 42
cases, including genuine reserve, cross and return shipment journeys. Other
modules, complete games and deployed acceptance remain open.
[Scope](EMPEROR_ALLIANCE_TIMING.md#advanced-emperor-gift-at-a-guild-rate-response--16-november-2026).
**Advanced Truthtrance ally funding — 16 November. Prototyped / Partial.** **Advanced Truthtrance ally funding — 16 November. Prototyped / Partial.**
Supported quiet Advanced Bidding and Shipment/Movement now use the existing Supported quiet Advanced Bidding and Shipment/Movement now use the existing
funding-update question, private feasible answers and native escrow. Pending funding-update question, private feasible answers and native escrow. Pending
@@ -37,8 +47,7 @@ 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 The latest bounded scan found first versions of the standalone Basic native
faction powers inspected, with interaction and complete-game boundaries still faction powers inspected, with interaction and complete-game boundaries still
open. An additional source-clear Advanced candidate is an Emperor gift during open.
a Guild-rate response; it is not implemented or verified by this checkpoint.
**Basic Emperor gifts while Sandtrout waits — 16 November. Prototyped / **Basic Emperor gifts while Sandtrout waits — 16 November. Prototyped /
Partial.** Supported opening, ordinary auction and Richese cache gift windows Partial.** Supported opening, ordinary auction and Richese cache gift windows
+23
View File
@@ -1,5 +1,28 @@
# Emperor alliance gift timing # Emperor alliance gift timing
## Advanced Emperor gift at a Guild rate response — 16 November 2026
**Prototyped / Partial.** In supported classic-faction Advanced games, the
Emperor may give an ally spice before a pending ordinary reserve shipment or
Guild cross/return transport rate response continues. A neutral public
opportunity appears independently of hidden hands and balances; the Emperor
may share or Continue and a bot may Continue. The gift has its own Karama
response. After allowance or cancellation, the original rate response and its
passes, physical shipment and approved funding resume; the existing rate
prevention and repricing policy then applies. The Emperor's own pending
shipment cost remains reserved when calculating a gift maximum. Live funding
promises retain their existing safeguards.
The user-authorized revised rules physical p. 31 / printed p. 29 allow the
allied transfer at any time; this online priority and its Continue control are
provisional ordering, not a separate publisher ruling. The
[public-start cases](../tests/emperor-guild-rate-gift-advanced.test.ts) and
[cross/return cases](../tests/emperor-guild-rate-gift-transport-advanced.test.ts)
use a real worm, alliance and Guild shipment, with staged wallets and card custody;
[controls](../tests/emperor-guild-rate-gift-controls.test.tsx) cover the
opportunity and gift. Other optional modules, wider nested responses, complete
games and deployed acceptance remain open.
## Basic opening and auction gifts with waiting Sandtrout — 16 November 2026 ## Basic opening and auction gifts with waiting Sandtrout — 16 November 2026
**Prototyped / Partial.** A waiting Sandtrout no longer suppresses an **Prototyped / Partial.** A waiting Sandtrout no longer suppresses an
+7
View File
@@ -1,5 +1,12 @@
# Rule decision index # Rule decision index
## Advanced Emperor gift at a Guild rate response — 16 November 2026
The Emperor's existing allied gift can interrupt a supported Guild-rate
response, which is retained through the gift's independent response. Public
priority is a provisional online timing choice.
[Scope](EMPEROR_ALLIANCE_TIMING.md#advanced-emperor-gift-at-a-guild-rate-response--16-november-2026).
## Advanced Truthtrance ally funding — 16 November 2026 ## Advanced Truthtrance ally funding — 16 November 2026
The existing provisional current-phase funding-update question extends to The existing provisional current-phase funding-update question extends to
+6
View File
@@ -4373,6 +4373,12 @@ function botAdvisorMatchingAllowed(g:GameView,action:Action) {
} catch(error) { if(error instanceof AdvisorMatchingError) return false; throw error; } } catch(error) { if(error instanceof AdvisorMatchingError) return false; throw error; }
} }
export function botActions(g: GameView): Action[] { export function botActions(g: GameView): Action[] {
if (g.emperorGuildRatePriority) {
const me = g.players.find(player => player.id === g.me);
return (me?.bot || me?.autopilot) && g.emperorGuildRatePriority.canContinue &&
g.status === 'playing' && !g.roomControl?.paused && !g.roomControl?.closed && !g.automaticContinuationPending
? [{type:'emperorGuildRateContinue', event:g.emperorGuildRatePriority.event}] : [];
}
if (g.saphoStationPriority) { if (g.saphoStationPriority) {
const own = g.players.find(player => player.id === g.me), priority = g.saphoStationPriority; const own = g.players.find(player => player.id === g.me), priority = g.saphoStationPriority;
return (own?.bot || own?.autopilot) && g.status === 'playing' && priority.canPass && return (own?.bot || own?.autopilot) && g.status === 'playing' && priority.canPass &&
+101 -2
View File
@@ -1254,6 +1254,8 @@ type SpiceBankerIncomePayment = {
}; };
export type ResponseWindow = { export type ResponseWindow = {
/** Original Guild-rate response parked while an allied gift is resolved. */
emperorGuildRateGift?: { event: string; response: ResponseWindow; signature: string };
/** The original public Guild timing decision remains live during this gift. */ /** The original public Guild timing decision remains live during this gift. */
emperorGuildTimingGift?: { event: string; signature: string }; emperorGuildTimingGift?: { event: string; signature: string };
/** The original Extortion payment decision remains live during this gift. */ /** The original Extortion payment decision remains live during this gift. */
@@ -2396,6 +2398,7 @@ export type Game = {
moritaniExtortion?: ExtortionState; moritaniExtortion?: ExtortionState;
/** Public release of the human Emperor's optional gift opportunity. */ /** Public release of the human Emperor's optional gift opportunity. */
emperorExtortionGiftRelease?: { event: string; emperor: string; recipient: string }; emperorExtortionGiftRelease?: { event: string; emperor: string; recipient: string };
emperorGuildRateGiftRelease?: { event: string; emperor: string };
grummanCollection?: GrummanCollection; grummanCollection?: GrummanCollection;
pendingMoritaniPlacement?: { pendingMoritaniPlacement?: {
token: string; token: string;
@@ -30836,6 +30839,59 @@ function emperorGuildTimingGiftIntegrity(g: Game) {
if (g.pendingKarama?.use.kind === 'cancel') if (g.pendingKarama?.use.kind === 'cancel')
validateEmperorGuildTimingGift(g, g.pendingKarama.use.response); validateEmperorGuildTimingGift(g, g.pendingKarama.use.response);
} }
function emperorGuildRateGiftPublicEligible(g: Game, p: Player): boolean {
const response = g.response;
const event = response?.guildRateEvent ?? response?.guildTransportEvent;
return g.status === 'playing' && g.advanced && g.phase === 5 && g.expansions.length === 0 &&
g.players.every(seat => ['atreides','beneGesserit','emperor','fremen','guild','harkonnen'].includes(seat.faction)) &&
!g.techTokens && !g.strongholdCards && !g.leaderSkills && !g.homeworlds && !g.nexusCards &&
!g.discoveryEnabled && !g.sandtrout && !g.coalitionPreview && !g.coalitionState && !g.phaseOpening && !g.decision &&
!g.truthtrance && !g.pendingKarama && !g.pendingTreacheryDiscard && !g.pendingKull &&
!g.pendingRicheseGift && !g.pendingNullentropy && !g.pendingEmperorAuctionGift &&
!g.pendingArrivalOverlap && !g.pendingAmbassador &&
response?.kind === 'guildRate' && typeof event === 'string' && !!event &&
(!!g.pendingShipment !== !!g.pendingGuildTransport) && p.faction === 'emperor' && !!p.ally &&
g.players.some(seat => seat.id === p.ally && seat.ally === p.id);
}
function emperorGuildRatePriority(g: Game): {event:string; emperor:string; recipient:string} | null {
const emperor = byFaction(g, 'emperor');
if (!emperor || !emperorGuildRateGiftPublicEligible(g, emperor) || !emperor.ally) return null;
const event = g.response!.guildRateEvent ?? g.response!.guildTransportEvent!;
if (g.emperorGuildRateGiftRelease?.event === event && g.emperorGuildRateGiftRelease.emperor === emperor.id) return null;
return {event, emperor:emperor.id, recipient:emperor.ally};
}
function emperorGuildRateGiftMaximum(g: Game, p: Player): number {
if (livePledgePromises(g.pledgePromises ?? [], p.id, g.turn, g.phase).length) return 0;
const shipment = g.pendingShipment, transport = g.pendingGuildTransport;
const pending = shipment?.player === p.id ? shipment.cost - shipment.allyPayment :
transport?.player === p.id ? transport.cost - transport.allyPayment : 0;
return Math.max(0, emperorAuctionGiftMaximum(g, p) - pending);
}
function emperorGuildRateGiftQuote(g: Game, p: Player): {recipient:string; maximum:number} | null {
if (!emperorGuildRateGiftPublicEligible(g, p) || !p.ally) return null;
const maximum = emperorGuildRateGiftMaximum(g, p);
return maximum > 0 ? {recipient:p.ally, maximum} : null;
}
function emperorGuildRateGiftSignature(g: Game, parent: ResponseWindow, owner:string, recipient:string, amount:number): string {
return JSON.stringify([g.turn,g.phase,g.active,g.order,g.pendingShipment,g.pendingGuildTransport,parent,owner,recipient,amount]);
}
function validateEmperorGuildRateGift(g: Game, response: ResponseWindow) {
const parent = response.emperorGuildRateGift;
if (!parent) return;
const owner = g.players.find(player => player.id === response.owner);
const recipient = g.players.find(player => player.id === response.recipient);
requireRule(response.kind === 'emperorGift' && owner?.faction === 'emperor' && recipient &&
owner.ally === recipient.id && recipient.ally === owner.id && parent.response.kind === 'guildRate' &&
parent.event === (parent.response.guildRateEvent ?? parent.response.guildTransportEvent) && !!parent.event &&
typeof response.amount === 'number' && Number.isSafeInteger(response.amount) && response.amount > 0 &&
response.amount <= emperorGuildRateGiftMaximum(g, owner) &&
parent.signature === emperorGuildRateGiftSignature(g,parent.response,owner.id,recipient.id,response.amount),
'The Emperor gift lost its original Guild-rate response.');
}
function emperorGuildRateGiftIntegrity(g: Game) {
if (g.response) validateEmperorGuildRateGift(g, g.response);
if (g.pendingKarama?.use.kind === 'cancel') validateEmperorGuildRateGift(g, g.pendingKarama.use.response);
}
function emperorPhaseOpeningGiftSignature(g: Game, opening: {passed: string[]; initialize: boolean}, owner: string, recipient: string, amount: number): string { function emperorPhaseOpeningGiftSignature(g: Game, opening: {passed: string[]; initialize: boolean}, owner: string, recipient: string, amount: number): string {
return JSON.stringify([g.turn, g.phase, g.active, g.order, g.ready, g.amalWindowOpen ?? false, return JSON.stringify([g.turn, g.phase, g.active, g.order, g.ready, g.amalWindowOpen ?? false,
opening, owner, recipient, amount]); opening, owner, recipient, amount]);
@@ -38886,6 +38942,7 @@ function finishResponse(g: Game, canceled: boolean, settlement?: BureaucratSettl
karamaConversionIntegrity(g); karamaConversionIntegrity(g);
currentFactionPayment(g); currentFactionPayment(g);
const response = g.response!; const response = g.response!;
validateEmperorGuildRateGift(g, response);
validateEmperorGuildTimingGift(g, response); validateEmperorGuildTimingGift(g, response);
validateEmperorExtortionGift(g, response); validateEmperorExtortionGift(g, response);
validateEmperorPhaseOpeningGift(g, response); validateEmperorPhaseOpeningGift(g, response);
@@ -40066,6 +40123,7 @@ function finishResponse(g: Game, canceled: boolean, settlement?: BureaucratSettl
); );
} }
if (response.emperorPhaseOpeningGift) g.phaseOpening = structuredClone(response.emperorPhaseOpeningGift.opening); if (response.emperorPhaseOpeningGift) g.phaseOpening = structuredClone(response.emperorPhaseOpeningGift.opening);
if (response.emperorGuildRateGift) g.response = structuredClone(response.emperorGuildRateGift.response);
if (response.emperorAuctionGiftEvent) { if (response.emperorAuctionGiftEvent) {
requireRule(g.pendingEmperorAuctionGift?.event === response.emperorAuctionGiftEvent, requireRule(g.pendingEmperorAuctionGift?.event === response.emperorAuctionGiftEvent,
'The Emperor gift lost its original auction opportunity.'); 'The Emperor gift lost its original auction opportunity.');
@@ -40798,10 +40856,12 @@ function savedNoFieldResponses(g: Game): ResponseWindow[] {
continuation && 'resume' in continuation ? continuation.resume : null, continuation && 'resume' in continuation ? continuation.resume : null,
g.pendingKull?.stage === 'counter' ? g.pendingKull.resume : null, g.pendingKull?.stage === 'counter' ? g.pendingKull.resume : null,
continuation?.kind === 'kullCounterDiscard' ? continuation.frame.resume : null]; continuation?.kind === 'kullCounterDiscard' ? continuation.frame.resume : null];
return contexts.flatMap(context => { const responses = contexts.flatMap(context => {
const karama = context && 'pendingKarama' in context ? context.pendingKarama as Game['pendingKarama'] : null; const karama = context && 'pendingKarama' in context ? context.pendingKarama as Game['pendingKarama'] : null;
return [context?.response, karama?.use.kind === 'cancel' ? karama.use.response : null]; return [context?.response, karama?.use.kind === 'cancel' ? karama.use.response : null];
}).filter((response): response is ResponseWindow => !!response); }).filter((response): response is ResponseWindow => !!response);
return responses.flatMap(response => response.emperorGuildRateGift
? [response, response.emperorGuildRateGift.response] : [response]);
} }
/** Bind both private stages, also while a card effect has saved their controls. */ /** Bind both private stages, also while a card effect has saved their controls. */
function leaderSkillNoFieldIntegrity(g: Game): boolean { function leaderSkillNoFieldIntegrity(g: Game): boolean {
@@ -43830,6 +43890,15 @@ function applyActionWithInitiator(state: Game, id: string, action: Action, initi
emperorExtortionGiftIntegrity(state); emperorExtortionGiftIntegrity(state);
emperorAuctionGiftIntegrity(state); emperorAuctionGiftIntegrity(state);
emperorGuildTimingGiftIntegrity(state); emperorGuildTimingGiftIntegrity(state);
emperorGuildRateGiftIntegrity(state);
const rateGiftResponse = state.response?.emperorGuildRateGift ||
(state.pendingKarama?.use.kind === 'cancel' && state.pendingKarama.use.response.emperorGuildRateGift);
if (rateGiftResponse && action?.type !== 'advanceBots')
requireRule(action?.type === 'passResponse' || action?.type === 'card' && action.mode === 'cancel',
'Resolve the Emperor gift response before another action.');
if (emperorGuildRatePriority(state) && action?.type !== 'advanceBots')
requireRule(action?.type === 'emperorGift' || action?.type === 'emperorGuildRateContinue',
'Wait for the Emperor to share spice or continue.');
const phaseGiftResponse = state.response?.emperorPhaseOpeningGift || const phaseGiftResponse = state.response?.emperorPhaseOpeningGift ||
(state.pendingKarama?.use.kind === 'cancel' && state.pendingKarama.use.response.emperorPhaseOpeningGift); (state.pendingKarama?.use.kind === 'cancel' && state.pendingKarama.use.response.emperorPhaseOpeningGift);
if (phaseGiftResponse && action?.type !== 'advanceBots') if (phaseGiftResponse && action?.type !== 'advanceBots')
@@ -44743,6 +44812,7 @@ function settleAutomaticContinuations(g: Game) {
if (g.pendingHomeworldOccupiedPercentage || g.pendingHomeworldOccupiedBonus && !g.decision) return; if (g.pendingHomeworldOccupiedPercentage || g.pendingHomeworldOccupiedBonus && !g.decision) return;
if (response?.kind === 'ixAuction' && g.homeworldOccupationPreview && if (response?.kind === 'ixAuction' && g.homeworldOccupationPreview &&
quoteOccupiedBiddingAuthority(g, 'ixAuction').blocked) return; quoteOccupiedBiddingAuthority(g, 'ixAuction').blocked) return;
if (response && emperorGuildRatePriority(g)) return;
if (response) { if (response) {
if ( if (
!( !(
@@ -44800,6 +44870,7 @@ export function normalizeAutomaticGame(state: Game): Game {
emperorExtortionGiftIntegrity(state); emperorExtortionGiftIntegrity(state);
emperorAuctionGiftIntegrity(state); emperorAuctionGiftIntegrity(state);
emperorGuildTimingGiftIntegrity(state); emperorGuildTimingGiftIntegrity(state);
emperorGuildRateGiftIntegrity(state);
twoPlayerControllersIntegrity(state); twoPlayerControllersIntegrity(state);
factionDraftIntegrity(state); factionDraftIntegrity(state);
factionSwapIntegrity(state); factionSwapIntegrity(state);
@@ -45661,8 +45732,29 @@ function applyActionInner(
} }; } };
return g; return g;
} }
if (t === 'emperorGuildRateContinue') {
const priority = emperorGuildRatePriority(g);
requireRule(priority && priority.emperor === id && action.event === priority.event &&
Object.keys(action).sort().join(',') === 'event,type',
'Continue only your current Emperor Guild-rate opportunity.');
g.emperorGuildRateGiftRelease = {event:priority.event, emperor:id};
return g;
}
if (t === 'emperorGift' && g.response?.kind === 'guildRate') {
const quote = emperorGuildRateGiftQuote(g, p);
requireRule(quote && Object.keys(action).sort().join(',') === 'amount,type',
'This Guild-rate gift is unavailable or no longer current.');
const amount = integer(action.amount, 1, quote.maximum, 'Spice');
const parent = structuredClone(g.response);
const event = parent.guildRateEvent ?? parent.guildTransportEvent!;
g.emperorGuildRateGiftRelease = {event, emperor:id};
g.response = {kind:'emperorGift', owner:id, recipient:quote.recipient, amount, elite:0, passed:[],
emperorGuildRateGift:{event,response:parent,signature:emperorGuildRateGiftSignature(g,parent,id,quote.recipient,amount)}};
return g;
}
if (g.response) { if (g.response) {
const response = g.response; const response = g.response;
requireRule(!emperorGuildRatePriority(g), 'Wait for the Emperor to share spice or continue.');
if (response.kind === 'fremenMovement') pendingFremenMovement(g, response); if (response.kind === 'fremenMovement') pendingFremenMovement(g, response);
if (t === 'passResponse') { if (t === 'passResponse') {
requireRule( requireRule(
@@ -49478,6 +49570,7 @@ export function viewGame(state: Game, id: string, now?: number) {
emperorExtortionGiftIntegrity(state); emperorExtortionGiftIntegrity(state);
emperorAuctionGiftIntegrity(state); emperorAuctionGiftIntegrity(state);
emperorGuildTimingGiftIntegrity(state); emperorGuildTimingGiftIntegrity(state);
emperorGuildRateGiftIntegrity(state);
twoPlayerControllersIntegrity(state); twoPlayerControllersIntegrity(state);
factionDraftIntegrity(state); factionDraftIntegrity(state);
factionSwapIntegrity(state); factionSwapIntegrity(state);
@@ -50546,6 +50639,7 @@ export function viewGame(state: Game, id: string, now?: number) {
? { amount: undefined } ? { amount: undefined }
: {}), : {}),
...(g.response.emperorGuildTimingGift ? { emperorGuildTimingGift: undefined } : {}), ...(g.response.emperorGuildTimingGift ? { emperorGuildTimingGift: undefined } : {}),
...(g.response.emperorGuildRateGift ? { emperorGuildRateGift: undefined } : {}),
...(g.response.emperorExtortionGift ? { emperorExtortionGift: undefined } : {}), ...(g.response.emperorExtortionGift ? { emperorExtortionGift: undefined } : {}),
...(g.response.emperorPhaseOpeningGift ? { emperorPhaseOpeningGift: undefined } : {}), ...(g.response.emperorPhaseOpeningGift ? { emperorPhaseOpeningGift: undefined } : {}),
...(g.response.emperorAuctionGiftEvent ? { emperorAuctionGiftEvent: undefined } : {}), ...(g.response.emperorAuctionGiftEvent ? { emperorAuctionGiftEvent: undefined } : {}),
@@ -50554,7 +50648,7 @@ export function viewGame(state: Game, id: string, now?: number) {
paymentIncome: currentFactionPayment(g), paymentIncome: currentFactionPayment(g),
responseControls: g.pendingRicheseBetrayal || g.pendingKull?.stage === 'offer' ? undefined : g.response responseControls: g.pendingRicheseBetrayal || g.pendingKull?.stage === 'offer' ? undefined : g.response
? { ? {
cancelCards: responseCancelCards(g, me, g.response), cancelCards: emperorGuildRatePriority(g) ? [] : responseCancelCards(g, me, g.response),
hasPassed: g.response.passed.includes(id), hasPassed: g.response.passed.includes(id),
} }
: undefined, : undefined,
@@ -50615,6 +50709,11 @@ export function viewGame(state: Game, id: string, now?: number) {
: 0, : 0,
}, },
emperorGuildTimingGift: emperorGuildTimingGiftQuote(g, me), emperorGuildTimingGift: emperorGuildTimingGiftQuote(g, me),
emperorGuildRateGift: emperorGuildRateGiftQuote(g, me),
emperorGuildRatePriority: (() => {
const priority = emperorGuildRatePriority(g);
return priority ? {event:priority.event, recipient:priority.recipient, canContinue:priority.emperor === id} : null;
})(),
emperorExtortionGift: emperorExtortionGiftQuote(g, me), emperorExtortionGift: emperorExtortionGiftQuote(g, me),
emperorExtortionPriority: (() => { emperorExtortionPriority: (() => {
const priority = emperorExtortionPriority(g); const priority = emperorExtortionPriority(g);
+1
View File
@@ -298,6 +298,7 @@ export const RULE_TOPICS: RuleTopic[] = [
'The recipient keeps paid spice separately until the next Mentat opening. A payment after the current opening waits for next turn’s opening. Your incoming bribes are shown separately from your spendable supply; they cannot fund bids, shipments or another bribe yet.', 'The recipient keeps paid spice separately until the next Mentat opening. A payment after the current opening waits for next turn’s opening. Your incoming bribes are shown separately from your spendable supply; they cannot fund bids, shipments or another bribe yet.',
'A waiting Sandtrout does not prevent the supported Basic bribe interruption windows.', 'A waiting Sandtrout does not prevent the supported Basic bribe interruption windows.',
'During supported Basic phase openings, auction payments, Richese cache sales and Extortion decisions, a waiting Sandtrout does not prevent the Emperor gifting spice to an ally formed after the Sandtrout draw.', 'During supported Basic phase openings, auction payments, Richese cache sales and Extortion decisions, a waiting Sandtrout does not prevent the Emperor gifting spice to an ally formed after the Sandtrout draw.',
'In supported classic Advanced games, the Emperor may share spice before a pending Guild shipment-rate response continues. Allowing or canceling the gift returns to the same rate decision and shipment.',
'You may pay out of turn when no decision or response is pending, including during Mentat after opening collection. In supported Basic games with classic or selected native expansion factions, direct bribes can also interrupt a normal auction-payment decision, Atreides auction inspection, Fremen allied-revival grant, ordinary Fremen or Ixian movement response, or CHOAM movement decision. Supported Basic Ix and Moritani games also allow payments during the Amal opening or an Extortion choice. The original parent and its passes remain pending. You cannot bribe yourself or your ally, or while Inflation shows Double. Emperor gifts to allies use their own power controls.', 'You may pay out of turn when no decision or response is pending, including during Mentat after opening collection. In supported Basic games with classic or selected native expansion factions, direct bribes can also interrupt a normal auction-payment decision, Atreides auction inspection, Fremen allied-revival grant, ordinary Fremen or Ixian movement response, or CHOAM movement decision. Supported Basic Ix and Moritani games also allow payments during the Amal opening or an Extortion choice. The original parent and its passes remain pending. You cannot bribe yourself or your ally, or while Inflation shows Double. Emperor gifts to allies use their own power controls.',
'Your payment limit excludes reserved spending and preserves binding Truthtrance answers. If an alliance, pending decision or available supply changes, recheck the recipient and amount. A rejected payment does not change the game.', 'Your payment limit excludes reserved spending and preserves binding Truthtrance answers. If an alliance, pending decision or available supply changes, recheck the recipient and amount. A rejected payment does not change the game.',
'In the Basic group preview, group allies are excluded from ordinary bribes and nonallied deals. Existing agreements remain recorded and can be released; a deferred bribe to a newly allied recipient stays pending while it is unavailable, subject to its original deadline.', 'In the Basic group preview, group allies are excluded from ordinary bribes and nonallied deals. Existing agreements remain recorded and can be released; a deferred bribe to a newly allied recipient stays pending while it is unavailable, subject to its original deadline.',
@@ -0,0 +1,118 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import {botActions, runBots} from '../game/bots';
import {DIFFICULTIES} from '../game/bot-profiles';
import {type Action, type Game, viewGame} from '../game/engine';
import {createTruthBidFixture} from './fixture-truth-bid';
import {actTruthAlliance as act, advanceTruthAlliance as advance,
truthAllianceClean as clean, truthAllianceInventory as inventory,
truthAllianceNexus, truthAlliancePlayer as player} from './fixture-truth-alliance';
import {beforeIxSpiceDraw, orderIxSpiceCards} from './fixture-ix-spice-cards';
/** Genuine public Advanced setup, actual second-turn worm, reciprocal consent
* and Guild shipment. Only unopened Spice order, personal purses and physical
* counter cards are staged; the alliance, payment and original rate window
* are reached through native actions. */
function fixture(counters: number) {
const base=createTruthBidFixture({advanced:true,window:'waiting',extraGuild:true});
let game=advance(base.game,state=>state.turn===2&&beforeIxSpiceDraw(state));
orderIxSpiceCards(game,['worm','land','land']);
game=advance(game,truthAllianceNexus);
game=act(game,'guild',{type:'alliance',target:'emperor'});
game=act(game,'emperor',{type:'alliance',target:'guild'});
game=advance(game,state=>state.phase===5&&state.active==='guild'&&clean(state));
assert.equal(player(game,'guild').ally,'emperor');
assert.equal(player(game,'emperor').ally,'guild');
const cards=inventory(game);
// Keep all counters in one public responder's actual hand; the no-counter
// case genuinely removes every playable physical Karama from all hands.
for(const seat of game.players) {
const keep=seat.hand.filter(card=>card.effect!=='karama');
game.deck.push(...seat.hand.filter(card=>card.effect==='karama'));
seat.hand=keep;
}
const counterIds:string[]=[];
for(let n=0;n<counters;n++) {
const index=game.deck.findIndex(card=>card.effect==='karama');assert.ok(index>=0);
const [card]=game.deck.splice(index,1);counterIds.push(card.id);
player(game,'atreides').hand.push(card);
}
assert.deepEqual(inventory(game),cards);
player(game,'guild').spice=2;player(game,'emperor').spice=8;
game=act(game,'guild',{type:'ship',territory:'polar_sink',sector:0,amount:2,allyPayment:0});
if(game.decision?.kind==='guildShipment')game=act(game,'guild',{type:'decision',allow:true});
assert.equal(game.response?.kind,'guildRate');assert.equal(game.pendingShipment?.cost,2);
return {game,cards,counterIds};
}
function passResponse(game:Game):Game {
for(let n=0;game.response&&n<20;n++) {
const actor=game.players.find(row=>!game.response!.passed.includes(row.id));assert.ok(actor);
game=act(game,actor.id,{type:'passResponse'});
}
return game;
}
function reject(game:Game,id:string,action:Action) {
const before=structuredClone(game);assert.throws(()=>act(game,id,action));assert.deepEqual(game,before);
}
function priority(game:Game) {
const view=viewGame(game,'emperor');
const opportunity=view.emperorGuildRatePriority;assert.ok(opportunity?.canContinue);
assert.equal(opportunity.recipient,'guild');return opportunity;
}
void test('Advanced Emperor gift preserves original Guild rate and funds the unchanged full-price shipment',()=>{
const f=fixture(1);let game=f.game;
const before=structuredClone(game),original=structuredClone(game.response),shipment=structuredClone(game.pendingShipment);
assert.deepEqual(viewGame(game,'emperor').emperorGuildRateGift,{recipient:'guild',maximum:8});
assert.equal(viewGame(game,'atreides').emperorGuildRateGift,null);
priority(game);reject(game,'atreides',{type:'card',mode:'cancel',card:f.counterIds[0]});
game=act(game,'emperor',{type:'emperorGift',amount:2});
assert.equal(game.response?.kind,'emperorGift');
while(game.response?.kind==='emperorGift') {
const actor=game.players.find(row=>!game.response!.passed.includes(row.id));assert.ok(actor);
game=act(game,actor.id,{type:'passResponse'});
}
assert.deepEqual(game.response,original);assert.deepEqual(game.pendingShipment,shipment);
assert.equal(player(game,'emperor').spice,player(before,'emperor').spice-2);
assert.equal(player(game,'guild').spice,player(before,'guild').spice+2);
game=act(game,'atreides',{type:'card',mode:'cancel',card:f.counterIds[0]});
assert.equal(game.pendingShipment,null);assert.equal(player(game,'guild').spice,0);
assert.equal(player(game,'guild').forces['polar_sink:0'],2);
assert.deepEqual(inventory(game),f.cards);
});
void test('canceling the gift restores its original rate window and unfunded rate cancellation withdraws shipment',()=>{
const f=fixture(2);let game=f.game;
const before=structuredClone(game),original=structuredClone(game.response),shipment=structuredClone(game.pendingShipment);
priority(game);game=act(game,'emperor',{type:'emperorGift',amount:2});
game=act(game,'atreides',{type:'card',mode:'cancel',card:f.counterIds[0]});
assert.deepEqual(game.response,original);assert.deepEqual(game.pendingShipment,shipment);
assert.equal(player(game,'emperor').spice,player(before,'emperor').spice);
assert.equal(player(game,'guild').spice,player(before,'guild').spice);
game=act(game,'atreides',{type:'card',mode:'cancel',card:f.counterIds[1]});
assert.equal(game.pendingShipment,null);assert.equal(player(game,'guild').spice,2);
assert.equal(player(game,'guild').shipped,false);assert.ok(game.guildRateBlocked);
assert.deepEqual(inventory(game),f.cards);
});
void test('a counter-free rate window waits for the human Emperor and every bot may continue',()=>{
const f=fixture(0), initial=f.game;const opportunity=priority(initial);
assert.equal(initial.response?.kind,'guildRate');
const empty=structuredClone(initial);player(empty,'emperor').spice=0;
assert.deepEqual(viewGame(empty,'guild').emperorGuildRatePriority,viewGame(initial,'guild').emperorGuildRatePriority);
assert.equal(viewGame(empty,'emperor').emperorGuildRateGift,null);
for(const difficulty of DIFFICULTIES) {
let game=structuredClone(initial);player(game,'guild').bot=difficulty;
const waiting=runBots(game,2);assert.deepEqual(waiting.response,game.response);
const view=viewGame(game,'emperor');view.players.find(row=>row.id==='emperor')!.bot=difficulty;
const action=botActions(view).find(row=>row.type==='emperorGuildRateContinue');assert.ok(action,difficulty);
assert.equal(action.event,opportunity.event);
const automated=structuredClone(game);player(automated,'emperor').bot=difficulty;
const resumed=runBots(automated,1);
assert.equal(resumed.pendingShipment??null,null,`${difficulty} bot releases the original rate`);
assert.equal(player(resumed,'guild').forces['polar_sink:0'],2);
game=act(game,'emperor',action);
game=passResponse(game);
assert.equal(player(game,'guild').spice,0);assert.equal(player(game,'guild').forces['polar_sink:0'],2);
}
});
@@ -0,0 +1,54 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import {Children, createElement, isValidElement} from 'react';
import {renderToStaticMarkup} from 'react-dom/server';
import {EmperorTimingGift} from '../components/emperor-timing-gift';
import {EmperorGuildRatePriority} from '../components/emperor-guild-rate-priority';
import type {Action, GameView} from '../game/engine';
function priorityProps() {
const sent:Action[] = [];
const game = {emperorGuildRatePriority:{event:'rate-event',recipient:'guild',canContinue:true},
players:[{id:'guild',name:'Guild'}]} as unknown as Pick<GameView,'emperorGuildRatePriority'|'players'>;
return {game, busy:false, sent, act:(action:Action) => sent.push(action)};
}
function button(props:ReturnType<typeof priorityProps>) {
const panel = EmperorGuildRatePriority(props); assert.ok(panel);
const row = Children.toArray(panel.props.children).find(child => isValidElement(child) && child.type === 'button');
assert.ok(isValidElement<{onClick:()=>void;disabled:boolean}>(row)); return row;
}
void test('Guild rate opportunity offers a persistent Continue to the Emperor', () => {
const props=priorityProps();
const html=renderToStaticMarkup(createElement(EmperorGuildRatePriority,props));
assert.match(html,/Emperor may share spice with Guild/);
assert.match(html,/Continue to Guild rate/);
button(props).props.onClick();
assert.deepEqual(props.sent,[{type:'emperorGuildRateContinue',event:'rate-event'}]);
});
void test('other seats see a neutral wait and stale or busy Continue controls do not submit', () => {
const other=priorityProps();other.game.emperorGuildRatePriority!.canContinue=false;
assert.match(renderToStaticMarkup(createElement(EmperorGuildRatePriority,other)),/Waiting for the Emperor/);
for(const variant of ['busy','event','permission','replace','close'] as const) {
const props=priorityProps();if(variant==='busy')props.busy=true;const control=button(props);
if(variant==='event')props.game.emperorGuildRatePriority!.event='another-event';
if(variant==='permission')props.game.emperorGuildRatePriority!.canContinue=false;
if(variant==='replace')props.game.emperorGuildRatePriority={...props.game.emperorGuildRatePriority!};
if(variant==='close')props.game.emperorGuildRatePriority=null;
control.props.onClick();assert.deepEqual(props.sent,[],variant);
}
});
void test('the private Guild rate quote shows the existing gift form and amount limits', () => {
const game={emperorPhaseOpeningGift:null,emperorExtortionGift:null,emperorGuildTimingGift:null,
emperorGuildRateGift:{recipient:'guild',maximum:4},players:[{id:'guild',name:'Guild'}]} as unknown as GameView;
const render=(view:GameView,busy=false)=>renderToStaticMarkup(createElement(EmperorTimingGift,{game:view,busy,act(){}}));
const html=render(game);
assert.match(html,/Share spice with Guild/);
assert.match(html,/original Guild rate response resumes/);
assert.match(html,/type="number"[^>]*min="1"[^>]*max="4"/);
assert.match(html,/<button\b(?![^>]*disabled)[^>]*>Share spice<\/button>/);
assert.match(render(game,true),/<button\b[^>]*disabled=""[^>]*>Share spice<\/button>/);
assert.equal(render({...game,emperorGuildRateGift:null}),'');
});
@@ -0,0 +1,101 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import {territory} from '../game/board';
import {type Action, type Game, viewGame} from '../game/engine';
import {createTruthBidFixture} from './fixture-truth-bid';
import {actTruthAlliance as act, advanceTruthAlliance as advance,
truthAllianceClean as clean, truthAllianceInventory as inventory,
truthAllianceNexus, truthAlliancePlayer as player} from './fixture-truth-alliance';
import {beforeIxSpiceDraw, orderIxSpiceCards} from './fixture-ix-spice-cards';
function passKind(game:Game, kind:string):Game {
for(let n=0;game.response?.kind===kind&&n<20;n++) {
const responder=game.players.find(row=>!game.response!.passed.includes(row.id));assert.ok(responder);
game=act(game,responder.id,{type:'passResponse'});
}
return game;
}
function rejected(game:Game,id:string,action:Action) {
const before=structuredClone(game);assert.throws(()=>act(game,id,action));assert.deepEqual(game,before);
}
/** Public Advanced setup and an actual first-turn Guild shipment to Polar
* Sink; an actual second-turn worm and reciprocal consent create the alliance.
* Only unopened Spice order, purses and physical Karama locations are staged. */
function fixture(destination:'cross'|'return') {
const base=createTruthBidFixture({advanced:true,window:'waiting',extraGuild:true});
let game=advance(base.game,state=>state.turn===1&&state.phase===5&&state.active==='guild'&&clean(state));
game=act(game,'guild',{type:'ship',territory:'polar_sink',sector:0,amount:2,allyPayment:0});
if(game.decision?.kind==='guildShipment')game=act(game,'guild',{type:'decision',allow:true});
game=passKind(game,'guildRate');
game=advance(game,state=>state.turn===2&&beforeIxSpiceDraw(state));
assert.equal(player(game,'guild').forces['polar_sink:0'],2);
orderIxSpiceCards(game,['worm','land','land']);
game=advance(game,truthAllianceNexus);
game=act(game,'guild',{type:'alliance',target:'emperor'});
game=act(game,'emperor',{type:'alliance',target:'guild'});
game=advance(game,state=>state.phase===5&&state.active==='guild'&&clean(state));
assert.equal(player(game,'guild').ally,'emperor');assert.equal(player(game,'emperor').ally,'guild');
assert.equal(player(game,'guild').forces['polar_sink:0'],2);
const original=inventory(game);
for(const seat of game.players) {
game.deck.push(...seat.hand.filter(card=>card.effect==='karama'));
seat.hand=seat.hand.filter(card=>card.effect!=='karama');
}
const counters:string[]=[];
for(let n=0;n<2;n++) {
const index=game.deck.findIndex(card=>card.effect==='karama');assert.ok(index>=0);
const [card]=game.deck.splice(index,1);player(game,'atreides').hand.push(card);counters.push(card.id);
}
assert.deepEqual(inventory(game),original);
const sector=territory('red_chasm').sectors.find(value=>value!==game.storm);assert.notEqual(sector,undefined);
const action:Action=destination==='cross'
? {type:'guildShip',from:'polar_sink:0',territory:'red_chasm',sector,amount:2,allyPayment:0}
: {type:'guildShip',from:'polar_sink:0',territory:'reserves',sector:0,amount:2,allyPayment:0};
const half=destination==='cross'?2:1;
player(game,'guild').spice=half;player(game,'emperor').spice=8;
game=act(game,'guild',action);
assert.equal(game.response?.kind,'guildTransportPermission');assert.equal(game.pendingGuildTransport?.cost,half);
game=passKind(game,'guildTransportPermission');
assert.equal(game.response?.kind,'guildRate');assert.equal(game.pendingGuildTransport?.cost,half);
return {game,original,counters,half,sector};
}
for(const destination of ['cross','return'] as const) void test(
`Advanced Emperor gift preserves native Guild ${destination} transport through rate cancellation`,()=>{
const f=fixture(destination);let game=f.game;
const original=structuredClone(game.response),frame=structuredClone(game.pendingGuildTransport);
const oldReserves=player(game,'guild').reserves, priority=viewGame(game,'emperor').emperorGuildRatePriority;
assert.ok(priority?.canContinue);assert.equal(priority.recipient,'guild');
assert.deepEqual(viewGame(game,'emperor').emperorGuildRateGift,{recipient:'guild',maximum:8});
rejected(game,'atreides',{type:'card',mode:'cancel',card:f.counters[0]});
game=act(game,'emperor',{type:'emperorGift',amount:f.half});
assert.equal(game.response?.kind,'emperorGift');game=passKind(game,'emperorGift');
assert.deepEqual(game.response,original);assert.deepEqual(game.pendingGuildTransport,frame);
assert.equal(player(game,'guild').spice,2*f.half);
game=act(game,'atreides',{type:'card',mode:'cancel',card:f.counters[0]});
assert.equal(game.pendingGuildTransport,null);assert.equal(player(game,'guild').spice,0);
assert.equal(player(game,'guild').forces['polar_sink:0']??0,0);
if(destination==='cross') {
assert.equal(player(game,'guild').forces[`red_chasm:${f.sector}`],2);
assert.equal(player(game,'guild').reserves,oldReserves);
} else assert.equal(player(game,'guild').reserves,oldReserves+2);
assert.deepEqual(inventory(game),f.original);
});
for(const destination of ['cross','return'] as const) void test(
`Advanced canceled gift retains native Guild ${destination} transport until its unfunded rate cancellation`,()=>{
const f=fixture(destination);let game=f.game;
const original=structuredClone(game.response),frame=structuredClone(game.pendingGuildTransport);
const oldReserves=player(game,'guild').reserves;
assert.ok(viewGame(game,'emperor').emperorGuildRatePriority?.canContinue);
game=act(game,'emperor',{type:'emperorGift',amount:f.half});
game=act(game,'atreides',{type:'card',mode:'cancel',card:f.counters[0]});
assert.deepEqual(game.response,original);assert.deepEqual(game.pendingGuildTransport,frame);
assert.equal(player(game,'guild').spice,f.half);assert.equal(player(game,'emperor').spice,8);
game=act(game,'atreides',{type:'card',mode:'cancel',card:f.counters[1]});
assert.equal(game.pendingGuildTransport,null);assert.equal(player(game,'guild').spice,f.half);
assert.equal(player(game,'guild').forces['polar_sink:0'],2);
assert.equal(player(game,'guild').reserves,oldReserves);assert.equal(player(game,'guild').shipped,false);
assert.ok(game.guildRateBlocked);assert.deepEqual(inventory(game),f.original);
});
+13
View File
@@ -48,6 +48,8 @@ function declare(g: Game, id: 'g' | 'e', amount: number, destination = 'arrakeen
} }
function cancel(g: Game, card: string): Game { function cancel(g: Game, card: string): Game {
assert.equal(g.response?.kind, 'guildRate'); assert.equal(g.response?.kind, 'guildRate');
const priority = viewGame(g, 'e').emperorGuildRatePriority;
if (priority?.canContinue) g = applyAction(g, 'e', {type:'emperorGuildRateContinue', event:priority.event});
return applyAction(reload(g), 'a', { type: 'card', mode: 'cancel', card }); return applyAction(reload(g), 'a', { type: 'card', mode: 'cancel', card });
} }
function reject(g: Game, actor: string, action: Action) { function reject(g: Game, actor: string, action: Action) {
@@ -197,6 +199,17 @@ void test('the Advanced Guild stop decision precedes the separate Karama rate re
assert.equal(player(done, 'e').forces['arrakeen:10'], 3); assert.equal(player(done, 'e').forces['arrakeen:10'], 3);
}); });
void test('an Advanced Emperor shipper cannot gift spice reserved for its pending Guild-rate payment', () => {
const {g:initial} = fixture('e', true);
const declared = declare(initial, 'e', 3);
const offered = applyAction(declared, 'g', {type:'decision',allow:true});
const gift = viewGame(offered, 'e').emperorGuildRateGift; assert.ok(gift);
assert.equal(gift.maximum, player(offered, 'e').spice - offered.pendingShipment!.cost);
reject(offered, 'e', {type:'emperorGift',amount:gift.maximum + 1});
const accepted = applyAction(offered, 'e', {type:'emperorGift',amount:gift.maximum});
assert.equal(accepted.response?.kind, 'emperorGift');
});
void test('an unstamped saved Advanced declaration gains a turn stamp before its new rate response', () => { void test('an unstamped saved Advanced declaration gains a turn stamp before its new rate response', () => {
const { g: initial, karama } = fixture('e', true); const { g: initial, karama } = fixture('e', true);
const legacy = declare(initial, 'e', 3); const legacy = declare(initial, 'e', 3);
@@ -51,6 +51,11 @@ function answerYes(f:ReturnType<typeof fixture>, minimum:number) {
} }
function passResponses(game:Game):Game { function passResponses(game:Game):Game {
for(let i=0;game.response && i<20;i++) { for(let i=0;game.response && i<20;i++) {
const priority=viewGame(game,'emperor').emperorGuildRatePriority;
if(priority?.canContinue) {
game=act(game,'emperor',{type:'emperorGuildRateContinue',event:priority.event});
continue;
}
const actor=game.players.find(row=>!game.response!.passed.includes(row.id));assert.ok(actor); const actor=game.players.find(row=>!game.response!.passed.includes(row.id));assert.ok(actor);
game=act(game,actor.id,{type:'passResponse'}); game=act(game,actor.id,{type:'passResponse'});
} }