pokerogue/test/moves/parting_shot.test.ts

201 lines
7.2 KiB
TypeScript
Raw Normal View History

import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, test } from "vitest";
import GameManager from "#test/testUtils/gameManager";
[Refactor/Bug/Move] Overhaul Stats and Battle Items, Implement Several Stat Moves (#2699) * Create Getters, Setters, and Types * Work on `pokemon.ts` * Adjust Types, Refactor `White Herb` Modifier * Migrate `TempBattleStat` Usage * Refactor `PokemonBaseStatModifier` Slightly * Remove `BattleStat`, Use "Stat Stages" & New Names * Address Phase `integers` * Finalize `BattleStat` Removal * Address Minor Manual NITs * Apply Own Review Suggestions * Fix Syntax Error * Add Docs * Overhaul X Items * Implement Guard and Power Split with Unit Tests * Add Several Unit Tests and Fixes * Implement Speed Swap with Unit Tests * Fix Keys in Summary Menu * Fix Starf Berry Raising EVA and ACC * Fix Contrary & Simple, Verify with Unit Tests * Implement Power & Guard Swap with Unit Tests * Add Move Effect Message to Speed Swap * Add Move Effect Message to Power & Guard Split * Add Localization Entries * Adjust Last X Item Unit Test * Overhaul X Items Unit Tests * Finish Missing Docs * Revamp Crit-Based Unit Tests & Dire Hit * Address Initial NITs * Apply NIT Batch Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> * Fix Moody Test * Address Multiple Messages for `ProtectStatAbAttr` * Change `ignoreOverride` to `bypassSummonData` * Adjust Italian Localization Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> * Fix Moody --------- Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com>
2024-09-02 22:12:34 -04:00
import { Stat } from "#enums/stat";
import { BerryPhase } from "#app/phases/berry-phase";
import { FaintPhase } from "#app/phases/faint-phase";
import { MessagePhase } from "#app/phases/message-phase";
import { TurnInitPhase } from "#app/phases/turn-init-phase";
describe("Moves - Parting Shot", () => {
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");
2024-10-04 13:08:31 +08:00
game.override.moveset([ Moves.PARTING_SHOT, Moves.SPLASH ]);
game.override.enemyMoveset(Moves.SPLASH);
game.override.startingLevel(5);
game.override.enemyLevel(5);
});
test(
"Parting Shot when buffed by prankster should fail against dark types",
async () => {
game.override
.enemySpecies(Species.POOCHYENA)
.ability(Abilities.PRANKSTER);
2024-10-04 13:08:31 +08:00
await game.startBattle([ Species.MURKROW, Species.MEOWTH ]);
const enemyPokemon = game.scene.getEnemyPokemon()!;
expect(enemyPokemon).toBeDefined();
game.move.select(Moves.PARTING_SHOT);
await game.phaseInterceptor.to(BerryPhase, false);
[Refactor/Bug/Move] Overhaul Stats and Battle Items, Implement Several Stat Moves (#2699) * Create Getters, Setters, and Types * Work on `pokemon.ts` * Adjust Types, Refactor `White Herb` Modifier * Migrate `TempBattleStat` Usage * Refactor `PokemonBaseStatModifier` Slightly * Remove `BattleStat`, Use "Stat Stages" & New Names * Address Phase `integers` * Finalize `BattleStat` Removal * Address Minor Manual NITs * Apply Own Review Suggestions * Fix Syntax Error * Add Docs * Overhaul X Items * Implement Guard and Power Split with Unit Tests * Add Several Unit Tests and Fixes * Implement Speed Swap with Unit Tests * Fix Keys in Summary Menu * Fix Starf Berry Raising EVA and ACC * Fix Contrary & Simple, Verify with Unit Tests * Implement Power & Guard Swap with Unit Tests * Add Move Effect Message to Speed Swap * Add Move Effect Message to Power & Guard Split * Add Localization Entries * Adjust Last X Item Unit Test * Overhaul X Items Unit Tests * Finish Missing Docs * Revamp Crit-Based Unit Tests & Dire Hit * Address Initial NITs * Apply NIT Batch Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> * Fix Moody Test * Address Multiple Messages for `ProtectStatAbAttr` * Change `ignoreOverride` to `bypassSummonData` * Adjust Italian Localization Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> * Fix Moody --------- Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com>
2024-09-02 22:12:34 -04:00
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(0);
expect(enemyPokemon.getStatStage(Stat.SPATK)).toBe(0);
expect(game.scene.getPlayerField()[0].species.speciesId).toBe(Species.MURKROW);
}
);
test(
"Parting shot should fail against good as gold ability",
async () => {
game.override
.enemySpecies(Species.GHOLDENGO)
.enemyAbility(Abilities.GOOD_AS_GOLD);
2024-10-04 13:08:31 +08:00
await game.startBattle([ Species.MURKROW, Species.MEOWTH ]);
const enemyPokemon = game.scene.getEnemyPokemon()!;
expect(enemyPokemon).toBeDefined();
game.move.select(Moves.PARTING_SHOT);
await game.phaseInterceptor.to(BerryPhase, false);
[Refactor/Bug/Move] Overhaul Stats and Battle Items, Implement Several Stat Moves (#2699) * Create Getters, Setters, and Types * Work on `pokemon.ts` * Adjust Types, Refactor `White Herb` Modifier * Migrate `TempBattleStat` Usage * Refactor `PokemonBaseStatModifier` Slightly * Remove `BattleStat`, Use "Stat Stages" & New Names * Address Phase `integers` * Finalize `BattleStat` Removal * Address Minor Manual NITs * Apply Own Review Suggestions * Fix Syntax Error * Add Docs * Overhaul X Items * Implement Guard and Power Split with Unit Tests * Add Several Unit Tests and Fixes * Implement Speed Swap with Unit Tests * Fix Keys in Summary Menu * Fix Starf Berry Raising EVA and ACC * Fix Contrary & Simple, Verify with Unit Tests * Implement Power & Guard Swap with Unit Tests * Add Move Effect Message to Speed Swap * Add Move Effect Message to Power & Guard Split * Add Localization Entries * Adjust Last X Item Unit Test * Overhaul X Items Unit Tests * Finish Missing Docs * Revamp Crit-Based Unit Tests & Dire Hit * Address Initial NITs * Apply NIT Batch Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> * Fix Moody Test * Address Multiple Messages for `ProtectStatAbAttr` * Change `ignoreOverride` to `bypassSummonData` * Adjust Italian Localization Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> * Fix Moody --------- Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com>
2024-09-02 22:12:34 -04:00
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(0);
expect(enemyPokemon.getStatStage(Stat.SPATK)).toBe(0);
expect(game.scene.getPlayerField()[0].species.speciesId).toBe(Species.MURKROW);
}
);
it.todo( // TODO: fix this bug to pass the test!
"Parting shot should fail if target is -6/-6 de-buffed",
async () => {
2024-10-04 13:08:31 +08:00
game.override.moveset([ Moves.PARTING_SHOT, Moves.MEMENTO, Moves.SPLASH ]);
await game.startBattle([ Species.MEOWTH, Species.MEOWTH, Species.MEOWTH, Species.MURKROW, Species.ABRA ]);
// use Memento 3 times to debuff enemy
game.move.select(Moves.MEMENTO);
await game.phaseInterceptor.to(FaintPhase);
expect(game.scene.getPlayerParty()[0].isFainted()).toBe(true);
game.doSelectPartyPokemon(1);
await game.phaseInterceptor.to(TurnInitPhase, false);
game.move.select(Moves.MEMENTO);
await game.phaseInterceptor.to(FaintPhase);
expect(game.scene.getPlayerParty()[0].isFainted()).toBe(true);
game.doSelectPartyPokemon(2);
await game.phaseInterceptor.to(TurnInitPhase, false);
game.move.select(Moves.MEMENTO);
await game.phaseInterceptor.to(FaintPhase);
expect(game.scene.getPlayerParty()[0].isFainted()).toBe(true);
game.doSelectPartyPokemon(3);
// set up done
await game.phaseInterceptor.to(TurnInitPhase, false);
const enemyPokemon = game.scene.getEnemyPokemon()!;
expect(enemyPokemon).toBeDefined();
[Refactor/Bug/Move] Overhaul Stats and Battle Items, Implement Several Stat Moves (#2699) * Create Getters, Setters, and Types * Work on `pokemon.ts` * Adjust Types, Refactor `White Herb` Modifier * Migrate `TempBattleStat` Usage * Refactor `PokemonBaseStatModifier` Slightly * Remove `BattleStat`, Use "Stat Stages" & New Names * Address Phase `integers` * Finalize `BattleStat` Removal * Address Minor Manual NITs * Apply Own Review Suggestions * Fix Syntax Error * Add Docs * Overhaul X Items * Implement Guard and Power Split with Unit Tests * Add Several Unit Tests and Fixes * Implement Speed Swap with Unit Tests * Fix Keys in Summary Menu * Fix Starf Berry Raising EVA and ACC * Fix Contrary & Simple, Verify with Unit Tests * Implement Power & Guard Swap with Unit Tests * Add Move Effect Message to Speed Swap * Add Move Effect Message to Power & Guard Split * Add Localization Entries * Adjust Last X Item Unit Test * Overhaul X Items Unit Tests * Finish Missing Docs * Revamp Crit-Based Unit Tests & Dire Hit * Address Initial NITs * Apply NIT Batch Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> * Fix Moody Test * Address Multiple Messages for `ProtectStatAbAttr` * Change `ignoreOverride` to `bypassSummonData` * Adjust Italian Localization Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> * Fix Moody --------- Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com>
2024-09-02 22:12:34 -04:00
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(-6);
expect(enemyPokemon.getStatStage(Stat.SPATK)).toBe(-6);
// now parting shot should fail
game.move.select(Moves.PARTING_SHOT);
await game.phaseInterceptor.to(BerryPhase, false);
[Refactor/Bug/Move] Overhaul Stats and Battle Items, Implement Several Stat Moves (#2699) * Create Getters, Setters, and Types * Work on `pokemon.ts` * Adjust Types, Refactor `White Herb` Modifier * Migrate `TempBattleStat` Usage * Refactor `PokemonBaseStatModifier` Slightly * Remove `BattleStat`, Use "Stat Stages" & New Names * Address Phase `integers` * Finalize `BattleStat` Removal * Address Minor Manual NITs * Apply Own Review Suggestions * Fix Syntax Error * Add Docs * Overhaul X Items * Implement Guard and Power Split with Unit Tests * Add Several Unit Tests and Fixes * Implement Speed Swap with Unit Tests * Fix Keys in Summary Menu * Fix Starf Berry Raising EVA and ACC * Fix Contrary & Simple, Verify with Unit Tests * Implement Power & Guard Swap with Unit Tests * Add Move Effect Message to Speed Swap * Add Move Effect Message to Power & Guard Split * Add Localization Entries * Adjust Last X Item Unit Test * Overhaul X Items Unit Tests * Finish Missing Docs * Revamp Crit-Based Unit Tests & Dire Hit * Address Initial NITs * Apply NIT Batch Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> * Fix Moody Test * Address Multiple Messages for `ProtectStatAbAttr` * Change `ignoreOverride` to `bypassSummonData` * Adjust Italian Localization Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> * Fix Moody --------- Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com>
2024-09-02 22:12:34 -04:00
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(-6);
expect(enemyPokemon.getStatStage(Stat.SPATK)).toBe(-6);
expect(game.scene.getPlayerField()[0].species.speciesId).toBe(Species.MURKROW);
}
);
it.todo( // TODO: fix this bug to pass the test!
"Parting shot shouldn't allow switch out when mist is active",
async () => {
game.override
.enemySpecies(Species.ALTARIA)
.enemyAbility(Abilities.NONE)
2024-10-04 13:08:31 +08:00
.enemyMoveset([ Moves.MIST ]);
await game.startBattle([ Species.SNORLAX, Species.MEOWTH ]);
const enemyPokemon = game.scene.getEnemyPokemon()!;
expect(enemyPokemon).toBeDefined();
game.move.select(Moves.PARTING_SHOT);
await game.phaseInterceptor.to(BerryPhase, false);
[Refactor/Bug/Move] Overhaul Stats and Battle Items, Implement Several Stat Moves (#2699) * Create Getters, Setters, and Types * Work on `pokemon.ts` * Adjust Types, Refactor `White Herb` Modifier * Migrate `TempBattleStat` Usage * Refactor `PokemonBaseStatModifier` Slightly * Remove `BattleStat`, Use "Stat Stages" & New Names * Address Phase `integers` * Finalize `BattleStat` Removal * Address Minor Manual NITs * Apply Own Review Suggestions * Fix Syntax Error * Add Docs * Overhaul X Items * Implement Guard and Power Split with Unit Tests * Add Several Unit Tests and Fixes * Implement Speed Swap with Unit Tests * Fix Keys in Summary Menu * Fix Starf Berry Raising EVA and ACC * Fix Contrary & Simple, Verify with Unit Tests * Implement Power & Guard Swap with Unit Tests * Add Move Effect Message to Speed Swap * Add Move Effect Message to Power & Guard Split * Add Localization Entries * Adjust Last X Item Unit Test * Overhaul X Items Unit Tests * Finish Missing Docs * Revamp Crit-Based Unit Tests & Dire Hit * Address Initial NITs * Apply NIT Batch Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> * Fix Moody Test * Address Multiple Messages for `ProtectStatAbAttr` * Change `ignoreOverride` to `bypassSummonData` * Adjust Italian Localization Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> * Fix Moody --------- Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com>
2024-09-02 22:12:34 -04:00
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(0);
expect(enemyPokemon.getStatStage(Stat.SPATK)).toBe(0);
expect(game.scene.getPlayerField()[0].species.speciesId).toBe(Species.MURKROW);
}
);
it.todo( // TODO: fix this bug to pass the test!
"Parting shot shouldn't allow switch out against clear body ability",
async () => {
game.override
.enemySpecies(Species.TENTACOOL)
.enemyAbility(Abilities.CLEAR_BODY);
2024-10-04 13:08:31 +08:00
await game.startBattle([ Species.SNORLAX, Species.MEOWTH ]);
const enemyPokemon = game.scene.getEnemyPokemon()!;
expect(enemyPokemon).toBeDefined();
game.move.select(Moves.PARTING_SHOT);
await game.phaseInterceptor.to(BerryPhase, false);
[Refactor/Bug/Move] Overhaul Stats and Battle Items, Implement Several Stat Moves (#2699) * Create Getters, Setters, and Types * Work on `pokemon.ts` * Adjust Types, Refactor `White Herb` Modifier * Migrate `TempBattleStat` Usage * Refactor `PokemonBaseStatModifier` Slightly * Remove `BattleStat`, Use "Stat Stages" & New Names * Address Phase `integers` * Finalize `BattleStat` Removal * Address Minor Manual NITs * Apply Own Review Suggestions * Fix Syntax Error * Add Docs * Overhaul X Items * Implement Guard and Power Split with Unit Tests * Add Several Unit Tests and Fixes * Implement Speed Swap with Unit Tests * Fix Keys in Summary Menu * Fix Starf Berry Raising EVA and ACC * Fix Contrary & Simple, Verify with Unit Tests * Implement Power & Guard Swap with Unit Tests * Add Move Effect Message to Speed Swap * Add Move Effect Message to Power & Guard Split * Add Localization Entries * Adjust Last X Item Unit Test * Overhaul X Items Unit Tests * Finish Missing Docs * Revamp Crit-Based Unit Tests & Dire Hit * Address Initial NITs * Apply NIT Batch Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> * Fix Moody Test * Address Multiple Messages for `ProtectStatAbAttr` * Change `ignoreOverride` to `bypassSummonData` * Adjust Italian Localization Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> * Fix Moody --------- Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com>
2024-09-02 22:12:34 -04:00
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(0);
expect(enemyPokemon.getStatStage(Stat.SPATK)).toBe(0);
expect(game.scene.getPlayerField()[0].species.speciesId).toBe(Species.MURKROW);
}
);
it.todo( // TODO: fix this bug to pass the test!
"Parting shot should de-buff and not fail if no party available to switch - party size 1",
async () => {
2024-10-04 13:08:31 +08:00
await game.startBattle([ Species.MURKROW ]);
const enemyPokemon = game.scene.getEnemyPokemon()!;
expect(enemyPokemon).toBeDefined();
game.move.select(Moves.PARTING_SHOT);
await game.phaseInterceptor.to(BerryPhase, false);
[Refactor/Bug/Move] Overhaul Stats and Battle Items, Implement Several Stat Moves (#2699) * Create Getters, Setters, and Types * Work on `pokemon.ts` * Adjust Types, Refactor `White Herb` Modifier * Migrate `TempBattleStat` Usage * Refactor `PokemonBaseStatModifier` Slightly * Remove `BattleStat`, Use "Stat Stages" & New Names * Address Phase `integers` * Finalize `BattleStat` Removal * Address Minor Manual NITs * Apply Own Review Suggestions * Fix Syntax Error * Add Docs * Overhaul X Items * Implement Guard and Power Split with Unit Tests * Add Several Unit Tests and Fixes * Implement Speed Swap with Unit Tests * Fix Keys in Summary Menu * Fix Starf Berry Raising EVA and ACC * Fix Contrary & Simple, Verify with Unit Tests * Implement Power & Guard Swap with Unit Tests * Add Move Effect Message to Speed Swap * Add Move Effect Message to Power & Guard Split * Add Localization Entries * Adjust Last X Item Unit Test * Overhaul X Items Unit Tests * Finish Missing Docs * Revamp Crit-Based Unit Tests & Dire Hit * Address Initial NITs * Apply NIT Batch Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> * Fix Moody Test * Address Multiple Messages for `ProtectStatAbAttr` * Change `ignoreOverride` to `bypassSummonData` * Adjust Italian Localization Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> * Fix Moody --------- Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com>
2024-09-02 22:12:34 -04:00
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(-1);
expect(enemyPokemon.getStatStage(Stat.SPATK)).toBe(-1);
expect(game.scene.getPlayerField()[0].species.speciesId).toBe(Species.MURKROW);
}
);
it.todo( // TODO: fix this bug to pass the test!
"Parting shot regularly not fail if no party available to switch - party fainted",
async () => {
2024-10-04 13:08:31 +08:00
await game.startBattle([ Species.MURKROW, Species.MEOWTH ]);
game.move.select(Moves.SPLASH);
// intentionally kill party pokemon, switch to second slot (now 1 party mon is fainted)
await game.killPokemon(game.scene.getPlayerParty()[0]);
expect(game.scene.getPlayerParty()[0].isFainted()).toBe(true);
await game.phaseInterceptor.run(MessagePhase);
game.doSelectPartyPokemon(1);
await game.phaseInterceptor.to(TurnInitPhase, false);
game.move.select(Moves.PARTING_SHOT);
await game.phaseInterceptor.to(BerryPhase, false);
[Refactor/Bug/Move] Overhaul Stats and Battle Items, Implement Several Stat Moves (#2699) * Create Getters, Setters, and Types * Work on `pokemon.ts` * Adjust Types, Refactor `White Herb` Modifier * Migrate `TempBattleStat` Usage * Refactor `PokemonBaseStatModifier` Slightly * Remove `BattleStat`, Use "Stat Stages" & New Names * Address Phase `integers` * Finalize `BattleStat` Removal * Address Minor Manual NITs * Apply Own Review Suggestions * Fix Syntax Error * Add Docs * Overhaul X Items * Implement Guard and Power Split with Unit Tests * Add Several Unit Tests and Fixes * Implement Speed Swap with Unit Tests * Fix Keys in Summary Menu * Fix Starf Berry Raising EVA and ACC * Fix Contrary & Simple, Verify with Unit Tests * Implement Power & Guard Swap with Unit Tests * Add Move Effect Message to Speed Swap * Add Move Effect Message to Power & Guard Split * Add Localization Entries * Adjust Last X Item Unit Test * Overhaul X Items Unit Tests * Finish Missing Docs * Revamp Crit-Based Unit Tests & Dire Hit * Address Initial NITs * Apply NIT Batch Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> * Fix Moody Test * Address Multiple Messages for `ProtectStatAbAttr` * Change `ignoreOverride` to `bypassSummonData` * Adjust Italian Localization Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com> * Fix Moody --------- Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com> Co-authored-by: Niccolò <123510358+NicusPulcis@users.noreply.github.com>
2024-09-02 22:12:34 -04:00
const enemyPokemon = game.scene.getEnemyPokemon()!;
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(0);
expect(enemyPokemon.getStatStage(Stat.SPATK)).toBe(0);
expect(game.scene.getPlayerField()[0].species.speciesId).toBe(Species.MEOWTH);
}
);
});