From 3dac0993f4c7a87c6bf582e12310fa7bdb4ed0a3 Mon Sep 17 00:00:00 2001 From: KimJeongSun Date: Mon, 2 Sep 2024 18:25:41 +0900 Subject: [PATCH] show passive name even if it is locked or disabled --- src/ui/starter-select-ui-handler.ts | 36 +++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/src/ui/starter-select-ui-handler.ts b/src/ui/starter-select-ui-handler.ts index ff76a467d25..8645e199653 100644 --- a/src/ui/starter-select-ui-handler.ts +++ b/src/ui/starter-select-ui-handler.ts @@ -32,19 +32,19 @@ import {SettingKeyboard} from "#app/system/settings/settings-keyboard"; import {Passive as PassiveAttr} from "#enums/passive"; import * as Challenge from "../data/challenge"; import MoveInfoOverlay from "./move-info-overlay"; -import { getEggTierForSpecies } from "#app/data/egg.js"; +import { getEggTierForSpecies } from "#app/data/egg"; import { Device } from "#enums/devices"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; import {Button} from "#enums/buttons"; -import { EggSourceType } from "#app/enums/egg-source-types.js"; +import { EggSourceType } from "#app/enums/egg-source-types"; import AwaitableUiHandler from "./awaitable-ui-handler"; import { DropDown, DropDownLabel, DropDownOption, DropDownState, DropDownType, SortCriteria } from "./dropdown"; import { StarterContainer } from "./starter-container"; import { DropDownColumn, FilterBar } from "./filter-bar"; import { ScrollBar } from "./scroll-bar"; -import { SelectChallengePhase } from "#app/phases/select-challenge-phase.js"; -import { TitlePhase } from "#app/phases/title-phase.js"; +import { SelectChallengePhase } from "#app/phases/select-challenge-phase"; +import { TitlePhase } from "#app/phases/title-phase"; import { Abilities } from "#app/enums/abilities"; export type StarterSelectCallback = (starters: Starter[]) => void; @@ -3066,9 +3066,31 @@ export default class StarterSelectUiHandler extends MessageUiHandler { this.pokemonAbilityText.setShadowColor(this.getTextColor(!isHidden ? TextStyle.SUMMARY_ALT : TextStyle.SUMMARY_GOLD, true)); const passiveAttr = this.scene.gameData.starterData[species.speciesId].passiveAttr; - this.pokemonPassiveText.setText(passiveAttr & PassiveAttr.UNLOCKED ? passiveAttr & PassiveAttr.ENABLED ? allAbilities[starterPassiveAbilities[this.lastSpecies.speciesId]].name : i18next.t("starterSelectUiHandler:disabled") : i18next.t("starterSelectUiHandler:locked")); - this.pokemonPassiveText.setColor(this.getTextColor(passiveAttr === (PassiveAttr.UNLOCKED | PassiveAttr.ENABLED) ? TextStyle.SUMMARY_ALT : TextStyle.SUMMARY_GRAY)); - this.pokemonPassiveText.setShadowColor(this.getTextColor(passiveAttr === (PassiveAttr.UNLOCKED | PassiveAttr.ENABLED) ? TextStyle.SUMMARY_ALT : TextStyle.SUMMARY_GRAY, true)); + const passiveAbility = allAbilities[starterPassiveAbilities[this.lastSpecies.speciesId]]; + + if (passiveAbility) { + const isUnlocked = passiveAttr & PassiveAttr.UNLOCKED; + const isEnabled = passiveAttr & PassiveAttr.ENABLED; + + const labelStyle = isUnlocked ? TextStyle.SUMMARY_ALT : TextStyle.SUMMARY_GRAY; + const textStyle = isUnlocked && isEnabled ? TextStyle.SUMMARY_ALT : TextStyle.SUMMARY_GRAY; + const labelAlpha = isUnlocked ? 1 : 0.5; + const textAlpha = isUnlocked && isEnabled ? 1 : 0.5; + + this.pokemonPassiveLabelText.setVisible(true); + this.pokemonPassiveLabelText.setColor(this.getTextColor(labelStyle)); + this.pokemonPassiveLabelText.setAlpha(labelAlpha); + this.pokemonPassiveLabelText.setShadowColor(this.getTextColor(labelStyle, true)); + + this.pokemonPassiveText.setVisible(true); + this.pokemonPassiveText.setText(passiveAbility.name); + this.pokemonPassiveText.setColor(this.getTextColor(textStyle)); + this.pokemonPassiveText.setAlpha(textAlpha); + this.pokemonPassiveText.setShadowColor(this.getTextColor(textStyle, true)); + } else { + this.pokemonPassiveLabelText.setVisible(false); + this.pokemonPassiveText.setVisible(false); + } this.pokemonNatureText.setText(getNatureName(natureIndex as unknown as Nature, true, true, false, this.scene.uiTheme));