feat: add resonance follow-up attacks

This commit is contained in:
2026-07-11 12:05:02 +09:00
parent 055f7d95c9
commit 9025d74398
4 changed files with 522 additions and 29 deletions

View File

@@ -35,6 +35,23 @@ try {
assert(normalizeBattleSaveSlot(Number.NaN, 3) === 1, 'Expected NaN slot to normalize to slot 1.');
assert(normalizeBattleSaveSlot(99, 3) === 3, 'Expected overflowing slot to clamp to slot count.');
assert(isValidBattleSaveState(validState, options), 'Expected valid battle save to pass validation.');
const validCompletedAttackHistoryState = {
...validState,
actedUnitIds: ['liu-bei', 'guan-yu'],
attackIntents: [
{ attackerId: 'liu-bei', targetId: 'rebel-1' },
{ attackerId: 'guan-yu', targetId: 'rebel-1' }
]
};
assert(
isValidBattleSaveState(validCompletedAttackHistoryState, options),
'Expected unique completed allied attacks against a living enemy to pass validation.'
);
assert(
JSON.stringify(parseBattleSaveState(JSON.stringify(validCompletedAttackHistoryState), options)?.attackIntents) ===
JSON.stringify(validCompletedAttackHistoryState.attackIntents),
'Expected completed allied attack history to round-trip through battle-save parsing.'
);
assert(
['elite', 'mobile', 'siege'].every((sortieOrderId) => isValidBattleSaveState({ ...validState, sortieOrderId }, options)),
'Expected every sortie order id to pass battle-save validation.'
@@ -218,6 +235,7 @@ try {
['unknown attack intent unit id', { attackIntents: [{ attackerId: 'liu-bei', targetId: 'ghost-unit' }] }],
['self-targeting attack intent', { attackIntents: [{ attackerId: 'liu-bei', targetId: 'liu-bei' }] }],
['duplicate attack intent attacker id', { attackIntents: [{ attackerId: 'liu-bei', targetId: 'rebel-1' }, { attackerId: 'liu-bei', targetId: 'rebel-1' }] }],
['unacted attack intent attacker', { actedUnitIds: [] }],
['enemy attack intent attacker', { attackIntents: [{ attackerId: 'rebel-1', targetId: 'liu-bei' }] }],
['ally attack intent target', { attackIntents: [{ attackerId: 'liu-bei', targetId: 'guan-yu' }] }],
['defeated attack intent attacker', { units: patchUnit(0, { hp: 0 }) }],