fix: fusions with gender evo condition can now evolve

This commit is contained in:
Sirz Benjie 2025-09-07 15:11:28 -05:00
parent b7cee4b313
commit 4718a59f0e
No known key found for this signature in database
GPG Key ID: 4A524B4D196C759E
2 changed files with 4 additions and 4 deletions

View File

@ -166,7 +166,7 @@ export class SpeciesEvolutionCondition {
return this.desc; return this.desc;
} }
public conditionsFulfilled(pokemon: Pokemon): boolean { public conditionsFulfilled(pokemon: Pokemon, forFusion = false): boolean {
console.log(this.data); console.log(this.data);
return this.data.every(cond => { return this.data.every(cond => {
switch (cond.key) { switch (cond.key) {
@ -186,7 +186,7 @@ export class SpeciesEvolutionCondition {
m.getStackCount() + pokemon.getPersistentTreasureCount() >= cond.value m.getStackCount() + pokemon.getPersistentTreasureCount() >= cond.value
); );
case EvoCondKey.GENDER: case EvoCondKey.GENDER:
return pokemon.gender === cond.gender; return cond.gender === (forFusion ? pokemon.fusionGender : pokemon.gender);
case EvoCondKey.SHEDINJA: // Shedinja cannot be evolved into directly case EvoCondKey.SHEDINJA: // Shedinja cannot be evolved into directly
return false; return false;
case EvoCondKey.BIOME: case EvoCondKey.BIOME:
@ -293,7 +293,7 @@ export class SpeciesFormEvolution {
pokemon.level >= this.level && pokemon.level >= this.level &&
// Check form key, using the fusion's form key if we're checking the fusion // Check form key, using the fusion's form key if we're checking the fusion
(this.preFormKey == null || (forFusion ? pokemon.getFusionFormKey() : pokemon.getFormKey()) === this.preFormKey) && (this.preFormKey == null || (forFusion ? pokemon.getFusionFormKey() : pokemon.getFormKey()) === this.preFormKey) &&
(this.condition == null || this.condition.conditionsFulfilled(pokemon)) && (this.condition == null || this.condition.conditionsFulfilled(pokemon, forFusion)) &&
((item ?? EvolutionItem.NONE) === (this.item ?? EvolutionItem.NONE)) ((item ?? EvolutionItem.NONE) === (this.item ?? EvolutionItem.NONE))
); );
} }

View File

@ -2635,7 +2635,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
e => new FusionSpeciesFormEvolution(this.species.speciesId, e), e => new FusionSpeciesFormEvolution(this.species.speciesId, e),
); );
for (const fe of fusionEvolutions) { for (const fe of fusionEvolutions) {
if (fe.validate(this)) { if (fe.validate(this, true)) {
return fe; return fe;
} }
} }