Merge branch 'beta' into ability_display

This commit is contained in:
Dean 2025-02-21 16:05:16 -08:00 committed by GitHub
commit ee954f33ee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -164,7 +164,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
private pokemonFormText: Phaser.GameObjects.Text; private pokemonFormText: Phaser.GameObjects.Text;
private pokemonHatchedIcon : Phaser.GameObjects.Sprite; private pokemonHatchedIcon : Phaser.GameObjects.Sprite;
private pokemonHatchedCountText: Phaser.GameObjects.Text; private pokemonHatchedCountText: Phaser.GameObjects.Text;
private pokemonShinyIcon: Phaser.GameObjects.Sprite; private pokemonShinyIcons: Phaser.GameObjects.Sprite[];
private activeTooltip: "ABILITY" | "PASSIVE" | "CANDY" | undefined; private activeTooltip: "ABILITY" | "PASSIVE" | "CANDY" | undefined;
private instructionsContainer: Phaser.GameObjects.Container; private instructionsContainer: Phaser.GameObjects.Container;
@ -245,6 +245,9 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
protected scale: number = 0.1666666667; protected scale: number = 0.1666666667;
private menuDescriptions: string[]; private menuDescriptions: string[];
private availableVariants: number;
private unlockedVariants: boolean[];
constructor() { constructor() {
super(Mode.POKEDEX_PAGE); super(Mode.POKEDEX_PAGE);
} }
@ -381,10 +384,16 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
this.pokemonHatchedIcon.setScale(0.8); this.pokemonHatchedIcon.setScale(0.8);
this.pokemonCaughtHatchedContainer.add(this.pokemonHatchedIcon); this.pokemonCaughtHatchedContainer.add(this.pokemonHatchedIcon);
this.pokemonShinyIcon = globalScene.add.sprite(14, 117, "shiny_icons"); this.pokemonShinyIcons = [];
this.pokemonShinyIcon.setOrigin(0.15, 0.2); for (let i = 0; i < 3; i++) {
this.pokemonShinyIcon.setScale(1); const pokemonShinyIcon = globalScene.add.sprite(153 + i * 13, 160, "shiny_icons");
this.pokemonCaughtHatchedContainer.add(this.pokemonShinyIcon); pokemonShinyIcon.setOrigin(0.15, 0.2);
pokemonShinyIcon.setScale(1);
pokemonShinyIcon.setFrame(getVariantIcon(i as Variant));
pokemonShinyIcon.setVisible(false);
this.pokemonCaughtHatchedContainer.add(pokemonShinyIcon);
this.pokemonShinyIcons.push(pokemonShinyIcon);
}
this.pokemonHatchedCountText = addTextObject(24, 19, "0", TextStyle.SUMMARY_ALT); this.pokemonHatchedCountText = addTextObject(24, 19, "0", TextStyle.SUMMARY_ALT);
this.pokemonHatchedCountText.setOrigin(0, 0); this.pokemonHatchedCountText.setOrigin(0, 0);
@ -672,6 +681,8 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
) )
); );
} }
this.availableVariants = species.getFullUnlocksData() & DexAttr.VARIANT_3 ? 3 : 1;
} }
// Function to ensure that forms appear in the appropriate biome and tod // Function to ensure that forms appear in the appropriate biome and tod
@ -795,17 +806,17 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
starterAttributes.variant = 0; starterAttributes.variant = 0;
} }
const unlockedVariants = [ this.unlockedVariants = [
hasShiny && caughtAttr & DexAttr.DEFAULT_VARIANT, !!(hasShiny && caughtAttr & DexAttr.DEFAULT_VARIANT),
hasShiny && caughtAttr & DexAttr.VARIANT_2, !!(hasShiny && caughtAttr & DexAttr.VARIANT_2),
hasShiny && caughtAttr & DexAttr.VARIANT_3 !!(hasShiny && caughtAttr & DexAttr.VARIANT_3)
]; ];
if (starterAttributes.variant === undefined || isNaN(starterAttributes.variant) || starterAttributes.variant < 0) { if (starterAttributes.variant === undefined || isNaN(starterAttributes.variant) || starterAttributes.variant < 0) {
starterAttributes.variant = 0; starterAttributes.variant = 0;
} else if (!unlockedVariants[starterAttributes.variant]) { } else if (!this.unlockedVariants[starterAttributes.variant]) {
let highestValidIndex = -1; let highestValidIndex = -1;
for (let i = 0; i <= starterAttributes.variant && i < unlockedVariants.length; i++) { for (let i = 0; i <= starterAttributes.variant && i < this.unlockedVariants.length; i++) {
if (unlockedVariants[i] !== 0n) { if (this.unlockedVariants[i]) {
highestValidIndex = i; highestValidIndex = i;
} }
} }
@ -1530,11 +1541,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
this.setSpeciesDetails(this.species, { shiny: true, variant: newVariant }); this.setSpeciesDetails(this.species, { shiny: true, variant: newVariant });
globalScene.playSound("se/sparkle"); globalScene.playSound("se/sparkle");
// Set the variant label to the shiny tint
const tint = getVariantTint(newVariant);
this.pokemonShinyIcon.setFrame(getVariantIcon(newVariant));
this.pokemonShinyIcon.setTint(tint);
this.pokemonShinyIcon.setVisible(true);
starterAttributes.shiny = true; starterAttributes.shiny = true;
this.savedStarterAttributes.shiny = starterAttributes.shiny; this.savedStarterAttributes.shiny = starterAttributes.shiny;
@ -1561,14 +1567,9 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
this.savedStarterAttributes.variant = starterAttributes.variant; this.savedStarterAttributes.variant = starterAttributes.variant;
if (newVariant > props.variant) { if (newVariant > props.variant) {
this.setSpeciesDetails(this.species, { variant: newVariant as Variant }); this.setSpeciesDetails(this.species, { variant: newVariant as Variant });
// Cycle tint based on current sprite tint
const tint = getVariantTint(newVariant as Variant);
this.pokemonShinyIcon.setFrame(getVariantIcon(newVariant as Variant));
this.pokemonShinyIcon.setTint(tint);
success = true; success = true;
} else { } else {
this.setSpeciesDetails(this.species, { shiny: false, variant: 0 }); this.setSpeciesDetails(this.species, { shiny: false, variant: 0 });
this.pokemonShinyIcon.setVisible(false);
success = true; success = true;
starterAttributes.shiny = false; starterAttributes.shiny = false;
@ -2005,7 +2006,9 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
this.type2Icon.setVisible(true); this.type2Icon.setVisible(true);
this.pokemonLuckLabelText.setVisible(false); this.pokemonLuckLabelText.setVisible(false);
this.pokemonLuckText.setVisible(false); this.pokemonLuckText.setVisible(false);
this.pokemonShinyIcon.setVisible(false); for (const icon of this.pokemonShinyIcons) {
icon.setVisible(false);
}
this.pokemonUncaughtText.setVisible(true); this.pokemonUncaughtText.setVisible(true);
this.pokemonCaughtHatchedContainer.setVisible(true); this.pokemonCaughtHatchedContainer.setVisible(true);
this.pokemonCandyContainer.setVisible(false); this.pokemonCandyContainer.setVisible(false);
@ -2031,7 +2034,9 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
this.type2Icon.setVisible(false); this.type2Icon.setVisible(false);
this.pokemonLuckLabelText.setVisible(false); this.pokemonLuckLabelText.setVisible(false);
this.pokemonLuckText.setVisible(false); this.pokemonLuckText.setVisible(false);
this.pokemonShinyIcon.setVisible(false); for (const icon of this.pokemonShinyIcons) {
icon.setVisible(false);
}
this.pokemonUncaughtText.setVisible(!!species); this.pokemonUncaughtText.setVisible(!!species);
this.pokemonCaughtHatchedContainer.setVisible(false); this.pokemonCaughtHatchedContainer.setVisible(false);
this.pokemonCandyContainer.setVisible(false); this.pokemonCandyContainer.setVisible(false);
@ -2232,13 +2237,26 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
const defaultDexAttr = this.getCurrentDexProps(species.speciesId); const defaultDexAttr = this.getCurrentDexProps(species.speciesId);
const defaultProps = globalScene.gameData.getSpeciesDexAttrProps(species, defaultDexAttr); const defaultProps = globalScene.gameData.getSpeciesDexAttrProps(species, defaultDexAttr);
const variant = defaultProps.variant;
const tint = getVariantTint(variant);
this.pokemonShinyIcon.setFrame(getVariantIcon(variant));
this.pokemonShinyIcon.setTint(tint);
this.pokemonShinyIcon.setVisible(defaultProps.shiny);
this.pokemonCaughtHatchedContainer.setVisible(true);
const variant = defaultProps.variant;
for (let v = 0; v < 3; v++) {
const icon = this.pokemonShinyIcons[v];
if (v < this.availableVariants) {
if (!this.unlockedVariants[v]) {
icon.setTint(0x000000);
} else if (shiny && v === variant) {
const tint = getVariantTint(v as Variant);
icon.setTint(tint);
} else {
icon.setTint(0x808080);
}
icon.setVisible(true);
} else {
icon.setVisible(false);
}
}
this.pokemonCaughtHatchedContainer.setVisible(true);
this.pokemonCaughtHatchedContainer.setY(25); this.pokemonCaughtHatchedContainer.setY(25);
this.pokemonCandyIcon.setTint(argbFromRgba(rgbHexToRgba(colorScheme[0]))); this.pokemonCandyIcon.setTint(argbFromRgba(rgbHexToRgba(colorScheme[0])));
this.pokemonCandyOverlayIcon.setTint(argbFromRgba(rgbHexToRgba(colorScheme[1]))); this.pokemonCandyOverlayIcon.setTint(argbFromRgba(rgbHexToRgba(colorScheme[1])));
@ -2246,7 +2264,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
this.pokemonCandyContainer.setVisible(true); this.pokemonCandyContainer.setVisible(true);
if (pokemonPrevolutions.hasOwnProperty(species.speciesId)) { if (pokemonPrevolutions.hasOwnProperty(species.speciesId)) {
this.pokemonShinyIcon.setFrame(getVariantIcon(variant));
this.pokemonHatchedIcon.setVisible(false); this.pokemonHatchedIcon.setVisible(false);
this.pokemonHatchedCountText.setVisible(false); this.pokemonHatchedCountText.setVisible(false);
this.pokemonFormText.setY(36); this.pokemonFormText.setY(36);
@ -2273,7 +2290,9 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
this.pokemonUncaughtText.setVisible(true); this.pokemonUncaughtText.setVisible(true);
this.pokemonCaughtHatchedContainer.setVisible(false); this.pokemonCaughtHatchedContainer.setVisible(false);
this.pokemonCandyContainer.setVisible(false); this.pokemonCandyContainer.setVisible(false);
this.pokemonShinyIcon.setVisible(false); for (const icon of this.pokemonShinyIcons) {
icon.setVisible(false);
}
} }
// Setting type icons and form text // Setting type icons and form text