Merge branch 'beta' into fix-challenge-filters

This commit is contained in:
Wlowscha 2025-03-02 01:54:02 +01:00 committed by GitHub
commit 27d6b1187a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 41 additions and 22 deletions

View File

@ -133,7 +133,7 @@
<span class="apad-label">V</span> <span class="apad-label">V</span>
</div> </div>
<!-- buttons to display battle-specific information --> <!-- buttons to display battle-specific information -->
<div id="apadInfo" class="apad-button apad-rectangle apad-small" data-key="V"> <div id="apadInfo" class="apad-button apad-rectangle apad-small" data-key="CYCLE_TERA">
<span class="apad-label">V</span> <span class="apad-label">V</span>
</div> </div>
<div id="apadStats" class="apad-button apad-rectangle apad-small" data-key="STATS"> <div id="apadStats" class="apad-button apad-rectangle apad-small" data-key="STATS">

View File

@ -1645,11 +1645,19 @@ export class GameData {
} else if (formIndex === 3) { } else if (formIndex === 3) {
dexEntry.caughtAttr |= globalScene.gameData.getFormAttr(1); dexEntry.caughtAttr |= globalScene.gameData.getFormAttr(1);
} }
} } else if (pokemon.species.speciesId === Species.ZYGARDE) {
const allFormChanges = pokemonFormChanges.hasOwnProperty(species.speciesId) ? pokemonFormChanges[species.speciesId] : []; if (formIndex === 4) {
const toCurrentFormChanges = allFormChanges.filter(f => (f.formKey === formKey)); dexEntry.caughtAttr |= globalScene.gameData.getFormAttr(2);
if (toCurrentFormChanges.length > 0) { } else if (formIndex === 5) {
dexEntry.caughtAttr |= globalScene.gameData.getFormAttr(0); dexEntry.caughtAttr |= globalScene.gameData.getFormAttr(3);
}
} else {
const allFormChanges = pokemonFormChanges.hasOwnProperty(species.speciesId) ? pokemonFormChanges[species.speciesId] : [];
const toCurrentFormChanges = allFormChanges.filter(f => (f.formKey === formKey));
if (toCurrentFormChanges.length > 0) {
// Needs to do this or Castform can unlock the wrong form, etc.
dexEntry.caughtAttr |= globalScene.gameData.getFormAttr(0);
}
} }
} }

View File

@ -787,6 +787,10 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
const formIndex = otherFormIndex !== undefined ? otherFormIndex : this.formIndex; const formIndex = otherFormIndex !== undefined ? otherFormIndex : this.formIndex;
const caughtAttr = this.isCaught(species); const caughtAttr = this.isCaught(species);
if (caughtAttr && (!species.forms.length || species.forms.length === 1)) {
return true;
}
const isFormCaught = (caughtAttr & globalScene.gameData.getFormAttr(formIndex ?? 0)) > 0n; const isFormCaught = (caughtAttr & globalScene.gameData.getFormAttr(formIndex ?? 0)) > 0n;
return isFormCaught; return isFormCaught;
} }
@ -1578,15 +1582,14 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
starterAttributes.variant = newVariant; // store the selected variant starterAttributes.variant = newVariant; // store the selected variant
this.savedStarterAttributes.variant = starterAttributes.variant; this.savedStarterAttributes.variant = starterAttributes.variant;
if (newVariant > props.variant) { if ((this.isCaught() & DexAttr.NON_SHINY) && (newVariant <= props.variant)) {
this.setSpeciesDetails(this.species, { variant: newVariant as Variant });
success = true;
} else {
this.setSpeciesDetails(this.species, { shiny: false, variant: 0 }); this.setSpeciesDetails(this.species, { shiny: false, variant: 0 });
success = true; success = true;
starterAttributes.shiny = false; starterAttributes.shiny = false;
this.savedStarterAttributes.shiny = starterAttributes.shiny; this.savedStarterAttributes.shiny = starterAttributes.shiny;
} else {
this.setSpeciesDetails(this.species, { variant: newVariant as Variant });
success = true;
} }
} }
} }
@ -2182,7 +2185,8 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
const isNonShinyCaught = !!(caughtAttr & DexAttr.NON_SHINY); const isNonShinyCaught = !!(caughtAttr & DexAttr.NON_SHINY);
const isShinyCaught = !!(caughtAttr & DexAttr.SHINY); const isShinyCaught = !!(caughtAttr & DexAttr.SHINY);
this.canCycleShiny = isNonShinyCaught && isShinyCaught; const caughtVariants = [ DexAttr.DEFAULT_VARIANT, DexAttr.VARIANT_2, DexAttr.VARIANT_3 ].filter(v => caughtAttr & v);
this.canCycleShiny = (isNonShinyCaught && isShinyCaught) || (isShinyCaught && caughtVariants.length > 1);
const isMaleCaught = !!(caughtAttr & DexAttr.MALE); const isMaleCaught = !!(caughtAttr & DexAttr.MALE);
const isFemaleCaught = !!(caughtAttr & DexAttr.FEMALE); const isFemaleCaught = !!(caughtAttr & DexAttr.FEMALE);

