mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-20 16:42:45 +02:00
[Bug][UI/UX] Fix fiery fallout message bug (#5834)
* Fix fiery fallout message bug * Ensure pokemon names are replaced when there is no separator
This commit is contained in:
parent
22f5ed1232
commit
9ae969117b
@ -35,20 +35,22 @@ export class MessagePhase extends Phase {
|
||||
this.text = this.text.split(pokename[p]).join(repname[p]);
|
||||
}
|
||||
const pageIndex = this.text.indexOf("$");
|
||||
if (pageIndex !== -1) {
|
||||
let page0 = this.text.slice(0, pageIndex);
|
||||
let page1 = this.text.slice(pageIndex + 1);
|
||||
// Pokemon names must be re-inserted _after_ the split, otherwise the index will be wrong
|
||||
for (let p = 0; p < globalScene.getPlayerField().length; p++) {
|
||||
page0 = page0.split(repname[p]).join(pokename[p]);
|
||||
page1 = page1.split(repname[p]).join(pokename[p]);
|
||||
}
|
||||
globalScene.unshiftPhase(
|
||||
new MessagePhase(page1, this.callbackDelay, this.prompt, this.promptDelay, this.speaker),
|
||||
);
|
||||
this.text = page0.trim();
|
||||
} else {
|
||||
for (let p = 0; p < globalScene.getPlayerField().length; p++) {
|
||||
this.text = this.text.split(repname[p]).join(pokename[p]);
|
||||
}
|
||||
if (pageIndex !== -1) {
|
||||
globalScene.unshiftPhase(
|
||||
new MessagePhase(
|
||||
this.text.slice(pageIndex + 1),
|
||||
this.callbackDelay,
|
||||
this.prompt,
|
||||
this.promptDelay,
|
||||
this.speaker,
|
||||
),
|
||||
);
|
||||
this.text = this.text.slice(0, pageIndex).trim();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user