From 59cb4daa5283e34832ff9223ef01c6ac51d2452a Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Sat, 6 Apr 2024 20:48:58 -0400 Subject: [PATCH] Fix gendered form evolutions always assigning male --- src/data/pokemon-evolutions.ts | 12 ++++++------ src/field/pokemon.ts | 25 ++++++++++++++----------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/data/pokemon-evolutions.ts b/src/data/pokemon-evolutions.ts index 46ca7ae5e38..baa515a8e42 100644 --- a/src/data/pokemon-evolutions.ts +++ b/src/data/pokemon-evolutions.ts @@ -856,8 +856,8 @@ export const pokemonEvolutions: PokemonEvolutions = { new SpeciesEvolution(Species.PANGORO, 32, null, new SpeciesEvolutionCondition(p => !!p.scene.getParty().find(p => p.getTypes(false, false, true).indexOf(Type.DARK) > -1)), SpeciesWildEvolutionDelay.MEDIUM) ], [Species.ESPURR]: [ - new SpeciesFormEvolution(Species.MEOWSTIC, '', '', 25, null, new SpeciesEvolutionCondition(p => p.gender === Gender.MALE, p => p.gender = Gender.MALE)), - new SpeciesFormEvolution(Species.MEOWSTIC, '', 'female', 25, null, new SpeciesEvolutionCondition(p => p.gender === Gender.FEMALE, p => p.gender = Gender.FEMALE)) + new SpeciesFormEvolution(Species.MEOWSTIC, '', 'female', 25, null, new SpeciesEvolutionCondition(p => p.gender === Gender.FEMALE, p => p.gender = Gender.FEMALE)), + new SpeciesFormEvolution(Species.MEOWSTIC, '', '', 25, null, new SpeciesEvolutionCondition(p => p.gender === Gender.MALE, p => p.gender = Gender.MALE)) ], [Species.HONEDGE]: [ new SpeciesEvolution(Species.DOUBLADE, 35, null, null) @@ -1128,8 +1128,8 @@ export const pokemonEvolutions: PokemonEvolutions = { new SpeciesEvolution(Species.QUAQUAVAL, 36, null, null) ], [Species.LECHONK]: [ - new SpeciesFormEvolution(Species.OINKOLOGNE, '', '', 18, null, new SpeciesEvolutionCondition(p => p.gender === Gender.MALE, p => p.gender = Gender.MALE)), - new SpeciesFormEvolution(Species.OINKOLOGNE, '', 'female', 18, null, new SpeciesEvolutionCondition(p => p.gender === Gender.FEMALE, p => p.gender = Gender.FEMALE)) + new SpeciesFormEvolution(Species.OINKOLOGNE, '', 'female', 18, null, new SpeciesEvolutionCondition(p => p.gender === Gender.FEMALE, p => p.gender = Gender.FEMALE)), + new SpeciesFormEvolution(Species.OINKOLOGNE, '', '', 18, null, new SpeciesEvolutionCondition(p => p.gender === Gender.MALE, p => p.gender = Gender.MALE)) ], [Species.TAROUNTULA]: [ new SpeciesEvolution(Species.SPIDOPS, 15, null, null) @@ -1364,8 +1364,8 @@ export const pokemonEvolutions: PokemonEvolutions = { new SpeciesEvolution(Species.LILLIGANT, 1, EvolutionItem.SUN_STONE, new SpeciesEvolutionCondition(p => p.scene.arena.getTimeOfDay() === TimeOfDay.DAWN || p.scene.arena.getTimeOfDay() === TimeOfDay.DAY), SpeciesWildEvolutionDelay.LONG) ], [Species.BASCULIN]: [ - new SpeciesFormEvolution(Species.BASCULEGION, 'white-striped', 'male', 40, null, new SpeciesEvolutionCondition(p => p.gender === Gender.MALE, p => p.gender = Gender.MALE), SpeciesWildEvolutionDelay.VERY_LONG), - new SpeciesFormEvolution(Species.BASCULEGION, 'white-striped', 'female', 40, null, new SpeciesEvolutionCondition(p => p.gender === Gender.FEMALE, p => p.gender = Gender.FEMALE), SpeciesWildEvolutionDelay.VERY_LONG) + new SpeciesFormEvolution(Species.BASCULEGION, 'white-striped', 'female', 40, null, new SpeciesEvolutionCondition(p => p.gender === Gender.FEMALE, p => p.gender = Gender.FEMALE), SpeciesWildEvolutionDelay.VERY_LONG), + new SpeciesFormEvolution(Species.BASCULEGION, 'white-striped', 'male', 40, null, new SpeciesEvolutionCondition(p => p.gender === Gender.MALE, p => p.gender = Gender.MALE), SpeciesWildEvolutionDelay.VERY_LONG) ], [Species.MINCCINO]: [ new SpeciesEvolution(Species.CINCCINO, 1, EvolutionItem.SHINY_STONE, null, SpeciesWildEvolutionDelay.LONG) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index b190a80c82d..d92287e44af 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -143,17 +143,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { this.id = Utils.randSeedInt(4294967296); this.ivs = ivs || Utils.getIvsFromId(this.id); - if (this.gender === undefined) { - if (this.species.malePercent === null) - this.gender = Gender.GENDERLESS; - else { - const genderChance = (this.id % 256) * 0.390625; - if (genderChance < this.species.malePercent) - this.gender = Gender.MALE; - else - this.gender = Gender.FEMALE; - } - } + if (this.gender === undefined) + this.generateGender(); if (this.formIndex === undefined) this.formIndex = this.scene.getSpeciesFormIndex(species, this.gender, this.nature, this.isPlayer()); @@ -602,6 +593,18 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { return Math.floor((this.hp / this.getMaxHp()) * 100) / 100; } + generateGender(): void { + if (this.species.malePercent === null) + this.gender = Gender.GENDERLESS; + else { + const genderChance = (this.id % 256) * 0.390625; + if (genderChance < this.species.malePercent) + this.gender = Gender.MALE; + else + this.gender = Gender.FEMALE; + } + } + getGender(ignoreOverride?: boolean): Gender { if (!ignoreOverride && this.summonData?.gender !== undefined) return this.summonData.gender;