From e672ead1847bc8fbe84a9446c11dc6ac26247c3e Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Tue, 9 Apr 2024 16:58:56 -0400 Subject: [PATCH] Indicate starters that exceed cost on starter select and show values for locked starters --- src/data/ability.ts | 2 +- src/ui/starter-select-ui-handler.ts | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/data/ability.ts b/src/data/ability.ts index 7c722a183db..d09bb2ebab5 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -2729,7 +2729,7 @@ export function initAbilities() { new Ability(Abilities.DAUNTLESS_SHIELD, "Dauntless Shield", "Boosts the Pokémon's Defense stat when the Pokémon enters a battle.", 8) .attr(PostSummonStatChangeAbAttr, BattleStat.DEF, 1, true), new Ability(Abilities.LIBERO, "Libero (N)", "Changes the Pokémon's type to the type of the move it's about to use.", 8), - new Ability(Abilities.BALL_FETCH, "Ball Fetch (N)", "If the Pokémon is not holding an item, it will fetch the Poké Ball from the first failed throw of the battle.", 8), + new Ability(Abilities.BALL_FETCH, "Ball Fetch (N)", "The Pokémon will fetch the Poké Ball from the first failed throw of the battle.", 8), new Ability(Abilities.COTTON_DOWN, "Cotton Down (N)", "When the Pokémon is hit by an attack, it scatters cotton fluff around and lowers the Speed stat of all Pokémon except itself.", 8), new Ability(Abilities.PROPELLER_TAIL, "Propeller Tail (N)", "Ignores the effects of opposing Pokémon's Abilities and moves that draw in moves.", 8), new Ability(Abilities.MIRROR_ARMOR, "Mirror Armor (N)", "Bounces back only the stat-lowering effects that the Pokémon receives.", 8) diff --git a/src/ui/starter-select-ui-handler.ts b/src/ui/starter-select-ui-handler.ts index 993a76b14ef..546c9ca5b29 100644 --- a/src/ui/starter-select-ui-handler.ts +++ b/src/ui/starter-select-ui-handler.ts @@ -889,7 +889,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { const genLimit = this.genSpecies[genCursorWithScroll].length; for (let s = 0; s < 81; s++) { const speciesId = s < genLimit ? this.genSpecies[genCursorWithScroll][s].speciesId : 0 as Species; - const slotVisible = speciesId && !!(this.scene.gameData.dexData[speciesId].caughtAttr); + const slotVisible = !!speciesId; if (slotVisible) { const baseStarterValue = speciesStarters[speciesId]; const starterValue = slotVisible ? this.scene.gameData.getSpeciesStarterValue(speciesId) : 0; @@ -914,7 +914,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { this.starterValueLabels[s].setShadowColor(this.getTextColor(textStyle, true)); } this.starterValueLabels[s].setVisible(slotVisible); - this.shinyIcons[s].setVisible(slotVisible && !!(this.scene.gameData.dexData[speciesId].caughtAttr & DexAttr.SHINY)); + this.shinyIcons[s].setVisible(slotVisible && !!this.scene.gameData.dexData[speciesId].caughtAttr && !!(this.scene.gameData.dexData[speciesId].caughtAttr & DexAttr.SHINY)); } } else { changed = super.setCursor(cursor); @@ -1244,17 +1244,22 @@ export default class StarterSelectUiHandler extends MessageUiHandler { tryUpdateValue(add?: integer): boolean { const value = this.starterGens.reduce((total: integer, gen: integer, i: integer) => total += this.scene.gameData.getSpeciesStarterValue(this.genSpecies[gen][this.starterCursors[i]].speciesId), 0); const newValue = value + (add || 0); - const overLimit = newValue > this.getValueLimit(); + const valueLimit = this.getValueLimit(); + const overLimit = newValue > valueLimit; let newValueStr = newValue.toString(); if (newValueStr.startsWith('0.')) newValueStr = newValueStr.slice(1); - this.valueLimitLabel.setText(`${newValueStr}/${this.getValueLimit()}`); + this.valueLimitLabel.setText(`${newValueStr}/${valueLimit}`); this.valueLimitLabel.setColor(this.getTextColor(!overLimit ? TextStyle.TOOLTIP_CONTENT : TextStyle.SUMMARY_PINK)); this.valueLimitLabel.setShadowColor(this.getTextColor(!overLimit ? TextStyle.TOOLTIP_CONTENT : TextStyle.SUMMARY_PINK, true)); if (overLimit) { this.scene.time.delayedCall(Utils.fixedInt(500), () => this.tryUpdateValue()); return false; } + for (let g = 0; g < this.genSpecies.length; g++) { + for (let s = 0; s < this.genSpecies[g].length; s++) + (this.starterSelectGenIconContainers[g].getAt(s) as Phaser.GameObjects.Sprite).setAlpha((newValue + this.scene.gameData.getSpeciesStarterValue(this.genSpecies[g][s].speciesId)) > valueLimit ? 0.375 : 1); + } this.value = newValue; return true; }