View File

@ -8,6 +8,7 @@ import i18next from "i18next";
import type BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext"; import type BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext";
import { starterColors } from "#app/battle-scene"; import { starterColors } from "#app/battle-scene";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import type { Ability } from "#app/data/ability";
import { allAbilities } from "#app/data/ability"; import { allAbilities } from "#app/data/ability";
import { speciesEggMoves } from "#app/data/balance/egg-moves"; import { speciesEggMoves } from "#app/data/balance/egg-moves";
import { GrowthRate, getGrowthRateColor } from "#app/data/exp"; import { GrowthRate, getGrowthRateColor } from "#app/data/exp";
@ -2125,20 +2126,20 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
} }
} while (newVariant !== props.variant); } while (newVariant !== props.variant);
starterAttributes.variant = newVariant; // store the selected variant starterAttributes.variant = newVariant; // store the selected variant
// If going to a higher variant, display that if ((this.speciesStarterDexEntry!.caughtAttr & DexAttr.NON_SHINY) && (newVariant <= props.variant)) {
if (newVariant > props.variant) { // If we have run out of variants, go back to non shiny
this.setSpeciesDetails(this.lastSpecies, { shiny: false, variant: 0 });
this.pokemonShinyIcon.setVisible(false);
success = true;
starterAttributes.shiny = false;
} else {
// If going to a higher variant, or only shiny forms are caught, go to next variant
this.setSpeciesDetails(this.lastSpecies, { variant: newVariant as Variant }); this.setSpeciesDetails(this.lastSpecies, { variant: newVariant as Variant });
// Cycle tint based on current sprite tint // Cycle tint based on current sprite tint
const tint = getVariantTint(newVariant as Variant); const tint = getVariantTint(newVariant as Variant);
this.pokemonShinyIcon.setFrame(getVariantIcon(newVariant as Variant)); this.pokemonShinyIcon.setFrame(getVariantIcon(newVariant as Variant));
this.pokemonShinyIcon.setTint(tint); this.pokemonShinyIcon.setTint(tint);
success = true; success = true;
// If we have run out of variants, go back to non shiny
} else {
this.setSpeciesDetails(this.lastSpecies, { shiny: false, variant: 0 });
this.pokemonShinyIcon.setVisible(false);
success = true;
starterAttributes.shiny = false;
} }
} }
} }
@ -3381,7 +3382,8 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
const isNonShinyCaught = !!(caughtAttr & DexAttr.NON_SHINY); const isNonShinyCaught = !!(caughtAttr & DexAttr.NON_SHINY);
const isShinyCaught = !!(caughtAttr & DexAttr.SHINY); const isShinyCaught = !!(caughtAttr & DexAttr.SHINY);
this.canCycleShiny = isNonShinyCaught && isShinyCaught; const caughtVariants = [ DexAttr.DEFAULT_VARIANT, DexAttr.VARIANT_2, DexAttr.VARIANT_3 ].filter(v => caughtAttr & v);
this.canCycleShiny = (isNonShinyCaught && isShinyCaught) || (isShinyCaught && caughtVariants.length > 1);
const isMaleCaught = !!(caughtAttr & DexAttr.MALE); const isMaleCaught = !!(caughtAttr & DexAttr.MALE);
const isFemaleCaught = !!(caughtAttr & DexAttr.FEMALE); const isFemaleCaught = !!(caughtAttr & DexAttr.FEMALE);
@ -3418,7 +3420,12 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
} }
if (dexEntry.caughtAttr) { if (dexEntry.caughtAttr) {
const ability = allAbilities[this.lastSpecies.getAbility(abilityIndex!)]; // TODO: is this bang correct? let ability: Ability;
if (this.lastSpecies.forms?.length > 1) {
ability = allAbilities[this.lastSpecies.forms[formIndex ?? 0].getAbility(abilityIndex!)];
} else {
ability = allAbilities[this.lastSpecies.getAbility(abilityIndex!)]; // TODO: is this bang correct?
}
this.pokemonAbilityText.setText(ability.name); this.pokemonAbilityText.setText(ability.name);
const isHidden = abilityIndex === (this.lastSpecies.ability2 ? 2 : 1); const isHidden = abilityIndex === (this.lastSpecies.ability2 ? 2 : 1);