Updated as per comments

This commit is contained in:
Opaque02 2024-09-20 01:44:30 +10:00
parent 09cfdf6f7f
commit eeb0a8602e
3 changed files with 11 additions and 10 deletions

View File

@ -3784,12 +3784,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
return rootForm.getAbility(abilityIndex) === rootForm.getAbility(currentAbilityIndex); 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) * Checks whether or not the pokemon's pokeball icon will be tinted.
* These values are checked against the exact pokemon you're catching (i.e. catching charizard won't compare against charmander) * This checks the dex attributes (gender, shiny/non shiny, variant and forms).
* It also checks your abilities against the starter version * These values are checked against the exact pokemon you're catching (i.e. catching charizard won't compare against charmander).
* If any are "new", the pokemon's pokeball is tinted * It also checks your abilities against the starter version.
* @returns true if the pokemon's pokeball should be tinted, meaning at least one thing is new * 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 { isTintedPokeball(): boolean {
const dexEntry = this.scene.gameData.dexData[this.species.speciesId]; const dexEntry = this.scene.gameData.dexData[this.species.speciesId];

View File

@ -185,7 +185,7 @@ export class AddPokeballModifierType extends ModifierType {
}); });
} }
addAmount(currentAmount: number) { setAmount(currentAmount: number) {
this.currentAmount = currentAmount; this.currentAmount = currentAmount;
} }
@ -2157,13 +2157,13 @@ function getModifierTypeOptionWithRetry(existingOptions: ModifierTypeOption[], r
allowLuckUpgrades = allowLuckUpgrades ?? true; allowLuckUpgrades = allowLuckUpgrades ?? true;
let candidate = getNewModifierTypeOption(party, ModifierPoolType.PLAYER, tier, undefined, 0, allowLuckUpgrades); let candidate = getNewModifierTypeOption(party, ModifierPoolType.PLAYER, tier, undefined, 0, allowLuckUpgrades);
if (candidate?.type instanceof AddPokeballModifierType) { 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; let r = 0;
while (existingOptions.length && ++r < retryCount && existingOptions.filter(o => o.type.name === candidate?.type.name || o.type.group === candidate?.type.group).length) { 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); candidate = getNewModifierTypeOption(party, ModifierPoolType.PLAYER, candidate?.type.tier ?? tier, candidate?.upgradeCount, 0, allowLuckUpgrades);
if (candidate?.type instanceof AddPokeballModifierType) { 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!; return candidate!;

View File

@ -678,7 +678,7 @@ class ModifierOption extends Phaser.GameObjects.Container {
} }
if (this.modifierTypeOption.type instanceof AddPokeballModifierType) { 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? this.itemText = addTextObject(this.scene, 0, 35, this.modifierTypeOption.type?.name!, TextStyle.PARTY, { align: "center" }); // TODO: is this bang correct?