From eeb0a8602e7767ea844dad49da8b3651642b68d9 Mon Sep 17 00:00:00 2001 From: Opaque02 <66582645+Opaque02@users.noreply.github.com> Date: Fri, 20 Sep 2024 01:44:30 +1000 Subject: [PATCH] Updated as per comments --- src/field/pokemon.ts | 13 +++++++------ src/modifier/modifier-type.ts | 6 +++--- src/ui/modifier-select-ui-handler.ts | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index c930768ae02..aa643587082 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -3784,12 +3784,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { return rootForm.getAbility(abilityIndex) === rootForm.getAbility(currentAbilityIndex); } - /* Checks whether or not the pokemon's pokeball will be tinted. - * This checks the dex attributes (gender, shiny/non shiny, variant and forms) - * These values are checked against the exact pokemon you're catching (i.e. catching charizard won't compare against charmander) - * It also checks your abilities against the starter version - * If any are "new", the pokemon's pokeball is tinted - * @returns true if the pokemon's pokeball should be tinted, meaning at least one thing is new + /* + * Checks whether or not the pokemon's pokeball icon will be tinted. + * This checks the dex attributes (gender, shiny/non shiny, variant and forms). + * These values are checked against the exact pokemon you're catching (i.e. catching charizard won't compare against charmander). + * It also checks your abilities against the starter version. + * If you are missing any, the pokemon's pokeball icon is tinted. + * @returns `true` if the pokemon's pokeball icon should be tinted, meaning at least one thing is new */ isTintedPokeball(): boolean { const dexEntry = this.scene.gameData.dexData[this.species.speciesId]; diff --git a/src/modifier/modifier-type.ts b/src/modifier/modifier-type.ts index 9bb41d36fc5..ca985d40c88 100644 --- a/src/modifier/modifier-type.ts +++ b/src/modifier/modifier-type.ts @@ -185,7 +185,7 @@ export class AddPokeballModifierType extends ModifierType { }); } - addAmount(currentAmount: number) { + setAmount(currentAmount: number) { this.currentAmount = currentAmount; } @@ -2157,13 +2157,13 @@ function getModifierTypeOptionWithRetry(existingOptions: ModifierTypeOption[], r allowLuckUpgrades = allowLuckUpgrades ?? true; let candidate = getNewModifierTypeOption(party, ModifierPoolType.PLAYER, tier, undefined, 0, allowLuckUpgrades); if (candidate?.type instanceof AddPokeballModifierType) { - candidate.type.addAmount(party[0].scene.pokeballCounts[candidate.type.getPokeballType()]); + candidate.type.setAmount(party[0].scene.pokeballCounts[candidate.type.getPokeballType()]); } let r = 0; while (existingOptions.length && ++r < retryCount && existingOptions.filter(o => o.type.name === candidate?.type.name || o.type.group === candidate?.type.group).length) { candidate = getNewModifierTypeOption(party, ModifierPoolType.PLAYER, candidate?.type.tier ?? tier, candidate?.upgradeCount, 0, allowLuckUpgrades); if (candidate?.type instanceof AddPokeballModifierType) { - candidate.type.addAmount(party[0].scene.pokeballCounts[candidate.type.getPokeballType()]); + candidate.type.setAmount(party[0].scene.pokeballCounts[candidate.type.getPokeballType()]); } } return candidate!; diff --git a/src/ui/modifier-select-ui-handler.ts b/src/ui/modifier-select-ui-handler.ts index 931c1d3252e..2413290c57c 100644 --- a/src/ui/modifier-select-ui-handler.ts +++ b/src/ui/modifier-select-ui-handler.ts @@ -678,7 +678,7 @@ class ModifierOption extends Phaser.GameObjects.Container { } if (this.modifierTypeOption.type instanceof AddPokeballModifierType) { - this.modifierTypeOption.type.addAmount((this.scene as BattleScene).pokeballCounts[this.modifierTypeOption.type.getPokeballType()]); + this.modifierTypeOption.type.setAmount((this.scene as BattleScene).pokeballCounts[this.modifierTypeOption.type.getPokeballType()]); } this.itemText = addTextObject(this.scene, 0, 35, this.modifierTypeOption.type?.name!, TextStyle.PARTY, { align: "center" }); // TODO: is this bang correct?