[UI] Run history fixes and improvements (#3987)

* Challenge Rules Word Wrap

* Fixed Modifiers

* Fixed item count color.

* removed .js endings

---------

Co-authored-by: frutescens <info@laptop>
This commit is contained in:
Mumble 2024-09-02 19:14:09 -07:00 committed by GitHub
parent 89e80f3deb
commit deb4e9dd24
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 17 additions and 8 deletions

View File

@ -13,8 +13,9 @@ import { BattleType } from "../battle";
import { TrainerVariant } from "../field/trainer";
import { Challenges } from "#enums/challenges";
import { getLuckString, getLuckTextTint } from "../modifier/modifier-type";
import RoundRectangle from "phaser3-rex-plugins/plugins/roundrectangle.js";
import RoundRectangle from "phaser3-rex-plugins/plugins/roundrectangle";
import { Type, getTypeRgb } from "../data/type";
import { TypeColor, TypeShadow } from "#app/enums/color";
import { getNatureStatMultiplier, getNatureName } from "../data/nature";
import { getVariantTint } from "#app/data/variant";
import { PokemonHeldItemModifier, TerastallizeModifier } from "../modifier/modifier";
@ -373,15 +374,16 @@ export default class RunInfoUiHandler extends UiHandler {
break;
case GameModes.CHALLENGE:
modeText.appendText(`${i18next.t("gameMode:challenge")}`, false);
modeText.appendText(`\t\t${i18next.t("runHistory:challengeRules")}: `);
modeText.appendText(`${i18next.t("runHistory:challengeRules")}: `);
modeText.setWrapMode(1); // wrap by word
modeText.setWrapWidth(500);
const rules: string[] = this.challengeParser();
if (rules) {
for (let i = 0; i < rules.length; i++) {
const newline = i > 0 && i%2 === 0;
if (i > 0) {
modeText.appendText(" + ", newline);
modeText.appendText(" + ", false);
}
modeText.appendText(rules[i], newline);
modeText.appendText(rules[i], false);
}
}
break;
@ -470,14 +472,18 @@ export default class RunInfoUiHandler extends UiHandler {
rules.push(i18next.t(`runHistory:challengeMonoGen${this.runInfo.challenges[i].value}`));
break;
case Challenges.SINGLE_TYPE:
rules.push(i18next.t(`pokemonInfo:Type.${Type[this.runInfo.challenges[i].value-1]}` as const));
const typeRule = Type[this.runInfo.challenges[i].value-1];
const typeTextColor = `[color=${TypeColor[typeRule]}]`;
const typeShadowColor = `[shadow=${TypeShadow[typeRule]}]`;
const typeText = typeTextColor + typeShadowColor + i18next.t(`pokemonInfo:Type.${typeRule}`)!+"[/color]"+"[/shadow]";
rules.push(typeText);
break;
case Challenges.FRESH_START:
rules.push(i18next.t("challenges:freshStart.name"));
break;
case Challenges.INVERSE_BATTLE:
//
rules.push(i18next.t("challenges:inverseBattle.shortName").split("").reverse().join(""));
rules.push(i18next.t("challenges:inverseBattle.shortName"));
break;
}
}
@ -628,7 +634,7 @@ export default class RunInfoUiHandler extends UiHandler {
// Pokemon Held Items - not displayed by default
// Endless/Endless Spliced have a different scale because Pokemon tend to accumulate more items in these runs.
const heldItemsScale = (this.runInfo.gameMode === GameModes.SPLICED_ENDLESS || this.runInfo.gameMode === GameModes.ENDLESS) ? 0.25 : 0.5;
const heldItemsContainer = this.scene.add.container(-82, 6);
const heldItemsContainer = this.scene.add.container(-82, 2);
const heldItemsList : PokemonHeldItemModifier[] = [];
if (this.runInfo.modifiers.length) {
for (const m of this.runInfo.modifiers) {
@ -648,6 +654,9 @@ export default class RunInfoUiHandler extends UiHandler {
break;
}
const itemIcon = item?.getIcon(this.scene, true);
if (item?.stackCount < item?.getMaxHeldItemCount(pokemon) && itemIcon.list[1] instanceof Phaser.GameObjects.BitmapText) {
itemIcon.list[1].clearTint();
}
itemIcon.setScale(heldItemsScale);
itemIcon.setPosition((index%19) * 10, row * 10);
heldItemsContainer.add(itemIcon);