mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-20 16:42:45 +02:00
Compare commits
16 Commits
20479f3fe0
...
2b2eedd15a
Author | SHA1 | Date | |
---|---|---|---|
|
2b2eedd15a | ||
|
2c3af4143c | ||
|
a75a04e6e5 | ||
|
1ff2701964 | ||
|
1e306e25b5 | ||
|
43aa772603 | ||
|
38bfcbe06d | ||
|
cfb608ad30 | ||
|
d418e70bf5 | ||
|
b8c2887b6d | ||
|
b7d8c65802 | ||
|
6b780b5d15 | ||
|
db624271b6 | ||
|
03bff38844 | ||
|
d8c939589a | ||
|
37f6e7075f |
@ -93,6 +93,10 @@ import { ChargingMove, MoveAttrMap, MoveAttrString, MoveKindString, MoveClassMap
|
||||
import { applyMoveAttrs } from "./apply-attrs";
|
||||
import { frenzyMissFunc, getMoveTargets } from "./move-utils";
|
||||
|
||||
/**
|
||||
* A function used to conditionally determine execution of a given {@linkcode MoveAttr}.
|
||||
* Conventionally returns `true` for success and `false` for failure.
|
||||
*/
|
||||
type MoveConditionFunc = (user: Pokemon, target: Pokemon, move: Move) => boolean;
|
||||
export type UserMoveConditionFunc = (user: Pokemon, move: Move) => boolean;
|
||||
|
||||
@ -1390,18 +1394,31 @@ export class BeakBlastHeaderAttr extends AddBattlerTagHeaderAttr {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attribute to display a message before a move is executed.
|
||||
*/
|
||||
export class PreMoveMessageAttr extends MoveAttr {
|
||||
private message: string | ((user: Pokemon, target: Pokemon, move: Move) => string);
|
||||
/** The message to display or a function returning one */
|
||||
private message: string | ((user: Pokemon, target: Pokemon, move: Move) => string | undefined);
|
||||
|
||||
/**
|
||||
* Create a new {@linkcode PreMoveMessageAttr} to display a message before move execution.
|
||||
* @param message - The message to display before move use, either as a string or a function producing one.
|
||||
* @remarks
|
||||
* If {@linkcode message} evaluates to an empty string (`''`), no message will be displayed
|
||||
* (though the move will still succeed).
|
||||
*/
|
||||
constructor(message: string | ((user: Pokemon, target: Pokemon, move: Move) => string)) {
|
||||
super();
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||
const message = typeof this.message === "string"
|
||||
? this.message as string
|
||||
: this.message(user, target, move);
|
||||
apply(user: Pokemon, target: Pokemon, move: Move, _args: any[]): boolean {
|
||||
const message = typeof this.message === "function"
|
||||
? this.message(user, target, move)
|
||||
: this.message;
|
||||
|
||||
// TODO: Consider changing if/when MoveAttr `apply` return values become significant
|
||||
if (message) {
|
||||
globalScene.phaseManager.queueMessage(message, 500);
|
||||
return true;
|
||||
@ -11299,7 +11316,11 @@ export function initMoves() {
|
||||
.attr(ForceSwitchOutAttr, true, SwitchType.SHED_TAIL)
|
||||
.condition(failIfLastInPartyCondition),
|
||||
new SelfStatusMove(MoveId.CHILLY_RECEPTION, PokemonType.ICE, -1, 10, -1, 0, 9)
|
||||
.attr(PreMoveMessageAttr, (user, move) => i18next.t("moveTriggers:chillyReception", { pokemonName: getPokemonNameWithAffix(user) }))
|
||||
.attr(PreMoveMessageAttr, (user, _target, _move) =>
|
||||
// Don't display text if current move phase is follow up (ie move called indirectly)
|
||||
isVirtual((globalScene.phaseManager.getCurrentPhase() as MovePhase).useMode)
|
||||
? ""
|
||||
: i18next.t("moveTriggers:chillyReception", { pokemonName: getPokemonNameWithAffix(user) }))
|
||||
.attr(ChillyReceptionAttr, true),
|
||||
new SelfStatusMove(MoveId.TIDY_UP, PokemonType.NORMAL, -1, 10, -1, 0, 9)
|
||||
.attr(StatStageChangeAttr, [ Stat.ATK, Stat.SPD ], 1, true)
|
||||
|
@ -164,8 +164,8 @@ export const ATrainersTestEncounter: MysteryEncounter = MysteryEncounterBuilder.
|
||||
encounter.setDialogueToken("eggType", i18next.t(`${namespace}:eggTypes.epic`));
|
||||
setEncounterRewards(
|
||||
{
|
||||
guaranteedModifierTypeFuncs: [modifierTypes.SACRED_ASH],
|
||||
guaranteedModifierTiers: [ModifierTier.ROGUE, ModifierTier.ULTRA],
|
||||
guaranteedModifierTypeFuncs: [modifierTypes.RELIC_GOLD],
|
||||
guaranteedModifierTiers: [ModifierTier.ROGUE, ModifierTier.ROGUE],
|
||||
fillRemaining: true,
|
||||
},
|
||||
[eggOptions],
|
||||
|
@ -26,12 +26,8 @@ const namespace = "mysteryEncounters/darkDeal";
|
||||
|
||||
/** Exclude Ultra Beasts (inludes Cosmog/Solgaleo/Lunala/Necrozma), Paradox (includes Miraidon/Koraidon), Eternatus, and Mythicals */
|
||||
const excludedBosses = [
|
||||
SpeciesId.NECROZMA,
|
||||
SpeciesId.COSMOG,
|
||||
SpeciesId.COSMOEM,
|
||||
SpeciesId.SOLGALEO,
|
||||
SpeciesId.LUNALA,
|
||||
SpeciesId.ETERNATUS,
|
||||
/** UBs */
|
||||
SpeciesId.NIHILEGO,
|
||||
SpeciesId.BUZZWOLE,
|
||||
SpeciesId.PHEROMOSA,
|
||||
@ -43,6 +39,12 @@ const excludedBosses = [
|
||||
SpeciesId.NAGANADEL,
|
||||
SpeciesId.STAKATAKA,
|
||||
SpeciesId.BLACEPHALON,
|
||||
SpeciesId.COSMOG,
|
||||
SpeciesId.COSMOEM,
|
||||
SpeciesId.SOLGALEO,
|
||||
SpeciesId.LUNALA,
|
||||
SpeciesId.NECROZMA,
|
||||
/** Paradox */
|
||||
SpeciesId.GREAT_TUSK,
|
||||
SpeciesId.SCREAM_TAIL,
|
||||
SpeciesId.BRUTE_BONNET,
|
||||
@ -50,10 +52,10 @@ const excludedBosses = [
|
||||
SpeciesId.SLITHER_WING,
|
||||
SpeciesId.SANDY_SHOCKS,
|
||||
SpeciesId.ROARING_MOON,
|
||||
SpeciesId.KORAIDON,
|
||||
SpeciesId.WALKING_WAKE,
|
||||
SpeciesId.GOUGING_FIRE,
|
||||
SpeciesId.RAGING_BOLT,
|
||||
SpeciesId.KORAIDON,
|
||||
SpeciesId.IRON_TREADS,
|
||||
SpeciesId.IRON_BUNDLE,
|
||||
SpeciesId.IRON_HANDS,
|
||||
@ -61,22 +63,23 @@ const excludedBosses = [
|
||||
SpeciesId.IRON_MOTH,
|
||||
SpeciesId.IRON_THORNS,
|
||||
SpeciesId.IRON_VALIANT,
|
||||
SpeciesId.MIRAIDON,
|
||||
SpeciesId.IRON_LEAVES,
|
||||
SpeciesId.IRON_BOULDER,
|
||||
SpeciesId.IRON_CROWN,
|
||||
SpeciesId.MIRAIDON,
|
||||
/** Mythical */
|
||||
SpeciesId.MEW,
|
||||
SpeciesId.CELEBI,
|
||||
SpeciesId.DEOXYS,
|
||||
SpeciesId.JIRACHI,
|
||||
SpeciesId.DARKRAI,
|
||||
SpeciesId.DEOXYS,
|
||||
SpeciesId.PHIONE,
|
||||
SpeciesId.MANAPHY,
|
||||
SpeciesId.ARCEUS,
|
||||
SpeciesId.DARKRAI,
|
||||
SpeciesId.SHAYMIN,
|
||||
SpeciesId.ARCEUS,
|
||||
SpeciesId.VICTINI,
|
||||
SpeciesId.MELOETTA,
|
||||
SpeciesId.KELDEO,
|
||||
SpeciesId.MELOETTA,
|
||||
SpeciesId.GENESECT,
|
||||
SpeciesId.DIANCIE,
|
||||
SpeciesId.HOOPA,
|
||||
@ -84,9 +87,9 @@ const excludedBosses = [
|
||||
SpeciesId.MAGEARNA,
|
||||
SpeciesId.MARSHADOW,
|
||||
SpeciesId.ZERAORA,
|
||||
SpeciesId.ZARUDE,
|
||||
SpeciesId.MELTAN,
|
||||
SpeciesId.MELMETAL,
|
||||
SpeciesId.ZARUDE,
|
||||
SpeciesId.PECHARUNT,
|
||||
];
|
||||
|
||||
|
@ -8,7 +8,6 @@ import {
|
||||
transitionMysteryEncounterIntroVisuals,
|
||||
} from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||
import type { PokemonHeldItemModifierType } from "#app/modifier/modifier-type";
|
||||
import { modifierTypes } from "#app/data/data-lists";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import type MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter";
|
||||
@ -22,6 +21,7 @@ import { applyModifierTypeToPlayerPokemon } from "#app/data/mystery-encounters/u
|
||||
import { showEncounterText } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
|
||||
import i18next from "#app/plugins/i18n";
|
||||
import { ModifierTier } from "#enums/modifier-tier";
|
||||
import { modifierTypes } from "#app/data/data-lists";
|
||||
import { getPokemonSpecies } from "#app/utils/pokemon-utils";
|
||||
import { MoveId } from "#enums/move-id";
|
||||
import { BattlerIndex } from "#enums/battler-index";
|
||||
@ -200,7 +200,8 @@ export const TrashToTreasureEncounter: MysteryEncounter = MysteryEncounterBuilde
|
||||
const encounter = globalScene.currentBattle.mysteryEncounter!;
|
||||
|
||||
setEncounterRewards({
|
||||
guaranteedModifierTiers: [ModifierTier.ROGUE, ModifierTier.ROGUE, ModifierTier.ULTRA, ModifierTier.GREAT],
|
||||
guaranteedModifierTypeFuncs: [modifierTypes.LEFTOVERS],
|
||||
guaranteedModifierTiers: [ModifierTier.ROGUE, ModifierTier.ULTRA, ModifierTier.GREAT],
|
||||
fillRemaining: true,
|
||||
});
|
||||
encounter.startOfBattleEffects.push(
|
||||
|
@ -50,6 +50,7 @@ const namespace = "mysteryEncounters/weirdDream";
|
||||
|
||||
/** Exclude Ultra Beasts, Paradox, Eternatus, and all legendary/mythical/trio pokemon that are below 570 BST */
|
||||
const EXCLUDED_TRANSFORMATION_SPECIES = [
|
||||
SpeciesId.ARCEUS,
|
||||
SpeciesId.ETERNATUS,
|
||||
/** UBs */
|
||||
SpeciesId.NIHILEGO,
|
||||
@ -85,20 +86,19 @@ const EXCLUDED_TRANSFORMATION_SPECIES = [
|
||||
SpeciesId.IRON_BOULDER,
|
||||
SpeciesId.IRON_CROWN,
|
||||
/** These are banned so they don't appear in the < 570 BST pool */
|
||||
SpeciesId.PHIONE,
|
||||
SpeciesId.TYPE_NULL,
|
||||
SpeciesId.COSMOG,
|
||||
SpeciesId.COSMOEM,
|
||||
SpeciesId.MELTAN,
|
||||
SpeciesId.KUBFU,
|
||||
SpeciesId.COSMOEM,
|
||||
SpeciesId.POIPOLE,
|
||||
SpeciesId.TERAPAGOS,
|
||||
SpeciesId.TYPE_NULL,
|
||||
SpeciesId.CALYREX,
|
||||
SpeciesId.NAGANADEL,
|
||||
SpeciesId.URSHIFU,
|
||||
SpeciesId.CALYREX,
|
||||
SpeciesId.OGERPON,
|
||||
SpeciesId.OKIDOGI,
|
||||
SpeciesId.MUNKIDORI,
|
||||
SpeciesId.FEZANDIPITI,
|
||||
SpeciesId.TERAPAGOS,
|
||||
];
|
||||
|
||||
const SUPER_LEGENDARY_BST_THRESHOLD = 600;
|
||||
@ -231,6 +231,7 @@ export const WeirdDreamEncounter: MysteryEncounter = MysteryEncounterBuilder.wit
|
||||
modifierTypes.MINT,
|
||||
modifierTypes.MINT,
|
||||
modifierTypes.MINT,
|
||||
modifierTypes.MINT,
|
||||
],
|
||||
fillRemaining: false,
|
||||
});
|
||||
|
@ -751,7 +751,7 @@ export async function catchPokemon(
|
||||
UiMode.POKEDEX_PAGE,
|
||||
pokemon.species,
|
||||
pokemon.formIndex,
|
||||
attributes,
|
||||
[attributes],
|
||||
null,
|
||||
() => {
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
|
||||
|
@ -764,7 +764,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
|
||||
readonly subLegendary: boolean;
|
||||
readonly legendary: boolean;
|
||||
readonly mythical: boolean;
|
||||
readonly species: string;
|
||||
public category: string;
|
||||
readonly growthRate: GrowthRate;
|
||||
/** The chance (as a decimal) for this Species to be male, or `null` for genderless species */
|
||||
readonly malePercent: number | null;
|
||||
@ -778,7 +778,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
|
||||
subLegendary: boolean,
|
||||
legendary: boolean,
|
||||
mythical: boolean,
|
||||
species: string,
|
||||
category: string,
|
||||
type1: PokemonType,
|
||||
type2: PokemonType | null,
|
||||
height: number,
|
||||
@ -829,7 +829,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
|
||||
this.subLegendary = subLegendary;
|
||||
this.legendary = legendary;
|
||||
this.mythical = mythical;
|
||||
this.species = species;
|
||||
this.category = category;
|
||||
this.growthRate = growthRate;
|
||||
this.malePercent = malePercent;
|
||||
this.genderDiffs = genderDiffs;
|
||||
@ -968,6 +968,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
|
||||
|
||||
localize(): void {
|
||||
this.name = i18next.t(`pokemon:${SpeciesId[this.speciesId].toLowerCase()}`);
|
||||
this.category = i18next.t(`pokemonCategory:${SpeciesId[this.speciesId].toLowerCase()}_category`);
|
||||
}
|
||||
|
||||
getWildSpeciesForLevel(level: number, allowEvolving: boolean, isBoss: boolean, gameMode: GameMode): SpeciesId {
|
||||
|
@ -668,6 +668,9 @@ export class MovePhase extends BattlePhase {
|
||||
}),
|
||||
500,
|
||||
);
|
||||
|
||||
// Moves with pre-use messages (Magnitude, Chilly Reception, Fickle Beam, etc.) always display their messages even on failure
|
||||
// TODO: This assumes single target for message funcs - is this sustainable?
|
||||
applyMoveAttrs("PreMoveMessageAttr", this.pokemon, this.pokemon.getOpponents(false)[0], this.move.getMove());
|
||||
}
|
||||
|
||||
|
@ -245,6 +245,7 @@ export async function initI18n(): Promise<void> {
|
||||
"pokeball",
|
||||
"pokedexUiHandler",
|
||||
"pokemon",
|
||||
"pokemonCategory",
|
||||
"pokemonEvolutions",
|
||||
"pokemonForm",
|
||||
"pokemonInfo",
|
||||
|
@ -174,6 +174,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
||||
private pokemonCaughtHatchedContainer: Phaser.GameObjects.Container;
|
||||
private pokemonCaughtCountText: Phaser.GameObjects.Text;
|
||||
private pokemonFormText: Phaser.GameObjects.Text;
|
||||
private pokemonCategoryText: Phaser.GameObjects.Text;
|
||||
private pokemonHatchedIcon: Phaser.GameObjects.Sprite;
|
||||
private pokemonHatchedCountText: Phaser.GameObjects.Text;
|
||||
private pokemonShinyIcons: Phaser.GameObjects.Sprite[];
|
||||
@ -409,6 +410,12 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
||||
this.pokemonFormText.setOrigin(0, 0);
|
||||
this.starterSelectContainer.add(this.pokemonFormText);
|
||||
|
||||
this.pokemonCategoryText = addTextObject(100, 18, "Category", TextStyle.WINDOW_ALT, {
|
||||
fontSize: "42px",
|
||||
});
|
||||
this.pokemonCategoryText.setOrigin(1, 0);
|
||||
this.starterSelectContainer.add(this.pokemonCategoryText);
|
||||
|
||||
this.pokemonCaughtHatchedContainer = globalScene.add.container(2, 25);
|
||||
this.pokemonCaughtHatchedContainer.setScale(0.5);
|
||||
this.starterSelectContainer.add(this.pokemonCaughtHatchedContainer);
|
||||
@ -2354,6 +2361,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
||||
this.pokemonCaughtHatchedContainer.setVisible(true);
|
||||
this.pokemonCandyContainer.setVisible(false);
|
||||
this.pokemonFormText.setVisible(false);
|
||||
this.pokemonCategoryText.setVisible(false);
|
||||
|
||||
const defaultDexAttr = globalScene.gameData.getSpeciesDefaultDexAttr(species, true, true);
|
||||
const props = globalScene.gameData.getSpeciesDexAttrProps(species, defaultDexAttr);
|
||||
@ -2382,6 +2390,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
||||
this.pokemonCaughtHatchedContainer.setVisible(false);
|
||||
this.pokemonCandyContainer.setVisible(false);
|
||||
this.pokemonFormText.setVisible(false);
|
||||
this.pokemonCategoryText.setVisible(false);
|
||||
|
||||
this.setSpeciesDetails(species!, {
|
||||
// TODO: is this bang correct?
|
||||
@ -2534,6 +2543,13 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
||||
this.pokemonNameText.setText(species ? "???" : "");
|
||||
}
|
||||
|
||||
// Setting the category
|
||||
if (isFormCaught) {
|
||||
this.pokemonCategoryText.setText(species.category);
|
||||
} else {
|
||||
this.pokemonCategoryText.setText("");
|
||||
}
|
||||
|
||||
// Setting tint of the sprite
|
||||
if (isFormCaught) {
|
||||
this.species.loadAssets(female!, formIndex, shiny, variant as Variant, true).then(() => {
|
||||
|
@ -1,11 +1,14 @@
|
||||
import { AbilityId } from "#enums/ability-id";
|
||||
import { RandomMoveAttr } from "#app/data/moves/move";
|
||||
import { MoveResult } from "#enums/move-result";
|
||||
import { getPokemonNameWithAffix } from "#app/messages";
|
||||
import { MoveId } from "#enums/move-id";
|
||||
import { SpeciesId } from "#enums/species-id";
|
||||
import { AbilityId } from "#app/enums/ability-id";
|
||||
import { WeatherType } from "#enums/weather-type";
|
||||
import GameManager from "#test/testUtils/gameManager";
|
||||
import i18next from "i18next";
|
||||
import Phaser from "phaser";
|
||||
//import { TurnInitPhase } from "#app/phases/turn-init-phase";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
describe("Moves - Chilly Reception", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
@ -25,95 +28,121 @@ describe("Moves - Chilly Reception", () => {
|
||||
game = new GameManager(phaserGame);
|
||||
game.override
|
||||
.battleStyle("single")
|
||||
.moveset([MoveId.CHILLY_RECEPTION, MoveId.SNOWSCAPE])
|
||||
.moveset([MoveId.CHILLY_RECEPTION, MoveId.SNOWSCAPE, MoveId.SPLASH, MoveId.METRONOME])
|
||||
.enemyMoveset(MoveId.SPLASH)
|
||||
.enemyAbility(AbilityId.BALL_FETCH)
|
||||
.ability(AbilityId.BALL_FETCH);
|
||||
});
|
||||
|
||||
it("should still change the weather if user can't switch out", async () => {
|
||||
it("should display message before use, switch the user out and change the weather to snow", async () => {
|
||||
await game.classicMode.startBattle([SpeciesId.SLOWKING, SpeciesId.MEOWTH]);
|
||||
|
||||
const [slowking, meowth] = game.scene.getPlayerParty();
|
||||
|
||||
game.move.select(MoveId.CHILLY_RECEPTION);
|
||||
game.doSelectPartyPokemon(1);
|
||||
await game.toEndOfTurn();
|
||||
|
||||
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW);
|
||||
expect(game.scene.getPlayerPokemon()).toBe(meowth);
|
||||
expect(slowking.isOnField()).toBe(false);
|
||||
expect(game.phaseInterceptor.log).toContain("SwitchSummonPhase");
|
||||
expect(game.textInterceptor.logs).toContain(
|
||||
i18next.t("moveTriggers:chillyReception", { pokemonName: getPokemonNameWithAffix(slowking) }),
|
||||
);
|
||||
});
|
||||
|
||||
it("should still change weather if user can't switch out", async () => {
|
||||
await game.classicMode.startBattle([SpeciesId.SLOWKING]);
|
||||
|
||||
game.move.select(MoveId.CHILLY_RECEPTION);
|
||||
await game.toEndOfTurn();
|
||||
|
||||
await game.phaseInterceptor.to("BerryPhase", false);
|
||||
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW);
|
||||
expect(game.phaseInterceptor.log).not.toContain("SwitchSummonPhase");
|
||||
expect(game.scene.getPlayerPokemon()?.getLastXMoves()[0].result).toBe(MoveResult.SUCCESS);
|
||||
});
|
||||
|
||||
it("should switch out even if it's snowing", async () => {
|
||||
it("should still switch out even if weather cannot be changed", async () => {
|
||||
await game.classicMode.startBattle([SpeciesId.SLOWKING, SpeciesId.MEOWTH]);
|
||||
// first turn set up snow with snowscape, try chilly reception on second turn
|
||||
|
||||
expect(game.scene.arena.weather?.weatherType).not.toBe(WeatherType.SNOW);
|
||||
|
||||
const [slowking, meowth] = game.scene.getPlayerParty();
|
||||
|
||||
game.move.select(MoveId.SNOWSCAPE);
|
||||
await game.phaseInterceptor.to("BerryPhase", false);
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW);
|
||||
|
||||
await game.phaseInterceptor.to("TurnInitPhase", false);
|
||||
game.move.select(MoveId.CHILLY_RECEPTION);
|
||||
game.doSelectPartyPokemon(1);
|
||||
// TODO: Uncomment lines once wimp out PR fixes force switches to not reset summon data immediately
|
||||
// await game.phaseInterceptor.to("SwitchSummonPhase", false);
|
||||
// expect(slowking.getLastXMoves()[0].result).toBe(MoveResult.SUCCESS);
|
||||
|
||||
await game.toEndOfTurn();
|
||||
|
||||
await game.phaseInterceptor.to("BerryPhase", false);
|
||||
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW);
|
||||
expect(game.scene.getPlayerField()[0].species.speciesId).toBe(SpeciesId.MEOWTH);
|
||||
expect(game.phaseInterceptor.log).toContain("SwitchSummonPhase");
|
||||
expect(game.scene.getPlayerPokemon()).toBe(meowth);
|
||||
expect(slowking.isOnField()).toBe(false);
|
||||
});
|
||||
|
||||
it("happy case - switch out and weather changes", async () => {
|
||||
// Source: https://replay.pokemonshowdown.com/gen9ou-2367532550
|
||||
it("should fail (while still displaying message) if neither weather change nor switch out succeeds", async () => {
|
||||
await game.classicMode.startBattle([SpeciesId.SLOWKING]);
|
||||
|
||||
expect(game.scene.arena.weather?.weatherType).not.toBe(WeatherType.SNOW);
|
||||
|
||||
const slowking = game.scene.getPlayerPokemon()!;
|
||||
|
||||
game.move.select(MoveId.SNOWSCAPE);
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW);
|
||||
|
||||
game.move.select(MoveId.CHILLY_RECEPTION);
|
||||
game.doSelectPartyPokemon(1);
|
||||
await game.toEndOfTurn();
|
||||
|
||||
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW);
|
||||
expect(game.phaseInterceptor.log).not.toContain("SwitchSummonPhase");
|
||||
expect(game.scene.getPlayerPokemon()).toBe(slowking);
|
||||
expect(slowking.getLastXMoves()[0].result).toBe(MoveResult.FAIL);
|
||||
expect(game.textInterceptor.logs).toContain(
|
||||
i18next.t("moveTriggers:chillyReception", { pokemonName: getPokemonNameWithAffix(slowking) }),
|
||||
);
|
||||
});
|
||||
|
||||
it("should succeed without message if called indirectly", async () => {
|
||||
vi.spyOn(RandomMoveAttr.prototype, "getMoveOverride").mockReturnValue(MoveId.CHILLY_RECEPTION);
|
||||
await game.classicMode.startBattle([SpeciesId.SLOWKING, SpeciesId.MEOWTH]);
|
||||
|
||||
game.move.select(MoveId.CHILLY_RECEPTION);
|
||||
game.doSelectPartyPokemon(1);
|
||||
const [slowking, meowth] = game.scene.getPlayerParty();
|
||||
|
||||
game.move.select(MoveId.METRONOME);
|
||||
game.doSelectPartyPokemon(1);
|
||||
await game.toEndOfTurn();
|
||||
|
||||
await game.phaseInterceptor.to("BerryPhase", false);
|
||||
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW);
|
||||
expect(game.scene.getPlayerField()[0].species.speciesId).toBe(SpeciesId.MEOWTH);
|
||||
expect(game.scene.getPlayerPokemon()).toBe(meowth);
|
||||
expect(slowking.isOnField()).toBe(false);
|
||||
expect(game.phaseInterceptor.log).toContain("SwitchSummonPhase");
|
||||
expect(game.textInterceptor.logs).not.toContain(
|
||||
i18next.t("moveTriggers:chillyReception", { pokemonName: getPokemonNameWithAffix(slowking) }),
|
||||
);
|
||||
});
|
||||
|
||||
// enemy uses another move and weather doesn't change
|
||||
it("check case - enemy not selecting chilly reception doesn't change weather ", async () => {
|
||||
game.override.battleStyle("single").enemyMoveset([MoveId.CHILLY_RECEPTION, MoveId.TACKLE]).moveset(MoveId.SPLASH);
|
||||
|
||||
// Bugcheck test for enemy AI bug
|
||||
it("check case - enemy not selecting chilly reception doesn't change weather", async () => {
|
||||
game.override.enemyMoveset([MoveId.CHILLY_RECEPTION, MoveId.TACKLE]);
|
||||
await game.classicMode.startBattle([SpeciesId.SLOWKING, SpeciesId.MEOWTH]);
|
||||
|
||||
game.move.select(MoveId.SPLASH);
|
||||
await game.move.selectEnemyMove(MoveId.TACKLE);
|
||||
await game.toEndOfTurn();
|
||||
|
||||
await game.phaseInterceptor.to("BerryPhase", false);
|
||||
expect(game.scene.arena.weather?.weatherType).toBe(undefined);
|
||||
});
|
||||
|
||||
it("enemy trainer - expected behavior ", async () => {
|
||||
game.override
|
||||
.battleStyle("single")
|
||||
.startingWave(8)
|
||||
.enemyMoveset(MoveId.CHILLY_RECEPTION)
|
||||
.enemySpecies(SpeciesId.MAGIKARP)
|
||||
.moveset([MoveId.SPLASH, MoveId.THUNDERBOLT]);
|
||||
|
||||
await game.classicMode.startBattle([SpeciesId.JOLTEON]);
|
||||
const RIVAL_MAGIKARP1 = game.scene.getEnemyPokemon()?.id;
|
||||
|
||||
game.move.select(MoveId.SPLASH);
|
||||
await game.phaseInterceptor.to("BerryPhase", false);
|
||||
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW);
|
||||
expect(game.scene.getEnemyPokemon()?.id !== RIVAL_MAGIKARP1);
|
||||
|
||||
await game.phaseInterceptor.to("TurnInitPhase", false);
|
||||
game.move.select(MoveId.SPLASH);
|
||||
|
||||
// second chilly reception should still switch out
|
||||
await game.phaseInterceptor.to("BerryPhase", false);
|
||||
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW);
|
||||
await game.phaseInterceptor.to("TurnInitPhase", false);
|
||||
expect(game.scene.getEnemyPokemon()?.id === RIVAL_MAGIKARP1);
|
||||
game.move.select(MoveId.THUNDERBOLT);
|
||||
|
||||
// enemy chilly recep move should fail: it's snowing and no option to switch out
|
||||
// no crashing
|
||||
await game.phaseInterceptor.to("BerryPhase", false);
|
||||
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW);
|
||||
await game.phaseInterceptor.to("TurnInitPhase", false);
|
||||
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW);
|
||||
game.move.select(MoveId.SPLASH);
|
||||
await game.phaseInterceptor.to("BerryPhase", false);
|
||||
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW);
|
||||
expect(game.scene.arena.weather?.weatherType).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
@ -147,12 +147,13 @@ describe("Weird Dream - Mystery Encounter", () => {
|
||||
const modifierSelectHandler = scene.ui.handlers.find(
|
||||
h => h instanceof ModifierSelectUiHandler,
|
||||
) as ModifierSelectUiHandler;
|
||||
expect(modifierSelectHandler.options.length).toEqual(5);
|
||||
expect(modifierSelectHandler.options.length).toEqual(6);
|
||||
expect(modifierSelectHandler.options[0].modifierTypeOption.type.id).toEqual("MEMORY_MUSHROOM");
|
||||
expect(modifierSelectHandler.options[1].modifierTypeOption.type.id).toEqual("ROGUE_BALL");
|
||||
expect(modifierSelectHandler.options[2].modifierTypeOption.type.id).toEqual("MINT");
|
||||
expect(modifierSelectHandler.options[3].modifierTypeOption.type.id).toEqual("MINT");
|
||||
expect(modifierSelectHandler.options[3].modifierTypeOption.type.id).toEqual("MINT");
|
||||
expect(modifierSelectHandler.options[4].modifierTypeOption.type.id).toEqual("MINT");
|
||||
expect(modifierSelectHandler.options[5].modifierTypeOption.type.id).toEqual("MINT");
|
||||
});
|
||||
|
||||
it("should leave encounter without battle", async () => {
|
||||
|
Loading…
Reference in New Issue
Block a user