Use new test utils and type check function

This commit is contained in:
innerthunder 2024-08-29 22:14:48 -07:00
parent f58b371c3b
commit a3986b1fac
2 changed files with 19 additions and 20 deletions

View File

@ -570,7 +570,7 @@ export class PowderTag extends BattlerTag {
const movePhase = pokemon.scene.getCurrentPhase(); const movePhase = pokemon.scene.getCurrentPhase();
if (movePhase instanceof MovePhase) { if (movePhase instanceof MovePhase) {
const move = movePhase.move.getMove(); const move = movePhase.move.getMove();
if (move.type === Type.FIRE) { if (pokemon.getMoveType(move) === Type.FIRE) {
movePhase.cancel(); movePhase.cancel();
const cancelDamage = new Utils.BooleanHolder(false); const cancelDamage = new Utils.BooleanHolder(false);

View File

@ -4,7 +4,6 @@ import GameManager from "#test/utils/gameManager";
import { Abilities } from "#app/enums/abilities"; import { Abilities } from "#app/enums/abilities";
import { Moves } from "#app/enums/moves"; import { Moves } from "#app/enums/moves";
import { Species } from "#app/enums/species"; import { Species } from "#app/enums/species";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { BerryPhase } from "#app/phases/berry-phase"; import { BerryPhase } from "#app/phases/berry-phase";
import { MoveResult } from "#app/field/pokemon"; import { MoveResult } from "#app/field/pokemon";
import { Type } from "#app/data/type"; import { Type } from "#app/data/type";
@ -31,23 +30,23 @@ describe("Moves - Powder", () => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override.battleType("single"); game.override.battleType("single");
game.override.enemySpecies(Species.SNORLAX); game.override
game.override.enemyLevel(100); .enemySpecies(Species.SNORLAX)
game.override.enemyMoveset(Array(4).fill(Moves.EMBER)); .enemyLevel(100)
game.override.enemyAbility(Abilities.INSOMNIA); .enemyMoveset(Array(4).fill(Moves.EMBER))
.enemyAbility(Abilities.INSOMNIA)
game.override.startingLevel(100); .startingLevel(100)
game.override.moveset([Moves.POWDER, Moves.SPLASH, Moves.FIERY_DANCE]); .moveset([Moves.POWDER, Moves.SPLASH, Moves.FIERY_DANCE]);
}); });
it( it(
"should cancel the target's Fire-type move and damage the target", "should cancel the target's Fire-type move and damage the target",
async () => { async () => {
await game.startBattle([Species.CHARIZARD]); await game.classicMode.startBattle([Species.CHARIZARD]);
const enemyPokemon = game.scene.getEnemyPokemon()!; const enemyPokemon = game.scene.getEnemyPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.POWDER)); game.move.select(Moves.POWDER);
await game.phaseInterceptor.to(BerryPhase, false); await game.phaseInterceptor.to(BerryPhase, false);
expect(enemyPokemon.getLastXMoves()[0].result).toBe(MoveResult.FAIL); expect(enemyPokemon.getLastXMoves()[0].result).toBe(MoveResult.FAIL);
@ -66,11 +65,11 @@ describe("Moves - Powder", () => {
async () => { async () => {
game.override.enemyAbility(Abilities.MAGIC_GUARD); game.override.enemyAbility(Abilities.MAGIC_GUARD);
await game.startBattle([Species.CHARIZARD]); await game.classicMode.startBattle([Species.CHARIZARD]);
const enemyPokemon = game.scene.getEnemyPokemon()!; const enemyPokemon = game.scene.getEnemyPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.POWDER)); game.move.select(Moves.POWDER);
await game.phaseInterceptor.to(BerryPhase, false); await game.phaseInterceptor.to(BerryPhase, false);
expect(enemyPokemon.getLastXMoves()[0].result).toBe(MoveResult.FAIL); expect(enemyPokemon.getLastXMoves()[0].result).toBe(MoveResult.FAIL);
@ -85,11 +84,11 @@ describe("Moves - Powder", () => {
.enemyMoveset(Array(4).fill(Moves.FLAME_WHEEL)) .enemyMoveset(Array(4).fill(Moves.FLAME_WHEEL))
.enemyStatusEffect(StatusEffect.FREEZE); .enemyStatusEffect(StatusEffect.FREEZE);
await game.startBattle([Species.CHARIZARD]); await game.classicMode.startBattle([Species.CHARIZARD]);
const enemyPokemon = game.scene.getEnemyPokemon()!; const enemyPokemon = game.scene.getEnemyPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.POWDER)); game.move.select(Moves.POWDER);
await game.phaseInterceptor.to(BerryPhase, false); await game.phaseInterceptor.to(BerryPhase, false);
expect(enemyPokemon.status?.effect).not.toBe(StatusEffect.FREEZE); expect(enemyPokemon.status?.effect).not.toBe(StatusEffect.FREEZE);
@ -103,11 +102,11 @@ describe("Moves - Powder", () => {
async () => { async () => {
game.override.enemyAbility(Abilities.PROTEAN); game.override.enemyAbility(Abilities.PROTEAN);
await game.startBattle([Species.CHARIZARD]); await game.classicMode.startBattle([Species.CHARIZARD]);
const enemyPokemon = game.scene.getEnemyPokemon()!; const enemyPokemon = game.scene.getEnemyPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.POWDER)); game.move.select(Moves.POWDER);
await game.phaseInterceptor.to(BerryPhase, false); await game.phaseInterceptor.to(BerryPhase, false);
expect(enemyPokemon.getLastXMoves()[0].result).toBe(MoveResult.FAIL); expect(enemyPokemon.getLastXMoves()[0].result).toBe(MoveResult.FAIL);
@ -123,12 +122,12 @@ describe("Moves - Powder", () => {
.enemySpecies(Species.BLASTOISE) .enemySpecies(Species.BLASTOISE)
.enemyAbility(Abilities.DANCER); .enemyAbility(Abilities.DANCER);
await game.startBattle([Species.CHARIZARD]); await game.classicMode.startBattle([Species.CHARIZARD]);
const playerPokemon = game.scene.getPlayerPokemon()!; const playerPokemon = game.scene.getPlayerPokemon()!;
const enemyPokemon = game.scene.getEnemyPokemon()!; const enemyPokemon = game.scene.getEnemyPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.FIERY_DANCE)); game.move.select(Moves.FIERY_DANCE);
await game.phaseInterceptor.to(MoveEffectPhase); await game.phaseInterceptor.to(MoveEffectPhase);
const enemyStartingHp = enemyPokemon.hp; const enemyStartingHp = enemyPokemon.hp;
@ -141,7 +140,7 @@ describe("Moves - Powder", () => {
}, TIMEOUT }, TIMEOUT
); );
it.todo("should cancel Hidden Power if it becomes a Fire-type move"); it.todo("should cancel Revelation Dance if it becomes a Fire-type move");
it.todo("should cancel Shell Trap and damage the target, even if the move would fail"); it.todo("should cancel Shell Trap and damage the target, even if the move would fail");
}); });