mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-25 08:16:04 +00:00
[Refactor] Refactor code for Grassy Terrain halving the power of Earthquake, Magnitude, and Bulldoze (#4263)
* EQ, magnitude, and bulldoze do half damage in grassy terrain * Fix more styling issues in grassy glide * lol unit tests * Add test :pikastare: --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
This commit is contained in:
parent
ddf97fd8f6
commit
8046b99b75
@ -813,10 +813,6 @@ export default class Move implements Localizable {
|
||||
power.value *= typeBoost.boostValue;
|
||||
}
|
||||
|
||||
if (source.scene.arena.getTerrainType() === TerrainType.GRASSY && target.isGrounded() && this.type === Type.GROUND && this.moveTarget === MoveTarget.ALL_NEAR_OTHERS) {
|
||||
power.value /= 2;
|
||||
}
|
||||
|
||||
applyMoveAttrs(VariablePowerAttr, source, target, this, power);
|
||||
|
||||
source.scene.applyModifiers(PokemonMultiHitModifier, source.isPlayer(), source, new Utils.IntegerHolder(0), power);
|
||||
@ -6956,6 +6952,7 @@ export function initMoves() {
|
||||
.makesContact(false),
|
||||
new AttackMove(Moves.EARTHQUAKE, Type.GROUND, MoveCategory.PHYSICAL, 100, 100, 10, -1, 0, 1)
|
||||
.attr(HitsTagAttr, BattlerTagType.UNDERGROUND, true)
|
||||
.attr(MovePowerMultiplierAttr, (user, target, move) => user.scene.arena.getTerrainType() === TerrainType.GRASSY ? 0.5 : 1)
|
||||
.makesContact(false)
|
||||
.target(MoveTarget.ALL_NEAR_OTHERS),
|
||||
new AttackMove(Moves.FISSURE, Type.GROUND, MoveCategory.PHYSICAL, 200, 30, 5, -1, 0, 1)
|
||||
@ -7349,6 +7346,7 @@ export function initMoves() {
|
||||
new AttackMove(Moves.MAGNITUDE, Type.GROUND, MoveCategory.PHYSICAL, -1, 100, 30, -1, 0, 2)
|
||||
.attr(PreMoveMessageAttr, magnitudeMessageFunc)
|
||||
.attr(MagnitudePowerAttr)
|
||||
.attr(MovePowerMultiplierAttr, (user, target, move) => user.scene.arena.getTerrainType() === TerrainType.GRASSY ? 0.5 : 1)
|
||||
.attr(HitsTagAttr, BattlerTagType.UNDERGROUND, true)
|
||||
.makesContact(false)
|
||||
.target(MoveTarget.ALL_NEAR_OTHERS),
|
||||
@ -8223,6 +8221,7 @@ export function initMoves() {
|
||||
.target(MoveTarget.ALL_NEAR_ENEMIES),
|
||||
new AttackMove(Moves.BULLDOZE, Type.GROUND, MoveCategory.PHYSICAL, 60, 100, 20, 100, 0, 5)
|
||||
.attr(StatStageChangeAttr, [ Stat.SPD ], -1)
|
||||
.attr(MovePowerMultiplierAttr, (user, target, move) => user.scene.arena.getTerrainType() === TerrainType.GRASSY ? 0.5 : 1)
|
||||
.makesContact(false)
|
||||
.target(MoveTarget.ALL_NEAR_OTHERS),
|
||||
new AttackMove(Moves.FROST_BREATH, Type.ICE, MoveCategory.SPECIAL, 60, 90, 10, 100, 0, 5)
|
||||
|
56
src/test/arena/grassy_terrain.test.ts
Normal file
56
src/test/arena/grassy_terrain.test.ts
Normal file
@ -0,0 +1,56 @@
|
||||
import { allMoves } from "#app/data/move";
|
||||
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, vi } from "vitest";
|
||||
|
||||
describe("Arena - Grassy Terrain", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
let game: GameManager;
|
||||
const TIMEOUT = 20 * 1000;
|
||||
|
||||
beforeAll(() => {
|
||||
phaserGame = new Phaser.Game({
|
||||
type: Phaser.HEADLESS,
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
game.phaseInterceptor.restoreOg();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
game = new GameManager(phaserGame);
|
||||
game.override
|
||||
.battleType("single")
|
||||
.disableCrits()
|
||||
.enemyLevel(30)
|
||||
.enemySpecies(Species.SNORLAX)
|
||||
.enemyAbility(Abilities.BALL_FETCH)
|
||||
.enemyMoveset(Moves.SPLASH)
|
||||
.moveset([Moves.GRASSY_TERRAIN, Moves.EARTHQUAKE])
|
||||
.ability(Abilities.BALL_FETCH);
|
||||
});
|
||||
|
||||
it("halves the damage of Earthquake", async () => {
|
||||
await game.classicMode.startBattle([Species.FEEBAS]);
|
||||
|
||||
const eq = allMoves[Moves.EARTHQUAKE];
|
||||
vi.spyOn(eq, "calculateBattlePower");
|
||||
|
||||
game.move.select(Moves.EARTHQUAKE);
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(eq.calculateBattlePower).toHaveReturnedWith(100);
|
||||
|
||||
game.move.select(Moves.GRASSY_TERRAIN);
|
||||
await game.toNextTurn();
|
||||
|
||||
game.move.select(Moves.EARTHQUAKE);
|
||||
await game.phaseInterceptor.to("BerryPhase");
|
||||
|
||||
expect(eq.calculateBattlePower).toHaveReturnedWith(50);
|
||||
}, TIMEOUT);
|
||||
});
|
Loading…
Reference in New Issue
Block a user