Connect Basic CHOAM skills and preserve market Ghola choices
Connect ordinary Leader Skill paths to Basic CHOAM with base opponents, the real 35-card Treachery deck and all fourteen skills. Retain wider development initializer behavior and existing mode/publication gates. Pause a declared sale until its Ghola revival and private skill choice finish. Bind the actual revived leader, offer event and completion to the saved interruption. Preserve nested Truthtrance disposal and exact sale responses; canceling a resumed sale leaves the free revival completed. Keep force-only and retained-skill revivals free of replacement offers. Add genuine setup, native card-sale, mandatory disposal, private custody, corruption and concurrent authenticated recovery regressions plus a two-through-six-player complete-game sample profile. Record the unresolved Sandmaster/native-HMS eligibility question without inventing a bonus. Validation: types, lint, 5101 offline tests and production build passed. Five genuine 2-6 player CHOAM Skills games completed with zero rejected actions. Independent review and 50 focused compatibility tests passed. Browser Y2UJGMCS exercised real setup, Ghola draw, exact private refresh, mobile assignment and resumed sale paying two spice once. Screenshot capture timed out; full visual acceptance remains open. All 1,583 prior rooms, 3,351 seats and auxiliary records remain intact; one QA room and human seat were added. No restart, reset or automation. Full AI implementation and tuning remain deferred until all non-AI features are complete, then target roughly 75% for each adjacent tier.
This commit is contained in:
1 parent
3efda2128e
commit
d1bf33d0bc
20 files changed
+1479
-31
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import type { Game, ResponseWindow } from './engine';
|
||||
import type { ChoamMarket } from './choam-market';
|
||||
import { quoteChoamSaleCancellation } from './choam-sale-cancellation';
|
||||
import { CHOAM_AUDITOR_ID } from './cards';
|
||||
|
||||
/** The sale is suspended, never replayed. Its physical card stays in its hand. */
|
||||
export type ChoamMarketGhola = {
|
||||
@@ -13,6 +14,13 @@ export type ChoamMarketGhola = {
|
||||
stage: 'discard' | 'income' | 'complete';
|
||||
response: ResponseWindow;
|
||||
market: ChoamMarket;
|
||||
/** New Skills interruptions bind their committed revival through the optional choice. */
|
||||
leaderSkill?: {
|
||||
leader: string | null;
|
||||
offer: string | null;
|
||||
completed: boolean;
|
||||
signature: string;
|
||||
};
|
||||
};
|
||||
|
||||
export function choamGholaEvent(pending: Pick<ChoamMarketGhola,
|
||||
@@ -21,6 +29,58 @@ export function choamGholaEvent(pending: Pick<ChoamMarketGhola,
|
||||
pending.player, pending.card, pending.discardSequence]);
|
||||
}
|
||||
|
||||
export function choamGholaSkillSignature(pending: ChoamMarketGhola): string {
|
||||
const skill = pending.leaderSkill;
|
||||
return JSON.stringify(['choamGholaSkill', pending.event, skill?.leader,
|
||||
skill?.offer, skill?.completed]);
|
||||
}
|
||||
|
||||
export function choamGholaSkillOfferEvent(pending: ChoamMarketGhola, leader: string): string {
|
||||
return JSON.stringify(['choamGholaSkillOffer', pending.event, leader]);
|
||||
}
|
||||
|
||||
function skillRevivalError(
|
||||
g: Game,
|
||||
pending: ChoamMarketGhola,
|
||||
decisions: readonly (Game['decision'] | undefined)[],
|
||||
): string | null {
|
||||
const record = pending.leaderSkill;
|
||||
if (!g.leaderSkills && !record) return null;
|
||||
if (!g.leaderSkills || !record ||
|
||||
!(record.leader === null || (typeof record.leader === 'string' && record.leader)) ||
|
||||
!(record.offer === null || (typeof record.offer === 'string' && record.offer)) ||
|
||||
typeof record.completed !== 'boolean' || record.signature !== choamGholaSkillSignature(pending))
|
||||
return 'The saved market Ghola lost its committed Leader Skill revival.';
|
||||
const owner = g.players.find(player => player.id === pending.player)!;
|
||||
const leader = owner.leaders.find(candidate => candidate.id === record.leader);
|
||||
if (record.leader !== null && (!leader || leader.dead || leader.capturedBy || leader.gholaBy))
|
||||
return 'The market Ghola no longer has its own revived leader.';
|
||||
const offer = g.leaderSkills.offers[pending.player];
|
||||
if (record.offer === null) {
|
||||
if (!record.completed || offer || (record.leader !== null && record.leader !== CHOAM_AUDITOR_ID &&
|
||||
!g.leaderSkills.assignments.some(assignment => assignment.owner === pending.player)))
|
||||
return 'This market Ghola cannot omit its optional Leader Skill offer.';
|
||||
return null;
|
||||
}
|
||||
if (record.leader === null)
|
||||
return 'A market Ghola skill offer must name its revived leader.';
|
||||
if (record.offer !== choamGholaSkillOfferEvent(pending, record.leader))
|
||||
return 'The market Ghola skill event no longer matches its committed revival.';
|
||||
if (record.completed) {
|
||||
if (offer) return 'The completed market Ghola still has an unresolved skill offer.';
|
||||
} else {
|
||||
if (!offer || offer.event !== record.offer || offer.leader !== record.leader)
|
||||
return 'The market Ghola lost its original leader or optional skill offer.';
|
||||
// An ordinary-card/Truthtrance disposal may temporarily hold this owned
|
||||
// decision in its continuation. Its exact event remains required there.
|
||||
if (pending.stage === 'complete' &&
|
||||
!decisions.some(decision => decision?.kind === 'leaderSkillRevival' &&
|
||||
decision.player === pending.player && decision.event === record.offer))
|
||||
return 'The completed Ghola is waiting for its owned Leader Skill decision.';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Public timing shared by the server and the hand's ordinary-card controls. */
|
||||
export function choamSaleGholaTiming(state: {
|
||||
status: string;
|
||||
@@ -38,6 +98,10 @@ export function choamSaleGholaTiming(state: {
|
||||
* move the sale card or change Tupile before the original declaration resumes. */
|
||||
export function choamMarketGholaError(g: Game): string | null {
|
||||
const pending = g.pendingChoamMarketGhola;
|
||||
const marketOffers = Object.entries(g.leaderSkills?.offers ?? {})
|
||||
.filter(([, offer]) => typeof offer?.event === 'string' && offer.event.startsWith('["choamGholaSkillOffer",'));
|
||||
if (marketOffers.length && (!pending || marketOffers.length !== 1 || marketOffers[0][0] !== pending.player))
|
||||
return 'The Ghola Leader Skill offer lost its suspended market.';
|
||||
if (!pending) return null;
|
||||
if (
|
||||
g.status !== 'playing' || pending.turn !== g.turn || pending.phase !== g.phase ||
|
||||
@@ -87,6 +151,9 @@ export function choamMarketGholaError(g: Game): string | null {
|
||||
if (incomes.some((income) => income!.recipient !== pending.player || income!.amount !== 1 ||
|
||||
!g.players.some((p) => p.id === income!.owner && p.faction === 'tleilaxu')))
|
||||
return 'The saved Ghola income no longer matches the revived faction.';
|
||||
const skillError = skillRevivalError(g, pending,
|
||||
contexts.map(context => context && 'decision' in context ? context.decision : undefined));
|
||||
if (skillError) return skillError;
|
||||
try {
|
||||
quoteChoamSaleCancellation(g, pending.response);
|
||||
} catch (error) {
|
||||
|
||||
Reference in new issue
Block a user