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:
Quintine committed 2026-09-21 15:10:29 +10:00
1 parent 3efda2128e
commit d1bf33d0bc
20 files changed
+1479 -31

No files matched your search

+23 -1
View File
@@ -449,7 +449,7 @@ import { biddingEndError, biddingEndQuiet, biddingEndPubliclyEmpty, type Bidding
import { quoteHomeworldPaymentIncome, quoteGuildPaymentRounding } from './homeworld-payment-income';
import { quoteEcazPoisonIncome, EcazPoisonIncomeError, type EcazPoisonDiscard } from './ecaz-poison-income';
import { resolveBattleWeapons } from './effective-weapons';
import { choamGholaEvent, choamMarketGholaError, choamSaleGholaTiming, type ChoamMarketGhola } from './choam-market-ghola';
import { choamGholaEvent, choamGholaSkillOfferEvent, choamGholaSkillSignature, choamMarketGholaError, choamSaleGholaTiming, type ChoamMarketGhola } from './choam-market-ghola';
import {
charityAmount,
charityQuote,
@@ -14384,6 +14384,7 @@ function resumeMarketGhola(g: Game) {
if (g.homeworldRevivalReturn && g.homeworldRevivalReturn.stage !== 'complete') return;
const pending = g.pendingChoamMarketGhola;
if (!pending || pending.stage !== 'complete' || g.pendingTreacheryDiscard || g.pendingNullentropy ||
g.leaderSkills?.offers[pending.player] ||
g.response || g.decision || g.pendingKarama || g.truthtrance ||
g.phaseOpening || g.pendingRicheseGift || g.pendingExchange) return;
nexusChoamTradeIntegrity(g);
@@ -14412,6 +14413,17 @@ function playMarketGhola(g: Game, p: Player, action: Action) {
g.pendingChoamMarketGhola.event = choamGholaEvent(g.pendingChoamMarketGhola);
g.response = null;
applyGholaEffect(g, p, action, card.id);
if (g.leaderSkills) {
const pending = g.pendingChoamMarketGhola;
const offer = g.leaderSkills.offers[p.id];
pending.leaderSkill = {
leader: p.leaders.find(leader => leader.id === action.leader)?.id ?? null,
offer: offer?.event ?? null,
completed: !offer,
signature: '',
};
pending.leaderSkill.signature = choamGholaSkillSignature(pending);
}
if (g.response) (g.response as ResponseWindow).intent = g.pendingChoamMarketGhola.event;
const used = discard(g, p, card.id);
log(g, `${p.name} played ${card.name}. The declared CHOAM sale waits for this revival and its income to finish.`,
@@ -14445,6 +14457,10 @@ function applyGholaEffect(g: Game, p: Player, action: Action, cardId?: string) {
// GF9 November 2020 FAQ p.9 permits a Ghola return in another battle
// this turn. Death history remains; the earlier battle location does not.
delete l.usedAt;
if (g.pendingChoamMarketGhola && g.leaderSkills && !isAuditorLeader(l) &&
!l.gholaBy && p.leaders.some(leader => leader.id === l.id))
g.leaderSkills = skillRule(() => offerRevivedLeaderSkill(
g.leaderSkills!, p.id, l.id, choamGholaSkillOfferEvent(g.pendingChoamMarketGhola!, l.id)));
log(
g,
`${p.name} revived ${l.name} with Ghola. The leader may fight again this turn; no spice or normal leader-revival allowance was spent.`,
@@ -21275,6 +21291,12 @@ function applyActionInner(
g.leaderSkills = skillRule(() => chooseLeaderSkill(g.leaderSkills!, id, stringField(action.event), skill, stringField(action.leader), skillEligibleLeaders(g,id), random));
log(g, `${p.name} assigned ${leaderSkillCard(action.skill as Parameters<typeof leaderSkillCard>[0]).name} to a newly revived leader.`, {faction:p.faction,name:'Leader Skill'});
}
const marketGhola = g.pendingChoamMarketGhola;
if (marketGhola?.player === id && marketGhola.leaderSkill?.offer === decision.event &&
!g.leaderSkills.offers[id]) {
marketGhola.leaderSkill.completed = true;
marketGhola.leaderSkill.signature = choamGholaSkillSignature(marketGhola);
}
g.decision = null;
if (g.battle && !g.battle.revealed && !g.battle.plans[id] && [g.battle.attacker,g.battle.defender].includes(id) && g.leaderSkills.assignments.some((a) => a.owner === id) && g.battle.leaderSkillHidden?.[id] === undefined)
g.decision = {kind:'leaderSkillVisibility',player:id,event:g.battle.event!,resumePowers:false};