This commit is contained in:
frutescens 2024-10-13 19:50:39 -07:00
parent 0c63324fc1
commit 293895f86f
2 changed files with 120 additions and 63 deletions

View File

@ -2898,71 +2898,70 @@ export class SecretPowerAttr extends MoveEffectAttr {
secondaryEffect = new StatStageChangeAttr([ Stat.SPD ], -1, false);
break;
}
}
const biome = user.scene.arena.biomeType;
switch (biome) {
case Biome.TOWN:
case Biome.METROPOLIS:
case Biome.SLUM:
case Biome.DOJO:
case Biome.FACTORY:
case Biome.CONSTRUCTION_SITE:
case Biome.LABORATORY:
case Biome.POWER_PLANT:
secondaryEffect = new StatusEffectAttr(StatusEffect.PARALYSIS, false);
break;
case Biome.PLAINS:
case Biome.GRASS:
case Biome.TALL_GRASS:
case Biome.FOREST:
case Biome.JUNGLE:
case Biome.MEADOW:
secondaryEffect = new StatusEffectAttr(StatusEffect.SLEEP, false);
break;
case Biome.SWAMP:
secondaryEffect = new StatStageChangeAttr([ Stat.SPD ], -1, false);
break;
case Biome.ICE_CAVE:
case Biome.SNOWY_FOREST:
secondaryEffect = new StatusEffectAttr(StatusEffect.FREEZE, false);
break;
case Biome.VOLCANO:
secondaryEffect = new StatusEffectAttr(StatusEffect.BURN, false);
break;
case Biome.FAIRY_CAVE:
secondaryEffect = new StatStageChangeAttr([ Stat.SPATK ], -1, false);
break;
case Biome.DESERT:
secondaryEffect = new StatStageChangeAttr([ Stat.ACC ], -1, false);
break;
case Biome.SEA:
case Biome.BEACH:
case Biome.LAKE:
case Biome.ISLAND:
case Biome.SEABED:
secondaryEffect = new StatStageChangeAttr([ Stat.ATK ], -1, false);
break;
case Biome.MOUNTAIN:
case Biome.BADLANDS:
case Biome.CAVE:
case Biome.WASTELAND:
secondaryEffect = new AddBattlerTagAttr(BattlerTagType.FLINCHED, false, true);
break;
case Biome.SPACE:
secondaryEffect = new StatStageChangeAttr([ Stat.DEF ], -1, false);
break;
case Biome.GRAVEYARD:
case Biome.RUINS:
case Biome.ABYSS:
case Biome.TEMPLE:
case Biome.END:
default:
return true;
} else {
const biome = user.scene.arena.biomeType;
switch (biome) {
case Biome.TOWN:
case Biome.METROPOLIS:
case Biome.SLUM:
case Biome.DOJO:
case Biome.FACTORY:
case Biome.CONSTRUCTION_SITE:
case Biome.LABORATORY:
case Biome.POWER_PLANT:
secondaryEffect = new StatusEffectAttr(StatusEffect.PARALYSIS, false);
break;
case Biome.PLAINS:
case Biome.GRASS:
case Biome.TALL_GRASS:
case Biome.FOREST:
case Biome.JUNGLE:
case Biome.MEADOW:
secondaryEffect = new StatusEffectAttr(StatusEffect.SLEEP, false);
break;
case Biome.SWAMP:
secondaryEffect = new StatStageChangeAttr([ Stat.SPD ], -1, false);
break;
case Biome.ICE_CAVE:
case Biome.SNOWY_FOREST:
secondaryEffect = new StatusEffectAttr(StatusEffect.FREEZE, false);
break;
case Biome.VOLCANO:
secondaryEffect = new StatusEffectAttr(StatusEffect.BURN, false);
break;
case Biome.FAIRY_CAVE:
secondaryEffect = new StatStageChangeAttr([ Stat.SPATK ], -1, false);
break;
case Biome.DESERT:
secondaryEffect = new StatStageChangeAttr([ Stat.ACC ], -1, false);
break;
case Biome.SEA:
case Biome.BEACH:
case Biome.LAKE:
case Biome.ISLAND:
case Biome.SEABED:
secondaryEffect = new StatStageChangeAttr([ Stat.ATK ], -1, false);
break;
case Biome.MOUNTAIN:
case Biome.BADLANDS:
case Biome.CAVE:
case Biome.WASTELAND:
secondaryEffect = new AddBattlerTagAttr(BattlerTagType.FLINCHED, false, true);
break;
case Biome.SPACE:
secondaryEffect = new StatStageChangeAttr([ Stat.DEF ], -1, false);
break;
case Biome.GRAVEYARD:
case Biome.RUINS:
case Biome.ABYSS:
case Biome.TEMPLE:
case Biome.END:
default:
return true;
}
}
return secondaryEffect.apply(user, target, move, []);
}
}
export class PostVictoryStatStageChangeAttr extends MoveAttr {
@ -7981,7 +7980,7 @@ export function initMoves() {
.unimplemented(),
new SelfStatusMove(Moves.SNATCH, Type.DARK, -1, 10, -1, 4, 3)
.unimplemented(),
new AttackMove(Moves.SECRET_POWER, Type.NORMAL, MoveCategory.PHYSICAL, 70, 100, 20, 30, 0, 3)
new AttackMove(Moves.SECRET_POWER, Type.NORMAL, MoveCategory.PHYSICAL, 70, 100, 20, 100, 0, 3)
.makesContact(false)
.attr(SecretPowerAttr),
new AttackMove(Moves.DIVE, Type.WATER, MoveCategory.PHYSICAL, 80, 100, 10, -1, 0, 3)

View File

@ -0,0 +1,58 @@
import { Abilities } from "#enums/abilities";
import { Biome } from "#app/enums/biome";
import { Moves } from "#enums/moves";
import { Stat } from "#enums/stat";
import { allMoves } from "#app/data/move";
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";
import { StatusEffect } from "#app/enums/status-effect";
describe("Moves - Secret Power", () => {
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.SECRET_POWER ])
.ability(Abilities.BALL_FETCH)
.battleType("single")
.disableCrits()
.enemySpecies(Species.MAGIKARP)
.enemyLevel(60)
.enemyAbility(Abilities.BALL_FETCH)
.enemyMoveset([ Moves.SPLASH, Moves.MISTY_TERRAIN ]);
vi.spyOn(allMoves[Moves.SECRET_POWER], "chance", "get").mockReturnValue(100);
});
it("Secret Power checks for an active terrain first then looks at the biome for its secondary effect", async () => {
game.override.startingBiome(Biome.METROPOLIS);
await game.classicMode.startBattle([ Species.FEEBAS ]);
const enemyPokemon = game.scene.getEnemyPokemon()!;
// No Terrain + Biome.METROPOLIS --> Paralysis
game.move.select(Moves.SECRET_POWER);
await game.forceEnemyMove(Moves.SPLASH);
await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyPokemon.status?.effect).toBe(StatusEffect.PARALYSIS);
// Misty Terrain --> SpAtk -1
game.move.select(Moves.SECRET_POWER);
await game.forceEnemyMove(Moves.MISTY_TERRAIN);
await game.phaseInterceptor.to("TurnEndPhase");
expect(enemyPokemon.getStatStage(Stat.SPATK)).toBe(-1);
});
});