Fix rival victory dialogue sprite not showing

This commit is contained in:
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.setPosition(406, 186);
this.trainer.setVisible(true)
if (clearScene) {
this.fadeOutBgm(250, false);

View File

@ -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: [

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, () => {
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();