From 622e077520a80c81907a5669e3caf6c01d7e8bad Mon Sep 17 00:00:00 2001 From: flx-sta <50131232+flx-sta@users.noreply.github.com> Date: Fri, 16 Aug 2024 22:43:05 +0200 Subject: [PATCH] add test to make sure pkm are not healed on evolve --- src/test/evolution.test.ts | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/src/test/evolution.test.ts b/src/test/evolution.test.ts index c935d1a9ecd..319ce7f9d7a 100644 --- a/src/test/evolution.test.ts +++ b/src/test/evolution.test.ts @@ -106,15 +106,47 @@ describe("Evolution", () => { const totodile = game.scene.getPlayerPokemon()!; const hpBefore = totodile.hp; - const enemyGolem = game.scene.getEnemyPokemon()!; - enemyGolem.hp = 1; - expect(totodile.hp).toBe(totodile.getMaxHp()); + const golem = game.scene.getEnemyPokemon()!; + golem.hp = 1; + + expect(golem.hp).toBe(1); + game.doAttack(getMovePosition(game.scene, 0, Moves.SURF)); await game.phaseInterceptor.to("EvolutionPhase"); expect(totodile.hp).toBe(totodile.getMaxHp()); expect(totodile.hp).toBeGreaterThan(hpBefore); }, TIMEOUT); + + it("should not fully heal HP when evolving", async () => { + game.override.moveset([Moves.SURF]) + .enemySpecies(Species.GOLEM) + .enemyMoveset(SPLASH_ONLY) + .startingWave(21) + .startingLevel(16) + .enemyLevel(50); + + await game.startBattle([Species.TOTODILE]); + + const totodile = game.scene.getPlayerPokemon()!; + totodile.hp = totodile.getMaxHp() / 2; + const hpBefore = totodile.hp; + const maxHpBefore = totodile.getMaxHp(); + + expect(totodile.hp).toBe(totodile.getMaxHp() / 2); + + const golem = game.scene.getEnemyPokemon()!; + golem.hp = 1; + + expect(golem.hp).toBe(1); + + game.doAttack(getMovePosition(game.scene, 0, Moves.SURF)); + await game.phaseInterceptor.to("EvolutionPhase"); + + expect(totodile.getMaxHp()).toBeGreaterThan(maxHpBefore); + expect(totodile.hp).toBeGreaterThan(hpBefore); + expect(totodile.hp).toBeLessThan(totodile.getMaxHp()); + }, TIMEOUT); });