diff --git a/src/game/scenes/CampScene.ts b/src/game/scenes/CampScene.ts index 116b8c8..613176d 100644 --- a/src/game/scenes/CampScene.ts +++ b/src/game/scenes/CampScene.ts @@ -263,6 +263,11 @@ type CampaignTimelineChapter = { nextHints: string[]; }; +type CampSceneData = { + openSortiePrep?: boolean; + skipIntroStory?: boolean; +}; + const portraitByUnitId: Record = { 'liu-bei': 'liuBei', 'guan-yu': 'guanYu', @@ -10009,11 +10014,18 @@ export class CampScene extends Phaser.Scene { private sortieFocusedUnitId = 'liu-bei'; private sortieRosterScroll = 0; private terrainCountCache = new Map(); + private openSortiePrepOnCreate = false; + private skipIntroStoryForSortie = false; constructor() { super('CampScene'); } + init(data?: CampSceneData) { + this.openSortiePrepOnCreate = Boolean(data?.openSortiePrep); + this.skipIntroStoryForSortie = Boolean(data?.skipIntroStory); + } + create() { this.contentObjects = []; this.dialogueObjects = []; @@ -10054,6 +10066,9 @@ export class CampScene extends Phaser.Scene { this.renderStaticButtons(); this.render(); + if (this.openSortiePrepOnCreate) { + this.time.delayedCall(0, () => this.showSortiePrep()); + } } private ensureCampAssets(onReady: () => void) { @@ -12322,6 +12337,15 @@ export class CampScene extends Phaser.Scene { markCampaignStep(flow.campaignStep); const selectedSortieUnitIds = [...this.selectedSortieUnitIds]; const sortieFormationAssignments = { ...this.sortieFormationAssignments }; + if (this.skipIntroStoryForSortie) { + void startLazyScene(this, 'BattleScene', { + battleId: flow.nextBattleId, + selectedSortieUnitIds, + sortieFormationAssignments + }); + return; + } + void startLazyScene(this, 'StoryScene', { pages: flow.pages, nextScene: 'BattleScene', @@ -13613,6 +13637,8 @@ export class CampScene extends Phaser.Scene { campaignProgress: this.campaignTimelineProgress(), campBattleId: this.currentCampBattleId(), campTitle: this.currentCampTitle(), + openSortiePrepOnCreate: this.openSortiePrepOnCreate, + skipIntroStoryForSortie: this.skipIntroStoryForSortie, availableDialogueIds: this.availableCampDialogues().map((dialogue) => dialogue.id), completedAvailableDialogues: this.completedAvailableDialogues().map((dialogue) => dialogue.id), availableVisitIds: this.availableCampVisits().map((visit) => visit.id), diff --git a/src/game/scenes/TitleScene.ts b/src/game/scenes/TitleScene.ts index 05de40a..4036064 100644 --- a/src/game/scenes/TitleScene.ts +++ b/src/game/scenes/TitleScene.ts @@ -319,11 +319,15 @@ export class TitleScene extends Phaser.Scene { const battleId = battleIdForCampaignStep(campaign.step); if (battleId) { - await this.navigateTo('BattleScene', { - battleId, - selectedSortieUnitIds: campaign.selectedSortieUnitIds, - sortieFormationAssignments: campaign.sortieFormationAssignments - }); + if (campaign.step !== 'first-battle' && campaign.firstBattleReport?.outcome === 'victory') { + await this.navigateTo('CampScene', { + openSortiePrep: true, + skipIntroStory: true + }); + return; + } + + await this.navigateTo('BattleScene', { battleId }); return; }