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]);
|
this.text = this.text.split(pokename[p]).join(repname[p]);
|
||||||
}
|
}
|
||||||
const pageIndex = this.text.indexOf("$");
|
const pageIndex = this.text.indexOf("$");
|
||||||
for (let p = 0; p < globalScene.getPlayerField().length; p++) {
|
|
||||||
this.text = this.text.split(repname[p]).join(pokename[p]);
|
|
||||||
}
|
|
||||||
if (pageIndex !== -1) {
|
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(
|
globalScene.unshiftPhase(
|
||||||
new MessagePhase(
|
new MessagePhase(page1, this.callbackDelay, this.prompt, this.promptDelay, this.speaker),
|
||||||
this.text.slice(pageIndex + 1),
|
|
||||||
this.callbackDelay,
|
|
||||||
this.prompt,
|
|
||||||
this.promptDelay,
|
|
||||||
this.speaker,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
this.text = this.text.slice(0, pageIndex).trim();
|
this.text = page0.trim();
|
||||||
|
} else {
|
||||||
|
for (let p = 0; p < globalScene.getPlayerField().length; p++) {
|
||||||
|
this.text = this.text.split(repname[p]).join(pokename[p]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user