From 767b57ec9e5dedc7f848a8a641724611b34c41ea Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Thu, 22 Feb 2024 19:24:00 -0500 Subject: [PATCH] Fix rival victory dialogue sprite not showing --- src/battle-scene.ts | 1 + src/data/dialogue.ts | 26 ++++++++++++++++++++------ src/phases.ts | 22 ++++++++++++++++------ 3 files changed, 37 insertions(+), 12 deletions(-) diff --git a/src/battle-scene.ts b/src/battle-scene.ts index cd8e6ae97..bd9999361 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -762,6 +762,7 @@ export default class BattleScene extends Phaser.Scene { this.trainer.setTexture(`trainer_${this.gameData.gender === PlayerGender.FEMALE ? 'f' : 'm'}_back`); this.trainer.setPosition(406, 186); + this.trainer.setVisible(true) if (clearScene) { this.fadeOutBgm(250, false); diff --git a/src/data/dialogue.ts b/src/data/dialogue.ts index 4aa6199f7..d09a81a86 100644 --- a/src/data/dialogue.ts +++ b/src/data/dialogue.ts @@ -351,8 +351,8 @@ export const trainerTypeDialogue = { $@c{angry_mopen}Give it your all! Wouldn't want your adventure to be over before it started, right?` ], victory: [ - `@c{shock}You just started and you're already this strong?!\n@c{angry}@d{96}You totally cheated, didn't you? - $@c{smile_wave_wink}Just kidding! @d{64}@c{smile_eclosed}I lost fair and square… I have a feeling you're going to do really well out there. + `@c{shock}You just started and you're already this strong?!@d{96}\n@c{angry}You totally cheated, didn't you? + $@c{smile_wave_wink}Just kidding!@d{64} @c{smile_eclosed}I lost fair and square… I have a feeling you're going to do really well out there. $@c{smile}By the way, the professor wanted me to give you some items. Hopefully they're helpful! $@c{smile_wave}Do your best like always! I believe in you!` ] @@ -442,10 +442,24 @@ export const trainerTypeDialogue = { ] } ], - [TrainerType.RIVAL_5]: { - encounter: [ `…` ], - victory: [ '…' ] - }, + [TrainerType.RIVAL_5]: [ + { + encounter: [ + `…` + ], + victory: [ + `…` + ] + }, + { + encounter: [ + `@c{neutral}…` + ], + victory: [ + `@c{neutral}…` + ] + } + ], [TrainerType.RIVAL_6]: [ { encounter: [ diff --git a/src/phases.ts b/src/phases.ts index 37295d5dd..03bb89158 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -2817,18 +2817,28 @@ export class TrainerVictoryPhase extends BattlePhase { this.scene.ui.showText(`You defeated\n${this.scene.currentBattle.trainer.getName(true)}!`, null, () => { const victoryMessages = this.scene.currentBattle.trainer.getVictoryMessages(); - let showMessageAndEnd = () => this.end(); - if (victoryMessages?.length) { + const showMessage = () => { let message: string; this.scene.executeWithSeedOffset(() => message = Utils.randSeedItem(victoryMessages), this.scene.currentBattle.waveIndex); const messagePages = message.split(/\$/g).map(m => m.trim()); for (let p = messagePages.length - 1; p >= 0; p--) { - const originalFunc = showMessageAndEnd; - showMessageAndEnd = () => this.scene.ui.showDialogue(messagePages[p], this.scene.currentBattle.trainer.getName(), null, originalFunc); + const originalFunc = showMessageOrEnd; + showMessageOrEnd = () => this.scene.ui.showDialogue(messagePages[p], this.scene.currentBattle.trainer.getName(), null, originalFunc); } - } - showMessageAndEnd(); + + showMessageOrEnd(); + }; + let showMessageOrEnd = () => this.end(); + if (victoryMessages?.length) { + if (this.scene.currentBattle.trainer.config.hasCharSprite) { + const originalFunc = showMessageOrEnd; + showMessageOrEnd = () => this.scene.charSprite.hide().then(() => this.scene.hideFieldOverlay(250).then(() => originalFunc())); + this.scene.showFieldOverlay(500).then(() => this.scene.charSprite.showCharacter(this.scene.currentBattle.trainer.getKey(), 'shock').then(() => showMessage())); + } else + showMessage(); + } else + showMessageOrEnd(); }, null, true); this.showEnemyTrainer();