Fix rival victory dialogue sprite not showing

pull/16/head
Flashfyre 2024-02-22 19:24:00 -05:00
parent 2351fde687
commit 767b57ec9e
3 changed files with 37 additions and 12 deletions

View File

@ -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.setTexture(`trainer_${this.gameData.gender === PlayerGender.FEMALE ? 'f' : 'm'}_back`);
this.trainer.setPosition(406, 186); this.trainer.setPosition(406, 186);
this.trainer.setVisible(true)
if (clearScene) { if (clearScene) {
this.fadeOutBgm(250, false); this.fadeOutBgm(250, false);

View File

@ -351,7 +351,7 @@ export const trainerTypeDialogue = {
$@c{angry_mopen}Give it your all! Wouldn't want your adventure to be over before it started, right?` $@c{angry_mopen}Give it your all! Wouldn't want your adventure to be over before it started, right?`
], ],
victory: [ victory: [
`@c{shock}You just started and you're already this strong?!\n@c{angry}@d{96}You totally cheated, didn't you? `@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_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}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!` $@c{smile_wave}Do your best like always! I believe in you!`
@ -442,10 +442,24 @@ export const trainerTypeDialogue = {
] ]
} }
], ],
[TrainerType.RIVAL_5]: { [TrainerType.RIVAL_5]: [
encounter: [ `` ], {
victory: [ '…' ] encounter: [
``
],
victory: [
``
]
}, },
{
encounter: [
`@c{neutral}…`
],
victory: [
`@c{neutral}…`
]
}
],
[TrainerType.RIVAL_6]: [ [TrainerType.RIVAL_6]: [
{ {
encounter: [ encounter: [

View File

@ -2817,18 +2817,28 @@ export class TrainerVictoryPhase extends BattlePhase {
this.scene.ui.showText(`You defeated\n${this.scene.currentBattle.trainer.getName(true)}!`, null, () => { this.scene.ui.showText(`You defeated\n${this.scene.currentBattle.trainer.getName(true)}!`, null, () => {
const victoryMessages = this.scene.currentBattle.trainer.getVictoryMessages(); const victoryMessages = this.scene.currentBattle.trainer.getVictoryMessages();
let showMessageAndEnd = () => this.end(); const showMessage = () => {
if (victoryMessages?.length) {
let message: string; let message: string;
this.scene.executeWithSeedOffset(() => message = Utils.randSeedItem(victoryMessages), this.scene.currentBattle.waveIndex); this.scene.executeWithSeedOffset(() => message = Utils.randSeedItem(victoryMessages), this.scene.currentBattle.waveIndex);
const messagePages = message.split(/\$/g).map(m => m.trim()); const messagePages = message.split(/\$/g).map(m => m.trim());
for (let p = messagePages.length - 1; p >= 0; p--) { for (let p = messagePages.length - 1; p >= 0; p--) {
const originalFunc = showMessageAndEnd; const originalFunc = showMessageOrEnd;
showMessageAndEnd = () => this.scene.ui.showDialogue(messagePages[p], this.scene.currentBattle.trainer.getName(), null, originalFunc); 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); }, null, true);
this.showEnemyTrainer(); this.showEnemyTrainer();