Add sabotage injury boundary parity

This commit is contained in:
2026-07-26 04:07:42 +00:00
parent ab22384def
commit ac711e66f5
6 changed files with 96 additions and 8 deletions
@@ -649,6 +649,74 @@ integration('general sabotage value boundary matrix', () => {
);
});
type SabotageInjuryBoundaryCase = {
action: 'che_화계' | 'che_선동' | 'che_파괴';
stat: 'leadership' | 'strength' | 'intelligence';
hiddenSeed: string;
};
const sabotageInjuryBoundaryCases: SabotageInjuryBoundaryCase[] = [
{ action: 'che_화계', stat: 'intelligence', hiddenSeed: 'general-injury-4' },
{ action: 'che_선동', stat: 'leadership', hiddenSeed: 'general-injury-13' },
{ action: 'che_파괴', stat: 'strength', hiddenSeed: 'general-injury-4' },
];
const injuryLogTexts = (logs: Array<Record<string, unknown>>): string[] =>
logs
.map((entry) => entry.text)
.filter((text): text is string => typeof text === 'string' && text.includes('부상</>을 당했습니다.'));
const legacyInjuryLogBody = (text: string): string => text.replace(/^<C>●<\/>\d+월:/, '');
integration('general sabotage injury boundary matrix', () => {
it.each(sabotageInjuryBoundaryCases)(
'$action matches legacy injury cap, integer persistence, and log',
async ({ action, stat, hiddenSeed }) => {
const request = buildRequest(
action,
{ destCityID: 70 },
{ [stat]: 100 },
{
generals: {
2: {
[stat]: 10,
injury: 79,
crew: 101,
atmos: 51,
train: 51,
},
},
cities: { 70: { security: 0, securityMax: 2_000 } },
}
);
request.setup!.world!.hiddenSeed = hiddenSeed;
const reference = runReferenceTurnCommandTraceRequest(
workspaceRoot!,
request as unknown as Record<string, unknown>
);
const core = await runCoreTurnCommandTrace(request, reference.before);
expect(reference.execution.outcome).toMatchObject({ completed: true });
expect(core.execution.outcome).toMatchObject({
requestedAction: action,
actionKey: action,
usedFallback: false,
});
expect(injuryLogTexts(reference.after.logs)).toHaveLength(1);
expect(injuryLogTexts(core.after.logs)).toEqual(
injuryLogTexts(reference.after.logs).map(legacyInjuryLogBody)
);
expect(core.rng).toEqual(reference.rng);
expect(
compareTurnSnapshotDeltas(reference.before, reference.after, core.before, core.after, {
ignoredPathPatterns: ignoredLifecyclePaths,
})
).toEqual([]);
},
120_000
);
});
type GeneralConstraintCase = {
name: string;
action: string;