[Bug] Run History displays Pokemon that have their natures changed during the run (#4149)

* Nature mints... spaghetti...

* Update src/ui/run-info-ui-handler.ts

Co-authored-by: MokaStitcher <54149968+MokaStitcher@users.noreply.github.com>

* No effect when no items

---------

Co-authored-by: frutescens <info@laptop>
Co-authored-by: MokaStitcher <54149968+MokaStitcher@users.noreply.github.com>
This commit is contained in:
Mumble 2024-09-11 18:00:26 -07:00 committed by GitHub
parent fec218b747
commit f294f034aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 7 deletions

View File

@ -541,7 +541,9 @@ export default class RunInfoUiHandler extends UiHandler {
// Contains Name, Level + Nature, Ability, Passive
const pokeInfoTextContainer = this.scene.add.container(-85, 3.5);
const textContainerFontSize = "34px";
const pNature = getNatureName(pokemon.nature);
// This checks if the Pokemon's nature has been overwritten during the run and displays the change accurately
const pNature = pokemon.getNature();
const pNatureName = getNatureName(pNature);
const pName = pokemon.getNameToRender();
//With the exception of Korean/Traditional Chinese/Simplified Chinese, the code shortens the terms for ability and passive to their first letter.
//These languages are exempted because they are already short enough.
@ -557,7 +559,7 @@ export default class RunInfoUiHandler extends UiHandler {
// Japanese is set to a greater line spacing of 35px in addBBCodeTextObject() if lineSpacing < 12.
const lineSpacing = (i18next.resolvedLanguage === "ja") ? 12 : 3;
const pokeInfoText = addBBCodeTextObject(this.scene, 0, 0, pName, TextStyle.SUMMARY, {fontSize: textContainerFontSize, lineSpacing: lineSpacing});
pokeInfoText.appendText(`${i18next.t("saveSlotSelectUiHandler:lv")}${Utils.formatFancyLargeNumber(pokemon.level, 1)} - ${pNature}`);
pokeInfoText.appendText(`${i18next.t("saveSlotSelectUiHandler:lv")}${Utils.formatFancyLargeNumber(pokemon.level, 1)} - ${pNatureName}`);
pokeInfoText.appendText(pAbilityInfo);
pokeInfoText.appendText(pPassiveInfo);
pokeInfoTextContainer.add(pokeInfoText);
@ -568,7 +570,7 @@ export default class RunInfoUiHandler extends UiHandler {
const pStats : string[]= [];
pokemon.stats.forEach((element) => pStats.push(Utils.formatFancyLargeNumber(element, 1)));
for (let i = 0; i < pStats.length; i++) {
const isMult = getNatureStatMultiplier(pokemon.nature, i);
const isMult = getNatureStatMultiplier(pNature, i);
pStats[i] = (isMult < 1) ? pStats[i] + "[color=#40c8f8]↓[/color]" : pStats[i];
pStats[i] = (isMult > 1) ? pStats[i] + "[color=#f89890]↑[/color]" : pStats[i];
}
@ -889,10 +891,12 @@ export default class RunInfoUiHandler extends UiHandler {
}
break;
case Button.CYCLE_ABILITY:
if (this.partyVisibility) {
this.showParty(false);
} else {
this.showParty(true);
if (this.runInfo.modifiers.length !== 0) {
if (this.partyVisibility) {
this.showParty(false);
} else {
this.showParty(true);
}
}
break;
}