fix: match deception command boundaries

This commit is contained in:
2026-07-26 10:13:46 +00:00
parent 400e7433fa
commit e4c71c5aef
3 changed files with 362 additions and 9 deletions
@@ -6,6 +6,7 @@ import { ActionDefinition as MoveCapitalAction } from '../../../src/actions/turn
import { ActionDefinition as ChangeNationNameAction } from '../../../src/actions/turn/nation/che_국호변경.js';
import { ActionDefinition as ExpandCityAction } from '../../../src/actions/turn/nation/che_증축.js';
import { ActionDefinition as LastStandAction } from '../../../src/actions/turn/nation/che_필사즉생.js';
import { ActionDefinition as DeceptionAction } from '../../../src/actions/turn/nation/che_허보.js';
import { LogCategory, LogScope } from '../../../src/logging/types.js';
import type { MapDefinition } from '../../../src/world/types.js';
import type { TurnSchedule } from '../../../src/turn/calendar.js';
@@ -248,6 +249,33 @@ describe('Nation Actions', () => {
});
});
describe('che_허보 (Deception)', () => {
it('fails like legacy choice when the target nation has no supplied city', () => {
const nation = buildNation(1);
const destNation = buildNation(2);
const general = buildGeneral(1, 1, 1);
const target = buildGeneral(2, 2, 2, 'Target');
const definition = new DeceptionAction([]);
expect(() =>
definition.resolve(
{
general,
nation,
destNation,
destCity: buildCity(2, 2),
destCityGenerals: [target],
friendlyGenerals: [general],
destNationSupplyCities: [],
addLog: () => {},
rng: {} as any,
} as any,
{ destCityId: 2 }
)
).toThrow(RangeError);
});
});
describe('che_천도 (Move Capital)', () => {
it('changes nation capital city', () => {
const nation = buildNation(1);