mirror of
				https://github.com/pagefaultgames/pokerogue.git
				synced 2025-10-26 05:55:53 +01:00 
			
		
		
		
	* Move game-mode to its own file Reduces circular imports to 325 * Move battler-index to own file Reduces circular deps to 314 * Move trainer-variant to own file Reduces circ deps to 313 * Move enums in pokemon to their own file * Move arena-tag-type to its own file * Move pokemon-moves to its own file * Move command to own file * Move learnMoveType to own file * Move form change item to own file * Move battlerTagLapseType to own file * Move anim enums to own shared file * Move enums out of challenges * Move species form change triggers to own file Reduces circ imports to 291 * Update test importing pokemon move * Replace move attribute imports with string names * Untangle circular deps from game data * Fix missing string call in switch summon phase * Apply kev's suggestions from code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Ensure ChargeMove's is method calls super * Use InstanceType for proper narrowing * Apply kev's suggestions from code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
		
			
				
	
	
		
			134 lines
		
	
	
		
			4.2 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			134 lines
		
	
	
		
			4.2 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import { BattlerIndex } from "#enums/battler-index";
 | |
| import { PokemonType } from "#enums/pokemon-type";
 | |
| import { MoveId } from "#enums/move-id";
 | |
| import { SpeciesId } from "#enums/species-id";
 | |
| import { Stat } from "#app/enums/stat";
 | |
| import { AbilityId } from "#enums/ability-id";
 | |
| import GameManager from "#test/testUtils/gameManager";
 | |
| import Phaser from "phaser";
 | |
| import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
 | |
| 
 | |
| describe("Moves - Tar Shot", () => {
 | |
|   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")
 | |
|       .enemyAbility(AbilityId.BALL_FETCH)
 | |
|       .enemyMoveset(MoveId.SPLASH)
 | |
|       .enemySpecies(SpeciesId.TANGELA)
 | |
|       .enemyLevel(1000)
 | |
|       .moveset([MoveId.TAR_SHOT, MoveId.FIRE_PUNCH])
 | |
|       .disableCrits();
 | |
|   });
 | |
| 
 | |
|   it("lowers the target's Speed stat by one stage and doubles the effectiveness of Fire-type moves used on the target", async () => {
 | |
|     await game.classicMode.startBattle([SpeciesId.PIKACHU]);
 | |
| 
 | |
|     const enemy = game.scene.getEnemyPokemon()!;
 | |
| 
 | |
|     vi.spyOn(enemy, "getMoveEffectiveness");
 | |
| 
 | |
|     game.move.select(MoveId.TAR_SHOT);
 | |
| 
 | |
|     await game.phaseInterceptor.to("TurnEndPhase");
 | |
|     expect(enemy.getStatStage(Stat.SPD)).toBe(-1);
 | |
| 
 | |
|     await game.toNextTurn();
 | |
| 
 | |
|     game.move.select(MoveId.FIRE_PUNCH);
 | |
|     await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
 | |
| 
 | |
|     await game.phaseInterceptor.to("MoveEndPhase");
 | |
|     expect(enemy.getMoveEffectiveness).toHaveReturnedWith(4);
 | |
|   });
 | |
| 
 | |
|   it("will not double the effectiveness of Fire-type moves used on a target that is already under the effect of Tar Shot (but may still lower its Speed)", async () => {
 | |
|     await game.classicMode.startBattle([SpeciesId.PIKACHU]);
 | |
| 
 | |
|     const enemy = game.scene.getEnemyPokemon()!;
 | |
| 
 | |
|     vi.spyOn(enemy, "getMoveEffectiveness");
 | |
| 
 | |
|     game.move.select(MoveId.TAR_SHOT);
 | |
| 
 | |
|     await game.phaseInterceptor.to("TurnEndPhase");
 | |
|     expect(enemy.getStatStage(Stat.SPD)).toBe(-1);
 | |
| 
 | |
|     await game.toNextTurn();
 | |
| 
 | |
|     game.move.select(MoveId.TAR_SHOT);
 | |
| 
 | |
|     await game.phaseInterceptor.to("TurnEndPhase");
 | |
|     expect(enemy.getStatStage(Stat.SPD)).toBe(-2);
 | |
| 
 | |
|     await game.toNextTurn();
 | |
| 
 | |
|     game.move.select(MoveId.FIRE_PUNCH);
 | |
|     await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
 | |
| 
 | |
|     await game.phaseInterceptor.to("MoveEndPhase");
 | |
|     expect(enemy.getMoveEffectiveness).toHaveReturnedWith(4);
 | |
|   });
 | |
| 
 | |
|   it("does not double the effectiveness of Fire-type moves against a Pokémon that is Terastallized", async () => {
 | |
|     game.override.enemySpecies(SpeciesId.SPRIGATITO);
 | |
|     await game.classicMode.startBattle([SpeciesId.PIKACHU]);
 | |
| 
 | |
|     const enemy = game.scene.getEnemyPokemon()!;
 | |
|     enemy.teraType = PokemonType.GRASS;
 | |
|     enemy.isTerastallized = true;
 | |
| 
 | |
|     vi.spyOn(enemy, "getMoveEffectiveness");
 | |
| 
 | |
|     game.move.select(MoveId.TAR_SHOT);
 | |
| 
 | |
|     await game.phaseInterceptor.to("TurnEndPhase");
 | |
|     expect(enemy.getStatStage(Stat.SPD)).toBe(-1);
 | |
| 
 | |
|     await game.toNextTurn();
 | |
| 
 | |
|     game.move.select(MoveId.FIRE_PUNCH);
 | |
|     await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
 | |
| 
 | |
|     await game.phaseInterceptor.to("MoveEndPhase");
 | |
|     expect(enemy.getMoveEffectiveness).toHaveReturnedWith(2);
 | |
|   });
 | |
| 
 | |
|   it("doubles the effectiveness of Fire-type moves against a Pokémon that is already under the effects of Tar Shot before it Terastallized", async () => {
 | |
|     game.override.enemySpecies(SpeciesId.SPRIGATITO);
 | |
|     await game.classicMode.startBattle([SpeciesId.PIKACHU]);
 | |
| 
 | |
|     const enemy = game.scene.getEnemyPokemon()!;
 | |
| 
 | |
|     vi.spyOn(enemy, "getMoveEffectiveness");
 | |
| 
 | |
|     game.move.select(MoveId.TAR_SHOT);
 | |
| 
 | |
|     await game.phaseInterceptor.to("TurnEndPhase");
 | |
|     expect(enemy.getStatStage(Stat.SPD)).toBe(-1);
 | |
| 
 | |
|     await game.toNextTurn();
 | |
| 
 | |
|     enemy.teraType = PokemonType.GRASS;
 | |
|     enemy.isTerastallized = true;
 | |
| 
 | |
|     game.move.select(MoveId.FIRE_PUNCH);
 | |
|     await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
 | |
| 
 | |
|     await game.phaseInterceptor.to("MoveEndPhase");
 | |
|     expect(enemy.getMoveEffectiveness).toHaveReturnedWith(4);
 | |
|   });
 | |
| });
 |