Connect the optional named-weapon question before skill posture and faction powers. Every accepted question waits for the same target-owned private card-show action, preserving held/absent privacy; matching cards are compulsory, otherwise the owner selects a fallback. Keep cards in hand and retain historical observations only for the questioner and target, without binding later plans. Support actual controls, inspectors, all four AI profiles and saved JSON/SQLite continuation. Normal activation remains disabled pending the user's uniform-response UX exception. The private flag is neither projected nor writable through actions. Legacy battles remain unchanged. Empty hands skip with an explicit unavailable receipt and no invented answer. Source and unresolved boundaries are documented, with a compact current-status dashboard preserving all goal, Git, subagent, usage and saved-game requirements. Independent review passed privacy, custody, sequencing and preview gating. Twenty-two focused tests cover canonical card roles, exact-match/fallback symmetry, target-only controls, captured lower-only behavior, stale/duplicate requests and concurrent SQLite writes. Typecheck, lint, 4605 offline tests, production build and 43 HTTP tests passed with stable source. The first broad run retained one outdated Mentat card-copy assertion; update it to verify private disclosure, custody, optional question and subsequent concealment. Gameplay source was unchanged by that test-only correction. Two genuine-setup sample games deliberately deal Mentat via a controlled initial skill shuffle. Basic: 100 actions, 3 JSON restores, turn-one Harkonnen win. Advanced: 507 actions, 14 restores, turn-five Harkonnen win. Each has one private observation, subsequent Atreides Prescience and no rejected candidate. These bounded force/skill custody samples do not establish general card-custody coverage, calibration or full module acceptance. After the reported outage all 665 opening rooms and original seat/recovery/receipt records were preserved (699 after integration). A fresh 666-room backup preceded checks; database integrity and foreign keys pass. The existing localhost server was reused; its live lock prevented a duplicate start. Existing Ecaz and Ixian browser seats restored their same hands and pending choices. A separate conserved staged Mentat preview restored its private history and posture, then legally concealed its leader before subsequent faction powers. Human/browser paths are distinguished from genuine-setup simulations. No database reset, recurring automation, public activation or publication. Verified source tree: 297ae06e0764d7cad525a802fe383a84971c3e9c5d6362c8cd0b79c5c3977caf Final source tree: 177c98415098ea42174a860d8b1fac4f7c7dd6c3e67c93b18330d1d0fc4edf0e The only post-verification edit removed one surplus newline at the end of the new developer document; its exact before/after content and fingerprints are retained privately. Staged diff checking caught this whitespace issue before commit. No application or test code changed.
131 lines
4.3 KiB
TypeScript
131 lines
4.3 KiB
TypeScript
import test from 'node:test';
|
||
import assert from 'node:assert/strict';
|
||
import {
|
||
LEADER_SKILL_CARDS,
|
||
leaderSkillCard,
|
||
type LeaderSkillId,
|
||
} from '../game/leader-skill-cards';
|
||
|
||
const EXPECTED_IDS: readonly LeaderSkillId[] = [
|
||
'bureaucrat',
|
||
'spice-banker',
|
||
'diplomat',
|
||
'mentat',
|
||
'suk-graduate',
|
||
'rihani-decipherer',
|
||
'sandmaster',
|
||
'smuggler',
|
||
'planetologist',
|
||
'warmaster',
|
||
'master-of-assassins',
|
||
'swordmaster-of-ginaz',
|
||
'killer-medic',
|
||
'prana-bindu-adept',
|
||
];
|
||
|
||
void test('the canonical inventory has exactly fourteen unique physical identities', () => {
|
||
assert.equal(LEADER_SKILL_CARDS.length, 14);
|
||
assert.deepEqual(
|
||
LEADER_SKILL_CARDS.map((card) => card.id),
|
||
EXPECTED_IDS,
|
||
);
|
||
assert.equal(new Set(LEADER_SKILL_CARDS.map((card) => card.id)).size, 14);
|
||
assert.equal(new Set(LEADER_SKILL_CARDS.map((card) => card.name)).size, 14);
|
||
for (const card of LEADER_SKILL_CARDS) {
|
||
assert.deepEqual(Object.keys(card), ['id', 'name', 'normal', 'battle']);
|
||
assert.ok(card.normal.length > 0);
|
||
assert.ok(card.battle.length > 0);
|
||
assert.ok(card.normal.every((line) => line.length > 20));
|
||
assert.ok(card.battle.every((line) => line.length > 20));
|
||
assert.match(card.id, /^[a-z]+(?:-[a-z]+)*$/);
|
||
}
|
||
});
|
||
|
||
void test('lookup is total for canonical IDs and rejects unknown runtime input', () => {
|
||
for (const card of LEADER_SKILL_CARDS)
|
||
assert.equal(leaderSkillCard(card.id), card);
|
||
assert.throws(
|
||
() => leaderSkillCard('not-a-physical-skill' as LeaderSkillId),
|
||
/Unknown Leader Skill Card/,
|
||
);
|
||
});
|
||
|
||
void test('the four weapon and defense disciplines preserve their distinct roles and values', () => {
|
||
const roles = [
|
||
['master-of-assassins', 'Poison Weapon'],
|
||
['swordmaster-of-ginaz', 'Projectile Weapon'],
|
||
['killer-medic', 'Poison Defense'],
|
||
['prana-bindu-adept', 'Projectile Defense'],
|
||
] as const;
|
||
for (const [id, role] of roles) {
|
||
const card = leaderSkillCard(id);
|
||
assert.match(card.normal.join(' '), new RegExp(`Add 1.*other.*${role}`));
|
||
assert.match(card.battle.join(' '), new RegExp(`Add 3.*${role}`));
|
||
}
|
||
});
|
||
|
||
void test('named economic, custody and information effects retain their source numbers', () => {
|
||
assert.match(
|
||
leaderSkillCard('bureaucrat').normal.join(' '),
|
||
/per phase.*at least 5.*2.*Spice Bank/,
|
||
);
|
||
assert.match(
|
||
leaderSkillCard('spice-banker').normal.join(' '),
|
||
/per phase.*at least 4.*1 spice.*Mentat Pause/,
|
||
);
|
||
assert.match(
|
||
leaderSkillCard('spice-banker').battle.join(' '),
|
||
/1–3.*separate.*full strength/,
|
||
);
|
||
assert.match(
|
||
leaderSkillCard('rihani-decipherer').battle.join(' '),
|
||
/draw 2 Traitor Cards.*unused Traitor Card.*unkept drawn card/,
|
||
);
|
||
assert.match(
|
||
leaderSkillCard('mentat').normal.join(' '),
|
||
/may name a specific weapon.*privately show.*if held.*choose another Treachery Card/,
|
||
);
|
||
assert.match(
|
||
leaderSkillCard('mentat').normal.join(' '),
|
||
/stays in their hand.*need not be used in battle.*then move.*behind the shield/,
|
||
);
|
||
});
|
||
|
||
void test('movement and battle-loss cards remain materially different', () => {
|
||
assert.match(
|
||
leaderSkillCard('planetologist').normal.join(' '),
|
||
/capped at 3.*two different territories.*one destination/,
|
||
);
|
||
assert.match(
|
||
leaderSkillCard('planetologist').battle.join(' '),
|
||
/green Special.*other than a Cheap Hero.*add 2.*Discard/,
|
||
);
|
||
assert.match(
|
||
leaderSkillCard('smuggler').normal.join(' '),
|
||
/off-planet.*empty territory.*additional force.*free/,
|
||
);
|
||
assert.match(
|
||
leaderSkillCard('sandmaster').normal.join(' '),
|
||
/into or through.*1 spice.*once per territory/,
|
||
);
|
||
assert.match(
|
||
leaderSkillCard('diplomat').battle.join(' '),
|
||
/lose.*undialed forces.*empty adjacent.*not a stronghold/,
|
||
);
|
||
assert.match(
|
||
leaderSkillCard('suk-graduate').normal.join(' '),
|
||
/return 1.*reserves.*instead of the Tleilaxu Tanks/,
|
||
);
|
||
assert.match(
|
||
leaderSkillCard('suk-graduate').battle.join(' '),
|
||
/up to 3.*leave 1.*return the rest/,
|
||
);
|
||
});
|
||
|
||
void test('Warmaster uses one Worthless card for either nonstacking band', () => {
|
||
const warmaster = leaderSkillCard('warmaster');
|
||
assert.match(warmaster.normal.join(' '), /Add 1.*other.*at least one/);
|
||
assert.match(warmaster.battle.join(' '), /Add 3.*at least one/);
|
||
assert.doesNotMatch(JSON.stringify(warmaster), /at least two|Add 4/);
|
||
});
|