fix: 삭턴 소진 NPC 사망 처리를 복구
This commit is contained in:
@@ -1993,7 +1993,7 @@ export const createReservedTurnHandler = async (options: {
|
||||
let deleteGeneral = false;
|
||||
const deletedTroopIds = Array.from(commandDeletedTroopIds);
|
||||
const lifecycleSnapshot = cloneTurnGeneral(currentGeneral);
|
||||
if (currentGeneral.meta.killturn <= 0 && typeof currentGeneral.deadYear === 'number') {
|
||||
if (currentGeneral.meta.killturn <= 0) {
|
||||
if (
|
||||
currentGeneral.npcState === 1 &&
|
||||
typeof currentGeneral.deadYear === 'number' &&
|
||||
|
||||
@@ -316,12 +316,13 @@ describe('legacy general turn lifecycle', () => {
|
||||
expect(harness.world.peekDirtyState().deletedGenerals).toContain(1);
|
||||
});
|
||||
|
||||
it('keeps compatibility fixtures without legacy lifespan metadata alive', async () => {
|
||||
it('deletes an expired NPC even when its in-memory lifespan metadata is missing', async () => {
|
||||
const harness = await createTurnTestHarness({
|
||||
snapshot: makeSnapshot([
|
||||
makeGeneral({
|
||||
deadYear: undefined,
|
||||
npcState: 2,
|
||||
npcState: 4,
|
||||
name: 'ⓖ의병',
|
||||
meta: { killturn: 1 },
|
||||
}),
|
||||
]),
|
||||
@@ -332,9 +333,9 @@ describe('legacy general turn lifecycle', () => {
|
||||
|
||||
await harness.runOneTick();
|
||||
|
||||
expect(harness.world.getGeneralById(1)).not.toBeNull();
|
||||
expect(harness.world.getGeneralById(1)!.meta.killturn).toBe(0);
|
||||
expect(harness.world.peekDirtyState().lifecycleEvents[0]?.outcome).toBe('active');
|
||||
expect(harness.world.getGeneralById(1)).toBeNull();
|
||||
expect(harness.world.peekDirtyState().deletedGenerals).toContain(1);
|
||||
expect(harness.world.peekDirtyState().lifecycleEvents[0]?.outcome).toBe('deleted');
|
||||
});
|
||||
|
||||
it('retires a player general and resets inherited stats and rank state', async () => {
|
||||
|
||||
Reference in New Issue
Block a user