Files
Dune/components/leader-skill-battle-guide.tsx
T
Quintine 20cc6057e9 Connect unmodified Smuggler battle collection
New Leader Skills battles bind territory spice to the public plan reveal and automatically pay the controlling player once the selected Smuggler survives, including a loser or captive with no surviving forces. Cap collection at the original single pile and unmodified disc strength. Pending spice cannot fund a plan. Settlement before Sandmaster's after-win addition remains an explicitly documented timing inference; modified strength, multiple positive piles and other module combinations remain gated pending the existing rulings and integration.

Share pre-seal admission across server, controls and all four bot profiles. Expose the public Ecaz card-variant flag so its guard also works in private views. Normalize the selected Kwisatz value once for UI validation and submission. Fix AI selection of unavailable native face-up skilled discs. Show reveal-time pending guidance and an automatic collection notice/chronicle without a new confirmation. Keep unversioned saved battles on their existing behavior.

Bind saved receipts to the original battle, controller, leader, plans, posture and pile; project no internal binding frame. Void collection on leader death, opposing/mutual Traitors and explosion without restoring destroyed spice. Apply captured-leader settlement before normal custody cleanup. Existing room versioning prevents concurrent final votes from paying twice.

Twelve new engine/SQLite tests cover Basic/Advanced winners and losers, caps, empty piles, zero remaining forces, weapon/Traitor/explosion outcomes, captive survival/death custody, Sandmaster ordering, corrupted receipts, immutable pre-seal guards, legacy continuation, legal paths for four profiles and authenticated concurrent/restarted settlement. Independent review prompted the Ecaz gate and stale-Kwisatz corrections and found no further material defect in the bounded delta. A focused regression also identified the missing public Ecaz configuration field, now projected.

Types, lint, 4884 offline tests, production build and 43 HTTP tests passed on the unchanged source fingerprint. Two genuine four-profile Leader Skills samples completed in 265 Basic and 211 Advanced actions with no rejected candidates and 14 JSON/private-view restorations; neither sampled game naturally exercised Smuggler collection, so focused and browser evidence establish that effect.

In isolated browser room YWV8AGKS, the Emperor selected Smuggler, sealed a zero dial, saw six pending spice without early credit, refreshed the pending decision and submitted no Traitor. After the opponent's production-engine final action, the browser showed the 6-8 loss, automatic six-spice collection, explanatory chronicle and restored balance 26 after another refresh. Opponent/setup staging was private and confined to the new QA room. Screenshot acceptance remains open. An initial private verification script compared SQLite null-prototype rows with parsed JSON too strictly; the transaction rolled back and the corrected content comparison passed.

After the reported outage the server was healthy and the previous private QA seat restored. All 1106 baseline rooms, 2314 seats and every original recovery, entry and handover row remain byte-for-byte unchanged; the HTTP/browser checks added 34 rooms and 71 seats. SQLite integrity and foreign keys pass. No restart, migration, database reset or automation was needed. No mode, module or publication gate is opened.

Verified source tree: dc55a36f7bfe108d6529b2e42add019d212648e6c17772b36e06fe73f9443265
2026-09-20 14:54:52 +10:00

28 lines
2.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type { GameView } from '@/game/engine';
import { usesSurvivingSkilledLeader } from '@/game/leader-skill-combat';
import { leaderSkillStrongholdCount } from '@/game/leader-skill-battle-board';
/** Guidance uses only the viewer's selected disc and public board occupation. */
export function LeaderSkillBattleGuide({ game, leader }: { game: GameView; leader: string }) {
const battle = game.battle;
if (!battle || ![battle.attacker, battle.defender].includes(game.me)) return null;
const assignments = game.leaderSkills?.assignments.filter((a) => a.controller === game.me) ?? [];
const opponent = game.players.find((p) => p.id === (battle.attacker === game.me ? battle.defender : battle.attacker))!;
const mentat = usesSurvivingSkilledLeader(assignments, 'mentat', leader, true);
const bureaucrat = usesSurvivingSkilledLeader(assignments, 'bureaucrat', leader, true);
const sandmaster = usesSurvivingSkilledLeader(assignments, 'sandmaster', leader, true);
const rihani = usesSurvivingSkilledLeader(assignments, 'rihani-decipherer', leader, true);
const smuggler = usesSurvivingSkilledLeader(assignments, 'smuggler', leader, true);
if (!mentat && !bureaucrat && !sandmaster && !rihani && !smuggler) return null;
return <div className="notice" aria-label="Leader Skill battle effect">
{mentat && <p>Mentat adds 2 to this leader’s battle strength if the leader survives.</p>}
{bureaucrat && <p>Bureaucrat subtracts {leaderSkillStrongholdCount(game, opponent)} from your opponent’s battle total if your leader survives. Count each occupied stronghold once, including contested strongholds. Advisors do not count.</p>}
{sandmaster && <p>If this Sandmaster survives and wins, add 3 spice to the territory’s existing spice pile automatically. No spice is added when the territory has no spice.</p>}
{rihani && <p>If this Rihani Decipherer survives and wins, you may draw two Traitors and exchange an unused old card for one of them. A native Rihani also privately inspects two deck cards first.</p>}
{smuggler && <p>{game.battle!.smugglerCollectionEnabled
? 'Smuggler records spice in this territory when both plans reveal, capped by this leader’s unmodified strength. If the leader survives, collect it automatically even if you lose or have no forces left. Pending spice cannot fund this plan. Strength modifiers and combined modules remain under review.'
: 'This saved battle predates automatic Smuggler collection. Its original battle behavior is preserved; new battles use the current collection flow.'}</p>}
{(mentat || bureaucrat) && <p className="fine">These score effects resolve automatically. They do not change the leader’s printed value or spice bounty.</p>}
</div>;
}