From f34be918911ab9f61edcbe8213faed5fdaa02c23 Mon Sep 17 00:00:00 2001 From: Acelynn Zhang <102631387+acelynnzhang@users.noreply.github.com> Date: Wed, 20 Aug 2025 20:10:54 -0500 Subject: [PATCH] [Ability] Embody Aspect now triggers on switch-in while Terastallized (#6294) * Fix Embody Aspect triggers * Use selectWithTera * apply suggestions --------- Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> --- src/data/abilities/ability.ts | 6 ++- test/abilities/embody-aspect.test.ts | 70 ++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 test/abilities/embody-aspect.test.ts diff --git a/src/data/abilities/ability.ts b/src/data/abilities/ability.ts index 21c4d45584e..2352ab8f704 100644 --- a/src/data/abilities/ability.ts +++ b/src/data/abilities/ability.ts @@ -7833,22 +7833,26 @@ export function initAbilities() { new Ability(AbilityId.TOXIC_CHAIN, 9) .attr(PostAttackApplyStatusEffectAbAttr, false, 30, StatusEffect.TOXIC), new Ability(AbilityId.EMBODY_ASPECT_TEAL, 9) - .attr(PostTeraFormChangeStatChangeAbAttr, [ Stat.SPD ], 1) + .attr(PostTeraFormChangeStatChangeAbAttr, [ Stat.SPD ], 1) // Activates immediately upon Terastallizing, as well as upon switching in while Terastallized + .conditionalAttr(pokemon => pokemon.isTerastallized, PostSummonStatStageChangeAbAttr, [ Stat.SPD ], 1, true) .uncopiable() .unreplaceable() // TODO is this true? .attr(NoTransformAbilityAbAttr), new Ability(AbilityId.EMBODY_ASPECT_WELLSPRING, 9) .attr(PostTeraFormChangeStatChangeAbAttr, [ Stat.SPDEF ], 1) + .conditionalAttr(pokemon => pokemon.isTerastallized, PostSummonStatStageChangeAbAttr, [ Stat.SPDEF ], 1, true) .uncopiable() .unreplaceable() .attr(NoTransformAbilityAbAttr), new Ability(AbilityId.EMBODY_ASPECT_HEARTHFLAME, 9) .attr(PostTeraFormChangeStatChangeAbAttr, [ Stat.ATK ], 1) + .conditionalAttr(pokemon => pokemon.isTerastallized, PostSummonStatStageChangeAbAttr, [ Stat.ATK ], 1, true) .uncopiable() .unreplaceable() .attr(NoTransformAbilityAbAttr), new Ability(AbilityId.EMBODY_ASPECT_CORNERSTONE, 9) .attr(PostTeraFormChangeStatChangeAbAttr, [ Stat.DEF ], 1) + .conditionalAttr(pokemon => pokemon.isTerastallized, PostSummonStatStageChangeAbAttr, [ Stat.DEF ], 1, true) .uncopiable() .unreplaceable() .attr(NoTransformAbilityAbAttr), diff --git a/test/abilities/embody-aspect.test.ts b/test/abilities/embody-aspect.test.ts new file mode 100644 index 00000000000..2c882c78383 --- /dev/null +++ b/test/abilities/embody-aspect.test.ts @@ -0,0 +1,70 @@ +import { AbilityId } from "#enums/ability-id"; +import { MoveId } from "#enums/move-id"; +import { SpeciesId } from "#enums/species-id"; +import { Stat } from "#enums/stat"; +import { GameManager } from "#test/test-utils/game-manager"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; + +describe("Ability - Embody Aspect", () => { + let phaserGame: Phaser.Game; + let game: GameManager; + + const teraForm = 4; + const baseForm = 0; + + beforeAll(() => { + phaserGame = new Phaser.Game({ + type: Phaser.HEADLESS, + }); + }); + + afterEach(() => { + game.phaseInterceptor.restoreOg(); + }); + + beforeEach(() => { + game = new GameManager(phaserGame); + game.override + .moveset([MoveId.SPLASH]) + .ability(AbilityId.EMBODY_ASPECT_TEAL) + .battleStyle("single") + .criticalHits(false) + .enemySpecies(SpeciesId.MAGIKARP) + .enemyMoveset(MoveId.SPLASH); + }); + + it("should activate on switch-in if user is Terastallized", async () => { + await game.classicMode.startBattle([SpeciesId.OGERPON, SpeciesId.ABOMASNOW]); + + const ogerpon = game.field.getPlayerPokemon(); + expect(ogerpon.formIndex).toBe(baseForm); + expect(ogerpon).toHaveStatStage(Stat.SPD, 0); + + //Terastallize Ogerpon + game.move.selectWithTera(MoveId.SPLASH); + await game.phaseInterceptor.to("QuietFormChangePhase"); + + expect(ogerpon.formIndex).toBe(teraForm); + + await game.toNextTurn(); + + expect(ogerpon).toHaveStatStage(Stat.SPD, 1); + expect(ogerpon).toHaveAbilityApplied(AbilityId.EMBODY_ASPECT_TEAL); + + // Clear out abilities applied set so we can check it again later + ogerpon.waveData.abilitiesApplied.clear(); + + //Switch ogerpon out + game.doSwitchPokemon(1); + await game.toNextTurn(); + + //Switch ogerpon back in + game.doSwitchPokemon(1); + await game.toNextTurn(); + + //Ability activated again + expect(ogerpon).toHaveStatStage(Stat.SPD, 1); + expect(ogerpon).toHaveAbilityApplied(AbilityId.EMBODY_ASPECT_TEAL); + }); +});