Add post-battle camp scene
This commit is contained in:
@@ -4,7 +4,6 @@ import {
|
||||
firstBattleBonds,
|
||||
firstBattleMap,
|
||||
firstBattleUnits,
|
||||
firstBattleVictoryPages,
|
||||
type BattleBond,
|
||||
type UnitData,
|
||||
type UnitStats
|
||||
@@ -17,6 +16,7 @@ import {
|
||||
getItem,
|
||||
type EquipmentSlot
|
||||
} from '../data/battleItems';
|
||||
import { setFirstBattleReport } from '../state/campaignState';
|
||||
import { palette } from '../ui/palette';
|
||||
|
||||
const unitTexture: Record<string, string> = {
|
||||
@@ -1732,6 +1732,7 @@ export class BattleScene extends Phaser.Scene {
|
||||
volume: outcome === 'victory' ? 0.38 : 0.28,
|
||||
stopAfterMs: 1200
|
||||
});
|
||||
this.publishFirstBattleReport(outcome);
|
||||
this.showBattleResult(outcome);
|
||||
}
|
||||
|
||||
@@ -1807,9 +1808,9 @@ export class BattleScene extends Phaser.Scene {
|
||||
});
|
||||
|
||||
if (outcome === 'victory') {
|
||||
this.addResultButton('이야기 계속', left + panelWidth - 422, top + 612, 132, () => {
|
||||
this.addResultButton('군영으로', left + panelWidth - 422, top + 612, 132, () => {
|
||||
soundDirector.playSelect();
|
||||
this.scene.start('StoryScene', { pages: firstBattleVictoryPages, nextScene: 'TitleScene' });
|
||||
this.scene.start('CampScene');
|
||||
}, depth + 3);
|
||||
}
|
||||
this.addResultButton('다시 하기', left + panelWidth - 276, top + 612, 124, () => {
|
||||
@@ -1885,6 +1886,38 @@ export class BattleScene extends Phaser.Scene {
|
||||
.sort((a, b) => b.score - a.score || b.stats.defeats - a.stats.defeats || b.stats.damageDealt - a.stats.damageDealt)[0];
|
||||
}
|
||||
|
||||
private publishFirstBattleReport(outcome: BattleOutcome) {
|
||||
const objectives = this.resultObjectives(outcome);
|
||||
const mvp = this.resultMvp();
|
||||
const defeatedEnemies = firstBattleUnits.filter((unit) => unit.faction === 'enemy' && unit.hp <= 0).length;
|
||||
const totalEnemies = firstBattleUnits.filter((unit) => unit.faction === 'enemy').length;
|
||||
|
||||
setFirstBattleReport({
|
||||
outcome,
|
||||
turnNumber: this.turnNumber,
|
||||
rewardGold: this.resultGold(outcome),
|
||||
defeatedEnemies,
|
||||
totalEnemies,
|
||||
objectives: objectives.map((objective) => ({ ...objective })),
|
||||
units: firstBattleUnits.map(cloneUnitData),
|
||||
bonds: Array.from(this.bondStates.values()).map((bond) => ({
|
||||
...bond,
|
||||
unitIds: [...bond.unitIds] as [string, string]
|
||||
})),
|
||||
mvp: mvp
|
||||
? {
|
||||
unitId: mvp.unit.id,
|
||||
name: mvp.unit.name,
|
||||
damageDealt: mvp.stats.damageDealt,
|
||||
defeats: mvp.stats.defeats
|
||||
}
|
||||
: undefined,
|
||||
itemRewards: outcome === 'victory' ? ['콩 1', '탁주 1', '의용군 명성 +1'] : [],
|
||||
completedCampDialogues: [],
|
||||
createdAt: new Date().toISOString()
|
||||
});
|
||||
}
|
||||
|
||||
private renderResultObjectivePanel(objectives: BattleObjectiveResult[], x: number, y: number, width: number, depth: number) {
|
||||
const height = 132;
|
||||
const bg = this.trackResultObject(this.add.rectangle(x, y, width, height, 0x101820, 0.9));
|
||||
|
||||
Reference in New Issue
Block a user