Files
core2026/packages/logic/test/disbandAction.test.ts
T
Hide_D fe438c5195 fix(logic): 전투 특기의 비전투 커맨드 효과를 복구
모병에서도 실제 행동명을 특기 계산에 전달해 징병 특기의 훈련과 사기를 레거시 값으로 맞춘다. 의술의 환자별 기록 소유권과 PLAIN 형식, 다인 치료 요약 대상도 복구하고 전투 특기 비전투 hook 회귀를 추가한다.
2026-08-21 02:59:15 +00:00

80 lines
2.6 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { createRefOrderedActionStack } from '../src/actionModules/bundle.js';
import type { GeneralActionModule } from '../src/actionModules/general.js';
import { ActionDefinition } from '../src/actions/turn/general/che_소집해제.js';
import { traitModule as recruitTrait } from '../src/actionModules/traits/war/che_징병.js';
describe('che_소집해제', () => {
it('applies legacy experience and dedication stat hooks', () => {
const personality = {
eventHandlers: {},
onCalcStat: (_context, statName, value) => {
if (statName === 'experience') return Number(value) * 1.1;
if (statName === 'dedication') return Number(value) * 0.9;
return value;
},
} satisfies GeneralActionModule;
const noOp = {};
const definition = new ActionDefinition({
generalActionModules: createRefOrderedActionStack({
nation: noOp,
officer: noOp,
domestic: noOp,
war: noOp,
personality,
crewType: null,
inheritance: noOp,
scenario: null,
items: [],
}),
} as never);
const general = { crew: 500, experience: 1_000, dedication: 2_000 };
const city = { population: 10_000 };
definition.resolve(
{
general,
city,
addLog: () => undefined,
} as never,
{}
);
expect(general.experience).toBe(1_077);
expect(general.dedication).toBe(2_090);
});
it('does not return population when the general has the 징병 trait', () => {
const definition = new ActionDefinition({
generalActionModules: [recruitTrait],
} as never);
const general = {
crew: 500,
experience: 1_000,
dedication: 2_000,
stats: { leadership: 80, strength: 70, intelligence: 60 },
role: {
personality: null,
specialDomestic: null,
specialWar: 'che_징병',
items: { horse: null, weapon: null, book: null, item: null },
},
meta: {},
};
const city = { population: 10_000 };
definition.resolve(
{
general,
city,
addLog: () => undefined,
} as never,
{}
);
expect(general.crew).toBe(0);
expect(city.population).toBe(10_000);
});
});