Prototype Leader Skills setup, battle disciplines and capture

Connect all fourteen physical skills and private setup to five card-role battle
modifiers, public posture, Harkonnen skilled capture, death return and optional
own-leader revival through controls, legal AI and persisted room actions.
Nine skill effects and combined-mode/publication acceptance remain unfinished.
Captured replacement entitlement and foreign ghola integration stay guarded.

Fresh publisher/designer research supports skilled-capture publicity through
its unique known physical card; this is recorded as a component inference.
Independent review found and fixed Voice/must-use-leader and invalid saved
assignment/offer cases. A pre-existing Discovery privacy assertion confused
card ID prefixes; the corrected deterministic physical-pair scenario was
independently reviewed. The first broad run was 4410/4411; corrected final
verification passes types/lint, all 4411 offline tests, build and 43 HTTP tests.
Final durations: check 149741ms, build 6659ms, integration 28274ms.
Source fingerprint: aef655ac1ebc0eb2f64294e13d3d27337167312cf8ab17568a166ee9c39f6a85.
Private final report: 20260913-leader-skills/checks-final/report.json.

Three seeded prototype games completed with no rejected bot candidates. Browser
setup/card inspection/refresh passed. Another user-reported power outage stopped
the server; backup and necessary restart restored the same private seat. All
292 games at restart and their original application records remain unchanged;
33 isolated HTTP-test rooms bring the current total to 325. No database reset.

Efficiency: one shared setup/lifecycle implementation supports five connected
role effects; selective existing agents handled catalog/UI/tests/research and
independent reviews. One repeated broad check was required by the reproduced
ID-prefix assertion failure. Aggregate goal counter rose from 65529766 to
67313673 through this checkpoint (1783907), including inherited context and
coordination; this is not a billing or savings estimate. Full goal remains active.
This commit is contained in:
Quintine committed 2026-09-13 17:31:37 +10:00
1 parent 369371671f
commit 6e6fecc9d4
28 files changed
+4196 -38

No files matched your search

+44 -2
View File
@@ -33,6 +33,11 @@ import {
type HomeworldBattleRules,
type HomeworldExplosionLosses,
} from './homeworld-battle-rules';
import {
leaderSkillBattleBonus,
type BattleLeaderSkill,
type LeaderSkillBattleBonus,
} from './leader-skill-combat';
export class BattleResolutionQuoteError extends Error {
constructor(message: string) {
@@ -68,6 +73,8 @@ export type ResolutionCombatant = ResolutionParticipant & {
lateDefense?: string;
poisonTooth?: boolean;
stoneMode?: 'kill' | 'ignore';
/** Current authorized assignments only; captured assignments grant no normal band. */
leaderSkills?: readonly BattleLeaderSkill[];
/** The current aidFor result: this escrow has already left the donor's balance. */
aid?: { donor: string; amount: number };
};
@@ -110,6 +117,10 @@ export type BattleResolutionQuote = {
defenderTraitor: boolean;
revelations: { player: string; identity: string }[];
leaderStrengths: { attacker: number; defender: number };
leaderSkillBonuses: {
attacker: LeaderSkillBattleBonus;
defender: LeaderSkillBattleBonus;
};
leaderDeaths: { attacker: boolean; defender: boolean };
scores: { attacker: number; defender: number } | null;
stone: StoneBurnerComparison | null;
@@ -428,6 +439,10 @@ function calculate(input: BattleResolutionInput): BattleResolutionQuote {
let scores: BattleResolutionQuote['scores'] = null;
let deaths = { attacker: false, defender: false };
let bounty: BattleResolutionQuote['bounty'] = null;
let leaderSkillBonuses: BattleResolutionQuote['leaderSkillBonuses'] = {
attacker: { bonus: 0, applied: [] },
defender: { bonus: 0, applied: [] },
};
if (result === 'mutualTraitors' || result === 'explosion')
deaths = { attacker: true, defender: true };
else if (result === 'traitor') {
@@ -453,19 +468,45 @@ function calculate(input: BattleResolutionInput): BattleResolutionQuote {
attacker: effects.attackerDead || stoneKills,
defender: effects.defenderDead || stoneKills,
};
const selectedLeader = (side: ResolutionCombatant) =>
side.leader
? { id: side.leader.id, kind: 'disc' as const }
: card(side, side.plan.leader)?.kind === 'hero'
? { id: side.plan.leader!, kind: 'hero' as const }
: undefined;
leaderSkillBonuses = {
attacker: leaderSkillBattleBonus({
assignments: a.leaderSkills ?? [],
selectedLeader: selectedLeader(a),
weapon: aw,
defense: ad,
skilledLeaderSurvives: !deaths.attacker,
}),
defender: leaderSkillBattleBonus({
assignments: d.leaderSkills ?? [],
selectedLeader: selectedLeader(d),
weapon: dw,
defense: dd,
skilledLeaderSurvives: !deaths.defender,
}),
};
scores = {
attacker:
a.plan.dial +
(a.id === homeworld?.native ? homeworld.strength : 0) +
(deaths.attacker || effects.stunned
? 0
: strengths.attacker + (a.plan.kwisatz ? 2 : 0)),
: strengths.attacker +
leaderSkillBonuses.attacker.bonus +
(a.plan.kwisatz ? 2 : 0)),
defender:
d.plan.dial +
(d.id === homeworld?.native ? homeworld.strength : 0) +
(deaths.defender || effects.stunned
? 0
: strengths.defender + (d.plan.kwisatz ? 2 : 0)),
: strengths.defender +
leaderSkillBonuses.defender.bonus +
(d.plan.kwisatz ? 2 : 0)),
};
winner = stone
? stone.winner === 'attacker'
@@ -636,6 +677,7 @@ function calculate(input: BattleResolutionInput): BattleResolutionQuote {
defenderTraitor: dc,
revelations,
leaderStrengths: strengths,
leaderSkillBonuses,
leaderDeaths: deaths,
scores,
stone,