diff --git a/src/data/move.ts b/src/data/move.ts index 57db2ed0777..5bb25067774 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -4004,7 +4004,7 @@ export class TeraStarstormTypeAttr extends VariableMoveTypeAttr { * @returns `true` if the move type is changed to {@linkcode Type.STELLAR}, `false` otherwise */ override apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { - if (user.isTerastallized() && user.species.speciesId === Species.TERAPAGOS) { + if (user.isTerastallized() && (user.fusionSpecies?.speciesId === Species.TERAPAGOS || user.species.speciesId === Species.TERAPAGOS)) { const moveType = args[0] as Utils.NumberHolder; moveType.value = Type.STELLAR; @@ -9643,7 +9643,8 @@ export function initMoves() { new AttackMove(Moves.TERA_STARSTORM, Type.NORMAL, MoveCategory.SPECIAL, 120, 100, 5, -1, 0, 9) .attr(TeraMoveCategoryAttr) .attr(TeraStarstormTypeAttr) - .attr(VariableTargetAttr, (user, target, move) => user.species.speciesId === Species.TERAPAGOS && user.isTerastallized() ? MoveTarget.ALL_NEAR_ENEMIES : MoveTarget.NEAR_OTHER), + .attr(VariableTargetAttr, (user, target, move) => (user.fusionSpecies?.speciesId === Species.TERAPAGOS || user.species.speciesId === Species.TERAPAGOS) && user.isTerastallized() ? MoveTarget.ALL_NEAR_ENEMIES : MoveTarget.NEAR_OTHER) + .partial(), // Does not ignore abilities that affect stats new AttackMove(Moves.FICKLE_BEAM, Type.DRAGON, MoveCategory.SPECIAL, 80, 100, 5, 30, 0, 9) .attr(PreMoveMessageAttr, doublePowerChanceMessageFunc) .attr(DoublePowerChanceAttr), diff --git a/src/test/moves/tera_starstorm.test.ts b/src/test/moves/tera_starstorm.test.ts index bb77471ed90..3ccd63e322e 100644 --- a/src/test/moves/tera_starstorm.test.ts +++ b/src/test/moves/tera_starstorm.test.ts @@ -24,8 +24,8 @@ describe("Moves - Tera Starstorm", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override - .moveset([Moves.TERA_STARSTORM]) - .battleType("single") + .moveset([Moves.TERA_STARSTORM, Moves.SPLASH]) + .battleType("double") .enemyAbility(Abilities.BALL_FETCH) .enemyMoveset(Moves.SPLASH) .enemyLevel(30) @@ -34,6 +34,7 @@ describe("Moves - Tera Starstorm", () => { }); it("changes type to Stellar when used by Terapagos in its Stellar Form", async () => { + game.override.battleType("single"); await game.classicMode.startBattle([Species.TERAPAGOS]); const terapagos = game.scene.getPlayerPokemon()!; @@ -48,8 +49,6 @@ describe("Moves - Tera Starstorm", () => { }); it("targets both opponents in a double battle when used by Terapagos in its Stellar Form", async () => { - game.override.battleType("double"); - await game.classicMode.startBattle([Species.MAGIKARP, Species.TERAPAGOS]); game.move.select(Moves.TERA_STARSTORM, 0, BattlerIndex.ENEMY); @@ -67,4 +66,33 @@ describe("Moves - Tera Starstorm", () => { await game.phaseInterceptor.to("MoveEndPhase"); expect(enemyField.every(pokemon => pokemon.isFullHp())).toBe(false); }); + + it("applies the effects when Terapagos in Stellar Form is fused with another Pokemon", async () => { + await game.classicMode.startBattle([Species.TERAPAGOS, Species.MAGIKARP, Species.CHARMANDER]); + + const fusionedMon = game.scene.getParty()[0]; + const magikarp = game.scene.getParty()[2]; + + // Fuse party members (taken from PlayerPokemon.fuse(...) function) + fusionedMon.fusionSpecies = magikarp.species; + fusionedMon.fusionFormIndex = magikarp.formIndex; + fusionedMon.fusionAbilityIndex = magikarp.abilityIndex; + fusionedMon.fusionShiny = magikarp.shiny; + fusionedMon.fusionVariant = magikarp.variant; + fusionedMon.fusionGender = magikarp.gender; + fusionedMon.fusionLuck = magikarp.luck; + + vi.spyOn(fusionedMon, "getMoveType"); + + game.move.select(Moves.TERA_STARSTORM, 0); + game.move.select(Moves.SPLASH, 1); + await game.phaseInterceptor.to("TurnEndPhase"); + + // Fusion and terastallized + expect(fusionedMon.isFusion()).toBe(true); + expect(fusionedMon.isTerastallized()).toBe(true); + // Move effects should be applied + expect(fusionedMon.getMoveType).toHaveReturnedWith(Type.STELLAR); + expect(game.scene.getEnemyField().every(pokemon => pokemon.isFullHp())).toBe(false); + }); });