mirror of
				https://github.com/pagefaultgames/pokerogue.git
				synced 2025-10-31 08:25:58 +01:00 
			
		
		
		
	* Rename `Abilities` to `AbilityId` * Rename `abilities.ts` to `ability-id.ts` * Rename `Moves` to `MoveId` * Rename `moves.ts` to `move-id.ts` * Rename `Species` to `SpeciesId` * Rename `species.ts` to `species-id.ts` * Rename `Biome` to `BiomeId` * Rename `biome.ts` to `biome-id.ts` * Replace `Abilities` with `AbilityId` in comments * Replace `Biome` with `BiomeId` in comments * Replace `Moves` with `MoveId` in comments * Replace `Species` with `SpeciesId` in comments
		
			
				
	
	
		
			170 lines
		
	
	
		
			5.9 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			170 lines
		
	
	
		
			5.9 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import { MoveId } from "#enums/move-id";
 | |
| import type Move from "#app/data/moves/move";
 | |
| import { AbilityId } from "#enums/ability-id";
 | |
| import { SpeciesId } from "#enums/species-id";
 | |
| import { BattlerIndex } from "#app/battle";
 | |
| import { MoveEffectPhase } from "#app/phases/move-effect-phase";
 | |
| import GameManager from "#test/testUtils/gameManager";
 | |
| import Phaser from "phaser";
 | |
| import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
 | |
| import { allMoves } from "#app/data/data-lists";
 | |
| 
 | |
