fix female bug. refine variable name also (#3601)
This commit is contained in:
parent
616219d17e
commit
b59cb128bf
|
@ -2295,13 +2295,12 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||||
container.cost = this.scene.gameData.getSpeciesStarterValue(container.species.speciesId);
|
container.cost = this.scene.gameData.getSpeciesStarterValue(container.species.speciesId);
|
||||||
|
|
||||||
// First, ensure you have the caught attributes for the species else default to bigint 0
|
// First, ensure you have the caught attributes for the species else default to bigint 0
|
||||||
const caughtVariants = this.scene.gameData.dexData[container.species.speciesId]?.caughtAttr || BigInt(0);
|
const isCaught = this.scene.gameData.dexData[container.species.speciesId]?.caughtAttr || BigInt(0);
|
||||||
|
|
||||||
// Define the variables based on whether their respective variants have been caught
|
// Define the variables based on whether their respective variants have been caught
|
||||||
const isVariant3Caught = !!(caughtVariants & DexAttr.VARIANT_3);
|
const isVariant3Caught = !!(isCaught & DexAttr.VARIANT_3);
|
||||||
const isVariant2Caught = !!(caughtVariants & DexAttr.VARIANT_2);
|
const isVariant2Caught = !!(isCaught & DexAttr.VARIANT_2);
|
||||||
const isVariantCaught = !!(caughtVariants & DexAttr.SHINY);
|
const isVariantCaught = !!(isCaught & DexAttr.SHINY);
|
||||||
const isCaught = !!(caughtVariants & DexAttr.NON_SHINY);
|
|
||||||
const isUncaught = !isCaught && !isVariantCaught && !isVariant2Caught && !isVariant3Caught;
|
const isUncaught = !isCaught && !isVariantCaught && !isVariant2Caught && !isVariant3Caught;
|
||||||
const isPassiveUnlocked = this.scene.gameData.starterData[container.species.speciesId].passiveAttr > 0;
|
const isPassiveUnlocked = this.scene.gameData.starterData[container.species.speciesId].passiveAttr > 0;
|
||||||
const isPassiveUnlockable = this.isPassiveAvailable(container.species.speciesId) && !isPassiveUnlocked;
|
const isPassiveUnlockable = this.isPassiveAvailable(container.species.speciesId) && !isPassiveUnlocked;
|
||||||
|
@ -2913,6 +2912,14 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||||
if (species) {
|
if (species) {
|
||||||
const dexEntry = this.scene.gameData.dexData[species.speciesId];
|
const dexEntry = this.scene.gameData.dexData[species.speciesId];
|
||||||
const abilityAttr = this.scene.gameData.starterData[species.speciesId].abilityAttr;
|
const abilityAttr = this.scene.gameData.starterData[species.speciesId].abilityAttr;
|
||||||
|
|
||||||
|
const isCaught = this.scene.gameData.dexData[species.speciesId]?.caughtAttr || BigInt(0);
|
||||||
|
const isVariant3Caught = !!(isCaught & DexAttr.VARIANT_3);
|
||||||
|
const isVariant2Caught = !!(isCaught & DexAttr.VARIANT_2);
|
||||||
|
const isVariantCaught = !!(isCaught & DexAttr.SHINY);
|
||||||
|
const isMaleCaught = !!(isCaught & DexAttr.MALE);
|
||||||
|
const isFemaleCaught = !!(isCaught & DexAttr.FEMALE);
|
||||||
|
|
||||||
if (!dexEntry.caughtAttr) {
|
if (!dexEntry.caughtAttr) {
|
||||||
const props = this.scene.gameData.getSpeciesDexAttrProps(species, this.getCurrentDexProps(species.speciesId));
|
const props = this.scene.gameData.getSpeciesDexAttrProps(species, this.getCurrentDexProps(species.speciesId));
|
||||||
const defaultAbilityIndex = this.scene.gameData.getStarterSpeciesDefaultAbilityIndex(species);
|
const defaultAbilityIndex = this.scene.gameData.getStarterSpeciesDefaultAbilityIndex(species);
|
||||||
|
@ -2975,15 +2982,9 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||||
starterSprite.setTexture(species.getIconAtlasKey(formIndex, shiny, variant), species.getIconId(female!, formIndex, shiny, variant));
|
starterSprite.setTexture(species.getIconAtlasKey(formIndex, shiny, variant), species.getIconId(female!, formIndex, shiny, variant));
|
||||||
currentFilteredContainer.checkIconId(female, formIndex, shiny, variant);
|
currentFilteredContainer.checkIconId(female, formIndex, shiny, variant);
|
||||||
}
|
}
|
||||||
// First, ensure you have the caught attributes for the species else default to bigint 0
|
|
||||||
const caughtVariants = this.scene.gameData.dexData[species.speciesId]?.caughtAttr || BigInt(0);
|
|
||||||
// Define the variables based on whether their respective variants have been caught
|
|
||||||
const isVariant3Caught = !!(caughtVariants & DexAttr.VARIANT_3);
|
|
||||||
const isVariant2Caught = !!(caughtVariants & DexAttr.VARIANT_2);
|
|
||||||
const isVariantCaught = !!(caughtVariants & DexAttr.SHINY);
|
|
||||||
|
|
||||||
this.canCycleShiny = isVariantCaught || isVariant2Caught || isVariant3Caught;
|
this.canCycleShiny = isVariantCaught || isVariant2Caught || isVariant3Caught;
|
||||||
this.canCycleGender = !!(dexEntry.caughtAttr & DexAttr.MALE && dexEntry.caughtAttr & DexAttr.FEMALE);
|
this.canCycleGender = isMaleCaught && isFemaleCaught;
|
||||||
this.canCycleAbility = [ abilityAttr & AbilityAttr.ABILITY_1, (abilityAttr & AbilityAttr.ABILITY_2) && species.ability2, abilityAttr & AbilityAttr.ABILITY_HIDDEN ].filter(a => a).length > 1;
|
this.canCycleAbility = [ abilityAttr & AbilityAttr.ABILITY_1, (abilityAttr & AbilityAttr.ABILITY_2) && species.ability2, abilityAttr & AbilityAttr.ABILITY_HIDDEN ].filter(a => a).length > 1;
|
||||||
this.canCycleForm = species.forms.filter(f => f.isStarterSelectable || !pokemonFormChanges[species.speciesId]?.find(fc => fc.formKey))
|
this.canCycleForm = species.forms.filter(f => f.isStarterSelectable || !pokemonFormChanges[species.speciesId]?.find(fc => fc.formKey))
|
||||||
.map((_, f) => dexEntry.caughtAttr & this.scene.gameData.getFormAttr(f)).filter(f => f).length > 1;
|
.map((_, f) => dexEntry.caughtAttr & this.scene.gameData.getFormAttr(f)).filter(f => f).length > 1;
|
||||||
|
@ -2992,7 +2993,12 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dexEntry.caughtAttr && species.malePercent !== null) {
|
if (dexEntry.caughtAttr && species.malePercent !== null) {
|
||||||
const gender = !female ? Gender.MALE : Gender.FEMALE;
|
let gender: Gender;
|
||||||
|
if ((female && isFemaleCaught) || (!female && !isMaleCaught)) {
|
||||||
|
gender = Gender.FEMALE;
|
||||||
|
} else {
|
||||||
|
gender = Gender.MALE;
|
||||||
|
}
|
||||||
this.pokemonGenderText.setText(getGenderSymbol(gender));
|
this.pokemonGenderText.setText(getGenderSymbol(gender));
|
||||||
this.pokemonGenderText.setColor(getGenderColor(gender));
|
this.pokemonGenderText.setColor(getGenderColor(gender));
|
||||||
this.pokemonGenderText.setShadowColor(getGenderColor(gender, true));
|
this.pokemonGenderText.setShadowColor(getGenderColor(gender, true));
|
||||||
|
|
Loading…
Reference in New Issue