From 0a661b9a6cf89b17b2bfb069ca38100ef829d037 Mon Sep 17 00:00:00 2001 From: JM-portatil Date: Tue, 10 Jun 2025 01:04:58 +0100 Subject: [PATCH 1/4] Fur Coat fix --- src/data/abilities/ability.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/abilities/ability.ts b/src/data/abilities/ability.ts index 128e772217f..23140d1bb7f 100644 --- a/src/data/abilities/ability.ts +++ b/src/data/abilities/ability.ts @@ -8737,7 +8737,7 @@ export function initAbilities() { .attr(PokemonTypeChangeAbAttr), //.condition((p) => !p.summonData.abilitiesApplied.includes(AbilityId.PROTEAN)), //Gen 9 Implementation new Ability(AbilityId.FUR_COAT, 6) - .attr(ReceivedMoveDamageMultiplierAbAttr, (_target, _user, move) => move.category === MoveCategory.PHYSICAL, 0.5) + .attr(ReceivedMoveDamageMultiplierAbAttr, (_target, _user, move) => move.category === MoveCategory.PHYSICAL || move.id === MoveId.PSYSHOCK || move.id === MoveId.PSYSTRIKE || move.id === MoveId.SECRET_SWORD, 0.5) .ignorable(), new Ability(AbilityId.MAGICIAN, 6) .attr(PostAttackStealHeldItemAbAttr), From eec986b58358894e39c5db407f4e7956d953dace Mon Sep 17 00:00:00 2001 From: JM-portatil Date: Thu, 12 Jun 2025 11:16:34 +0100 Subject: [PATCH 2/4] [Update Fur Coat ability to reduce damage from DefDefAttr moves and test added --- src/data/abilities/ability.ts | 2 +- test/abilities/fur_coat.test.ts | 105 ++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 test/abilities/fur_coat.test.ts diff --git a/src/data/abilities/ability.ts b/src/data/abilities/ability.ts index 23140d1bb7f..753c5b795db 100644 --- a/src/data/abilities/ability.ts +++ b/src/data/abilities/ability.ts @@ -8737,7 +8737,7 @@ export function initAbilities() { .attr(PokemonTypeChangeAbAttr), //.condition((p) => !p.summonData.abilitiesApplied.includes(AbilityId.PROTEAN)), //Gen 9 Implementation new Ability(AbilityId.FUR_COAT, 6) - .attr(ReceivedMoveDamageMultiplierAbAttr, (_target, _user, move) => move.category === MoveCategory.PHYSICAL || move.id === MoveId.PSYSHOCK || move.id === MoveId.PSYSTRIKE || move.id === MoveId.SECRET_SWORD, 0.5) + .attr(ReceivedMoveDamageMultiplierAbAttr, (_target, _user, move) => move.category === MoveCategory.PHYSICAL || move.hasAttr("DefDefAttr"), 0.5) .ignorable(), new Ability(AbilityId.MAGICIAN, 6) .attr(PostAttackStealHeldItemAbAttr), diff --git a/test/abilities/fur_coat.test.ts b/test/abilities/fur_coat.test.ts new file mode 100644 index 00000000000..e8d46ababe6 --- /dev/null +++ b/test/abilities/fur_coat.test.ts @@ -0,0 +1,105 @@ +import { AbilityId } from "#enums/ability-id"; +import { MoveId } from "#enums/move-id"; +import { SpeciesId } from "#enums/species-id"; +import GameManager from "#test/testUtils/gameManager"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; +import { allAbilities } from "#app/data/data-lists"; + +describe("Abilities - Fur Coat", () => { + let phaserGame: Phaser.Game; + let game: GameManager; + + beforeAll(() => { + phaserGame = new Phaser.Game({ + type: Phaser.HEADLESS, + }); + }); + + afterEach(() => { + game.phaseInterceptor.restoreOg(); + }); + + beforeEach(() => { + game = new GameManager(phaserGame); + game.override + .battleStyle("single") + .moveset([MoveId.TACKLE, MoveId.PSYSHOCK, MoveId.PSYSTRIKE, MoveId.SECRET_SWORD, MoveId.SCALD]) + .ability(AbilityId.BALL_FETCH) + .enemySpecies(SpeciesId.MINCCINO) + .enemyAbility(AbilityId.BALL_FETCH) + .enemyMoveset([MoveId.SPLASH]) + .disableCrits(); + }); + + it("should reduce damage from a physical move after gaining Fur Coat", async () => { + await game.classicMode.startBattle([SpeciesId.PIKACHU]); + const enemy = game.scene.getEnemyPokemon()!; + // Use Tackle before Fur Coat + game.move.select(MoveId.TACKLE); + await game.phaseInterceptor.to("TurnEndPhase"); + const damageBefore = enemy.getMaxHp() - enemy.hp; + // Give Fur Coat + enemy.setTempAbility(allAbilities[AbilityId.FUR_COAT]); + enemy.hp = enemy.getMaxHp(); + // Use Tackle after Fur Coat + game.move.select(MoveId.TACKLE); + await game.phaseInterceptor.to("TurnEndPhase"); + const damageAfter = enemy.getMaxHp() - enemy.hp; + expect(damageAfter).toBeLessThan(damageBefore); + }); + + it("should not reduce damage from a special move", async () => { + await game.classicMode.startBattle([SpeciesId.PIKACHU]); + const enemy = game.scene.getEnemyPokemon()!; + // Use Scald before Fur Coat + game.move.select(MoveId.SCALD); + await game.phaseInterceptor.to("TurnEndPhase"); + const damageBefore = enemy.getMaxHp() - enemy.hp; + // Give Fur Coat + enemy.setTempAbility(allAbilities[AbilityId.FUR_COAT]); + enemy.hp = enemy.getMaxHp(); + // Use Scald after Fur Coat + game.move.select(MoveId.SCALD); + await game.phaseInterceptor.to("TurnEndPhase"); + const damageAfter = enemy.getMaxHp() - enemy.hp; + expect(damageAfter).toBeCloseTo(damageBefore, 1); + }); + + it("should reduce damage from Psyshock, Psystrike, and Secret Sword after gaining Fur Coat", async () => { + await game.classicMode.startBattle([SpeciesId.PIKACHU]); + const enemy = game.scene.getEnemyPokemon()!; + // Test Psyshock + game.move.select(MoveId.PSYSHOCK); + await game.phaseInterceptor.to("TurnEndPhase"); + const psyshockBefore = enemy.getMaxHp() - enemy.hp; + enemy.setTempAbility(allAbilities[AbilityId.FUR_COAT]); + enemy.hp = enemy.getMaxHp(); + game.move.select(MoveId.PSYSHOCK); + await game.phaseInterceptor.to("TurnEndPhase"); + const psyshockAfter = enemy.getMaxHp() - enemy.hp; + expect(psyshockAfter).toBeLessThan(psyshockBefore); + // Test Psystrike + enemy.hp = enemy.getMaxHp(); + game.move.select(MoveId.PSYSTRIKE); + await game.phaseInterceptor.to("TurnEndPhase"); + const psystrikeBefore = enemy.getMaxHp() - enemy.hp; + enemy.setTempAbility(allAbilities[AbilityId.FUR_COAT]); + enemy.hp = enemy.getMaxHp(); + game.move.select(MoveId.PSYSTRIKE); + await game.phaseInterceptor.to("TurnEndPhase"); + const psystrikeAfter = enemy.getMaxHp() - enemy.hp; + expect(psystrikeAfter).toBeLessThan(psystrikeBefore); + // Test Secret Sword + enemy.hp = enemy.getMaxHp(); + game.move.select(MoveId.SECRET_SWORD); + await game.phaseInterceptor.to("TurnEndPhase"); + const secretSwordBefore = enemy.getMaxHp() - enemy.hp; + enemy.setTempAbility(allAbilities[AbilityId.FUR_COAT]); + enemy.hp = enemy.getMaxHp(); + game.move.select(MoveId.SECRET_SWORD); + await game.phaseInterceptor.to("TurnEndPhase"); + const secretSwordAfter = enemy.getMaxHp() - enemy.hp; + expect(secretSwordAfter).toBeLessThan(secretSwordBefore); + }); +}); From 9049e1b32bd19556760a181c3285b45a07304d12 Mon Sep 17 00:00:00 2001 From: NightKev <34855794+DayKev@users.noreply.github.com> Date: Thu, 12 Jun 2025 03:52:45 -0700 Subject: [PATCH 3/4] Fix Fur Coat tests --- test/abilities/fur_coat.test.ts | 81 ++++++++++++++------------------- 1 file changed, 33 insertions(+), 48 deletions(-) diff --git a/test/abilities/fur_coat.test.ts b/test/abilities/fur_coat.test.ts index e8d46ababe6..b418e0eb1a9 100644 --- a/test/abilities/fur_coat.test.ts +++ b/test/abilities/fur_coat.test.ts @@ -4,7 +4,6 @@ import { SpeciesId } from "#enums/species-id"; import GameManager from "#test/testUtils/gameManager"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; -import { allAbilities } from "#app/data/data-lists"; describe("Abilities - Fur Coat", () => { let phaserGame: Phaser.Game; @@ -24,82 +23,68 @@ describe("Abilities - Fur Coat", () => { game = new GameManager(phaserGame); game.override .battleStyle("single") - .moveset([MoveId.TACKLE, MoveId.PSYSHOCK, MoveId.PSYSTRIKE, MoveId.SECRET_SWORD, MoveId.SCALD]) .ability(AbilityId.BALL_FETCH) - .enemySpecies(SpeciesId.MINCCINO) + .enemySpecies(SpeciesId.MILOTIC) .enemyAbility(AbilityId.BALL_FETCH) .enemyMoveset([MoveId.SPLASH]) + .enemyLevel(20) .disableCrits(); }); it("should reduce damage from a physical move after gaining Fur Coat", async () => { await game.classicMode.startBattle([SpeciesId.PIKACHU]); - const enemy = game.scene.getEnemyPokemon()!; + const enemy = game.field.getEnemyPokemon(); // Use Tackle before Fur Coat - game.move.select(MoveId.TACKLE); - await game.phaseInterceptor.to("TurnEndPhase"); + game.move.use(MoveId.TACKLE); + await game.toEndOfTurn(); const damageBefore = enemy.getMaxHp() - enemy.hp; // Give Fur Coat - enemy.setTempAbility(allAbilities[AbilityId.FUR_COAT]); + game.field.mockAbility(enemy, AbilityId.FUR_COAT); enemy.hp = enemy.getMaxHp(); // Use Tackle after Fur Coat - game.move.select(MoveId.TACKLE); - await game.phaseInterceptor.to("TurnEndPhase"); + game.move.use(MoveId.TACKLE); + await game.toEndOfTurn(); const damageAfter = enemy.getMaxHp() - enemy.hp; expect(damageAfter).toBeLessThan(damageBefore); }); it("should not reduce damage from a special move", async () => { await game.classicMode.startBattle([SpeciesId.PIKACHU]); - const enemy = game.scene.getEnemyPokemon()!; + const enemy = game.field.getEnemyPokemon(); // Use Scald before Fur Coat - game.move.select(MoveId.SCALD); - await game.phaseInterceptor.to("TurnEndPhase"); + game.move.use(MoveId.SCALD); + await game.toEndOfTurn(); const damageBefore = enemy.getMaxHp() - enemy.hp; // Give Fur Coat - enemy.setTempAbility(allAbilities[AbilityId.FUR_COAT]); + game.field.mockAbility(enemy, AbilityId.FUR_COAT); enemy.hp = enemy.getMaxHp(); // Use Scald after Fur Coat - game.move.select(MoveId.SCALD); - await game.phaseInterceptor.to("TurnEndPhase"); + game.move.use(MoveId.SCALD); + await game.toEndOfTurn(); const damageAfter = enemy.getMaxHp() - enemy.hp; expect(damageAfter).toBeCloseTo(damageBefore, 1); }); - it("should reduce damage from Psyshock, Psystrike, and Secret Sword after gaining Fur Coat", async () => { + it.each([ + { moveName: "Psyshock", moveId: MoveId.PSYSHOCK }, + { moveName: "Psystrike", moveId: MoveId.PSYSTRIKE }, + { moveName: "Secret Sword", moveId: MoveId.SECRET_SWORD }, + ])("should reduce damage from $moveName after gaining Fur Coat", async ({ moveId }) => { await game.classicMode.startBattle([SpeciesId.PIKACHU]); - const enemy = game.scene.getEnemyPokemon()!; - // Test Psyshock - game.move.select(MoveId.PSYSHOCK); - await game.phaseInterceptor.to("TurnEndPhase"); - const psyshockBefore = enemy.getMaxHp() - enemy.hp; - enemy.setTempAbility(allAbilities[AbilityId.FUR_COAT]); + const enemy = game.field.getEnemyPokemon(); + + game.move.use(moveId); + await game.toEndOfTurn(); + + const attackDamageBefore = enemy.getMaxHp() - enemy.hp; + + game.field.mockAbility(enemy, AbilityId.FUR_COAT); enemy.hp = enemy.getMaxHp(); - game.move.select(MoveId.PSYSHOCK); - await game.phaseInterceptor.to("TurnEndPhase"); - const psyshockAfter = enemy.getMaxHp() - enemy.hp; - expect(psyshockAfter).toBeLessThan(psyshockBefore); - // Test Psystrike - enemy.hp = enemy.getMaxHp(); - game.move.select(MoveId.PSYSTRIKE); - await game.phaseInterceptor.to("TurnEndPhase"); - const psystrikeBefore = enemy.getMaxHp() - enemy.hp; - enemy.setTempAbility(allAbilities[AbilityId.FUR_COAT]); - enemy.hp = enemy.getMaxHp(); - game.move.select(MoveId.PSYSTRIKE); - await game.phaseInterceptor.to("TurnEndPhase"); - const psystrikeAfter = enemy.getMaxHp() - enemy.hp; - expect(psystrikeAfter).toBeLessThan(psystrikeBefore); - // Test Secret Sword - enemy.hp = enemy.getMaxHp(); - game.move.select(MoveId.SECRET_SWORD); - await game.phaseInterceptor.to("TurnEndPhase"); - const secretSwordBefore = enemy.getMaxHp() - enemy.hp; - enemy.setTempAbility(allAbilities[AbilityId.FUR_COAT]); - enemy.hp = enemy.getMaxHp(); - game.move.select(MoveId.SECRET_SWORD); - await game.phaseInterceptor.to("TurnEndPhase"); - const secretSwordAfter = enemy.getMaxHp() - enemy.hp; - expect(secretSwordAfter).toBeLessThan(secretSwordBefore); + + game.move.use(moveId); + await game.toEndOfTurn(); + + const attackDamageAfter = enemy.getMaxHp() - enemy.hp; + expect(attackDamageAfter).toBeLessThan(attackDamageBefore); }); }); From 231c88f8fc003af5550ca973ac822801a9a68938 Mon Sep 17 00:00:00 2001 From: NightKev <34855794+DayKev@users.noreply.github.com> Date: Thu, 19 Jun 2025 17:10:34 -0700 Subject: [PATCH 4/4] Fix test due to merge issue --- test/abilities/fur_coat.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/abilities/fur_coat.test.ts b/test/abilities/fur_coat.test.ts index b418e0eb1a9..0211072fd6d 100644 --- a/test/abilities/fur_coat.test.ts +++ b/test/abilities/fur_coat.test.ts @@ -28,7 +28,7 @@ describe("Abilities - Fur Coat", () => { .enemyAbility(AbilityId.BALL_FETCH) .enemyMoveset([MoveId.SPLASH]) .enemyLevel(20) - .disableCrits(); + .criticalHits(false); }); it("should reduce damage from a physical move after gaining Fur Coat", async () => {