2024-09-02 22:12:34 -04:00
|
|
|
import { Stat } from "#enums/stat";
|
2024-08-22 06:49:33 -07:00
|
|
|
import { StatusEffect } from "#app/data/status-effect";
|
|
|
|
import { Type } from "#app/data/type";
|
|
|
|
import { BattlerTagType } from "#app/enums/battler-tag-type";
|
|
|
|
import { toDmgValue } from "#app/utils";
|
2024-07-25 16:47:50 -07:00
|
|
|
import { Abilities } from "#enums/abilities";
|
|
|
|
import { Moves } from "#enums/moves";
|
|
|
|
import { Species } from "#enums/species";
|
2024-08-06 07:06:25 -07:00
|
|
|
import GameManager from "#test/utils/gameManager";
|
2024-08-22 06:49:33 -07:00
|
|
|
import Phaser from "phaser";
|
2024-09-04 22:31:32 -07:00
|
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-09-20 14:05:45 -07:00
|
|
|
|
2024-06-26 13:03:14 -07:00
|
|
|
describe("Abilities - Parental Bond", () => {
|
|
|
|
let phaserGame: Phaser.Game;
|
|
|
|
let game: GameManager;
|
|
|
|
|
|
|
|
beforeAll(() => {
|
|
|
|
phaserGame = new Phaser.Game({
|
|
|
|
type: Phaser.HEADLESS,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
game.phaseInterceptor.restoreOg();
|
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
game = new GameManager(phaserGame);
|
2024-07-25 14:48:48 -07:00
|
|
|
game.override.battleType("single");
|
2024-07-25 16:18:47 -07:00
|
|
|
game.override.disableCrits();
|
2024-07-25 15:35:20 -07:00
|
|
|
game.override.ability(Abilities.PARENTAL_BOND);
|
2024-07-25 14:57:47 -07:00
|
|
|
game.override.enemySpecies(Species.SNORLAX);
|
2024-09-04 22:31:32 -07:00
|
|
|
game.override.enemyAbility(Abilities.FUR_COAT);
|
2024-09-09 09:55:11 -07:00
|
|
|
game.override.enemyMoveset(Moves.SPLASH);
|
2024-07-25 15:29:19 -07:00
|
|
|
game.override.startingLevel(100);
|
2024-07-25 16:10:38 -07:00
|
|
|
game.override.enemyLevel(100);
|
2024-06-26 13:03:14 -07:00
|
|
|
});
|
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
it(
|
|
|
|
"should add second strike to attack move",
|
2024-06-26 13:03:14 -07:00
|
|
|
async () => {
|
2024-10-04 13:08:31 +08:00
|
|
|
game.override.moveset([ Moves.TACKLE ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-07 09:23:12 -07:00
|
|
|
const leadPokemon = game.scene.getPlayerPokemon()!;
|
|
|
|
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
2024-06-26 13:03:14 -07:00
|
|
|
|
|
|
|
let enemyStartingHp = enemyPokemon.hp;
|
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.TACKLE);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("DamagePhase");
|
2024-06-26 13:03:14 -07:00
|
|
|
const firstStrikeDamage = enemyStartingHp - enemyPokemon.hp;
|
|
|
|
enemyStartingHp = enemyPokemon.hp;
|
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("BerryPhase", false);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
|
|
|
const secondStrikeDamage = enemyStartingHp - enemyPokemon.hp;
|
|
|
|
|
|
|
|
expect(leadPokemon.turnData.hitCount).toBe(2);
|
2024-08-22 14:39:11 +09:00
|
|
|
expect(secondStrikeDamage).toBe(toDmgValue(0.25 * firstStrikeDamage));
|
2024-09-20 14:05:45 -07:00
|
|
|
}
|
2024-06-26 13:03:14 -07:00
|
|
|
);
|
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
it(
|
|
|
|
"should apply secondary effects to both strikes",
|
2024-06-26 13:03:14 -07:00
|
|
|
async () => {
|
2024-10-04 13:08:31 +08:00
|
|
|
game.override.moveset([ Moves.POWER_UP_PUNCH ]);
|
2024-07-25 14:57:47 -07:00
|
|
|
game.override.enemySpecies(Species.AMOONGUSS);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-07 09:23:12 -07:00
|
|
|
const leadPokemon = game.scene.getPlayerPokemon()!;
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.POWER_UP_PUNCH);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("BerryPhase", false);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
|
|
|
expect(leadPokemon.turnData.hitCount).toBe(2);
|
2024-09-02 22:12:34 -04:00
|
|
|
expect(leadPokemon.getStatStage(Stat.ATK)).toBe(2);
|
2024-09-20 14:05:45 -07:00
|
|
|
}
|
2024-06-26 13:03:14 -07:00
|
|
|
);
|
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
it(
|
|
|
|
"should not apply to Status moves",
|
2024-06-26 13:03:14 -07:00
|
|
|
async () => {
|
2024-10-04 13:08:31 +08:00
|
|
|
game.override.moveset([ Moves.BABY_DOLL_EYES ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-07 09:23:12 -07:00
|
|
|
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.BABY_DOLL_EYES);
|
2024-09-04 22:31:32 -07:00
|
|
|
|
|
|
|
await game.phaseInterceptor.to("BerryPhase", false);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-09-02 22:12:34 -04:00
|
|
|
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(-1);
|
2024-09-20 14:05:45 -07:00
|
|
|
}
|
2024-06-26 13:03:14 -07:00
|
|
|
);
|
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
it(
|
|
|
|
"should not apply to multi-hit moves",
|
2024-06-26 13:03:14 -07:00
|
|
|
async () => {
|
2024-10-04 13:08:31 +08:00
|
|
|
game.override.moveset([ Moves.DOUBLE_HIT ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-07 09:23:12 -07:00
|
|
|
const leadPokemon = game.scene.getPlayerPokemon()!;
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.DOUBLE_HIT);
|
2024-08-09 22:37:10 +08:00
|
|
|
await game.move.forceHit();
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("BerryPhase", false);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
|
|
|
expect(leadPokemon.turnData.hitCount).toBe(2);
|
2024-09-20 14:05:45 -07:00
|
|
|
}
|
2024-06-26 13:03:14 -07:00
|
|
|
);
|
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
it(
|
|
|
|
"should not apply to self-sacrifice moves",
|
2024-06-26 13:03:14 -07:00
|
|
|
async () => {
|
2024-10-04 13:08:31 +08:00
|
|
|
game.override.moveset([ Moves.SELF_DESTRUCT ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-07 09:23:12 -07:00
|
|
|
const leadPokemon = game.scene.getPlayerPokemon()!;
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.SELF_DESTRUCT);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("DamagePhase", false);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
|
|
|
expect(leadPokemon.turnData.hitCount).toBe(1);
|
2024-09-20 14:05:45 -07:00
|
|
|
}
|
2024-06-26 13:03:14 -07:00
|
|
|
);
|
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
it(
|
|
|
|
"should not apply to Rollout",
|
2024-06-26 13:03:14 -07:00
|
|
|
async () => {
|
2024-10-04 13:08:31 +08:00
|
|
|
game.override.moveset([ Moves.ROLLOUT ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-07 09:23:12 -07:00
|
|
|
const leadPokemon = game.scene.getPlayerPokemon()!;
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.ROLLOUT);
|
2024-08-09 22:37:10 +08:00
|
|
|
await game.move.forceHit();
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("DamagePhase", false);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
|
|
|
expect(leadPokemon.turnData.hitCount).toBe(1);
|
2024-09-20 14:05:45 -07:00
|
|
|
}
|
2024-06-26 13:03:14 -07:00
|
|
|
);
|
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
it(
|
|
|
|
"should not apply multiplier to fixed-damage moves",
|
2024-06-26 13:03:14 -07:00
|
|
|
async () => {
|
2024-10-04 13:08:31 +08:00
|
|
|
game.override.moveset([ Moves.DRAGON_RAGE ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-07 09:23:12 -07:00
|
|
|
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.DRAGON_RAGE);
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("BerryPhase", false);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
expect(enemyPokemon.hp).toBe(enemyPokemon.getMaxHp() - 80);
|
2024-09-20 14:05:45 -07:00
|
|
|
}
|
2024-06-26 13:03:14 -07:00
|
|
|
);
|
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
it(
|
|
|
|
"should not apply multiplier to counter moves",
|
2024-06-26 13:03:14 -07:00
|
|
|
async () => {
|
2024-10-04 13:08:31 +08:00
|
|
|
game.override.moveset([ Moves.COUNTER ]);
|
|
|
|
game.override.enemyMoveset([ Moves.TACKLE ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.SHUCKLE ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-07 09:23:12 -07:00
|
|
|
const leadPokemon = game.scene.getPlayerPokemon()!;
|
|
|
|
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.COUNTER);
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("DamagePhase");
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
const playerDamage = leadPokemon.getMaxHp() - leadPokemon.hp;
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("BerryPhase", false);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
expect(enemyPokemon.hp).toBe(enemyPokemon.getMaxHp() - 4 * playerDamage);
|
2024-09-20 14:05:45 -07:00
|
|
|
}
|
2024-06-26 13:03:14 -07:00
|
|
|
);
|
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
it(
|
|
|
|
"should not apply to multi-target moves",
|
2024-06-26 13:03:14 -07:00
|
|
|
async () => {
|
2024-07-25 14:48:48 -07:00
|
|
|
game.override.battleType("double");
|
2024-10-04 13:08:31 +08:00
|
|
|
game.override.moveset([ Moves.EARTHQUAKE ]);
|
2024-09-04 22:31:32 -07:00
|
|
|
game.override.passiveAbility(Abilities.LEVITATE);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.MAGIKARP, Species.FEEBAS ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
|
|
|
const playerPokemon = game.scene.getPlayerField();
|
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.EARTHQUAKE);
|
|
|
|
game.move.select(Moves.EARTHQUAKE, 1);
|
2024-09-04 22:31:32 -07:00
|
|
|
|
|
|
|
await game.phaseInterceptor.to("BerryPhase", false);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
|
|
|
playerPokemon.forEach(p => expect(p.turnData.hitCount).toBe(1));
|
2024-09-20 14:05:45 -07:00
|
|
|
}
|
2024-06-26 13:03:14 -07:00
|
|
|
);
|
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
it(
|
|
|
|
"should apply to multi-target moves when hitting only one target",
|
2024-06-26 13:03:14 -07:00
|
|
|
async () => {
|
2024-10-04 13:08:31 +08:00
|
|
|
game.override.moveset([ Moves.EARTHQUAKE ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-07 09:23:12 -07:00
|
|
|
const leadPokemon = game.scene.getPlayerPokemon()!;
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.EARTHQUAKE);
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("DamagePhase", false);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
|
|
|
expect(leadPokemon.turnData.hitCount).toBe(2);
|
2024-09-20 14:05:45 -07:00
|
|
|
}
|
2024-06-26 13:03:14 -07:00
|
|
|
);
|
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
it(
|
|
|
|
"should only trigger post-target move effects once",
|
2024-06-26 13:03:14 -07:00
|
|
|
async () => {
|
2024-10-04 13:08:31 +08:00
|
|
|
game.override.moveset([ Moves.MIND_BLOWN ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-07 09:23:12 -07:00
|
|
|
const leadPokemon = game.scene.getPlayerPokemon()!;
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.MIND_BLOWN);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("DamagePhase", false);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
|
|
|
expect(leadPokemon.turnData.hitCount).toBe(2);
|
|
|
|
|
|
|
|
// This test will time out if the user faints
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("BerryPhase", false);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
expect(leadPokemon.hp).toBe(Math.ceil(leadPokemon.getMaxHp() / 2));
|
2024-09-20 14:05:45 -07:00
|
|
|
}
|
2024-06-26 13:03:14 -07:00
|
|
|
);
|
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
it(
|
|
|
|
"Burn Up only removes type after the second strike",
|
2024-06-26 13:03:14 -07:00
|
|
|
async () => {
|
2024-10-04 13:08:31 +08:00
|
|
|
game.override.moveset([ Moves.BURN_UP ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.CHARIZARD ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-07 09:23:12 -07:00
|
|
|
const leadPokemon = game.scene.getPlayerPokemon()!;
|
|
|
|
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.BURN_UP);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("MoveEffectPhase");
|
2024-06-26 13:03:14 -07:00
|
|
|
|
|
|
|
expect(leadPokemon.turnData.hitCount).toBe(2);
|
|
|
|
expect(enemyPokemon.hp).toBeGreaterThan(0);
|
|
|
|
expect(leadPokemon.isOfType(Type.FIRE)).toBe(true);
|
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("BerryPhase", false);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
|
|
|
expect(leadPokemon.isOfType(Type.FIRE)).toBe(false);
|
2024-09-20 14:05:45 -07:00
|
|
|
}
|
2024-06-26 13:03:14 -07:00
|
|
|
);
|
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
it(
|
2024-06-26 13:03:14 -07:00
|
|
|
"Moves boosted by this ability and Multi-Lens should strike 4 times",
|
|
|
|
async () => {
|
2024-10-04 13:08:31 +08:00
|
|
|
game.override.moveset([ Moves.TACKLE ]);
|
2024-08-22 06:49:33 -07:00
|
|
|
game.override.startingHeldItems([{ name: "MULTI_LENS", count: 1 }]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-07 09:23:12 -07:00
|
|
|
const leadPokemon = game.scene.getPlayerPokemon()!;
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.TACKLE);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("DamagePhase");
|
2024-06-26 13:03:14 -07:00
|
|
|
|
|
|
|
expect(leadPokemon.turnData.hitCount).toBe(4);
|
2024-09-20 14:05:45 -07:00
|
|
|
}
|
2024-06-26 13:03:14 -07:00
|
|
|
);
|
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
it(
|
2024-06-26 13:03:14 -07:00
|
|
|
"Super Fang boosted by this ability and Multi-Lens should strike twice",
|
|
|
|
async () => {
|
2024-10-04 13:08:31 +08:00
|
|
|
game.override.moveset([ Moves.SUPER_FANG ]);
|
2024-08-22 06:49:33 -07:00
|
|
|
game.override.startingHeldItems([{ name: "MULTI_LENS", count: 1 }]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-07 09:23:12 -07:00
|
|
|
const leadPokemon = game.scene.getPlayerPokemon()!;
|
|
|
|
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.SUPER_FANG);
|
2024-08-09 22:37:10 +08:00
|
|
|
await game.move.forceHit();
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("DamagePhase");
|
2024-06-26 13:03:14 -07:00
|
|
|
|
|
|
|
expect(leadPokemon.turnData.hitCount).toBe(2);
|
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("MoveEndPhase", false);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
expect(enemyPokemon.hp).toBe(Math.ceil(enemyPokemon.getMaxHp() * 0.25));
|
2024-09-20 14:05:45 -07:00
|
|
|
}
|
2024-06-26 13:03:14 -07:00
|
|
|
);
|
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
it(
|
2024-06-26 13:03:14 -07:00
|
|
|
"Seismic Toss boosted by this ability and Multi-Lens should strike twice",
|
|
|
|
async () => {
|
2024-10-04 13:08:31 +08:00
|
|
|
game.override.moveset([ Moves.SEISMIC_TOSS ]);
|
2024-08-22 06:49:33 -07:00
|
|
|
game.override.startingHeldItems([{ name: "MULTI_LENS", count: 1 }]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-07 09:23:12 -07:00
|
|
|
const leadPokemon = game.scene.getPlayerPokemon()!;
|
|
|
|
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
2024-06-26 13:03:14 -07:00
|
|
|
|
|
|
|
const enemyStartingHp = enemyPokemon.hp;
|
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.SEISMIC_TOSS);
|
2024-08-09 22:37:10 +08:00
|
|
|
await game.move.forceHit();
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("DamagePhase");
|
2024-06-26 13:03:14 -07:00
|
|
|
|
|
|
|
expect(leadPokemon.turnData.hitCount).toBe(2);
|
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("MoveEndPhase", false);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
|
|
|
expect(enemyPokemon.hp).toBe(enemyStartingHp - 200);
|
2024-09-20 14:05:45 -07:00
|
|
|
}
|
2024-06-26 13:03:14 -07:00
|
|
|
);
|
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
it(
|
2024-06-26 13:03:14 -07:00
|
|
|
"Hyper Beam boosted by this ability should strike twice, then recharge",
|
|
|
|
async () => {
|
2024-10-04 13:08:31 +08:00
|
|
|
game.override.moveset([ Moves.HYPER_BEAM ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-07 09:23:12 -07:00
|
|
|
const leadPokemon = game.scene.getPlayerPokemon()!;
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.HYPER_BEAM);
|
2024-08-09 22:37:10 +08:00
|
|
|
await game.move.forceHit();
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("DamagePhase");
|
2024-06-26 13:03:14 -07:00
|
|
|
|
|
|
|
expect(leadPokemon.turnData.hitCount).toBe(2);
|
|
|
|
expect(leadPokemon.getTag(BattlerTagType.RECHARGING)).toBeUndefined();
|
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("TurnEndPhase");
|
2024-06-26 13:03:14 -07:00
|
|
|
|
|
|
|
expect(leadPokemon.getTag(BattlerTagType.RECHARGING)).toBeDefined();
|
2024-09-20 14:05:45 -07:00
|
|
|
}
|
2024-06-26 13:03:14 -07:00
|
|
|
);
|
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
it(
|
2024-06-26 13:03:14 -07:00
|
|
|
"Anchor Shot boosted by this ability should only trap the target after the second hit",
|
|
|
|
async () => {
|
2024-10-04 13:08:31 +08:00
|
|
|
game.override.moveset([ Moves.ANCHOR_SHOT ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-07 09:23:12 -07:00
|
|
|
const leadPokemon = game.scene.getPlayerPokemon()!;
|
|
|
|
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.ANCHOR_SHOT);
|
2024-08-09 22:37:10 +08:00
|
|
|
await game.move.forceHit();
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("DamagePhase");
|
2024-06-26 13:03:14 -07:00
|
|
|
|
|
|
|
expect(leadPokemon.turnData.hitCount).toBe(2);
|
2024-09-04 22:31:32 -07:00
|
|
|
expect(enemyPokemon.getTag(BattlerTagType.TRAPPED)).toBeUndefined();
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("MoveEndPhase");
|
|
|
|
expect(enemyPokemon.getTag(BattlerTagType.TRAPPED)).toBeDefined();
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("TurnEndPhase");
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
expect(enemyPokemon.getTag(BattlerTagType.TRAPPED)).toBeDefined();
|
2024-09-20 14:05:45 -07:00
|
|
|
}
|
2024-06-26 13:03:14 -07:00
|
|
|
);
|
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
it(
|
2024-06-26 13:03:14 -07:00
|
|
|
"Smack Down boosted by this ability should only ground the target after the second hit",
|
|
|
|
async () => {
|
2024-10-04 13:08:31 +08:00
|
|
|
game.override.moveset([ Moves.SMACK_DOWN ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-07 09:23:12 -07:00
|
|
|
const leadPokemon = game.scene.getPlayerPokemon()!;
|
|
|
|
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.SMACK_DOWN);
|
2024-08-09 22:37:10 +08:00
|
|
|
await game.move.forceHit();
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("DamagePhase");
|
2024-06-26 13:03:14 -07:00
|
|
|
|
|
|
|
expect(leadPokemon.turnData.hitCount).toBe(2);
|
|
|
|
expect(enemyPokemon.getTag(BattlerTagType.IGNORE_FLYING)).toBeUndefined();
|
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("TurnEndPhase");
|
2024-06-26 13:03:14 -07:00
|
|
|
|
|
|
|
expect(enemyPokemon.getTag(BattlerTagType.IGNORE_FLYING)).toBeDefined();
|
2024-09-20 14:05:45 -07:00
|
|
|
}
|
2024-06-26 13:03:14 -07:00
|
|
|
);
|
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
it(
|
2024-06-26 13:03:14 -07:00
|
|
|
"U-turn boosted by this ability should strike twice before forcing a switch",
|
|
|
|
async () => {
|
2024-10-04 13:08:31 +08:00
|
|
|
game.override.moveset([ Moves.U_TURN ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.MAGIKARP, Species.BLASTOISE ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-07 09:23:12 -07:00
|
|
|
const leadPokemon = game.scene.getPlayerPokemon()!;
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.U_TURN);
|
2024-08-09 22:37:10 +08:00
|
|
|
await game.move.forceHit();
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("MoveEffectPhase");
|
2024-06-26 13:03:14 -07:00
|
|
|
expect(leadPokemon.turnData.hitCount).toBe(2);
|
|
|
|
|
|
|
|
// This will cause this test to time out if the switch was forced on the first hit.
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("MoveEffectPhase", false);
|
2024-09-20 14:05:45 -07:00
|
|
|
}
|
2024-06-26 13:03:14 -07:00
|
|
|
);
|
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
it(
|
2024-06-26 13:03:14 -07:00
|
|
|
"Wake-Up Slap boosted by this ability should only wake up the target after the second hit",
|
|
|
|
async () => {
|
2024-10-04 13:08:31 +08:00
|
|
|
game.override.moveset([ Moves.WAKE_UP_SLAP ]).enemyStatusEffect(StatusEffect.SLEEP);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-07 09:23:12 -07:00
|
|
|
const leadPokemon = game.scene.getPlayerPokemon()!;
|
|
|
|
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.WAKE_UP_SLAP);
|
2024-08-09 22:37:10 +08:00
|
|
|
await game.move.forceHit();
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("DamagePhase");
|
2024-06-26 13:03:14 -07:00
|
|
|
|
|
|
|
expect(leadPokemon.turnData.hitCount).toBe(2);
|
|
|
|
expect(enemyPokemon.status?.effect).toBe(StatusEffect.SLEEP);
|
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("BerryPhase", false);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
|
|
|
expect(enemyPokemon.status?.effect).toBeUndefined();
|
2024-09-20 14:05:45 -07:00
|
|
|
}
|
2024-06-26 13:03:14 -07:00
|
|
|
);
|
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
it(
|
|
|
|
"should not cause user to hit into King's Shield more than once",
|
2024-06-26 13:03:14 -07:00
|
|
|
async () => {
|
2024-10-04 13:08:31 +08:00
|
|
|
game.override.moveset([ Moves.TACKLE ]);
|
|
|
|
game.override.enemyMoveset([ Moves.KINGS_SHIELD ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-07 09:23:12 -07:00
|
|
|
const leadPokemon = game.scene.getPlayerPokemon()!;
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.TACKLE);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("BerryPhase", false);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-09-02 22:12:34 -04:00
|
|
|
expect(leadPokemon.getStatStage(Stat.ATK)).toBe(-1);
|
2024-09-20 14:05:45 -07:00
|
|
|
}
|
2024-06-26 13:03:14 -07:00
|
|
|
);
|
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
it(
|
|
|
|
"should not cause user to hit into Storm Drain more than once",
|
2024-06-26 13:03:14 -07:00
|
|
|
async () => {
|
2024-10-04 13:08:31 +08:00
|
|
|
game.override.moveset([ Moves.WATER_GUN ]);
|
2024-07-25 15:05:32 -07:00
|
|
|
game.override.enemyAbility(Abilities.STORM_DRAIN);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-07 09:23:12 -07:00
|
|
|
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.WATER_GUN);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("BerryPhase", false);
|
2024-06-26 13:03:14 -07:00
|
|
|
|
2024-09-02 22:12:34 -04:00
|
|
|
expect(enemyPokemon.getStatStage(Stat.SPATK)).toBe(1);
|
2024-09-20 14:05:45 -07:00
|
|
|
}
|
2024-06-26 13:03:14 -07:00
|
|
|
);
|
2024-06-26 18:05:03 -07:00
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
it(
|
|
|
|
"should not apply to multi-target moves with Multi-Lens",
|
2024-06-26 18:05:03 -07:00
|
|
|
async () => {
|
2024-07-25 14:48:48 -07:00
|
|
|
game.override.battleType("double");
|
2024-10-04 13:08:31 +08:00
|
|
|
game.override.moveset([ Moves.EARTHQUAKE, Moves.SPLASH ]);
|
2024-09-04 22:31:32 -07:00
|
|
|
game.override.passiveAbility(Abilities.LEVITATE);
|
2024-08-22 06:49:33 -07:00
|
|
|
game.override.startingHeldItems([{ name: "MULTI_LENS", count: 1 }]);
|
2024-06-26 18:05:03 -07:00
|
|
|
|
2024-10-04 13:08:31 +08:00
|
|
|
await game.classicMode.startBattle([ Species.MAGIKARP, Species.FEEBAS ]);
|
2024-06-26 18:05:03 -07:00
|
|
|
|
|
|
|
const enemyPokemon = game.scene.getEnemyField();
|
|
|
|
|
|
|
|
const enemyStartingHp = enemyPokemon.map(p => p.hp);
|
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
game.move.select(Moves.EARTHQUAKE);
|
|
|
|
game.move.select(Moves.SPLASH, 1);
|
2024-06-26 18:05:03 -07:00
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("DamagePhase");
|
2024-06-26 18:05:03 -07:00
|
|
|
const enemyFirstHitDamage = enemyStartingHp.map((hp, i) => hp - enemyPokemon[i].hp);
|
|
|
|
|
2024-09-04 22:31:32 -07:00
|
|
|
await game.phaseInterceptor.to("BerryPhase", false);
|
2024-06-26 18:05:03 -07:00
|
|
|
|
2024-08-22 06:49:33 -07:00
|
|
|
enemyPokemon.forEach((p, i) => expect(enemyStartingHp[i] - p.hp).toBe(2 * enemyFirstHitDamage[i]));
|
2024-09-20 14:05:45 -07:00
|
|
|
}
|
2024-06-26 18:05:03 -07:00
|
|
|
);
|
2024-06-26 13:03:14 -07:00
|
|
|
});
|