Fix Alluring Voice and add tests

This commit is contained in:
NightKev 2024-08-12 01:46:11 -07:00
parent 507daf60a2
commit 7914257bb2
3 changed files with 113 additions and 2 deletions

View File

@ -5872,7 +5872,7 @@ export class AddBattlerTagIfBoostedAttr extends AddBattlerTagAttr {
* @returns true
*/
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
if (user.getTag(BattlerTagType.STATS_BOOSTED)) {
if (target.getTag(BattlerTagType.STATS_BOOSTED)) {
super.apply(user, target, move, args);
}
return true;
@ -5895,7 +5895,7 @@ export class StatusIfBoostedAttr extends MoveEffectAttr {
/**
* @param user {@linkcode Pokemon} using this move
* @param target {@linkcode Pokemon} target of this move
* @param move {@linkcode Move} being used
* @param move {@linkcode Move} N/A
* @param {any[]} args N/A
* @returns true
*/

View File

@ -0,0 +1,56 @@
import { Abilities } from "#app/enums/abilities";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { BattlerIndex } from "#app/battle.js";
import { BattlerTagType } from "#app/enums/battler-tag-type.js";
import { BerryPhase } from "#app/phases.js";
const TIMEOUT = 20 * 1000;
describe("Moves - Alluring Voice", () => {
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
.battleType("single")
.disableCrits()
.enemySpecies(Species.MAGIKARP)
.enemyAbility(Abilities.ICE_SCALES)
.enemyMoveset(Array(4).fill(Moves.HOWL))
.startingLevel(10)
.enemyLevel(10)
.starterSpecies(Species.FEEBAS)
.ability(Abilities.BALL_FETCH)
.moveset([Moves.ALLURING_VOICE]);
});
it("should confuse the opponent if their stats were raised", async () => {
await game.startBattle();
const enemy = game.scene.getEnemyPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.ALLURING_VOICE));
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
await game.phaseInterceptor.to(BerryPhase);
console.log(enemy.getTag(BattlerTagType.CONFUSED));
expect(enemy.getTag(BattlerTagType.CONFUSED)?.tagType).toBe("CONFUSED");
}, TIMEOUT);
});

View File

@ -0,0 +1,55 @@
import { Abilities } from "#app/enums/abilities";
import GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { BattlerIndex } from "#app/battle.js";
import { BerryPhase } from "#app/phases.js";
import { StatusEffect } from "#app/enums/status-effect.js";
const TIMEOUT = 20 * 1000;
describe("Moves - Burning Jealousy", () => {
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
.battleType("single")
.disableCrits()
.enemySpecies(Species.MAGIKARP)
.enemyAbility(Abilities.ICE_SCALES)
.enemyMoveset(Array(4).fill(Moves.HOWL))
.startingLevel(10)
.enemyLevel(10)
.starterSpecies(Species.FEEBAS)
.ability(Abilities.BALL_FETCH)
.moveset([Moves.BURNING_JEALOUSY]);
});
it("should burn the opponent if their stats were raised", async () => {
await game.startBattle();
const enemy = game.scene.getEnemyPokemon()!;
game.doAttack(getMovePosition(game.scene, 0, Moves.BURNING_JEALOUSY));
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
await game.phaseInterceptor.to(BerryPhase);
expect(enemy.status?.effect).toBe(StatusEffect.BURN);
}, TIMEOUT);
});