| describe("Abilities - Supreme Overlord", () => {
 | |
|   let phaserGame: Phaser.Game;
 | |
|   let game: GameManager;
 | |
| 
 | |
|   let move: Move;
 | |
|   let basePower: number;
 | |
| 
 | |
|   beforeAll(() => {
 | |
|     phaserGame = new Phaser.Game({
 | |
|       type: Phaser.HEADLESS,
 | |
|     });
 | |
|   });
 | |
| 
 | |
|   afterEach(() => {
 | |
|     game.phaseInterceptor.restoreOg();
 | |
|   });
 | |
| 
 | |
|   beforeEach(() => {
 | |
|     move = allMoves[MoveId.TACKLE];
 | |
|     basePower = move.power;
 | |
|     game = new GameManager(phaserGame);
 | |
|     game.override
 | |
|       .battleStyle("single")
 | |
|       .enemySpecies(SpeciesId.MAGIKARP)
 | |
|       .enemyLevel(100)
 | |
|       .startingLevel(1)
 | |
|       .enemyAbility(AbilityId.BALL_FETCH)
 | |
|       .ability(AbilityId.SUPREME_OVERLORD)
 | |
|       .enemyMoveset([MoveId.SPLASH])
 | |
|       .moveset([MoveId.TACKLE, MoveId.EXPLOSION, MoveId.LUNAR_DANCE]);
 | |
| 
 | |
|     vi.spyOn(move, "calculateBattlePower");
 | |
|   });
 | |
| 
 | |
|   it("should increase Power by 20% if 2 Pokemon are fainted in the party", async () => {
 | |
|     await game.classicMode.startBattle([SpeciesId.BULBASAUR, SpeciesId.CHARMANDER, SpeciesId.SQUIRTLE]);
 | |
| 
 | |
|     game.move.select(MoveId.EXPLOSION);
 | |
|     await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
 | |
|     game.doSelectPartyPokemon(1);
 | |
|     await game.toNextTurn();
 | |
| 
 | |
|     game.move.select(MoveId.EXPLOSION);
 | |
|     await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
 | |
|     game.doSelectPartyPokemon(2);
 | |
|     await game.toNextTurn();
 | |
| 
 | |
|     game.move.select(MoveId.TACKLE);
 | |
|     await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
 | |
|     await game.phaseInterceptor.to(MoveEffectPhase);
 | |
| 
 | |
|     expect(move.calculateBattlePower).toHaveReturnedWith(basePower * 1.2);
 | |
|   });
 | |
| 
 | |
|   it("should increase Power by 30% if an ally fainted twice and another one once", async () => {
 | |
|     await game.classicMode.startBattle([SpeciesId.BULBASAUR, SpeciesId.CHARMANDER, SpeciesId.SQUIRTLE]);
 | |
| 
 | |
|     /**
 | |
|      * Bulbasur faints once
 | |
|      */
 | |
|     game.move.select(MoveId.EXPLOSION);
 | |
|     await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
 | |
|     game.doSelectPartyPokemon(1);
 | |
|     await game.toNextTurn();
 | |
| 
 | |
|     /**
 | |
|      * Charmander faints once
 | |
|      */
 | |
|     game.doRevivePokemon(1);
 | |
|     game.move.select(MoveId.EXPLOSION);
 | |
|     await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
 | |
|     game.doSelectPartyPokemon(1);
 | |
|     await game.toNextTurn();
 | |
| 
 | |
|     /**
 | |
|      * Bulbasur faints twice
 | |
|      */
 | |
|     game.move.select(MoveId.EXPLOSION);
 | |
|     await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
 | |
|     game.doSelectPartyPokemon(2);
 | |
|     await game.toNextTurn();
 | |
| 
 | |
|     game.move.select(MoveId.TACKLE);
 | |
|     await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
 | |
|     await game.phaseInterceptor.to(MoveEffectPhase);
 | |
| 
 | |
|     expect(move.calculateBattlePower).toHaveReturnedWith(basePower * 1.3);
 | |
|   });
 | |
| 
 | |
|   it("should maintain its power during next battle if it is within the same arena encounter", async () => {
 | |
|     game.override.enemySpecies(SpeciesId.MAGIKARP).startingWave(1).enemyLevel(1).startingLevel(100);
 | |
| 
 | |
|     await game.classicMode.startBattle([SpeciesId.BULBASAUR, SpeciesId.CHARMANDER, SpeciesId.SQUIRTLE]);
 | |
| 
 | |
|     /**
 | |
|      * The first Pokemon faints and another Pokemon in the party is selected.
 | |
|      */
 | |
|     game.move.select(MoveId.LUNAR_DANCE);
 | |
|     await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
 | |
|     game.doSelectPartyPokemon(1);
 | |
|     await game.toNextTurn();
 | |
| 
 | |
|     /**
 | |
|      * Enemy Pokemon faints and new wave is entered.
 | |
|      */
 | |
|     game.move.select(MoveId.TACKLE);
 | |
|     await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
 | |
|     await game.toNextWave();
 | |
| 
 | |
|     game.move.select(MoveId.TACKLE);
 | |
|     await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
 | |
|     await game.phaseInterceptor.to("TurnEndPhase");
 | |
| 
 | |
|     expect(move.calculateBattlePower).toHaveLastReturnedWith(basePower * 1.1);
 | |
|   });
 | |
| 
 | |
|   it("should reset playerFaints count if we enter new trainer battle", async () => {
 | |
|     game.override.enemySpecies(SpeciesId.MAGIKARP).startingWave(4).enemyLevel(1).startingLevel(100);
 | |
| 
 | |
|     await game.classicMode.startBattle([SpeciesId.BULBASAUR, SpeciesId.CHARMANDER, SpeciesId.SQUIRTLE]);
 | |
| 
 | |
|     game.move.select(MoveId.LUNAR_DANCE);
 | |
|     await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
 | |
|     game.doSelectPartyPokemon(1);
 | |
|     await game.toNextTurn();
 | |
| 
 | |
|     game.move.select(MoveId.TACKLE);
 | |
|     await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
 | |
|     await game.toNextWave();
 | |
| 
 | |
|     game.move.select(MoveId.TACKLE);
 | |
|     await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
 | |
|     await game.phaseInterceptor.to("BerryPhase", false);
 | |
| 
 | |
|     expect(move.calculateBattlePower).toHaveLastReturnedWith(basePower);
 | |
|   });
 | |
| 
 | |
|   it("should reset playerFaints count if we enter new biome", async () => {
 | |
|     game.override.enemySpecies(SpeciesId.MAGIKARP).startingWave(10).enemyLevel(1).startingLevel(100);
 | |
| 
 | |
|     await game.classicMode.startBattle([SpeciesId.BULBASAUR, SpeciesId.CHARMANDER, SpeciesId.SQUIRTLE]);
 | |
| 
 | |
|     game.move.select(MoveId.LUNAR_DANCE);
 | |
|     await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
 | |
|     game.doSelectPartyPokemon(1);
 | |
|     await game.toNextTurn();
 | |
| 
 | |
|     game.move.select(MoveId.TACKLE);
 | |
|     await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
 | |
|     await game.toNextWave();
 | |
| 
 | |
|     game.move.select(MoveId.TACKLE);
 | |
|     await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
 | |
|     await game.phaseInterceptor.to("BerryPhase", false);
 | |
| 
 | |
|     expect(move.calculateBattlePower).toHaveLastReturnedWith(basePower);
 | |
|   });
 | |
| });
 |