From 194f352dda65cc7058775f069f6d433b1472c03f Mon Sep 17 00:00:00 2001 From: Christopher Schmidt Date: Sat, 29 Mar 2025 11:02:18 -0400 Subject: [PATCH] Adds grip claw and multi lens tests --- test/items/grip_claw.test.ts | 25 +++++++++++++++++++++++++ test/items/multi_lens.test.ts | 17 +++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/test/items/grip_claw.test.ts b/test/items/grip_claw.test.ts index 1d169006116..aa7c23ca43d 100644 --- a/test/items/grip_claw.test.ts +++ b/test/items/grip_claw.test.ts @@ -98,6 +98,31 @@ describe("Items - Grip Claw", () => { expect(enemy1HeldItemCountsAfter).toBe(enemy1HeldItemCount); expect(enemy2HeldItemCountsAfter).toBe(enemy2HeldItemCount); }); + + it("should not allow Pollen Puff to steal items when healing ally", async () => { + game.override + .battleType("double") + .moveset([Moves.POLLEN_PUFF, Moves.ENDURE]) + .startingHeldItems([ + { name: "GRIP_CLAW", count: 1 }, + { name: "BERRY", type: BerryType.LUM, count: 1 }, + ]); + await game.classicMode.startBattle([Species.BULBASAUR, Species.OMANYTE]); + + const [leftPokemon, rightPokemon] = game.scene.getPlayerField(); + + const gripClaw = leftPokemon.getHeldItems()[0] as ContactHeldItemTransferChanceModifier; + vi.spyOn(gripClaw, "chance", "get").mockReturnValue(100); + + const heldItemCountBefore = getHeldItemCount(rightPokemon); + + game.move.select(Moves.POLLEN_PUFF, 0, BattlerIndex.PLAYER_2); + game.move.select(Moves.ENDURE, 1); + + await game.toNextTurn(); + + expect(getHeldItemCount(rightPokemon)).toBe(heldItemCountBefore); + }); }); /* diff --git a/test/items/multi_lens.test.ts b/test/items/multi_lens.test.ts index 90e73ae88ea..176e8213f55 100644 --- a/test/items/multi_lens.test.ts +++ b/test/items/multi_lens.test.ts @@ -211,4 +211,21 @@ describe("Items - Multi Lens", () => { // TODO: Update hit count to 1 once Future Sight is fixed to not activate held items if user is off the field expect(enemyPokemon.damageAndUpdate).toHaveBeenCalledTimes(2); }); + + it("should not allow Pollen Puff to heal ally more than once", async () => { + game.override.battleType("double").moveset([Moves.POLLEN_PUFF, Moves.ENDURE]); + await game.classicMode.startBattle([Species.BULBASAUR, Species.OMANYTE]); + + const [, rightPokemon] = game.scene.getPlayerField(); + + rightPokemon.damageAndUpdate(rightPokemon.hp - 1); + + game.move.select(Moves.POLLEN_PUFF, 0, BattlerIndex.PLAYER_2); + game.move.select(Moves.ENDURE, 1); + + await game.toNextTurn(); + + // Pollen Puff heals with a ratio of 0.5, as long as Pollen Puff triggers only once the pokemon will always be <= (0.5 * Max HP) + 1 + expect(rightPokemon.hp).toBeLessThanOrEqual(0.5 * rightPokemon.getMaxHp() + 1); + }); });