Preserve cache promises and support concealed Ambassador collection
Verify and publish checkpoint container / container (push) Successful in 11m9s
Verify and publish checkpoint container / container (push) Successful in 11m9s
This commit is contained in:
1 parent
3ede19c90a
commit
1a65e69932
14 files changed
+594
-9
No files matched your search
@@ -86,7 +86,7 @@ export function AmbassadorMovement({
|
|||||||
!!source.marker &&
|
!!source.marker &&
|
||||||
location(source.territory, source.marker.sector) === target;
|
location(source.territory, source.marker.sector) === target;
|
||||||
const includesMarker = !!source.marker && takeMarker && !markerAtTarget;
|
const includesMarker = !!source.marker && takeMarker && !markerAtTarget;
|
||||||
const sandmaster = !includesMarker && destination
|
const sandmaster = destination
|
||||||
? sandmasterDestinationCollection(game, game.me, source.territory, destination.territory, destination.sector)
|
? sandmasterDestinationCollection(game, game.me, source.territory, destination.territory, destination.sector)
|
||||||
: null;
|
: null;
|
||||||
const sandmasterPile =
|
const sandmasterPile =
|
||||||
|
|||||||
@@ -2994,6 +2994,7 @@ export function GameTable({
|
|||||||
</p>
|
</p>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
|
{g.responseControls?.blocked && <p className="notice">{g.responseControls.blocked}</p>}
|
||||||
{me.hand
|
{me.hand
|
||||||
?.filter((c) => g.responseControls?.cancelCards.includes(c.id))
|
?.filter((c) => g.responseControls?.cancelCards.includes(c.id))
|
||||||
.map((c) => (
|
.map((c) => (
|
||||||
|
|||||||
@@ -17,6 +17,22 @@ open mode gates.
|
|||||||
|
|
||||||
## Current checkpoint and work
|
## Current checkpoint and work
|
||||||
|
|
||||||
|
**Sandmaster on concealed Ambassador relocation — 16 November. Prototyped /
|
||||||
|
Partial.** Supported selected-deck Skills games can collect one destination
|
||||||
|
spice while a Fremen Ambassador relocates Richese's concealed marker, including
|
||||||
|
zero and mixed groups. The original marker and arrival continuation remain;
|
||||||
|
the combined interpretation is provisional. Fresh Semuta/Skills combinations,
|
||||||
|
complete games and deployed acceptance remain open.
|
||||||
|
[Scope](SANDMASTER_MOVEMENT.md#concealed-marker-in-fremen-ambassador-relocation--16-november-2026).
|
||||||
|
|
||||||
|
**Promised cache cancellation — 16 November. Prototyped / Partial.** A player
|
||||||
|
cannot cancel the cache required by their own feasible early Truthtrance Yes;
|
||||||
|
foreign cancellation closes waiting cache answers immediately while any viable
|
||||||
|
phase-wide answer remains. Kull admission of early questions and broader
|
||||||
|
interactions remain open.
|
||||||
|
[Scope](TRUTHTRANCE_BID_PROMISES.md#voluntary-cancellation-of-a-promised-cache--16-november-2026).
|
||||||
|
Eighteen related unit files covering both changes pass 211 cases.
|
||||||
|
|
||||||
**Joint all-auction and early Richese cache answers — 16 November. Prototyped /
|
**Joint all-auction and early Richese cache answers — 16 November. Prototyped /
|
||||||
Partial.** Supported Basic games can bind both answers before Bidding; a real
|
Partial.** Supported Basic games can bind both answers before Bidding; a real
|
||||||
cache declaration can satisfy both, or separately funded bids retain their
|
cache declaration can satisfy both, or separately funded bids retain their
|
||||||
|
|||||||
@@ -1,5 +1,19 @@
|
|||||||
# Rule decision index
|
# Rule decision index
|
||||||
|
|
||||||
|
## Sandmaster and concealed Ambassador relocation — 16 November 2026
|
||||||
|
|
||||||
|
The existing provisional Sandmaster destination collection composes with an
|
||||||
|
owned concealed No-Field relocated by a Fremen Ambassador, counting any marker
|
||||||
|
face as one force. This combination is not a publisher ruling.
|
||||||
|
[Scope](SANDMASTER_MOVEMENT.md#concealed-marker-in-fremen-ambassador-relocation--16-november-2026).
|
||||||
|
|
||||||
|
## Voluntary cancellation of a promised cache — 16 November 2026
|
||||||
|
|
||||||
|
The existing provisional Truthtrance compliance policy prevents a player from
|
||||||
|
canceling a cache required by their own feasible early Yes. A committed foreign
|
||||||
|
cancellation immediately closes the waiting cache answers.
|
||||||
|
[Scope](TRUTHTRANCE_BID_PROMISES.md#voluntary-cancellation-of-a-promised-cache--16-november-2026).
|
||||||
|
|
||||||
## Joint phase-wide and early Richese cache answers — 16 November 2026
|
## Joint phase-wide and early Richese cache answers — 16 November 2026
|
||||||
|
|
||||||
The supported Basic early-cache and all-auction answers can share a real
|
The supported Basic early-cache and all-auction answers can share a real
|
||||||
|
|||||||
@@ -5,6 +5,30 @@ ground movement now connects the normal band through explicit routes, optional
|
|||||||
collection, player controls, all four AI profiles and saved continuation.
|
collection, player controls, all four AI profiles and saved continuation.
|
||||||
This does not open public Leader Skills starts or publication.
|
This does not open public Leader Skills starts or publication.
|
||||||
|
|
||||||
|
## Concealed marker in Fremen Ambassador relocation — 16 November 2026
|
||||||
|
|
||||||
|
**Prototyped / Partial.** In supported selected-deck Skills profiles, Richese
|
||||||
|
may optionally collect one spice at the destination when its own concealed
|
||||||
|
No-Field relocates through the Fremen Ambassador, alone or with physical
|
||||||
|
forces. The zero marker counts as one for the move just like the other faces;
|
||||||
|
its hidden value and identity stay concealed. The existing owned destination
|
||||||
|
pile selector and minimal bot action use the same quote. The original marker
|
||||||
|
moves once, the selected pile loses one spice and Richese gains one before the
|
||||||
|
original arrival reaction. Same-territory moves, stale markers, dead trainers
|
||||||
|
and unavailable piles keep their existing restrictions.
|
||||||
|
|
||||||
|
The No-Field's one-force rule and the Ambassador's relocation compose with
|
||||||
|
Sandmaster's printed movement band; this is a provisional combined
|
||||||
|
interpretation, not a publisher clarification. Fresh Semuta/Skills profile
|
||||||
|
combinations, other interactions, complete games and deployed acceptance
|
||||||
|
remain open. [Native cases](../tests/fremen-ambassador-marker-sandmaster-runtime.test.ts)
|
||||||
|
use public selected-deck setup and explicitly stage conserved forces, marker,
|
||||||
|
Ambassador, alliance and board piles. [Quote cases](../tests/fremen-ambassador-marker-sandmaster.test.ts)
|
||||||
|
cover both rulesets, all marker faces and invalid selections. [Owner control
|
||||||
|
cases](../tests/ambassador-marker-sandmaster-controls.test.tsx) operate the
|
||||||
|
marker and pile selectors and submit the actual move in both rulesets. The
|
||||||
|
related 18-file batch, including cache cancellation, passes 211 cases.
|
||||||
|
|
||||||
## Flight and concealed-marker routes — 26 October 2026
|
## Flight and concealed-marker routes — 26 October 2026
|
||||||
|
|
||||||
Sandmaster's physical normal band applies when moving owned forces into or
|
Sandmaster's physical normal band applies when moving owned forces into or
|
||||||
@@ -146,7 +170,7 @@ arrival interruption resumes without collecting twice.
|
|||||||
Choosing the debit sector is **provisional owner allocation**, not a publisher
|
Choosing the debit sector is **provisional owner allocation**, not a publisher
|
||||||
ruling: the source grants one spice for entering the territory but does not
|
ruling: the source grants one spice for entering the territory but does not
|
||||||
name its sector. Same-territory moves, living-native skill eligibility,
|
name its sector. Same-territory moves, living-native skill eligibility,
|
||||||
concealed-marker restrictions, typed forces, ordinary allowances and the
|
typed forces, ordinary allowances and the
|
||||||
original Ambassador event remain unchanged. This does not change ground-route
|
original Ambassador event remain unchanged. This does not change ground-route
|
||||||
or native HMS eligibility, add spice or invent intervening sectors.
|
or native HMS eligibility, add spice or invent intervening sectors.
|
||||||
|
|
||||||
@@ -167,7 +191,7 @@ Sandmaster movement band now optionally collects one spice at its entered
|
|||||||
destination, before arrival reactions. No intervening route is implied.
|
destination, before arrival reactions. No intervening route is implied.
|
||||||
Moving between sectors of the same territory earns none. The existing
|
Moving between sectors of the same territory earns none. The existing
|
||||||
living native trainer, supported-profile and unique positive pile rules
|
living native trainer, supported-profile and unique positive pile rules
|
||||||
remain; concealed-marker relocation is still separate.
|
remain; concealed-marker relocation is described above.
|
||||||
|
|
||||||
`sandmasterDestinationCollection` is shared by this direct relocation and
|
`sandmasterDestinationCollection` is shared by this direct relocation and
|
||||||
the existing worm adapter. Human controls expose a checked, optional
|
the existing worm adapter. Human controls expose a checked, optional
|
||||||
|
|||||||
@@ -1,5 +1,21 @@
|
|||||||
# Truthtrance ordinary bid commitments
|
# Truthtrance ordinary bid commitments
|
||||||
|
|
||||||
|
## Voluntary cancellation of a promised cache — 16 November 2026
|
||||||
|
|
||||||
|
**Prototyped / Partial.** A player with a still-feasible early cache Yes cannot
|
||||||
|
use Karama to cancel that cache. The private response explains the restriction
|
||||||
|
and hides the unavailable cancellation action. Another player's cancellation
|
||||||
|
remains legal: when the cache actually disappears, waiting Yes answers release
|
||||||
|
and No answers close before any subsequent auction inspection. An externally
|
||||||
|
impossible Yes is released rather than preventing its owner from canceling.
|
||||||
|
Previously committed Kull and Semuta continuations retain their original
|
||||||
|
resolution. This is the existing provisional compliance-while-possible policy,
|
||||||
|
not a new publisher ruling. Kull admission of early questions and wider promise
|
||||||
|
combinations remain open; when Kull admission is added, an early Yes holder's
|
||||||
|
counter to Kull must also account for the original cache cancellation it would
|
||||||
|
resume. [Native cases](../tests/truth-early-richese-cancel-self.test.ts)
|
||||||
|
include both cache positions, Semuta claim/pass and a disclosed shortfall fixture.
|
||||||
|
|
||||||
## All-auction and early Richese cache bids — 16 November 2026
|
## All-auction and early Richese cache bids — 16 November 2026
|
||||||
|
|
||||||
**Prototyped / Partial.** In supported Basic Richese games, a player can answer
|
**Prototyped / Partial.** In supported Basic Richese games, a player can answer
|
||||||
|
|||||||
+2
-2
@@ -430,8 +430,8 @@ function fremenAmbassadorMoves(g: GameView): Action[] {
|
|||||||
(presenceAt(me, destination.territory) ? 8 : 0) -
|
(presenceAt(me, destination.territory) ? 8 : 0) -
|
||||||
(abandons ? 25 : 0) -
|
(abandons ? 25 : 0) -
|
||||||
(destination.advisors ? 3 : 0);
|
(destination.advisors ? 3 : 0);
|
||||||
const sandmaster = !marker
|
const sandmaster = sandmasterDestinationCollection(
|
||||||
? sandmasterDestinationCollection(g, me.id, source.territory, destination.territory, destination.sector) : null;
|
g, me.id, source.territory, destination.territory, destination.sector);
|
||||||
try{
|
try{
|
||||||
quoteAdvisorAmbassadorMatching({...g,pendingAmbassador:{...entry,turn:g.turn,phase:g.phase,
|
quoteAdvisorAmbassadorMatching({...g,pendingAmbassador:{...entry,turn:g.turn,phase:g.phase,
|
||||||
beneficiary:me.id},advisorAmbassadorMatchingDenied:entry.matchingDenied},
|
beneficiary:me.id},advisorAmbassadorMatchingDenied:entry.matchingDenied},
|
||||||
|
|||||||
@@ -18641,6 +18641,18 @@ function reconcileEarlyRicheseTruth(g: Game,voluntary?: {actor:string;action:Act
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/** Once another player's cancellation is committed, the cache no longer
|
||||||
|
* exists even if an Atreides inspection or Semuta continuation opens next. */
|
||||||
|
function finishCanceledEarlyRicheseTruth(g: Game): void {
|
||||||
|
if (!g.earlyRicheseBidPromises?.length) return;
|
||||||
|
for (const p of g.players) {
|
||||||
|
const before: EarlyRicheseBidPromise[] = g.earlyRicheseBidPromises ?? [];
|
||||||
|
g.earlyRicheseBidPromises = earlyRicheseBidRule((): EarlyRicheseBidPromise[] => reconcileEarlyRicheseBids(before,p.id,g.turn,
|
||||||
|
{cachePending:false,canBid:false,maximum:0,change:'external'}));
|
||||||
|
if (g.earlyRicheseBidPromises.some((row,index) => row.player === p.id && row.released && !before[index]?.released))
|
||||||
|
log(g, `${p.name} can no longer fulfill the early Richese cache bid answer; it is no longer binding.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
function richeseBidWindow(g: Game): boolean {
|
function richeseBidWindow(g: Game): boolean {
|
||||||
return bidPromiseModeSupported({ ...g, semutaPreview: undefined }) && g.status === 'playing' && g.phase === 3 &&
|
return bidPromiseModeSupported({ ...g, semutaPreview: undefined }) && g.status === 'playing' && g.phase === 3 &&
|
||||||
!!g.richeseAuction && ['onceAround','silent'].includes(g.richeseAuction.method) && !g.richeseAuction.outcome &&
|
!!g.richeseAuction && ['onceAround','silent'].includes(g.richeseAuction.method) && !g.richeseAuction.outcome &&
|
||||||
@@ -20134,12 +20146,37 @@ function karamaCard(g: Game, p: Player, id?: unknown, purpose?: KullPurpose) {
|
|||||||
);
|
);
|
||||||
return available.find((c) => c.effect === 'karama') ?? available[0];
|
return available.find((c) => c.effect === 'karama') ?? available[0];
|
||||||
}
|
}
|
||||||
|
/** Only a still-feasible own Yes prevents the player from canceling its
|
||||||
|
* first cache; an externally impossible answer is not revived by this check. */
|
||||||
|
function earlyRicheseCancellationBlocked(g: Game, p: Player, response: ResponseWindow): boolean {
|
||||||
|
if (response.kind !== 'richeseAuction' || response.owner === p.id || !g.richeseBidding || !richeseCacheRuns(g)) return false;
|
||||||
|
const early = liveEarlyRicheseBidPromises(g.earlyRicheseBidPromises ?? [],p.id,g.turn);
|
||||||
|
const phase = livePhaseBidPromises(g.phaseAnyBidPromises ?? [],p.id,g.turn);
|
||||||
|
const maximum = Math.min(earlyRicheseBidMaximum(g,p),
|
||||||
|
...early.filter(row => !row.answer).map(row => row.minimum - 1),
|
||||||
|
...phase.filter(row => !row.answer).map(row => row.minimum - 1));
|
||||||
|
return early.some(row => row.answer && row.minimum <= maximum);
|
||||||
|
}
|
||||||
|
/** A foreign loss can make an answer impossible while the response is open.
|
||||||
|
* Release that already-impossible answer before the respondent acts. */
|
||||||
|
function reconcileEarlyRicheseCancellationAdmission(g: Game, p: Player): void {
|
||||||
|
if (!g.earlyRicheseBidPromises?.length || !g.richeseBidding) return;
|
||||||
|
const phase = livePhaseBidPromises(g.phaseAnyBidPromises ?? [],p.id,g.turn);
|
||||||
|
const maximum = Math.min(earlyRicheseBidMaximum(g,p),
|
||||||
|
...phase.filter(row => !row.answer).map(row => row.minimum - 1));
|
||||||
|
const before = g.earlyRicheseBidPromises;
|
||||||
|
g.earlyRicheseBidPromises = earlyRicheseBidRule(() => reconcileEarlyRicheseBids(before,p.id,g.turn,
|
||||||
|
{cachePending:richeseCacheRuns(g),canBid:p.hand.length < handLimit(p),maximum,change:'external'}));
|
||||||
|
if (g.earlyRicheseBidPromises.some((row,index) => row.player === p.id && row.released && !before[index]?.released))
|
||||||
|
log(g, `${p.name} can no longer fulfill the early Richese cache bid answer; it is no longer binding.`);
|
||||||
|
}
|
||||||
function responseCancelCards(
|
function responseCancelCards(
|
||||||
g: Game,
|
g: Game,
|
||||||
p: Player,
|
p: Player,
|
||||||
response: ResponseWindow,
|
response: ResponseWindow,
|
||||||
): string[] {
|
): string[] {
|
||||||
if (p.id === response.owner) return [];
|
if (p.id === response.owner) return [];
|
||||||
|
if (earlyRicheseCancellationBlocked(g,p,response)) return [];
|
||||||
if (g.pendingKull?.stage === 'counter')
|
if (g.pendingKull?.stage === 'counter')
|
||||||
return kullCounterCards(p.hand, physicalTreacheryCards(g), g.pendingKull.card,
|
return kullCounterCards(p.hand, physicalTreacheryCards(g), g.pendingKull.card,
|
||||||
card => {
|
card => {
|
||||||
@@ -21554,6 +21591,13 @@ function decideKull(g: Game, p: Player, action: Action): void {
|
|||||||
function spendKarama(g: Game, p: Player, card: Card, use: KaramaUse, kullOffered = false) {
|
function spendKarama(g: Game, p: Player, card: Card, use: KaramaUse, kullOffered = false) {
|
||||||
const blocked = karamaSpendingBlock(g, p, card, karamaUsePurpose(g, use));
|
const blocked = karamaSpendingBlock(g, p, card, karamaUsePurpose(g, use));
|
||||||
requireRule(!blocked, blocked ?? 'This card cannot be spent as Karama.');
|
requireRule(!blocked, blocked ?? 'This card cannot be spent as Karama.');
|
||||||
|
// A saved Kull attempt has already entered its interruption; preserve that
|
||||||
|
// committed continuation instead of applying a new admission rule to it.
|
||||||
|
if (!kullOffered && use.kind === 'cancel') {
|
||||||
|
requireRule(!earlyRicheseCancellationBlocked(g,p,use.response),
|
||||||
|
'Keep the Richese cache auction needed for your Truthtrance Yes answer.');
|
||||||
|
if (use.response.kind === 'richeseAuction') reconcileEarlyRicheseCancellationAdmission(g,p);
|
||||||
|
}
|
||||||
validateKaramaUse(g, p, use, card);
|
validateKaramaUse(g, p, use, card);
|
||||||
if (!kullOffered && !g.pendingKull && g.kullPreview && byFaction(g, 'choam')?.id !== p.id)
|
if (!kullOffered && !g.pendingKull && g.kullPreview && byFaction(g, 'choam')?.id !== p.id)
|
||||||
requireRule(kullOriginalWholeCostAllowed(g, p, card, use),
|
requireRule(kullOriginalWholeCostAllowed(g, p, card, use),
|
||||||
@@ -40107,6 +40151,7 @@ function finishResponse(g: Game, canceled: boolean, settlement?: BureaucratSettl
|
|||||||
round.normalCount = round.normalCountBeforeCache ??
|
round.normalCount = round.normalCountBeforeCache ??
|
||||||
Math.max(0, round.normalCount! + Number(richeseCacheRuns(g)));
|
Math.max(0, round.normalCount! + Number(richeseCacheRuns(g)));
|
||||||
round.cacheCanceled = true;
|
round.cacheCanceled = true;
|
||||||
|
finishCanceledEarlyRicheseTruth(g);
|
||||||
log(
|
log(
|
||||||
g,
|
g,
|
||||||
'The compulsory Richese cache auction was canceled; one ordinary lot is restored.',
|
'The compulsory Richese cache auction was canceled; one ordinary lot is restored.',
|
||||||
@@ -51267,6 +51312,9 @@ export function viewGame(state: Game, id: string, now?: number) {
|
|||||||
? {
|
? {
|
||||||
cancelCards: emperorGuildRatePriority(g) ? [] : 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),
|
||||||
|
...(earlyRicheseCancellationBlocked(g,me,g.response) ? {
|
||||||
|
blocked: 'Your Truthtrance Yes requires the Richese cache auction to remain available.',
|
||||||
|
} : {}),
|
||||||
}
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
revivalPrevention:
|
revivalPrevention:
|
||||||
|
|||||||
@@ -336,8 +336,9 @@ export function quoteFremenAmbassadorMove(
|
|||||||
'Choose a Sandmaster spice pile only when collecting.');
|
'Choose a Sandmaster spice pile only when collecting.');
|
||||||
let ambassadorSandmaster: FremenAmbassadorMove['ambassadorSandmaster'];
|
let ambassadorSandmaster: FremenAmbassadorMove['ambassadorSandmaster'];
|
||||||
if (action.sandmasterCollect) {
|
if (action.sandmasterCollect) {
|
||||||
requireMove(physical > 0 && !noField,
|
// A concealed No-Field is one moving force, including its zero face. The
|
||||||
'Sandmaster collection with concealed Ambassador relocation is still being integrated.');
|
// effect belongs to this relocation rather than the marker's hidden value.
|
||||||
|
requireMove(total > 0, 'Sandmaster collection needs a moving force or No-Field.');
|
||||||
const quote = sandmasterDestinationCollection(
|
const quote = sandmasterDestinationCollection(
|
||||||
g, p.id, origin, to, sector, action.sandmasterPile,
|
g, p.id, origin, to, sector, action.sandmasterPile,
|
||||||
);
|
);
|
||||||
|
|||||||
+2
-2
@@ -3791,7 +3791,7 @@ export const RULE_TOPICS: RuleTopic[] = [
|
|||||||
'Choose the separate all-auction phase bid question to include ordinary, Richese cache and Black Market declarations. One accepted qualifying bid fulfills Yes even if it loses; No caps qualifying bids until Bidding closes. Silent zero is a decline. Existing ordinary-only answers retain their original scope. Some combinations with other binding questions are not yet available.',
|
'Choose the separate all-auction phase bid question to include ordinary, Richese cache and Black Market declarations. One accepted qualifying bid fulfills Yes even if it loses; No caps qualifying bids until Bidding closes. Silent zero is a decline. Existing ordinary-only answers retain their original scope. Some combinations with other binding questions are not yet available.',
|
||||||
'A current ordinary, Richese Once Around or Silent bid answer can coexist with the all-auction answer. One native declaration may satisfy both; each No caps that declaration, and a phase-wide Yes may instead wait for a separately funded later lot.',
|
'A current ordinary, Richese Once Around or Silent bid answer can coexist with the all-auction answer. One native declaration may satisfy both; each No caps that declaration, and a phase-wide Yes may instead wait for a separately funded later lot.',
|
||||||
'In a Silent Richese lot the question binds the respondent’s single sealed submission. Zero declines; a positive bid remains hidden until the native simultaneous reveal. Available answers use that bidder’s own funding, without using opponents’ concealed amounts.',
|
'In a Silent Richese lot the question binds the respondent’s single sealed submission. Zero declines; a positive bid remains hidden until the native simultaneous reveal. Available answers use that bidder’s own funding, without using opponents’ concealed amounts.',
|
||||||
'Before Basic Bidding, ask about a minimum bid in the first actual Richese cache auction of this turn. The answer waits for the real event and does not predict its card or method. Current uncommitted personal funds and hand space supply a conservative Yes witness; cancellation or an opposing action can release an impossible commitment. The Richese owner’s Once Around turn may vanish if everyone else passes.',
|
'Before Basic Bidding, ask about a minimum bid in the first actual Richese cache auction of this turn. The answer waits for the real event and does not predict its card or method. Current uncommitted personal funds and hand space supply a conservative Yes witness. You cannot cancel a cache required by your own feasible Yes; another player’s cancellation or opposing action can release an impossible commitment. The Richese owner’s Once Around turn may vanish if everyone else passes.',
|
||||||
'A supported early cache answer and the all-auction phase answer can coexist. A single qualifying cache bid may satisfy both; separate bids need enough currently funded spice and hand space for both purchases. A cache No ends with that lot, while a phase No continues until Bidding ends.',
|
'A supported early cache answer and the all-auction phase answer can coexist. A single qualifying cache bid may satisfy both; separate bids need enough currently funded spice and hand space for both purchases. A cache No ends with that lot, while a phase No continues until Bidding ends.',
|
||||||
'Your waiting cache commitment remains visible until its auction opens or it ends. Once the real lot opens, the ordinary Richese bid guide takes over.',
|
'Your waiting cache commitment remains visible until its auction opens or it ends. Once the real lot opens, the ordinary Richese bid guide takes over.',
|
||||||
'The phase-wide guide may wait for a later lot only when the existing funded sale, prepared next card and post-sale space and funds support it. An unbid lot, hypothetical rival raise, cancelable unfunded overbid or Harkonnen bonus slot is not invented as a future opportunity. Before Bidding, current funding and available card count provide a provisional forecast; special auction preparation and combined future commitments remain limited.',
|
'The phase-wide guide may wait for a later lot only when the existing funded sale, prepared next card and post-sale space and funds support it. An unbid lot, hypothetical rival raise, cancelable unfunded overbid or Harkonnen bonus slot is not invented as a future opportunity. Before Bidding, current funding and available card count provide a provisional forecast; special auction preparation and combined future commitments remain limited.',
|
||||||
@@ -6604,7 +6604,7 @@ export const RULE_TOPICS: RuleTopic[] = [
|
|||||||
'Suk Graduate returns one selected casualty to reserves while its leader stays face up, or lets its surviving battle leader save up to three: one stays in its original sector and the rest return to reserves. The effects do not stack. Rescued counters still count toward Advanced Atreides’ seven battle losses for Kwisatz Haderach; combined modules remain unfinished.',
|
'Suk Graduate returns one selected casualty to reserves while its leader stays face up, or lets its surviving battle leader save up to three: one stays in its original sector and the rest return to reserves. The effects do not stack. Rescued counters still count toward Advanced Atreides’ seven battle losses for Kwisatz Haderach; combined modules remain unfinished.',
|
||||||
'In the supported classic Nexus/Skills composition, Emperor Cunning counts five actual ordinary counters as temporary Sardaukar, or the full positive eligible short group under the provisional shortage policy. Normal or trained Suk rescue still saves physical ordinary casualties. The original casualty allocation remains pending while the rescue choice is open; physical counters move only when rescue settles. Original support is already paid and is not refunded or charged twice. A normal save returns one to reserves; a trained save keeps one and returns the rest. Actual starred reserves and Tanks remain unchanged.',
|
'In the supported classic Nexus/Skills composition, Emperor Cunning counts five actual ordinary counters as temporary Sardaukar, or the full positive eligible short group under the provisional shortage policy. Normal or trained Suk rescue still saves physical ordinary casualties. The original casualty allocation remains pending while the rescue choice is open; physical counters move only when rescue settles. Original support is already paid and is not refunded or charged twice. A normal save returns one to reserves; a trained save keeps one and returns the rest. Actual starred reserves and Tanks remain unchanged.',
|
||||||
'A surviving selected Mentat adds two battle strength. A surviving selected Bureaucrat subtracts one from the opponent’s total per distinct stronghold occupied by that opponent; advisors do not count. Printed disc values and bounties stay unchanged.',
|
'A surviving selected Mentat adds two battle strength. A surviving selected Bureaucrat subtracts one from the opponent’s total per distinct stronghold occupied by that opponent; advisors do not count. Printed disc values and bounties stay unchanged.',
|
||||||
'A living native Sandmaster may collect one spice per entered territory along a declared legal ground route. With multiple positive piles, provisionally choose one debit sector per territory or decline; two piles never grant two spice from the same territory. Canceled moves earn nothing. The initial source and a sector-only reposition earn nothing. Separate movements have separate opportunities. Native worm rides and physical Fremen Ambassador relocation offer one selected destination pile before arrival reactions, without an invented route or normal movement use. Native Ixian HMS passengers choose one pile in each entered territory before faction collection, including supplied Advanced special Karama; its route preview reflects both transfers. These allocations are provisional. Other special relocation remains unfinished.',
|
'A living native Sandmaster may collect one spice per entered territory along a declared legal ground route. With multiple positive piles, provisionally choose one debit sector per territory or decline; two piles never grant two spice from the same territory. Canceled moves earn nothing. The initial source and a sector-only reposition earn nothing. Separate movements have separate opportunities. Native worm rides and supported Fremen Ambassador relocation, including an owned concealed No-Field, offer one selected destination pile before arrival reactions, without an invented route or normal movement use. Native Ixian HMS passengers choose one pile in each entered territory before faction collection, including supplied Advanced special Karama; its route preview reflects both transfers. These allocations are provisional. Other special relocation remains unfinished.',
|
||||||
'A surviving skilled Sandmaster winner adds three board spice to an existing pile in the battle territory, even with no surviving forces. No pile adds nothing; a single pile resolves automatically. With several remaining positive piles, the winner selects one sector after any Smuggler allocation. Owner selection is a visibly provisional placement policy, not a publisher ruling.',
|
'A surviving skilled Sandmaster winner adds three board spice to an existing pile in the battle territory, even with no surviving forces. No pile adds nothing; a single pile resolves automatically. With several remaining positive piles, the winner selects one sector after any Smuggler allocation. Owner selection is a visibly provisional placement policy, not a publisher ruling.',
|
||||||
'Rihani normally inspects two random Traitor Deck cards privately, then reshuffles them. A surviving selected native Rihani also offers a separate optional draw of two. Decide before seeing them: once drawn, keep one new card and publicly reveal and return one unused old card. The other new card returns secretly. A captured Rihani grants only the optional exchange. Your private history records both samples; a card just called to win is already used.',
|
'Rihani normally inspects two random Traitor Deck cards privately, then reshuffles them. A surviving selected native Rihani also offers a separate optional draw of two. Decide before seeing them: once drawn, keep one new card and publicly reveal and return one unused old card. The other new card returns secretly. A captured Rihani grants only the optional exchange. Your private history records both samples; a card just called to win is already used.',
|
||||||
'Smuggler can include one free accompanying force in an off-planet shipment into an empty territory. Select the entire physical total; three forces cost the ordinary price of two. The checkbox can decline this optional benefit. Guild rounding follows the free force. Richese may instead ship one separate free reserve force beside its owned No-Field into an empty territory; the marker retains its ordinary price and hidden value. Existing forces, including advisors, prevent the bonus; ordinary Fremen on-planet reinforcement has no bonus.',
|
'Smuggler can include one free accompanying force in an off-planet shipment into an empty territory. Select the entire physical total; three forces cost the ordinary price of two. The checkbox can decline this optional benefit. Guild rounding follows the free force. Richese may instead ship one separate free reserve force beside its owned No-Field into an empty territory; the marker retains its ordinary price and hidden value. Existing forces, including advisors, prevent the bonus; ordinary Fremen on-planet reinforcement has no bonus.',
|
||||||
|
|||||||
@@ -0,0 +1,156 @@
|
|||||||
|
import assert from 'node:assert/strict';
|
||||||
|
import test from 'node:test';
|
||||||
|
import { readFileSync } from 'node:fs';
|
||||||
|
import { runInNewContext } from 'node:vm';
|
||||||
|
import { createElement, isValidElement, type ReactElement, type ReactNode } from 'react';
|
||||||
|
import { renderToStaticMarkup } from 'react-dom/server';
|
||||||
|
import * as jsxRuntime from 'react/jsx-runtime';
|
||||||
|
import ts from 'typescript';
|
||||||
|
import { AmbassadorMovement } from '../components/ambassador-movement';
|
||||||
|
import { applyAction, viewGame, type Action, type Game, type GameView } from '../game/engine';
|
||||||
|
import * as board from '../game/board';
|
||||||
|
import * as sandmaster from '../game/sandmaster-movement';
|
||||||
|
import * as matching from '../game/advisor-ambassador-matching';
|
||||||
|
import { placeAmbassador, validateAmbassadors } from '../game/ecaz-ambassadors';
|
||||||
|
import { deployRicheseNoField } from '../game/richese-no-field';
|
||||||
|
import { validateEcazLoyalty } from '../game/ecaz-loyalty';
|
||||||
|
import { createSelectedDeckSkillsSetup, assertSelectedDeckSkillsInventory } from './fixture-selected-deck-skills';
|
||||||
|
|
||||||
|
const seat = (game: Game, id: string) => {
|
||||||
|
const player = game.players.find(row => row.id === id); assert.ok(player); return player;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** The shared inventory fixture predates Advanced Ecaz Loyalty. Validate its
|
||||||
|
* real custody, then include that unique card in the fixture's traitor count. */
|
||||||
|
function assertInventory(game: Game) {
|
||||||
|
validateEcazLoyalty(game);
|
||||||
|
const inventory = structuredClone(game);
|
||||||
|
if (inventory.ecazLoyalty?.card) {
|
||||||
|
(inventory.traitorReserve ??= []).push(inventory.ecazLoyalty.card);
|
||||||
|
delete inventory.ecazLoyalty;
|
||||||
|
}
|
||||||
|
assertSelectedDeckSkillsInventory(inventory);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Public setup and original Sandmaster assignment. The original marker,
|
||||||
|
* Ambassador, forces and destination Spice piles are staged at a controlled
|
||||||
|
* movement boundary; the actual trigger and beneficiary choice are played. */
|
||||||
|
function fixture(advanced: boolean) {
|
||||||
|
const setup = createSelectedDeckSkillsSetup({advanced, factions:['richese','ecaz','atreides'],
|
||||||
|
expansions:['choam','ecaz'],skill:'sandmaster'});
|
||||||
|
let game = structuredClone(setup.afterSetup);
|
||||||
|
for (const player of game.players) {
|
||||||
|
player.reserves += Object.values(player.forces).reduce((sum,n) => sum+n,0);
|
||||||
|
player.forces = {}; player.shipped = false; player.moved = 0;
|
||||||
|
}
|
||||||
|
const entrant = seat(game,'atreides'), richese = seat(game,'richese'), ecaz = seat(game,'ecaz');
|
||||||
|
entrant.reserves--; entrant.forces = {'imperial_basin:10':1}; entrant.shipped = true;
|
||||||
|
richese.ally = 'ecaz'; ecaz.ally = 'richese';
|
||||||
|
assert.ok(richese.noField);
|
||||||
|
const marker = richese.noField.tokens.find(token => token.value === 3); assert.ok(marker);
|
||||||
|
richese.noField = deployRicheseNoField(richese.noField, {tokenId:marker.id,controller:richese.id,
|
||||||
|
location:{territory:'red_chasm',sector:7}});
|
||||||
|
richese.noFieldEvent = 'ui-marker-event';
|
||||||
|
assert.ok(game.ecazAmbassadors);
|
||||||
|
const ambassadors = structuredClone(game.ecazAmbassadors);
|
||||||
|
const token = ambassadors.tokens.find(row => row.effect === 'fremen'); assert.ok(token);
|
||||||
|
if (!ambassadors.cohort.includes(token.id)) {
|
||||||
|
const replaced = ambassadors.tokens.find(row => row.id === ambassadors.cohort[0]); assert.ok(replaced);
|
||||||
|
replaced.zone = 'pool'; token.zone = 'supply'; ambassadors.cohort[0] = token.id;
|
||||||
|
}
|
||||||
|
game.ecazAmbassadors = placeAmbassador(ambassadors,token.id,{turn:1,availableSpice:ecaz.spice,
|
||||||
|
destination:{id:'arrakeen',stronghold:true,inStorm:false,allowed:true}}).state;
|
||||||
|
validateAmbassadors(game.ecazAmbassadors);
|
||||||
|
Object.assign(game,{turn:2,phase:5,storm:18,active:'atreides',ready:[],response:null,decision:null,
|
||||||
|
phaseOpening:null,stormResolution:null,stormPending:null,movementRemaining:['atreides','richese','ecaz'],
|
||||||
|
spice:{'south_mesa:4':4,'south_mesa:5':2}});
|
||||||
|
delete game.stormMovementSource;
|
||||||
|
assertInventory(game);
|
||||||
|
game = applyAction(game,'atreides',{type:'move',forces:{'imperial_basin:10':1},territory:'arrakeen',sector:10});
|
||||||
|
assert.equal(game.pendingAmbassador?.stage,'offer');
|
||||||
|
game = applyAction(game,'ecaz',{type:'decision',event:game.pendingAmbassador!.event,
|
||||||
|
trigger:true,beneficiary:'richese'});
|
||||||
|
assert.equal(game.pendingAmbassador?.stage,'move');
|
||||||
|
return {game,marker:marker.id};
|
||||||
|
}
|
||||||
|
|
||||||
|
type Element = ReactElement<{children?:ReactNode;[key:string]:unknown}>;
|
||||||
|
function elements(node: ReactNode): Element[] {
|
||||||
|
if (Array.isArray(node)) return node.flatMap(elements);
|
||||||
|
if (!isValidElement<{children?:ReactNode;[key:string]:unknown}>(node)) return [];
|
||||||
|
return [node,...elements(node.props.children)];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Run the real component with persistent deterministic hooks so the real
|
||||||
|
* select, checkbox and submit callbacks can be exercised without a DOM. */
|
||||||
|
function controller(game: GameView, busy = false) {
|
||||||
|
const states: unknown[] = [], sent: Action[] = [];
|
||||||
|
let cursor = 0;
|
||||||
|
const exports: {AmbassadorMovement?: typeof AmbassadorMovement} = {};
|
||||||
|
const code = ts.transpileModule(readFileSync(new URL('../components/ambassador-movement.tsx',import.meta.url),'utf8'), {
|
||||||
|
compilerOptions:{module:ts.ModuleKind.CommonJS,target:ts.ScriptTarget.ES2022,jsx:ts.JsxEmit.ReactJSX},
|
||||||
|
}).outputText;
|
||||||
|
runInNewContext(code,{exports,require(name:string) {
|
||||||
|
if (name === 'react/jsx-runtime') return jsxRuntime;
|
||||||
|
if (name === 'react') return {useId:() => 'ambassador-fixture',useState(initial:unknown) {
|
||||||
|
const index = cursor++; if (!(index in states)) states[index] = initial;
|
||||||
|
return [states[index],(next:unknown) => {
|
||||||
|
states[index] = typeof next === 'function' ? (next as (value:unknown) => unknown)(states[index]) : next;
|
||||||
|
}];
|
||||||
|
}};
|
||||||
|
if (name === '@/game/board') return board;
|
||||||
|
if (name === '@/game/sandmaster-movement') return sandmaster;
|
||||||
|
if (name === '@/game/advisor-ambassador-matching') return matching;
|
||||||
|
if (name === './ui/button') return {Button:'button'};
|
||||||
|
if (name === './ui/input') return {Input:'input'};
|
||||||
|
throw Error(`Unexpected component import ${name}`);
|
||||||
|
}});
|
||||||
|
assert.ok(exports.AmbassadorMovement);
|
||||||
|
const render = () => { cursor=0; return elements(exports.AmbassadorMovement!({game,busy,act:action=>sent.push(action)})); };
|
||||||
|
const select = (suffix:string,value:string) => {
|
||||||
|
const node = render().find(element => element.props.id === `ambassador-fixture-${suffix}`); assert.ok(node);
|
||||||
|
assert.ok(elements(node).some(option => option.type === 'option' && option.props.value === value));
|
||||||
|
(node.props.onChange as (event:{target:{value:string}})=>void)({target:{value}});
|
||||||
|
};
|
||||||
|
return {render,sent,select};
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const advanced of [false,true]) void test(
|
||||||
|
`${advanced ? 'Advanced' : 'Basic'} marker-only Ambassador owner selects an actual Sandmaster pile`, () => {
|
||||||
|
const {game,marker} = fixture(advanced), view = viewGame(game,'richese');
|
||||||
|
const html = renderToStaticMarkup(createElement(AmbassadorMovement,{game:view,busy:false,act() {}}));
|
||||||
|
assert.match(html,/Ambassador force relocation/);
|
||||||
|
assert.match(html,/Include concealed No-Field/);
|
||||||
|
assert.match(html,/Choose physical forces or the concealed No-Field/);
|
||||||
|
assert.equal(renderToStaticMarkup(createElement(AmbassadorMovement,
|
||||||
|
{game:viewGame(game,'atreides'),busy:false,act() {}})), '');
|
||||||
|
const ui = controller(view);
|
||||||
|
ui.select('destination','south_mesa'); ui.select('sector','south_mesa:4');
|
||||||
|
const checkbox = ui.render().find(element => element.type === 'input' && element.props.type === 'checkbox' &&
|
||||||
|
element.props.checked === false); assert.ok(checkbox);
|
||||||
|
(checkbox.props.onChange as (event:{target:{checked:boolean}})=>void)({target:{checked:true}});
|
||||||
|
ui.select('sandmaster-pile','south_mesa:5');
|
||||||
|
const button = ui.render().find(element => element.type === 'button' &&
|
||||||
|
element.props.children === 'Relocate selected forces'); assert.ok(button);
|
||||||
|
assert.equal(button.props.disabled,false); (button.props.onClick as ()=>void)();
|
||||||
|
assert.deepEqual(JSON.parse(JSON.stringify(ui.sent)),[{type:'decision',event:game.pendingAmbassador!.event,
|
||||||
|
forces:{},eliteForces:{},territory:'south_mesa',sector:4,
|
||||||
|
noField:{tokenId:marker,event:'ui-marker-event'},sandmasterCollect:true,sandmasterPile:'south_mesa:5'}]);
|
||||||
|
const before = seat(game,'richese').spice, done = applyAction(game,'richese',ui.sent[0]);
|
||||||
|
assert.equal(seat(done,'richese').spice,before+1);
|
||||||
|
assert.equal(done.spice['south_mesa:5'],1);
|
||||||
|
assert.deepEqual(seat(done,'richese').noField?.deployed?.location,{territory:'south_mesa',sector:4});
|
||||||
|
assert.throws(() => applyAction(done,'richese',ui.sent[0]),'The spent event cannot repeat');
|
||||||
|
assertInventory(done);
|
||||||
|
|
||||||
|
const blocked = controller(view,true);
|
||||||
|
blocked.select('destination','south_mesa'); blocked.select('sector','south_mesa:4');
|
||||||
|
const busyCheckbox = blocked.render().find(element => element.type === 'input' && element.props.type === 'checkbox' &&
|
||||||
|
element.props.checked === false); assert.ok(busyCheckbox);
|
||||||
|
(busyCheckbox.props.onChange as (event:{target:{checked:boolean}})=>void)({target:{checked:true}});
|
||||||
|
const busyButton = blocked.render().find(element => element.type === 'button' &&
|
||||||
|
element.props.children === 'Relocate selected forces'); assert.ok(busyButton);
|
||||||
|
assert.equal(busyButton.props.disabled,true); (busyButton.props.onClick as ()=>void)();
|
||||||
|
assert.deepEqual(blocked.sent,[]);
|
||||||
|
},
|
||||||
|
);
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
import assert from 'node:assert/strict';
|
||||||
|
import test from 'node:test';
|
||||||
|
import { applyAction, viewGame, type Game } from '../game/engine';
|
||||||
|
import { botActions } from '../game/bots';
|
||||||
|
import { DIFFICULTIES } from '../game/bot-profiles';
|
||||||
|
import { placeAmbassador, validateAmbassadors } from '../game/ecaz-ambassadors';
|
||||||
|
import { deployRicheseNoField } from '../game/richese-no-field';
|
||||||
|
import { validateEcazLoyalty } from '../game/ecaz-loyalty';
|
||||||
|
import { createSelectedDeckSkillsSetup, assertSelectedDeckSkillsInventory } from './fixture-selected-deck-skills';
|
||||||
|
|
||||||
|
const player = (game: Game, id: string) => {
|
||||||
|
const result = game.players.find(seat => seat.id === id); assert.ok(result); return result;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** The shared fixture predates Advanced Ecaz Loyalty: count its unique public
|
||||||
|
* card alongside circulating Traitors, after validating its real custody. */
|
||||||
|
function assertInventory(game: Game) {
|
||||||
|
validateEcazLoyalty(game);
|
||||||
|
const inventory = structuredClone(game);
|
||||||
|
if (inventory.ecazLoyalty?.card) {
|
||||||
|
(inventory.traitorReserve ??= []).push(inventory.ecazLoyalty.card);
|
||||||
|
delete inventory.ecazLoyalty;
|
||||||
|
}
|
||||||
|
assertSelectedDeckSkillsInventory(inventory);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Genuine public setup and Sandmaster assignment. Controlled supplements
|
||||||
|
* relocate original forces to reserves/board, place the original Ambassador,
|
||||||
|
* deploy the actual marker, set the alliance/phase boundary and destination
|
||||||
|
* piles. No card, skill, leader, Ambassador or No-Field identity is minted. */
|
||||||
|
function source(advanced: boolean, value: 0 | 3 | 5, withForces: boolean) {
|
||||||
|
const setup = createSelectedDeckSkillsSetup({advanced, factions:['richese','ecaz','atreides'],
|
||||||
|
expansions:['choam','ecaz'],skill:'sandmaster'});
|
||||||
|
let game = structuredClone(setup.afterSetup);
|
||||||
|
assert.equal(game.players[0].faction,'richese');
|
||||||
|
assert.equal(game.leaderSkills!.assignments.find(row => row.owner === 'richese')?.skill,'sandmaster');
|
||||||
|
const beforeSkills = structuredClone(game.leaderSkills);
|
||||||
|
for (const seat of game.players) {
|
||||||
|
const returned = Object.values(seat.forces).reduce((sum,n) => sum+n,0);
|
||||||
|
seat.reserves += returned; seat.forces = {}; seat.shipped = false; seat.moved = 0;
|
||||||
|
}
|
||||||
|
const entrant = player(game,'atreides'), richese = player(game,'richese'), ecaz = player(game,'ecaz');
|
||||||
|
entrant.reserves--; entrant.forces = {'imperial_basin:10':1}; entrant.shipped = true;
|
||||||
|
if (withForces) { richese.reserves -= 2; richese.forces = {'red_chasm:7':2}; }
|
||||||
|
richese.ally = 'ecaz'; ecaz.ally = 'richese';
|
||||||
|
assert.ok(richese.noField);
|
||||||
|
const marker = richese.noField.tokens.find(token => token.value === value); assert.ok(marker);
|
||||||
|
richese.noField = deployRicheseNoField(richese.noField, {tokenId:marker.id,controller:richese.id,
|
||||||
|
location:{territory:'red_chasm',sector:7}});
|
||||||
|
richese.noFieldEvent = 'staged-marker-event';
|
||||||
|
assert.ok(game.ecazAmbassadors);
|
||||||
|
const ambassadors = structuredClone(game.ecazAmbassadors);
|
||||||
|
const token = ambassadors.tokens.find(row => row.effect === 'fremen'); assert.ok(token);
|
||||||
|
if (!ambassadors.cohort.includes(token.id)) {
|
||||||
|
const replaced = ambassadors.tokens.find(row => row.id === ambassadors.cohort[0]); assert.ok(replaced);
|
||||||
|
replaced.zone = 'pool'; token.zone = 'supply'; ambassadors.cohort[0] = token.id;
|
||||||
|
}
|
||||||
|
game.ecazAmbassadors = placeAmbassador(ambassadors,token.id,{turn:1,availableSpice:ecaz.spice,
|
||||||
|
destination:{id:'arrakeen',stronghold:true,inStorm:false,allowed:true}}).state;
|
||||||
|
validateAmbassadors(game.ecazAmbassadors);
|
||||||
|
Object.assign(game,{turn:2,phase:5,storm:18,active:'atreides',ready:[],response:null,decision:null,
|
||||||
|
phaseOpening:null,stormResolution:null,stormPending:null,movementRemaining:['atreides','richese','ecaz'],
|
||||||
|
spice:{'south_mesa:4':4,'south_mesa:5':2}});
|
||||||
|
delete game.stormMovementSource;
|
||||||
|
assert.deepEqual(game.leaderSkills,beforeSkills);
|
||||||
|
assertInventory(game);
|
||||||
|
game = applyAction(game,'atreides',{type:'move',forces:{'imperial_basin:10':1},territory:'arrakeen',sector:10});
|
||||||
|
assert.equal(game.pendingAmbassador?.stage,'offer');
|
||||||
|
game = applyAction(game,'ecaz',{type:'decision',event:game.pendingAmbassador!.event,
|
||||||
|
trigger:true,beneficiary:'richese'});
|
||||||
|
assert.equal(game.pendingAmbassador?.stage,'move');
|
||||||
|
return {game,marker:marker.id};
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const advanced of [false,true]) for (const value of [0,3,5] as const)
|
||||||
|
for (const withForces of [false,true]) void test(
|
||||||
|
`${advanced ? 'Advanced' : 'Basic'} marker ${value}${withForces ? ' with forces' : ' alone'} collects on actual Ambassador relocation`, () => {
|
||||||
|
const {game,marker} = source(advanced,value,withForces);
|
||||||
|
const before = structuredClone(game), richese = player(game,'richese');
|
||||||
|
const publicMarker = viewGame(game,'atreides').players.find(seat => seat.id === 'richese')!.noField;
|
||||||
|
assert.ok(publicMarker);
|
||||||
|
assert.ok(!JSON.stringify(publicMarker).includes(marker), 'A rival does not receive the private token identity');
|
||||||
|
const own = viewGame(game,'richese');
|
||||||
|
const offered = own.ambassadorEntry?.movement?.sources.find(row => row.territory === 'red_chasm');
|
||||||
|
assert.equal(offered?.marker?.tokenId,marker);
|
||||||
|
const done = applyAction(game,'richese',{type:'decision',event:game.pendingAmbassador!.event,
|
||||||
|
forces:withForces ? {'red_chasm:7':2} : {},noField:{tokenId:marker,event:richese.noFieldEvent!},
|
||||||
|
territory:'south_mesa',sector:4,sandmasterCollect:true,sandmasterPile:'south_mesa:5'});
|
||||||
|
const moved = player(done,'richese');
|
||||||
|
assert.equal(moved.spice,richese.spice+1);
|
||||||
|
assert.equal(done.spice['south_mesa:4'],4); assert.equal(done.spice['south_mesa:5'],1);
|
||||||
|
assert.deepEqual(moved.noField?.deployed?.location,{territory:'south_mesa',sector:4});
|
||||||
|
assert.equal(moved.noField?.deployed?.tokenId,marker);
|
||||||
|
assert.notEqual(moved.noFieldEvent,richese.noFieldEvent);
|
||||||
|
assert.equal(moved.reserves,richese.reserves);
|
||||||
|
assert.equal(moved.forces['south_mesa:4'] ?? 0,withForces ? 2 : 0);
|
||||||
|
assert.equal(moved.moved,richese.moved); assert.equal(moved.shipped,richese.shipped);
|
||||||
|
assert.equal(done.log.filter(row => row.automatic?.name === 'Sandmaster collection').length,
|
||||||
|
before.log.filter(row => row.automatic?.name === 'Sandmaster collection').length + 1);
|
||||||
|
assertInventory(done);
|
||||||
|
});
|
||||||
|
|
||||||
|
void test('four bot profiles can legally relocate the sole marker in the real Ambassador window', () => {
|
||||||
|
const {game} = source(false,0,false);
|
||||||
|
for (const difficulty of DIFFICULTIES) {
|
||||||
|
const view = viewGame(game,'richese');
|
||||||
|
view.players.find(seat => seat.id === 'richese')!.bot = difficulty;
|
||||||
|
const choice = botActions(view).find(action => action.type === 'decision' && action.noField);
|
||||||
|
assert.ok(choice,difficulty);
|
||||||
|
assert.doesNotThrow(() => applyAction(structuredClone(game),'richese',choice),difficulty);
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
import assert from 'node:assert/strict';
|
||||||
|
import test from 'node:test';
|
||||||
|
import { createGame, newPlayer, type Action, type Game } from '../game/engine';
|
||||||
|
import { createLeaderSkills } from '../game/leader-skills';
|
||||||
|
import { createRicheseNoField, deployRicheseNoField } from '../game/richese-no-field';
|
||||||
|
import { quoteFremenAmbassadorMove } from '../game/fremen-ambassador';
|
||||||
|
|
||||||
|
/** Controlled board position; all marker denominations use the same public
|
||||||
|
* movement and Sandmaster calculation. No card or physical unit is invented. */
|
||||||
|
function source(value: 0 | 3 | 5, advanced: boolean, withForces: boolean) {
|
||||||
|
const game = createGame('SAMARKER', newPlayer('r', 'Richese', 'richese'), advanced, ['choam', 'ecaz']);
|
||||||
|
game.players.push(newPlayer('e', 'Ecaz', 'ecaz'), newPlayer('a', 'Atreides', 'atreides'));
|
||||||
|
Object.assign(game, {status:'playing',turn:2,phase:5,storm:18,order:['e','a','r'],active:'a'});
|
||||||
|
const richese = game.players[0];
|
||||||
|
richese.spice = 5;
|
||||||
|
richese.forces = withForces ? {'red_chasm:7':2} : {};
|
||||||
|
richese.reserves = withForces ? 18 : 20;
|
||||||
|
richese.noField = deployRicheseNoField(createRicheseNoField(['nf0','nf3','nf5']), {
|
||||||
|
tokenId:`nf${value}`,controller:'r',location:{territory:'red_chasm',sector:7},
|
||||||
|
});
|
||||||
|
richese.noFieldEvent = 'marker-event';
|
||||||
|
const skills = createLeaderSkills(() => 0.2);
|
||||||
|
skills.deck = skills.deck.filter(skill => skill !== 'sandmaster');
|
||||||
|
skills.assignments = [{skill:'sandmaster',owner:'r',leader:richese.leaders[0].id}];
|
||||||
|
game.leaderSkills = skills;
|
||||||
|
game.spice = {'south_mesa:4':4,'south_mesa:5':2};
|
||||||
|
const action: Action = {type:'decision',event:'ambassador-event',
|
||||||
|
forces:withForces ? {'red_chasm:7':2} : {},noField:{tokenId:`nf${value}`,event:'marker-event'},
|
||||||
|
territory:'south_mesa',sector:4,sandmasterCollect:true,sandmasterPile:'south_mesa:5'};
|
||||||
|
return {game,action};
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const advanced of [false,true]) for (const value of [0,3,5] as const)
|
||||||
|
for (const withForces of [false,true]) void test(
|
||||||
|
`${advanced ? 'Advanced' : 'Basic'} concealed ${value}${withForces ? ' with forces' : ' alone'} quotes one Sandmaster collection`, () => {
|
||||||
|
const {game,action} = source(value,advanced,withForces);
|
||||||
|
const before = structuredClone(game), priorAction = structuredClone(action);
|
||||||
|
const result = quoteFremenAmbassadorMove(game,'r',action);
|
||||||
|
assert.equal(result.total,withForces ? 3 : 1);
|
||||||
|
assert.deepEqual(result.noField,{tokenId:`nf${value}`,event:'marker-event',from:'red_chasm:7'});
|
||||||
|
assert.deepEqual(result.ambassadorSandmaster,{leader:game.players[0].leaders[0].id,key:'south_mesa:5',before:2});
|
||||||
|
assert.deepEqual(game,before);
|
||||||
|
assert.deepEqual(action,priorAction);
|
||||||
|
});
|
||||||
|
|
||||||
|
void test('marker quote requires a live token, an eligible trainer and an actual destination pile', () => {
|
||||||
|
const {game,action} = source(0,false,false);
|
||||||
|
const before: Game = structuredClone(game);
|
||||||
|
assert.throws(() => quoteFremenAmbassadorMove(game,'r',{
|
||||||
|
...action,noField:{tokenId:'nf0',event:'stale'},
|
||||||
|
}));
|
||||||
|
assert.throws(() => quoteFremenAmbassadorMove(game,'r',{
|
||||||
|
...action,sandmasterPile:'false_wall_west:13',
|
||||||
|
}));
|
||||||
|
const denied = structuredClone(game);
|
||||||
|
denied.players[0].leaders[0].dead = true;
|
||||||
|
assert.throws(() => quoteFremenAmbassadorMove(denied,'r',action));
|
||||||
|
assert.deepEqual(game,before);
|
||||||
|
assert.equal(quoteFremenAmbassadorMove(game,'r',{...action,sandmasterCollect:false,sandmasterPile:undefined})
|
||||||
|
.ambassadorSandmaster,undefined);
|
||||||
|
});
|
||||||
@@ -0,0 +1,136 @@
|
|||||||
|
import assert from 'node:assert/strict';
|
||||||
|
import test from 'node:test';
|
||||||
|
import { viewGame, type Game } from '../game/engine';
|
||||||
|
import { SEMUTA_DRUG_ID } from '../game/semuta-drug';
|
||||||
|
import {
|
||||||
|
actTruthtranceRichesePromises as act,
|
||||||
|
advanceTruthtranceRichesePromises as advance,
|
||||||
|
askTruthtranceRichesePromises as ask,
|
||||||
|
createTruthtranceRichesePromisesFixture as fixture,
|
||||||
|
passTruthRicheseFreshDiscard,
|
||||||
|
truthtranceRichesePromisesClean as clean,
|
||||||
|
truthtranceRichesePromisesInventory as inventory,
|
||||||
|
truthtranceRichesePromisesPlayer as player,
|
||||||
|
} from './fixture-truthtrance-richese-promises';
|
||||||
|
|
||||||
|
/** Public Basic Richese/Atreides/Emperor start. The original unopened Karama,
|
||||||
|
* second Truthtrance and cached Semuta are moved to named hands, conserving
|
||||||
|
* the full physical inventory. No wallet, promise or auction is installed. */
|
||||||
|
function source(earlyAnswer: 'yes' | 'no', joint: boolean, position: 'first' | 'last') {
|
||||||
|
const f = fixture({advanced:false});
|
||||||
|
let game = structuredClone(f.earlySource);
|
||||||
|
const take = (effect: string) => {
|
||||||
|
const index = game.deck.findIndex(card => card.effect === effect && card.id !== f.truth);
|
||||||
|
assert.ok(index >= 0, `The original ${effect} remains in the deck`);
|
||||||
|
return game.deck.splice(index,1)[0];
|
||||||
|
};
|
||||||
|
const selfKarama = take('karama'), otherKarama = take('karama');
|
||||||
|
player(game,f.emperor).hand.push(selfKarama);
|
||||||
|
player(game,f.asker).hand.push(otherKarama);
|
||||||
|
const secondTruth = joint ? take('truthtrance') : null;
|
||||||
|
if (secondTruth) player(game,f.asker).hand.push(secondTruth);
|
||||||
|
const semutaIndex = game.richeseCache!.findIndex(card => card.id === SEMUTA_DRUG_ID);
|
||||||
|
assert.ok(semutaIndex >= 0);
|
||||||
|
const [semuta] = game.richeseCache!.splice(semutaIndex,1);
|
||||||
|
player(game,f.richese).hand.push(semuta);
|
||||||
|
assert.deepEqual(inventory(game),f.originalCards);
|
||||||
|
|
||||||
|
game = ask(game,f,{kind:'earlyRicheseBid',target:f.emperor,turn:game.turn,minimum:4});
|
||||||
|
assert.ok(viewGame(game,f.emperor).truthEarlyRicheseBidAnswers?.includes(earlyAnswer));
|
||||||
|
game = passTruthRicheseFreshDiscard(act(game,f.emperor,{type:'truthAnswer',answer:earlyAnswer}));
|
||||||
|
const early = game.earlyRicheseBidPromises?.find(row => row.player === f.emperor); assert.ok(early);
|
||||||
|
if (secondTruth) {
|
||||||
|
game = act(game,f.asker,{type:'card',card:secondTruth.id});
|
||||||
|
game = advance(game,state => state.truthtrance?.stage === 'ask');
|
||||||
|
game = act(game,f.asker,{type:'truthAsk',question:{
|
||||||
|
kind:'phaseAnyBid',target:f.emperor,turn:game.turn,minimum:6,
|
||||||
|
}});
|
||||||
|
assert.ok(viewGame(game,f.emperor).truthPhaseAnyBidAnswers?.includes('yes'));
|
||||||
|
game = passTruthRicheseFreshDiscard(act(game,f.emperor,{type:'truthAnswer',answer:'yes'}));
|
||||||
|
}
|
||||||
|
const phase = game.phaseAnyBidPromises?.find(row => row.player === f.emperor);
|
||||||
|
game = advance(game,state => state.decision?.kind === 'richeseDeclaration');
|
||||||
|
const ordinaryBefore = game.richeseBidding!.normalCount!;
|
||||||
|
game = act(game,f.richese,{type:'decision',event:game.richeseBidding!.event,position});
|
||||||
|
assert.equal(game.response?.kind,'richeseAuction');
|
||||||
|
assert.ok(!game.richeseBidding?.cacheCanceled);
|
||||||
|
assert.deepEqual(inventory(game),f.originalCards);
|
||||||
|
return {f,game,early,phase,selfKarama,otherKarama,ordinaryBefore};
|
||||||
|
}
|
||||||
|
|
||||||
|
function settleDiscard(state: Game, owner: string, claim: boolean): Game {
|
||||||
|
let game = state;
|
||||||
|
const pending = game.pendingTreacheryDiscard;
|
||||||
|
assert.ok(pending?.reaction?.stage === 'offer', 'The actual cancellation opens Semuta');
|
||||||
|
const event = pending.batch.event;
|
||||||
|
if (!claim) return passTruthRicheseFreshDiscard(game);
|
||||||
|
assert.ok(viewGame(game,owner).semutaReaction?.canCommit);
|
||||||
|
game = act(game,owner,{type:'semutaCommit',event});
|
||||||
|
if (game.pendingTreacheryDiscard?.reaction?.stage === 'select') {
|
||||||
|
const card = pending.batch.entries[0].card.id;
|
||||||
|
game = act(game,owner,{type:'semutaSelect',event,card});
|
||||||
|
}
|
||||||
|
assert.notEqual(game.pendingTreacheryDiscard?.batch.event,event);
|
||||||
|
return game;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const position of ['first','last'] as const)
|
||||||
|
for (const joint of [false,true]) void test(
|
||||||
|
`Basic ${position} self-cancellation cannot evade an early cache Yes${joint ? ' with phase Yes' : ''}`, () => {
|
||||||
|
const f = source('yes',joint,position), before = structuredClone(f.game);
|
||||||
|
assert.ok(!viewGame(f.game,f.f.emperor).responseControls?.cancelCards.includes(f.selfKarama.id),
|
||||||
|
'The private cancellation controls explain the unsupported voluntary action');
|
||||||
|
assert.match(viewGame(f.game,f.f.emperor).responseControls?.blocked ?? '', /Truthtrance Yes/);
|
||||||
|
assert.throws(() => act(f.game,f.f.emperor,{type:'card',card:f.selfKarama.id,mode:'cancel'}));
|
||||||
|
assert.deepEqual(f.game,before, 'Rejected action does not spend Karama or alter the cache response');
|
||||||
|
assert.ok(player(f.game,f.f.emperor).hand.some(card => card.id === f.selfKarama.id));
|
||||||
|
assert.ok(f.game.earlyRicheseBidPromises?.some(row => row.id === f.early.id && !row.released && !row.boundEvent));
|
||||||
|
if (f.phase) assert.ok(f.game.phaseAnyBidPromises?.some(row => row.event === f.phase!.event && !row.released));
|
||||||
|
assert.deepEqual(inventory(f.game),f.f.originalCards);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
for (const claim of [false,true]) void test(
|
||||||
|
`Another player's cache cancellation releases the Yes; Semuta ${claim ? 'claims' : 'passes'}`, () => {
|
||||||
|
const f = source('yes',true,'first');
|
||||||
|
let game = act(f.game,f.f.asker,{type:'card',card:f.otherKarama.id,mode:'cancel'});
|
||||||
|
game = settleDiscard(game,f.f.richese,claim);
|
||||||
|
assert.equal(game.richeseBidding?.cacheCanceled,true);
|
||||||
|
assert.equal(game.richeseBidding?.normalCount,f.ordinaryBefore+1);
|
||||||
|
assert.ok(game.phaseAnyBidPromises?.some(row => row.event === f.phase!.event && !row.fulfilled && !row.released));
|
||||||
|
assert.equal(player(game,f.f.richese).hand.some(card => card.id === f.otherKarama.id),claim);
|
||||||
|
assert.equal(player(game,f.f.richese).hand.some(card => card.id === SEMUTA_DRUG_ID),!claim);
|
||||||
|
game = advance(game,state => clean(state) && !!state.auction && state.auction.active === f.f.emperor);
|
||||||
|
assert.ok(game.earlyRicheseBidPromises?.some(row => row.id === f.early.id && row.released && !row.boundEvent));
|
||||||
|
const guide = viewGame(game,f.f.emperor).phaseAnyBidGuide?.action;
|
||||||
|
assert.ok(guide); assert.equal(guide.type,'bid'); assert.equal(guide.amount,6);
|
||||||
|
game = act(game,f.f.emperor,guide);
|
||||||
|
assert.ok(game.phaseAnyBidPromises?.some(row => row.event === f.phase!.event && row.fulfilled));
|
||||||
|
assert.deepEqual(inventory(game),f.f.originalCards);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
void test('a player may cancel the cache after answering No to the early bid question', () => {
|
||||||
|
const f = source('no',false,'first');
|
||||||
|
let game = act(f.game,f.f.emperor,{type:'card',card:f.selfKarama.id,mode:'cancel'});
|
||||||
|
game = settleDiscard(game,f.f.richese,false);
|
||||||
|
assert.equal(game.richeseBidding?.cacheCanceled,true);
|
||||||
|
assert.ok(game.earlyRicheseBidPromises?.some(row => row.id === f.early.id && row.fulfilled && !row.released));
|
||||||
|
assert.deepEqual(inventory(game),f.f.originalCards);
|
||||||
|
});
|
||||||
|
|
||||||
|
void test('self-cancellation is allowed after an external shortfall already made the Yes impossible', () => {
|
||||||
|
const f = source('yes',false,'first');
|
||||||
|
// Disclosed external-state supplement: this completed loss is staged while
|
||||||
|
// the cache response is open, so the old Yes has not been reconciled yet.
|
||||||
|
// No physical cards, bids, responses or promise receipts are fabricated.
|
||||||
|
const game = structuredClone(f.game);
|
||||||
|
player(game,f.f.emperor).spice = 0;
|
||||||
|
assert.ok(game.earlyRicheseBidPromises?.some(row => row.id === f.early.id && !row.released));
|
||||||
|
assert.ok(viewGame(game,f.f.emperor).responseControls?.cancelCards.includes(f.selfKarama.id));
|
||||||
|
let resolved = act(game,f.f.emperor,{type:'card',card:f.selfKarama.id,mode:'cancel'});
|
||||||
|
resolved = settleDiscard(resolved,f.f.richese,false);
|
||||||
|
assert.equal(resolved.richeseBidding?.cacheCanceled,true);
|
||||||
|
assert.ok(resolved.earlyRicheseBidPromises?.some(row => row.id === f.early.id && row.released));
|
||||||
|
assert.deepEqual(inventory(resolved),f.f.originalCards);
|
||||||
|
});
|
||||||
Reference in new issue
Block a user