mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-26 00:36:25 +00:00
[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:
parent
89e80f3deb
commit
deb4e9dd24
@ -13,8 +13,9 @@ import { BattleType } from "../battle";
|
|||||||
import { TrainerVariant } from "../field/trainer";
|
import { TrainerVariant } from "../field/trainer";
|
||||||
import { Challenges } from "#enums/challenges";
|
import { Challenges } from "#enums/challenges";
|
||||||
import { getLuckString, getLuckTextTint } from "../modifier/modifier-type";
|
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 { Type, getTypeRgb } from "../data/type";
|
||||||
|
import { TypeColor, TypeShadow } from "#app/enums/color";
|
||||||
import { getNatureStatMultiplier, getNatureName } from "../data/nature";
|
import { getNatureStatMultiplier, getNatureName } from "../data/nature";
|
||||||
import { getVariantTint } from "#app/data/variant";
|
import { getVariantTint } from "#app/data/variant";
|
||||||
import { PokemonHeldItemModifier, TerastallizeModifier } from "../modifier/modifier";
|
import { PokemonHeldItemModifier, TerastallizeModifier } from "../modifier/modifier";
|
||||||
@ -373,15 +374,16 @@ export default class RunInfoUiHandler extends UiHandler {
|
|||||||
break;
|
break;
|
||||||
case GameModes.CHALLENGE:
|
case GameModes.CHALLENGE:
|
||||||
modeText.appendText(`${i18next.t("gameMode:challenge")}`, false);
|
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();
|
const rules: string[] = this.challengeParser();
|
||||||
if (rules) {
|
if (rules) {
|
||||||
for (let i = 0; i < rules.length; i++) {
|
for (let i = 0; i < rules.length; i++) {
|
||||||
const newline = i > 0 && i%2 === 0;
|
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
modeText.appendText(" + ", newline);
|
modeText.appendText(" + ", false);
|
||||||
}
|
}
|
||||||
modeText.appendText(rules[i], newline);
|
modeText.appendText(rules[i], false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -470,14 +472,18 @@ export default class RunInfoUiHandler extends UiHandler {
|
|||||||
rules.push(i18next.t(`runHistory:challengeMonoGen${this.runInfo.challenges[i].value}`));
|
rules.push(i18next.t(`runHistory:challengeMonoGen${this.runInfo.challenges[i].value}`));
|
||||||
break;
|
break;
|
||||||
case Challenges.SINGLE_TYPE:
|
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;
|
break;
|
||||||
case Challenges.FRESH_START:
|
case Challenges.FRESH_START:
|
||||||
rules.push(i18next.t("challenges:freshStart.name"));
|
rules.push(i18next.t("challenges:freshStart.name"));
|
||||||
break;
|
break;
|
||||||
case Challenges.INVERSE_BATTLE:
|
case Challenges.INVERSE_BATTLE:
|
||||||
//
|
//
|
||||||
rules.push(i18next.t("challenges:inverseBattle.shortName").split("").reverse().join(""));
|
rules.push(i18next.t("challenges:inverseBattle.shortName"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -628,7 +634,7 @@ export default class RunInfoUiHandler extends UiHandler {
|
|||||||
// Pokemon Held Items - not displayed by default
|
// Pokemon Held Items - not displayed by default
|
||||||
// Endless/Endless Spliced have a different scale because Pokemon tend to accumulate more items in these runs.
|
// 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 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[] = [];
|
const heldItemsList : PokemonHeldItemModifier[] = [];
|
||||||
if (this.runInfo.modifiers.length) {
|
if (this.runInfo.modifiers.length) {
|
||||||
for (const m of this.runInfo.modifiers) {
|
for (const m of this.runInfo.modifiers) {
|
||||||
@ -648,6 +654,9 @@ export default class RunInfoUiHandler extends UiHandler {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
const itemIcon = item?.getIcon(this.scene, true);
|
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.setScale(heldItemsScale);
|
||||||
itemIcon.setPosition((index%19) * 10, row * 10);
|
itemIcon.setPosition((index%19) * 10, row * 10);
|
||||||
heldItemsContainer.add(itemIcon);
|
heldItemsContainer.add(itemIcon);
|
||||||
|
Loading…
Reference in New Issue
Block a user