Skip to content

Commit

Permalink
[P2] Diamond Storm should only trigger once when hitting multiple pok…
Browse files Browse the repository at this point in the history
…emon (#4544)

* Diamond Storm should only trigger once when hitting multiple pokemon

* Also fix Clangorous Soulblaze just in case

* Fix linting

* Fix linting

Oops missed this one
  • Loading branch information
DayKev authored Oct 4, 2024
1 parent 2753728 commit d362456
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/data/move.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8756,7 +8756,7 @@ export function initMoves() {
.attr(StatStageChangeAttr, [ Stat.SPATK ], -1)
.soundBased(),
new AttackMove(Moves.DIAMOND_STORM, Type.ROCK, MoveCategory.PHYSICAL, 100, 95, 5, 50, 0, 6)
.attr(StatStageChangeAttr, [ Stat.DEF ], 2, true)
.attr(StatStageChangeAttr, [ Stat.DEF ], 2, true, undefined, undefined, undefined, undefined, true)
.makesContact(false)
.target(MoveTarget.ALL_NEAR_ENEMIES),
new AttackMove(Moves.STEAM_ERUPTION, Type.WATER, MoveCategory.SPECIAL, 110, 95, 5, 30, 0, 6)
Expand Down Expand Up @@ -9183,7 +9183,7 @@ export function initMoves() {
.makesContact(false)
.ignoresVirtual(),
new AttackMove(Moves.CLANGOROUS_SOULBLAZE, Type.DRAGON, MoveCategory.SPECIAL, 185, -1, 1, 100, 0, 7)
.attr(StatStageChangeAttr, [ Stat.ATK, Stat.DEF, Stat.SPATK, Stat.SPDEF, Stat.SPD ], 1, true)
.attr(StatStageChangeAttr, [ Stat.ATK, Stat.DEF, Stat.SPATK, Stat.SPDEF, Stat.SPD ], 1, true, undefined, undefined, undefined, undefined, true)
.soundBased()
.target(MoveTarget.ALL_NEAR_ENEMIES)
.partial()
Expand Down
46 changes: 46 additions & 0 deletions src/test/moves/diamond_storm.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { allMoves } from "#app/data/move";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import { Stat } from "#enums/stat";
import GameManager from "#test/utils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";

describe("Moves - Diamond Storm", () => {
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.DIAMOND_STORM ])
.battleType("single")
.enemySpecies(Species.MAGIKARP)
.enemyAbility(Abilities.BALL_FETCH)
.enemyMoveset(Moves.SPLASH);
});

it("should only increase defense once even if hitting 2 pokemon", async () => {
game.override.battleType("double");
const diamondStorm = allMoves[Moves.DIAMOND_STORM];
vi.spyOn(diamondStorm, "chance", "get").mockReturnValue(100);
vi.spyOn(diamondStorm, "accuracy", "get").mockReturnValue(100);
await game.classicMode.startBattle([ Species.FEEBAS ]);

game.move.select(Moves.DIAMOND_STORM);
await game.phaseInterceptor.to("BerryPhase");

expect(game.scene.getPlayerPokemon()!.getStatStage(Stat.DEF)).toBe(2);
});
});

0 comments on commit d362456

Please sign in to comment.