1
This commit is contained in:
@@ -423,4 +423,49 @@ describe('buildBattlePlan', () => {
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('prefers fight_defeat over fight_victory when the round ends with player death after local battle settlement', () => {
|
||||
const state = {
|
||||
...createBaseState(),
|
||||
currentBattleNpcId: 'npc-opponent',
|
||||
currentNpcBattleMode: 'fight' as const,
|
||||
playerHp: 6,
|
||||
playerMaxHp: 30,
|
||||
sceneHostileNpcs: [
|
||||
{
|
||||
id: 'npc-opponent',
|
||||
name: '山道客',
|
||||
action: '提刀逼近',
|
||||
description: '测试敌人',
|
||||
animation: 'idle' as const,
|
||||
xMeters: 3,
|
||||
yOffset: 0,
|
||||
facing: 'left' as const,
|
||||
attackRange: 1,
|
||||
speed: 1,
|
||||
hp: 8,
|
||||
maxHp: 8,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const plan = buildBattlePlan({
|
||||
state,
|
||||
option: {
|
||||
...createBattleOption(),
|
||||
functionId: 'battle_all_in_crush',
|
||||
},
|
||||
character: createTestCharacter(),
|
||||
totalSequenceMs: 900,
|
||||
turnVisualMs: 820,
|
||||
resetStageMs: 260,
|
||||
minTurnCount: 1,
|
||||
});
|
||||
|
||||
expect(plan.turns.map((turn) => turn.actor)).toEqual(['player', 'monster']);
|
||||
expect(plan.finalState.playerHp).toBe(0);
|
||||
expect(plan.finalState.inBattle).toBe(false);
|
||||
expect(plan.finalState.currentNpcBattleOutcome).toBe('fight_defeat');
|
||||
expect(plan.finalState.sceneHostileNpcs).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user