diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 516662617f1..b138de793cf 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -884,6 +884,9 @@ export default class BattleScene extends SceneBase { } const pokemon = new EnemyPokemon(this, species, level, trainerSlot, boss, dataSource); + if (Overrides.OPP_FUSION_OVERRIDE) { + pokemon.generateFusionSpecies(); + } overrideModifiers(this, false); overrideHeldItems(this, pokemon, false); diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 7593cb870b4..10bff9fa92a 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -1897,7 +1897,15 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { && species.speciesId !== this.species.speciesId; }; - this.fusionSpecies = this.scene.randomSpecies(this.scene.currentBattle?.waveIndex || 0, this.level, false, filter, true); + let fusionOverride: PokemonSpecies | undefined = undefined; + + if (forStarter && this instanceof PlayerPokemon && Overrides.STARTER_FUSION_SPECIES_OVERRIDE) { + fusionOverride = getPokemonSpecies(Overrides.STARTER_FUSION_SPECIES_OVERRIDE); + } else if (this instanceof EnemyPokemon && Overrides.OPP_FUSION_SPECIES_OVERRIDE) { + fusionOverride = getPokemonSpecies(Overrides.OPP_FUSION_SPECIES_OVERRIDE); + } + + this.fusionSpecies = fusionOverride ?? this.scene.randomSpecies(this.scene.currentBattle?.waveIndex || 0, this.level, false, filter, true); this.fusionAbilityIndex = (this.fusionSpecies.abilityHidden && hasHiddenAbility ? 2 : this.fusionSpecies.ability2 !== this.fusionSpecies.ability1 ? randAbilityIndex : 0); this.fusionShiny = this.shiny; this.fusionVariant = this.variant; diff --git a/src/overrides.ts b/src/overrides.ts index ec0577ceb3d..c3583b446b0 100644 --- a/src/overrides.ts +++ b/src/overrides.ts @@ -97,6 +97,14 @@ class DefaultOverrides { * @example SPECIES_OVERRIDE = Species.Bulbasaur; */ readonly STARTER_SPECIES_OVERRIDE: Species | number = 0; + /** + * This will force your starter to be a random fusion + */ + readonly STARTER_FUSION_OVERRIDE: boolean = false; + /** + * This will override the species of the fusion + */ + readonly STARTER_FUSION_SPECIES_OVERRIDE: Species | integer = 0; readonly ABILITY_OVERRIDE: Abilities = Abilities.NONE; readonly PASSIVE_ABILITY_OVERRIDE: Abilities = Abilities.NONE; readonly STATUS_OVERRIDE: StatusEffect = StatusEffect.NONE; @@ -109,6 +117,14 @@ class DefaultOverrides { // OPPONENT / ENEMY OVERRIDES // -------------------------- readonly OPP_SPECIES_OVERRIDE: Species | number = 0; + /** + * This will make all opponents fused Pokemon + */ + readonly OPP_FUSION_OVERRIDE: boolean = false; + /** + * This will override the species of the fusion only when the opponent is already a fusion + */ + readonly OPP_FUSION_SPECIES_OVERRIDE: Species | integer = 0; readonly OPP_LEVEL_OVERRIDE: number = 0; readonly OPP_ABILITY_OVERRIDE: Abilities = Abilities.NONE; readonly OPP_PASSIVE_ABILITY_OVERRIDE: Abilities = Abilities.NONE; diff --git a/src/phases/select-starter-phase.ts b/src/phases/select-starter-phase.ts index cd3c112549c..1692b5f2234 100644 --- a/src/phases/select-starter-phase.ts +++ b/src/phases/select-starter-phase.ts @@ -80,7 +80,7 @@ export class SelectStarterPhase extends Phase { starterPokemon.nickname = starter.nickname; } - if (this.scene.gameMode.isSplicedOnly) { + if (this.scene.gameMode.isSplicedOnly || Overrides.STARTER_FUSION_OVERRIDE) { starterPokemon.generateFusionSpecies(true); } starterPokemon.setVisible(false); diff --git a/src/test/utils/helpers/overridesHelper.ts b/src/test/utils/helpers/overridesHelper.ts index 686de58e874..23ce55ada78 100644 --- a/src/test/utils/helpers/overridesHelper.ts +++ b/src/test/utils/helpers/overridesHelper.ts @@ -83,6 +83,27 @@ export class OverridesHelper extends GameManagerHelper { return this; } + /** + * Override the player (pokemon) to be a random fusion + * @returns this + */ + enableStarterFusion(): this { + vi.spyOn(Overrides, "STARTER_FUSION_OVERRIDE", "get").mockReturnValue(true); + this.log("Player Pokemon is a random fusion!"); + return this; + } + + /** + * Override the player (pokemon) fusion species + * @param species the fusion species to set + * @returns this + */ + starterFusionSpecies(species: Species | number): this { + vi.spyOn(Overrides, "STARTER_FUSION_SPECIES_OVERRIDE", "get").mockReturnValue(species); + this.log(`Player Pokemon fusion species set to ${Species[species]} (=${species})!`); + return this; + } + /** * Override the player (pokemons) forms * @param forms the (pokemon) forms to set @@ -230,6 +251,27 @@ export class OverridesHelper extends GameManagerHelper { return this; } + /** + * Override the enemy (pokemon) to be a random fusion + * @returns this + */ + enableEnemyFusion(): this { + vi.spyOn(Overrides, "OPP_FUSION_OVERRIDE", "get").mockReturnValue(true); + this.log("Enemy Pokemon is a random fusion!"); + return this; + } + + /** + * Override the enemy (pokemon) fusion species + * @param species the fusion species to set + * @returns this + */ + enemyFusionSpecies(species: Species | number): this { + vi.spyOn(Overrides, "OPP_FUSION_SPECIES_OVERRIDE", "get").mockReturnValue(species); + this.log(`Enemy Pokemon fusion species set to ${Species[species]} (=${species})!`); + return this; + } + /** * Override the enemy (pokemon) {@linkcode Abilities | ability} * @param ability the (pokemon) {@linkcode Abilities | ability} to set