Stakeout should trigger if the enemy switches with U-Turn/etc
This commit is contained in:
parent
6442b8345f
commit
4265112f98
|
@ -5948,7 +5948,7 @@ export function initAbilities() {
|
||||||
.bypassFaint()
|
.bypassFaint()
|
||||||
.partial(), // Meteor form should protect against status effects and yawn
|
.partial(), // Meteor form should protect against status effects and yawn
|
||||||
new Ability(Abilities.STAKEOUT, 7)
|
new Ability(Abilities.STAKEOUT, 7)
|
||||||
.attr(MovePowerBoostAbAttr, (user, target, move) => user?.scene.currentBattle.turnCommands[target?.getBattlerIndex() ?? BattlerIndex.ATTACKER]?.command === Command.POKEMON, 2),
|
.attr(MovePowerBoostAbAttr, (user, target, move) => !!target?.turnData.switchedInThisTurn, 2),
|
||||||
new Ability(Abilities.WATER_BUBBLE, 7)
|
new Ability(Abilities.WATER_BUBBLE, 7)
|
||||||
.attr(ReceivedTypeDamageMultiplierAbAttr, Type.FIRE, 0.5)
|
.attr(ReceivedTypeDamageMultiplierAbAttr, Type.FIRE, 0.5)
|
||||||
.attr(MoveTypePowerBoostAbAttr, Type.WATER, 2)
|
.attr(MoveTypePowerBoostAbAttr, Type.WATER, 2)
|
||||||
|
|
|
@ -0,0 +1,85 @@
|
||||||
|
import { BattlerIndex } from "#app/battle";
|
||||||
|
import { isBetween } from "#app/utils";
|
||||||
|
import { Abilities } from "#enums/abilities";
|
||||||
|
import { Moves } from "#enums/moves";
|
||||||
|
import { Species } from "#enums/species";
|
||||||
|
import GameManager from "#test/utils/gameManager";
|
||||||
|
import Phaser from "phaser";
|
||||||
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||||
|
|
||||||
|
describe("Abilities - Stakeout", () => {
|
||||||
|
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
|
||||||
|
.moveset([ Moves.SPLASH, Moves.SURF ])
|
||||||
|
.ability(Abilities.STAKEOUT)
|
||||||
|
.battleType("single")
|
||||||
|
.disableCrits()
|
||||||
|
.startingLevel(100)
|
||||||
|
.enemyLevel(100)
|
||||||
|
.enemySpecies(Species.SNORLAX)
|
||||||
|
.enemyAbility(Abilities.BALL_FETCH)
|
||||||
|
.enemyMoveset([ Moves.SPLASH, Moves.FLIP_TURN ])
|
||||||
|
.startingWave(5);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should do double damage to a pokemon that switched out", async () => {
|
||||||
|
await game.classicMode.startBattle([ Species.MILOTIC ]);
|
||||||
|
|
||||||
|
const [ enemy1, ] = game.scene.getEnemyParty();
|
||||||
|
|
||||||
|
game.move.select(Moves.SURF);
|
||||||
|
await game.forceEnemyMove(Moves.SPLASH);
|
||||||
|
await game.toNextTurn();
|
||||||
|
const damage1 = enemy1.getInverseHp();
|
||||||
|
enemy1.hp = enemy1.getMaxHp();
|
||||||
|
|
||||||
|
game.move.select(Moves.SPLASH);
|
||||||
|
game.forceEnemyToSwitch();
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
game.move.select(Moves.SURF);
|
||||||
|
game.forceEnemyToSwitch();
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
expect(enemy1.isFainted()).toBe(false);
|
||||||
|
expect(isBetween(enemy1.getInverseHp(), (damage1 * 2) - 5, (damage1 * 2) + 5)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should do double damage to a pokemon that switched out via U-Turn/etc", async () => {
|
||||||
|
await game.classicMode.startBattle([ Species.MILOTIC ]);
|
||||||
|
|
||||||
|
const [ enemy1, ] = game.scene.getEnemyParty();
|
||||||
|
|
||||||
|
game.move.select(Moves.SURF);
|
||||||
|
await game.forceEnemyMove(Moves.SPLASH);
|
||||||
|
await game.toNextTurn();
|
||||||
|
const damage1 = enemy1.getInverseHp();
|
||||||
|
enemy1.hp = enemy1.getMaxHp();
|
||||||
|
|
||||||
|
game.move.select(Moves.SPLASH);
|
||||||
|
await game.forceEnemyMove(Moves.FLIP_TURN);
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
game.move.select(Moves.SURF);
|
||||||
|
await game.forceEnemyMove(Moves.FLIP_TURN);
|
||||||
|
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
expect(enemy1.isFainted()).toBe(false);
|
||||||
|
expect(isBetween(enemy1.getInverseHp(), (damage1 * 2) - 5, (damage1 * 2) + 5)).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue