mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-20 16:42:45 +02:00
Merge c021f3206e
into 1ff2701964
This commit is contained in:
commit
514acb1db5
@ -21,7 +21,7 @@ import type { EnemyPokemon, PlayerPokemon, TurnMove } from "#app/field/pokemon";
|
||||
import type Pokemon from "#app/field/pokemon";
|
||||
import { ArenaTagType } from "#enums/arena-tag-type";
|
||||
import { BattleSpec } from "#enums/battle-spec";
|
||||
import type { MoveId } from "#enums/move-id";
|
||||
import { MoveId } from "#enums/move-id";
|
||||
import { PlayerGender } from "#enums/player-gender";
|
||||
import { MusicPreference } from "#app/system/settings/settings";
|
||||
import { SpeciesId } from "#enums/species-id";
|
||||
@ -73,7 +73,7 @@ export default class Battle {
|
||||
public battleScore = 0;
|
||||
public postBattleLoot: PokemonHeldItemModifier[] = [];
|
||||
public escapeAttempts = 0;
|
||||
public lastMove: MoveId;
|
||||
public lastMove: MoveId = MoveId.NONE;
|
||||
public battleSeed: string = randomString(16, true);
|
||||
private battleSeedState: string | null = null;
|
||||
public moneyScattered = 0;
|
||||
|
@ -3102,7 +3102,6 @@ export class OverrideMoveEffectAttr extends MoveAttr {
|
||||
/**
|
||||
* Attack Move that doesn't hit the turn it is played and doesn't allow for multiple
|
||||
* uses on the same target. Examples are Future Sight or Doom Desire.
|
||||
* @extends OverrideMoveEffectAttr
|
||||
* @param tagType The {@linkcode ArenaTagType} that will be placed on the field when the move is used
|
||||
* @param chargeAnim The {@linkcode ChargeAnim | Charging Animation} used for the move
|
||||
* @param chargeText The text to display when the move is used
|
||||
@ -3147,7 +3146,6 @@ export class DelayedAttackAttr extends OverrideMoveEffectAttr {
|
||||
/**
|
||||
* Attribute that cancels the associated move's effects when set to be combined with the user's ally's
|
||||
* subsequent move this turn. Used for Grass Pledge, Water Pledge, and Fire Pledge.
|
||||
* @extends OverrideMoveEffectAttr
|
||||
*/
|
||||
export class AwaitCombinedPledgeAttr extends OverrideMoveEffectAttr {
|
||||
constructor() {
|
||||
@ -6781,74 +6779,76 @@ export class FirstMoveTypeAttr extends MoveEffectAttr {
|
||||
}
|
||||
|
||||
/**
|
||||
* Attribute used to call a move.
|
||||
* Used by other move attributes: {@linkcode RandomMoveAttr}, {@linkcode RandomMovesetMoveAttr}, {@linkcode CopyMoveAttr}
|
||||
* @see {@linkcode apply} for move call
|
||||
* @extends OverrideMoveEffectAttr
|
||||
* Abstract attribute used for all move-calling moves, containing common functionality
|
||||
* for executing called moves.
|
||||
*/
|
||||
class CallMoveAttr extends OverrideMoveEffectAttr {
|
||||
protected invalidMoves: ReadonlySet<MoveId>;
|
||||
protected hasTarget: boolean;
|
||||
export abstract class CallMoveAttr extends OverrideMoveEffectAttr {
|
||||
constructor(
|
||||
/**
|
||||
* Whether this move should target the user; default `true`.
|
||||
* If `true`, will unleash non-spread moves against a random eligible target,
|
||||
* or else the move's selected target.
|
||||
*/
|
||||
override selfTarget = true,
|
||||
) {
|
||||
super(selfTarget)
|
||||
}
|
||||
|
||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||
// Get eligible targets for move, failing if we can't target anything
|
||||
const replaceMoveTarget = move.moveTarget === MoveTarget.NEAR_OTHER ? MoveTarget.NEAR_ENEMY : undefined;
|
||||
const moveTargets = getMoveTargets(user, move.id, replaceMoveTarget);
|
||||
if (moveTargets.targets.length === 0) {
|
||||
globalScene.phaseManager.queueMessage(i18next.t("battle:attackFailed"));
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Abstract function yielding the move to be used.
|
||||
* @param user - The {@linkcode Pokemon} using the move
|
||||
* @param target - The {@linkcode Pokemon} being targeted by the move
|
||||
* @returns The MoveId that will be called and used.
|
||||
*/
|
||||
protected abstract getMove(user: Pokemon, target: Pokemon): MoveId;
|
||||
|
||||
override apply(user: Pokemon, target: Pokemon): boolean {
|
||||
const copiedMove = allMoves[this.getMove(user, target)];
|
||||
|
||||
const replaceMoveTarget = copiedMove.moveTarget === MoveTarget.NEAR_OTHER ? MoveTarget.NEAR_ENEMY : undefined;
|
||||
const moveTargets = getMoveTargets(user, copiedMove.id, replaceMoveTarget);
|
||||
|
||||
// Spread moves and ones with only 1 valid target will use their normal targeting.
|
||||
// If not, target the Mirror Move recipient or else a random enemy in our target list
|
||||
const targets = moveTargets.multiple || moveTargets.targets.length === 1
|
||||
? moveTargets.targets
|
||||
: [this.hasTarget
|
||||
: [this.selfTarget
|
||||
? target.getBattlerIndex()
|
||||
: moveTargets.targets[user.randBattleSeedInt(moveTargets.targets.length)]];
|
||||
|
||||
globalScene.phaseManager.unshiftNew("LoadMoveAnimPhase", move.id);
|
||||
globalScene.phaseManager.unshiftNew("MovePhase", user, targets, new PokemonMove(move.id), MoveUseMode.FOLLOW_UP);
|
||||
globalScene.phaseManager.unshiftNew("LoadMoveAnimPhase", copiedMove.id);
|
||||
globalScene.phaseManager.unshiftNew("MovePhase", user, targets, new PokemonMove(copiedMove.id), MoveUseMode.FOLLOW_UP);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attribute used to call a random move.
|
||||
* Used for {@linkcode MoveId.METRONOME}
|
||||
* @see {@linkcode apply} for move selection and move call
|
||||
* @extends CallMoveAttr to call a selected move
|
||||
* Attribute to call a random move among moves not in a banlist.
|
||||
* Used for {@linkcode MoveId.METRONOME}.
|
||||
*/
|
||||
export class RandomMoveAttr extends CallMoveAttr {
|
||||
constructor(invalidMoves: ReadonlySet<MoveId>) {
|
||||
super();
|
||||
this.invalidMoves = invalidMoves;
|
||||
constructor(
|
||||
/**
|
||||
* A {@linkcode ReadonlySet} containing all moves that this {@linkcode MoveAttr} cannot copy,
|
||||
* in addition to unimplemented moves and {@linkcode MoveId.NONE}.
|
||||
* The move will fail if the chosen move is inside this banlist (if it exists).
|
||||
*/
|
||||
protected readonly invalidMoves: ReadonlySet<MoveId>,
|
||||
) {
|
||||
super(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function exists solely to allow tests to override the randomly selected move by mocking this function.
|
||||
*/
|
||||
public getMoveOverride(): MoveId | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* User calls a random moveId.
|
||||
* Pick a random move to execute, barring unimplemented moves and ones
|
||||
* in this move's {@linkcode invalidMetronomeMoves | exclusion list}.
|
||||
* Overridden as public to allow tests to override move choice using mocks.
|
||||
*
|
||||
* Invalid moves are indicated by what is passed in to invalidMoves: {@linkcode invalidMetronomeMoves}
|
||||
* @param user Pokemon that used the move and will call a random move
|
||||
* @param target Pokemon that will be targeted by the random move (if single target)
|
||||
* @param move Move being used
|
||||
* @param args Unused
|
||||
* @param user - The {@linkcode Pokemon} using the move
|
||||
* @returns The {@linkcode MoveId} that will be called.
|
||||
*/
|
||||
override apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||
const moveIds = getEnumValues(MoveId).map(m => !this.invalidMoves.has(m) && !allMoves[m].name.endsWith(" (N)") ? m : MoveId.NONE);
|
||||
let moveId: MoveId = MoveId.NONE;
|
||||
do {
|
||||
moveId = this.getMoveOverride() ?? moveIds[user.randBattleSeedInt(moveIds.length)];
|
||||
}
|
||||
while (moveId === MoveId.NONE);
|
||||
return super.apply(user, target, allMoves[moveId], args);
|
||||
public override getMove(user: Pokemon): MoveId {
|
||||
const moveIds = getEnumValues(MoveId).filter(m => m !== MoveId.NONE && !this.invalidMoves.has(m) && !allMoves[m].name.endsWith(" (N)"));
|
||||
return moveIds[user.randBattleSeedInt(moveIds.length)];
|
||||
}
|
||||
}
|
||||
|
||||
@ -6857,221 +6857,204 @@ export class RandomMoveAttr extends CallMoveAttr {
|
||||
* Used for {@linkcode MoveId.ASSIST} and {@linkcode MoveId.SLEEP_TALK}
|
||||
*
|
||||
* Fails if the user has no callable moves.
|
||||
*
|
||||
* Invalid moves are indicated by what is passed in to invalidMoves: {@linkcode invalidAssistMoves} or {@linkcode invalidSleepTalkMoves}
|
||||
* @extends RandomMoveAttr to use the callMove function on a moveId
|
||||
* @see {@linkcode getCondition} for move selection
|
||||
*/
|
||||
export class RandomMovesetMoveAttr extends CallMoveAttr {
|
||||
private includeParty: boolean;
|
||||
private moveId: number;
|
||||
constructor(invalidMoves: ReadonlySet<MoveId>, includeParty: boolean = false) {
|
||||
super();
|
||||
this.includeParty = includeParty;
|
||||
this.invalidMoves = invalidMoves;
|
||||
export class RandomMovesetMoveAttr extends RandomMoveAttr {
|
||||
/**
|
||||
* The previously-selected {@linkcode MoveId} for this attribute.
|
||||
* Reset to {@linkcode MoveId.NONE} after successful use.
|
||||
*/
|
||||
private selectedMove: MoveId = MoveId.NONE
|
||||
constructor(invalidMoves: ReadonlySet<MoveId>,
|
||||
/**
|
||||
* Whether to consider all moves from the user's party (`true`) or the user's own moveset (`false`);
|
||||
* default `false`.
|
||||
*/
|
||||
private includeParty = false
|
||||
) {
|
||||
super(invalidMoves);
|
||||
}
|
||||
|
||||
/**
|
||||
* User calls a random moveId selected in {@linkcode getCondition}
|
||||
* @param user Pokemon that used the move and will call a random move
|
||||
* @param target Pokemon that will be targeted by the random move (if single target)
|
||||
* @param move Move being used
|
||||
* @param args Unused
|
||||
* Select a random move from either the user's or its party members' movesets,
|
||||
* or return an already-selected one if one exists.
|
||||
*
|
||||
* @param user - The {@linkcode Pokemon} using the move.
|
||||
* @returns The {@linkcode MoveId} that will be called.
|
||||
*/
|
||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||
return super.apply(user, target, allMoves[this.moveId], args);
|
||||
override getMove(user: Pokemon): MoveId {
|
||||
if (this.selectedMove) {
|
||||
const m = this.selectedMove;
|
||||
this.selectedMove = MoveId.NONE;
|
||||
return m;
|
||||
}
|
||||
|
||||
// includeParty will be true for Assist, false for Sleep Talk
|
||||
const allies: Pokemon[] = this.includeParty
|
||||
? (user.isPlayer() ? globalScene.getPlayerParty() : globalScene.getEnemyParty()).filter(p => p !== user)
|
||||
: [ user ];
|
||||
|
||||
// Assist & Sleep Talk consider duplicate moves for their selection (hence why we use an array instead of a set)
|
||||
const moveset = allies.flatMap(p => p.moveset);
|
||||
const eligibleMoves = moveset.filter(m => m.moveId !== MoveId.NONE && !this.invalidMoves.has(m.moveId) && !m.getMove().name.endsWith(" (N)"));
|
||||
this.selectedMove = eligibleMoves[user.randBattleSeedInt(eligibleMoves.length)]?.moveId ?? MoveId.NONE; // will fail if 0 length array
|
||||
return this.selectedMove;
|
||||
}
|
||||
|
||||
getCondition(): MoveConditionFunc {
|
||||
return (user, target, move) => {
|
||||
// includeParty will be true for Assist, false for Sleep Talk
|
||||
let allies: Pokemon[];
|
||||
if (this.includeParty) {
|
||||
allies = user.isPlayer() ? globalScene.getPlayerParty().filter(p => p !== user) : globalScene.getEnemyParty().filter(p => p !== user);
|
||||
} else {
|
||||
allies = [ user ];
|
||||
}
|
||||
const partyMoveset = allies.map(p => p.moveset).flat();
|
||||
const moves = partyMoveset.filter(m => !this.invalidMoves.has(m!.moveId) && !m!.getMove().name.endsWith(" (N)"));
|
||||
if (moves.length === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.moveId = moves[user.randBattleSeedInt(moves.length)].moveId;
|
||||
return true;
|
||||
};
|
||||
override getCondition(): MoveConditionFunc {
|
||||
return (user) => this.getMove(user) !== MoveId.NONE;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: extend CallMoveAttr
|
||||
export class NaturePowerAttr extends OverrideMoveEffectAttr {
|
||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||
let moveId = MoveId.NONE;
|
||||
switch (globalScene.arena.getTerrainType()) {
|
||||
// this allows terrains to 'override' the biome move
|
||||
case TerrainType.NONE:
|
||||
switch (globalScene.arena.biomeType) {
|
||||
case BiomeId.TOWN:
|
||||
moveId = MoveId.ROUND;
|
||||
break;
|
||||
case BiomeId.METROPOLIS:
|
||||
moveId = MoveId.TRI_ATTACK;
|
||||
break;
|
||||
case BiomeId.SLUM:
|
||||
moveId = MoveId.SLUDGE_BOMB;
|
||||
break;
|
||||
case BiomeId.PLAINS:
|
||||
moveId = MoveId.SILVER_WIND;
|
||||
break;
|
||||
case BiomeId.GRASS:
|
||||
moveId = MoveId.GRASS_KNOT;
|
||||
break;
|
||||
case BiomeId.TALL_GRASS:
|
||||
moveId = MoveId.POLLEN_PUFF;
|
||||
break;
|
||||
case BiomeId.MEADOW:
|
||||
moveId = MoveId.GIGA_DRAIN;
|
||||
break;
|
||||
case BiomeId.FOREST:
|
||||
moveId = MoveId.BUG_BUZZ;
|
||||
break;
|
||||
case BiomeId.JUNGLE:
|
||||
moveId = MoveId.LEAF_STORM;
|
||||
break;
|
||||
case BiomeId.SEA:
|
||||
moveId = MoveId.HYDRO_PUMP;
|
||||
break;
|
||||
case BiomeId.SWAMP:
|
||||
moveId = MoveId.MUD_BOMB;
|
||||
break;
|
||||
case BiomeId.BEACH:
|
||||
moveId = MoveId.SCALD;
|
||||
break;
|
||||
case BiomeId.LAKE:
|
||||
moveId = MoveId.BUBBLE_BEAM;
|
||||
break;
|
||||
case BiomeId.SEABED:
|
||||
moveId = MoveId.BRINE;
|
||||
break;
|
||||
case BiomeId.ISLAND:
|
||||
moveId = MoveId.LEAF_TORNADO;
|
||||
break;
|
||||
case BiomeId.MOUNTAIN:
|
||||
moveId = MoveId.AIR_SLASH;
|
||||
break;
|
||||
case BiomeId.BADLANDS:
|
||||
moveId = MoveId.EARTH_POWER;
|
||||
break;
|
||||
case BiomeId.DESERT:
|
||||
moveId = MoveId.SCORCHING_SANDS;
|
||||
break;
|
||||
case BiomeId.WASTELAND:
|
||||
moveId = MoveId.DRAGON_PULSE;
|
||||
break;
|
||||
case BiomeId.CONSTRUCTION_SITE:
|
||||
moveId = MoveId.STEEL_BEAM;
|
||||
break;
|
||||
case BiomeId.CAVE:
|
||||
moveId = MoveId.POWER_GEM;
|
||||
break;
|
||||
case BiomeId.ICE_CAVE:
|
||||
moveId = MoveId.ICE_BEAM;
|
||||
break;
|
||||
case BiomeId.SNOWY_FOREST:
|
||||
moveId = MoveId.FROST_BREATH;
|
||||
break;
|
||||
case BiomeId.VOLCANO:
|
||||
moveId = MoveId.LAVA_PLUME;
|
||||
break;
|
||||
case BiomeId.GRAVEYARD:
|
||||
moveId = MoveId.SHADOW_BALL;
|
||||
break;
|
||||
case BiomeId.RUINS:
|
||||
moveId = MoveId.ANCIENT_POWER;
|
||||
break;
|
||||
case BiomeId.TEMPLE:
|
||||
moveId = MoveId.EXTRASENSORY;
|
||||
break;
|
||||
case BiomeId.DOJO:
|
||||
moveId = MoveId.FOCUS_BLAST;
|
||||
break;
|
||||
case BiomeId.FAIRY_CAVE:
|
||||
moveId = MoveId.ALLURING_VOICE;
|
||||
break;
|
||||
case BiomeId.ABYSS:
|
||||
moveId = MoveId.OMINOUS_WIND;
|
||||
break;
|
||||
case BiomeId.SPACE:
|
||||
moveId = MoveId.DRACO_METEOR;
|
||||
break;
|
||||
case BiomeId.FACTORY:
|
||||
moveId = MoveId.FLASH_CANNON;
|
||||
break;
|
||||
case BiomeId.LABORATORY:
|
||||
moveId = MoveId.ZAP_CANNON;
|
||||
break;
|
||||
case BiomeId.POWER_PLANT:
|
||||
moveId = MoveId.CHARGE_BEAM;
|
||||
break;
|
||||
case BiomeId.END:
|
||||
moveId = MoveId.ETERNABEAM;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case TerrainType.MISTY:
|
||||
moveId = MoveId.MOONBLAST;
|
||||
break;
|
||||
case TerrainType.ELECTRIC:
|
||||
moveId = MoveId.THUNDERBOLT;
|
||||
break;
|
||||
case TerrainType.GRASSY:
|
||||
moveId = MoveId.ENERGY_BALL;
|
||||
break;
|
||||
case TerrainType.PSYCHIC:
|
||||
moveId = MoveId.PSYCHIC;
|
||||
break;
|
||||
default:
|
||||
// Just in case there's no match
|
||||
moveId = MoveId.TRI_ATTACK;
|
||||
break;
|
||||
}
|
||||
/**
|
||||
* Attribute to call a different move based on the current terrain and biome.
|
||||
* Used by {@linkcode MoveId.NATURE_POWER}
|
||||
*/
|
||||
export class NaturePowerAttr extends CallMoveAttr {
|
||||
constructor() {
|
||||
super(false)
|
||||
}
|
||||
|
||||
// Load the move's animation if we didn't already and unshift a new usage phase
|
||||
globalScene.phaseManager.unshiftNew("LoadMoveAnimPhase", moveId);
|
||||
globalScene.phaseManager.unshiftNew("MovePhase", user, [ target.getBattlerIndex() ], new PokemonMove(moveId), MoveUseMode.FOLLOW_UP);
|
||||
return true;
|
||||
override getMove(user: Pokemon): MoveId {
|
||||
const moveId = this.getMoveIdForTerrain(globalScene.arena.getTerrainType(), globalScene.arena.biomeType)
|
||||
// Unshift a phase to load the move's animation (in case it isn't already), then use the move.
|
||||
globalScene.phaseManager.queueMessage(i18next.t("moveTriggers:naturePowerUse", {
|
||||
pokemonName: getPokemonNameWithAffix(user),
|
||||
moveName: allMoves[moveId].name,
|
||||
}))
|
||||
|
||||
return moveId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to retrieve the correct move for the current terrain and biome.
|
||||
* Made into a separate function for brevity.
|
||||
*/
|
||||
private getMoveIdForTerrain(terrain: TerrainType, biome: BiomeId): MoveId {
|
||||
switch (terrain) {
|
||||
case TerrainType.ELECTRIC:
|
||||
return MoveId.THUNDERBOLT;
|
||||
case TerrainType.GRASSY:
|
||||
return MoveId.ENERGY_BALL;
|
||||
case TerrainType.PSYCHIC:
|
||||
return MoveId.PSYCHIC;
|
||||
case TerrainType.MISTY:
|
||||
return MoveId.MOONBLAST;
|
||||
}
|
||||
|
||||
// No terrain means check biome
|
||||
switch (biome) {
|
||||
case BiomeId.TOWN:
|
||||
return MoveId.ROUND;
|
||||
case BiomeId.METROPOLIS:
|
||||
return MoveId.TRI_ATTACK;
|
||||
case BiomeId.SLUM:
|
||||
return MoveId.SLUDGE_BOMB;
|
||||
case BiomeId.PLAINS:
|
||||
return MoveId.SILVER_WIND;
|
||||
case BiomeId.GRASS:
|
||||
return MoveId.GRASS_KNOT;
|
||||
case BiomeId.TALL_GRASS:
|
||||
return MoveId.POLLEN_PUFF;
|
||||
case BiomeId.MEADOW:
|
||||
return MoveId.GIGA_DRAIN;
|
||||
case BiomeId.FOREST:
|
||||
return MoveId.BUG_BUZZ;
|
||||
case BiomeId.JUNGLE:
|
||||
return MoveId.LEAF_STORM;
|
||||
case BiomeId.SEA:
|
||||
return MoveId.HYDRO_PUMP;
|
||||
case BiomeId.SWAMP:
|
||||
return MoveId.MUD_BOMB;
|
||||
case BiomeId.BEACH:
|
||||
return MoveId.SCALD;
|
||||
case BiomeId.LAKE:
|
||||
return MoveId.BUBBLE_BEAM;
|
||||
case BiomeId.SEABED:
|
||||
return MoveId.BRINE;
|
||||
case BiomeId.ISLAND:
|
||||
return MoveId.LEAF_TORNADO;
|
||||
case BiomeId.MOUNTAIN:
|
||||
return MoveId.AIR_SLASH;
|
||||
case BiomeId.BADLANDS:
|
||||
return MoveId.EARTH_POWER;
|
||||
case BiomeId.DESERT:
|
||||
return MoveId.SCORCHING_SANDS;
|
||||
case BiomeId.WASTELAND:
|
||||
return MoveId.DRAGON_PULSE;
|
||||
case BiomeId.CONSTRUCTION_SITE:
|
||||
return MoveId.STEEL_BEAM;
|
||||
case BiomeId.CAVE:
|
||||
return MoveId.POWER_GEM;
|
||||
case BiomeId.ICE_CAVE:
|
||||
return MoveId.ICE_BEAM;
|
||||
case BiomeId.SNOWY_FOREST:
|
||||
return MoveId.FROST_BREATH;
|
||||
case BiomeId.VOLCANO:
|
||||
return MoveId.LAVA_PLUME;
|
||||
case BiomeId.GRAVEYARD:
|
||||
return MoveId.SHADOW_BALL;
|
||||
case BiomeId.RUINS:
|
||||
return MoveId.ANCIENT_POWER;
|
||||
case BiomeId.TEMPLE:
|
||||
return MoveId.EXTRASENSORY;
|
||||
case BiomeId.DOJO:
|
||||
return MoveId.FOCUS_BLAST;
|
||||
case BiomeId.FAIRY_CAVE:
|
||||
return MoveId.ALLURING_VOICE;
|
||||
case BiomeId.ABYSS:
|
||||
return MoveId.OMINOUS_WIND;
|
||||
case BiomeId.SPACE:
|
||||
return MoveId.DRACO_METEOR;
|
||||
case BiomeId.FACTORY:
|
||||
return MoveId.FLASH_CANNON;
|
||||
case BiomeId.LABORATORY:
|
||||
return MoveId.ZAP_CANNON;
|
||||
case BiomeId.POWER_PLANT:
|
||||
return MoveId.CHARGE_BEAM;
|
||||
case BiomeId.END:
|
||||
return MoveId.ETERNABEAM;
|
||||
default:
|
||||
// Fallback for no match
|
||||
biome satisfies never;
|
||||
console.warn(`NaturePowerAttr lacks defined move to use for current biome ${toReadableString(BiomeId[biome])}; consider adding an appropriate move to the attribute's selection table.`)
|
||||
return MoveId.TRI_ATTACK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attribute used to copy a previously-used move.
|
||||
* Used for {@linkcode MoveId.COPYCAT} and {@linkcode MoveId.MIRROR_MOVE}
|
||||
* @see {@linkcode apply} for move selection and move call
|
||||
* @extends CallMoveAttr to call a selected move
|
||||
* Used for {@linkcode MoveId.COPYCAT} and {@linkcode MoveId.MIRROR_MOVE}.
|
||||
*/
|
||||
export class CopyMoveAttr extends CallMoveAttr {
|
||||
private mirrorMove: boolean;
|
||||
constructor(mirrorMove: boolean, invalidMoves: ReadonlySet<MoveId> = new Set()) {
|
||||
super();
|
||||
this.mirrorMove = mirrorMove;
|
||||
this.invalidMoves = invalidMoves;
|
||||
constructor(
|
||||
/**
|
||||
* A {@linkcode ReadonlySet} containing all moves that this {@linkcode MoveAttr} cannot copy,
|
||||
* in addition to unimplemented moves and {@linkcode MoveId.NONE}.
|
||||
* The move will fail if the chosen move is inside this banlist (if it exists).
|
||||
*/
|
||||
protected readonly invalidMoves: ReadonlySet<MoveId>,
|
||||
selfTarget = true,
|
||||
) {
|
||||
super(selfTarget);
|
||||
}
|
||||
|
||||
apply(user: Pokemon, target: Pokemon, _move: Move, args: any[]): boolean {
|
||||
this.hasTarget = this.mirrorMove;
|
||||
// bang is correct as condition func returns `false` and fails move if no last move exists
|
||||
const lastMove = this.mirrorMove ? target.getLastNonVirtualMove(false, false)!.move : globalScene.currentBattle.lastMove;
|
||||
return super.apply(user, target, allMoves[lastMove], args);
|
||||
override getMove(_user: Pokemon, target: Pokemon): MoveId {
|
||||
return this.selfTarget
|
||||
? globalScene.currentBattle.lastMove
|
||||
: target.getLastXMoves()[0]?.move ?? MoveId.NONE
|
||||
}
|
||||
|
||||
getCondition(): MoveConditionFunc {
|
||||
return (_user, target, _move) => {
|
||||
const lastMove = this.mirrorMove ? target.getLastNonVirtualMove(false, false)?.move : globalScene.currentBattle.lastMove;
|
||||
return !isNullOrUndefined(lastMove) && !this.invalidMoves.has(lastMove);
|
||||
const chosenMove = this.getMove(_user, target);
|
||||
return chosenMove !== MoveId.NONE && !this.invalidMoves.has(chosenMove);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Attribute used for moves that cause the target to repeat their last used move.
|
||||
*
|
||||
@ -8766,7 +8749,7 @@ export function initMoves() {
|
||||
new SelfStatusMove(MoveId.METRONOME, PokemonType.NORMAL, -1, 10, -1, 0, 1)
|
||||
.attr(RandomMoveAttr, invalidMetronomeMoves),
|
||||
new StatusMove(MoveId.MIRROR_MOVE, PokemonType.FLYING, -1, 20, -1, 0, 1)
|
||||
.attr(CopyMoveAttr, true, invalidMirrorMoveMoves),
|
||||
.attr(CopyMoveAttr, invalidMirrorMoveMoves, true),
|
||||
new AttackMove(MoveId.SELF_DESTRUCT, PokemonType.NORMAL, MoveCategory.PHYSICAL, 200, 100, 5, -1, 0, 1)
|
||||
.attr(SacrificialAttr)
|
||||
.makesContact(false)
|
||||
@ -9638,7 +9621,7 @@ export function initMoves() {
|
||||
.target(MoveTarget.NEAR_ENEMY)
|
||||
.unimplemented(),
|
||||
new SelfStatusMove(MoveId.COPYCAT, PokemonType.NORMAL, -1, 20, -1, 0, 4)
|
||||
.attr(CopyMoveAttr, false, invalidCopycatMoves),
|
||||
.attr(CopyMoveAttr, invalidCopycatMoves),
|
||||
new StatusMove(MoveId.POWER_SWAP, PokemonType.PSYCHIC, -1, 10, 100, 0, 4)
|
||||
.attr(SwapStatStagesAttr, [ Stat.ATK, Stat.SPATK ])
|
||||
.ignoresSubstitute(),
|
||||
|
@ -380,12 +380,10 @@ export class MovePhase extends BattlePhase {
|
||||
success = passesConditions && !failedDueToWeather && !failedDueToTerrain;
|
||||
}
|
||||
|
||||
// Update the battle's "last move" pointer, unless we're currently mimicking a move.
|
||||
if (!allMoves[this.move.moveId].hasAttr("CopyMoveAttr")) {
|
||||
// The last move used is unaffected by moves that fail
|
||||
if (success) {
|
||||
globalScene.currentBattle.lastMove = this.move.moveId;
|
||||
}
|
||||
// Update the battle's "last move" pointer, unless we're currently mimicking a move
|
||||
// or the move failed.
|
||||
if (!allMoves[this.move.moveId].hasAttr("CallMoveAttr") && success) {
|
||||
globalScene.currentBattle.lastMove = this.move.moveId;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -83,7 +83,7 @@ describe("Abilities - Gorilla Tactics", () => {
|
||||
});
|
||||
|
||||
it("should lock into calling moves, even if also in moveset", async () => {
|
||||
vi.spyOn(RandomMoveAttr.prototype, "getMoveOverride").mockReturnValue(MoveId.TACKLE);
|
||||
vi.spyOn(RandomMoveAttr.prototype, "getMove").mockReturnValue(MoveId.TACKLE);
|
||||
await game.classicMode.startBattle([SpeciesId.GALAR_DARMANITAN]);
|
||||
|
||||
const darmanitan = game.scene.getPlayerPokemon()!;
|
||||
|
@ -1,7 +1,5 @@
|
||||
import { Stat } from "#enums/stat";
|
||||
import { TerrainType } from "#app/data/terrain";
|
||||
import { MoveEndPhase } from "#app/phases/move-end-phase";
|
||||
import { TurnEndPhase } from "#app/phases/turn-end-phase";
|
||||
import { AbilityId } from "#enums/ability-id";
|
||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||
import { MoveId } from "#enums/move-id";
|
||||
@ -10,7 +8,6 @@ import GameManager from "#test/testUtils/gameManager";
|
||||
import Phaser from "phaser";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { RandomMoveAttr } from "#app/data/moves/move";
|
||||
import { allMoves } from "#app/data/data-lists";
|
||||
|
||||
// See also: TypeImmunityAbAttr
|
||||
describe("Abilities - Sap Sipper", () => {
|
||||
@ -38,131 +35,98 @@ describe("Abilities - Sap Sipper", () => {
|
||||
.enemyMoveset(MoveId.SPLASH);
|
||||
});
|
||||
|
||||
it("raises ATK stat stage by 1 and block effects when activated against a grass attack", async () => {
|
||||
const moveToUse = MoveId.LEAFAGE;
|
||||
|
||||
game.override.moveset(moveToUse);
|
||||
|
||||
it("should nullify all effects of Grass-type attacks and raise ATK by 1 stage", async () => {
|
||||
await game.classicMode.startBattle([SpeciesId.BULBASAUR]);
|
||||
|
||||
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||
const initialEnemyHp = enemyPokemon.hp;
|
||||
game.move.use(MoveId.LEAFAGE);
|
||||
await game.toNextTurn();
|
||||
|
||||
game.move.select(moveToUse);
|
||||
|
||||
await game.phaseInterceptor.to(TurnEndPhase);
|
||||
|
||||
expect(initialEnemyHp - enemyPokemon.hp).toBe(0);
|
||||
const enemyPokemon = game.field.getEnemyPokemon();
|
||||
expect(enemyPokemon.hp).toBe(enemyPokemon.getMaxHp());
|
||||
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(1);
|
||||
});
|
||||
|
||||
it("raises ATK stat stage by 1 and block effects when activated against a grass status move", async () => {
|
||||
const moveToUse = MoveId.SPORE;
|
||||
|
||||
game.override.moveset(moveToUse);
|
||||
|
||||
it("should work on grass status moves", async () => {
|
||||
await game.classicMode.startBattle([SpeciesId.BULBASAUR]);
|
||||
|
||||
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||
|
||||
game.move.select(moveToUse);
|
||||
|
||||
await game.phaseInterceptor.to(TurnEndPhase);
|
||||
game.move.use(MoveId.SPORE);
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(enemyPokemon.status).toBeUndefined();
|
||||
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(1);
|
||||
});
|
||||
|
||||
it("do not activate against status moves that target the field", async () => {
|
||||
const moveToUse = MoveId.GRASSY_TERRAIN;
|
||||
|
||||
game.override.moveset(moveToUse);
|
||||
|
||||
it("should not activate on non Grass-type moves", async () => {
|
||||
await game.classicMode.startBattle([SpeciesId.BULBASAUR]);
|
||||
|
||||
game.move.select(moveToUse);
|
||||
game.move.use(MoveId.TACKLE);
|
||||
await game.toEndOfTurn();
|
||||
|
||||
await game.phaseInterceptor.to(TurnEndPhase);
|
||||
|
||||
expect(game.scene.arena.terrain).toBeDefined();
|
||||
expect(game.scene.arena.terrain!.terrainType).toBe(TerrainType.GRASSY);
|
||||
expect(game.scene.getEnemyPokemon()!.getStatStage(Stat.ATK)).toBe(0);
|
||||
});
|
||||
|
||||
it("activate once against multi-hit grass attacks", async () => {
|
||||
const moveToUse = MoveId.BULLET_SEED;
|
||||
|
||||
game.override.moveset(moveToUse);
|
||||
|
||||
await game.classicMode.startBattle([SpeciesId.BULBASAUR]);
|
||||
|
||||
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||
const initialEnemyHp = enemyPokemon.hp;
|
||||
|
||||
game.move.select(moveToUse);
|
||||
|
||||
await game.phaseInterceptor.to(TurnEndPhase);
|
||||
|
||||
expect(initialEnemyHp - enemyPokemon.hp).toBe(0);
|
||||
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(1);
|
||||
});
|
||||
|
||||
it("do not activate against status moves that target the user", async () => {
|
||||
const moveToUse = MoveId.SPIKY_SHIELD;
|
||||
|
||||
game.override.moveset(moveToUse);
|
||||
|
||||
await game.classicMode.startBattle([SpeciesId.BULBASAUR]);
|
||||
|
||||
const playerPokemon = game.scene.getPlayerPokemon()!;
|
||||
|
||||
game.move.select(moveToUse);
|
||||
|
||||
await game.phaseInterceptor.to(MoveEndPhase);
|
||||
|
||||
expect(playerPokemon.getTag(BattlerTagType.SPIKY_SHIELD)).toBeDefined();
|
||||
|
||||
await game.phaseInterceptor.to(TurnEndPhase);
|
||||
|
||||
expect(playerPokemon.getStatStage(Stat.ATK)).toBe(0);
|
||||
const enemy = game.field.getEnemyPokemon();
|
||||
expect(enemy.hp).toBeLessThan(enemy.getMaxHp());
|
||||
expect(enemy.getStatStage(Stat.ATK)).toBe(0);
|
||||
expect(game.phaseInterceptor.log).not.toContain("ShowAbilityPhase");
|
||||
});
|
||||
|
||||
it("activate once against multi-hit grass attacks (metronome)", async () => {
|
||||
const moveToUse = MoveId.METRONOME;
|
||||
|
||||
const randomMoveAttr = allMoves[MoveId.METRONOME].findAttr(
|
||||
attr => attr instanceof RandomMoveAttr,
|
||||
) as RandomMoveAttr;
|
||||
vi.spyOn(randomMoveAttr, "getMoveOverride").mockReturnValue(MoveId.BULLET_SEED);
|
||||
|
||||
game.override.moveset(moveToUse);
|
||||
|
||||
it("should not activate against field-targeted moves", async () => {
|
||||
await game.classicMode.startBattle([SpeciesId.BULBASAUR]);
|
||||
|
||||
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||
const initialEnemyHp = enemyPokemon.hp;
|
||||
game.move.use(MoveId.GRASSY_TERRAIN);
|
||||
await game.toNextTurn();
|
||||
|
||||
game.move.select(moveToUse);
|
||||
|
||||
await game.phaseInterceptor.to(TurnEndPhase);
|
||||
|
||||
expect(initialEnemyHp - enemyPokemon.hp).toBe(0);
|
||||
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(1);
|
||||
expect(game.scene.arena.terrain).toBeDefined();
|
||||
expect(game.scene.arena.terrain!.terrainType).toBe(TerrainType.GRASSY);
|
||||
expect(game.field.getEnemyPokemon().getStatStage(Stat.ATK)).toBe(0);
|
||||
});
|
||||
|
||||
it("still activates regardless of accuracy check", async () => {
|
||||
game.override.moveset(MoveId.LEAF_BLADE);
|
||||
|
||||
it("should trigger and cancel multi-hit moves, including ones called indirectly", async () => {
|
||||
vi.spyOn(RandomMoveAttr.prototype, "getMove").mockReturnValue(MoveId.BULLET_SEED);
|
||||
await game.classicMode.startBattle([SpeciesId.BULBASAUR]);
|
||||
|
||||
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||
const player = game.field.getPlayerPokemon();
|
||||
const enemy = game.field.getEnemyPokemon();
|
||||
|
||||
game.move.select(MoveId.LEAF_BLADE);
|
||||
await game.phaseInterceptor.to("MoveEffectPhase");
|
||||
game.move.use(MoveId.BULLET_SEED);
|
||||
await game.toEndOfTurn();
|
||||
|
||||
expect(enemy.hp).toBe(enemy.getMaxHp());
|
||||
expect(enemy.getStatStage(Stat.ATK)).toBe(1);
|
||||
expect(player.turnData.hitCount).toBe(1);
|
||||
|
||||
game.move.use(MoveId.METRONOME);
|
||||
await game.toEndOfTurn();
|
||||
|
||||
expect(enemy.hp).toBe(enemy.getMaxHp());
|
||||
expect(enemy.getStatStage(Stat.ATK)).toBe(2);
|
||||
expect(player.turnData.hitCount).toBe(1);
|
||||
});
|
||||
|
||||
it("should not activate on self-targeted status moves", async () => {
|
||||
await game.classicMode.startBattle([SpeciesId.BULBASAUR]);
|
||||
|
||||
const player = game.field.getPlayerPokemon();
|
||||
|
||||
game.move.use(MoveId.SPIKY_SHIELD);
|
||||
await game.phaseInterceptor.to("MoveEndPhase");
|
||||
|
||||
expect(player.getTag(BattlerTagType.SPIKY_SHIELD)).toBeDefined();
|
||||
|
||||
await game.toEndOfTurn();
|
||||
|
||||
expect(player.getStatStage(Stat.ATK)).toBe(0);
|
||||
expect(game.phaseInterceptor.log).not.toContain("ShowAbilityPhase");
|
||||
});
|
||||
|
||||
it("should activate even on missed moves", async () => {
|
||||
await game.classicMode.startBattle([SpeciesId.BULBASAUR]);
|
||||
|
||||
game.move.use(MoveId.LEAF_BLADE);
|
||||
await game.move.forceMiss();
|
||||
await game.phaseInterceptor.to("BerryPhase", false);
|
||||
await game.toEndOfTurn();
|
||||
|
||||
const enemyPokemon = game.field.getEnemyPokemon();
|
||||
expect(enemyPokemon.getStatStage(Stat.ATK)).toBe(1);
|
||||
});
|
||||
});
|
||||
|
@ -1,13 +1,12 @@
|
||||
import { BattlerIndex } from "#enums/battler-index";
|
||||
import { Stat } from "#app/enums/stat";
|
||||
import { MoveResult } from "#enums/move-result";
|
||||
import { CommandPhase } from "#app/phases/command-phase";
|
||||
import { AbilityId } from "#enums/ability-id";
|
||||
import { MoveId } from "#enums/move-id";
|
||||
import { SpeciesId } from "#enums/species-id";
|
||||
import GameManager from "#test/testUtils/gameManager";
|
||||
import Phaser from "phaser";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
describe("Moves - Assist", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
@ -25,11 +24,12 @@ describe("Moves - Assist", () => {
|
||||
|
||||
beforeEach(() => {
|
||||
game = new GameManager(phaserGame);
|
||||
|
||||
// Manual moveset overrides are required for the player pokemon in these tests
|
||||
// because the normal moveset override doesn't allow for accurate testing of moveset changes
|
||||
game.override
|
||||
.ability(AbilityId.BALL_FETCH)
|
||||
.battleStyle("double")
|
||||
.battleStyle("single")
|
||||
.criticalHits(false)
|
||||
.enemySpecies(SpeciesId.MAGIKARP)
|
||||
.enemyLevel(100)
|
||||
@ -37,69 +37,73 @@ describe("Moves - Assist", () => {
|
||||
.enemyMoveset(MoveId.SPLASH);
|
||||
});
|
||||
|
||||
it("should only use an ally's moves", async () => {
|
||||
game.override.enemyMoveset(MoveId.SWORDS_DANCE);
|
||||
it("should call a random eligible move from an ally's moveset and apply secondary effects", async () => {
|
||||
game.override.battleStyle("double");
|
||||
await game.classicMode.startBattle([SpeciesId.FEEBAS, SpeciesId.SHUCKLE]);
|
||||
|
||||
const [feebas, shuckle] = game.scene.getPlayerField();
|
||||
// These are all moves Assist cannot call; Sketch will be used to test that it can call other moves properly
|
||||
game.move.changeMoveset(feebas, [MoveId.ASSIST, MoveId.SKETCH, MoveId.PROTECT, MoveId.DRAGON_TAIL]);
|
||||
game.move.changeMoveset(shuckle, [MoveId.ASSIST, MoveId.SKETCH, MoveId.PROTECT, MoveId.DRAGON_TAIL]);
|
||||
game.move.changeMoveset(feebas, [MoveId.CIRCLE_THROW, MoveId.ASSIST, MoveId.WOOD_HAMMER, MoveId.ACID_SPRAY]);
|
||||
game.move.changeMoveset(shuckle, [MoveId.COPYCAT, MoveId.ASSIST, MoveId.TORCH_SONG, MoveId.TACKLE]);
|
||||
|
||||
game.move.select(MoveId.ASSIST, 0);
|
||||
game.move.select(MoveId.SKETCH, 1);
|
||||
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.ENEMY_2, BattlerIndex.PLAYER_2, BattlerIndex.PLAYER]);
|
||||
// Player_2 uses Sketch, copies Swords Dance, Player_1 uses Assist, uses Player_2's Sketched Swords Dance
|
||||
await game.toNextTurn();
|
||||
// Force rolling the first eligible move for both mons
|
||||
vi.spyOn(feebas, "randBattleSeedInt").mockImplementation(() => 0);
|
||||
vi.spyOn(shuckle, "randBattleSeedInt").mockImplementation(() => 0);
|
||||
|
||||
expect(game.scene.getPlayerPokemon()!.getStatStage(Stat.ATK)).toBe(2); // Stat raised from Assist -> Swords Dance
|
||||
game.move.select(MoveId.ASSIST, BattlerIndex.PLAYER);
|
||||
game.move.select(MoveId.ASSIST, BattlerIndex.PLAYER_2);
|
||||
await game.toEndOfTurn();
|
||||
|
||||
expect(feebas.getLastXMoves()[0].move).toBe(MoveId.TORCH_SONG);
|
||||
expect(shuckle.getLastXMoves()[0].move).toBe(MoveId.WOOD_HAMMER);
|
||||
expect(feebas.getStatStage(Stat.SPATK)).toBe(1); // Stat raised from Assist --> Torch Song
|
||||
expect(shuckle.hp).toBeLessThan(shuckle.getMaxHp()); // recoil dmg taken from Assist --> Wood Hammer
|
||||
|
||||
expect(feebas.getLastXMoves(-1).map(tm => tm.result)).toEqual([MoveResult.SUCCESS, MoveResult.SUCCESS]);
|
||||
expect(shuckle.getLastXMoves(-1).map(tm => tm.result)).toEqual([MoveResult.SUCCESS, MoveResult.SUCCESS]);
|
||||
});
|
||||
|
||||
it("should fail if there are no allies", async () => {
|
||||
it("should consider off-field allies", async () => {
|
||||
await game.classicMode.startBattle([SpeciesId.FEEBAS, SpeciesId.SHUCKLE]);
|
||||
|
||||
const [feebas, shuckle] = game.scene.getPlayerParty();
|
||||
game.move.changeMoveset(shuckle, MoveId.HYPER_BEAM);
|
||||
|
||||
game.move.use(MoveId.ASSIST);
|
||||
await game.toEndOfTurn();
|
||||
|
||||
expect(feebas.getLastXMoves(-1)).toHaveLength(2);
|
||||
expect(feebas.getLastXMoves()[0]).toMatchObject({
|
||||
move: MoveId.HYPER_BEAM,
|
||||
target: [BattlerIndex.ENEMY],
|
||||
virtual: true,
|
||||
result: MoveResult.SUCCESS,
|
||||
});
|
||||
});
|
||||
|
||||
it("should fail if there are no allies, even if user has eligible moves", async () => {
|
||||
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
|
||||
|
||||
const feebas = game.scene.getPlayerPokemon()!;
|
||||
game.move.changeMoveset(feebas, [MoveId.ASSIST, MoveId.SKETCH, MoveId.PROTECT, MoveId.DRAGON_TAIL]);
|
||||
const feebas = game.field.getPlayerPokemon();
|
||||
game.move.changeMoveset(feebas, [MoveId.ASSIST, MoveId.TACKLE]);
|
||||
|
||||
game.move.select(MoveId.ASSIST, 0);
|
||||
await game.toNextTurn();
|
||||
expect(game.scene.getPlayerPokemon()!.getLastXMoves()[0].result).toBe(MoveResult.FAIL);
|
||||
game.move.select(MoveId.ASSIST);
|
||||
await game.toEndOfTurn();
|
||||
|
||||
expect(feebas.getLastXMoves(-1)).toHaveLength(1);
|
||||
expect(feebas.getLastXMoves()[0].result).toBe(MoveResult.FAIL);
|
||||
});
|
||||
|
||||
it("should fail if ally has no usable moves and user has usable moves", async () => {
|
||||
game.override.enemyMoveset(MoveId.SWORDS_DANCE);
|
||||
it("should fail if allies have no eligible moves", async () => {
|
||||
await game.classicMode.startBattle([SpeciesId.FEEBAS, SpeciesId.SHUCKLE]);
|
||||
|
||||
const [feebas, shuckle] = game.scene.getPlayerField();
|
||||
game.move.changeMoveset(feebas, [MoveId.ASSIST, MoveId.SKETCH, MoveId.PROTECT, MoveId.DRAGON_TAIL]);
|
||||
game.move.changeMoveset(shuckle, [MoveId.ASSIST, MoveId.SKETCH, MoveId.PROTECT, MoveId.DRAGON_TAIL]);
|
||||
const [feebas, shuckle] = game.scene.getPlayerParty();
|
||||
// All of these are ineligible moves
|
||||
game.move.changeMoveset(shuckle, [MoveId.METRONOME, MoveId.DIG, MoveId.FLY]);
|
||||
|
||||
game.move.select(MoveId.SKETCH, 0);
|
||||
game.move.select(MoveId.PROTECT, 1);
|
||||
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.ENEMY_2, BattlerIndex.PLAYER, BattlerIndex.PLAYER_2]);
|
||||
// Player uses Sketch to copy Swords Dance, Player_2 stalls a turn. Player will attempt Assist and should have no usable moves
|
||||
await game.toNextTurn();
|
||||
game.move.select(MoveId.ASSIST, 0);
|
||||
await game.phaseInterceptor.to(CommandPhase);
|
||||
game.move.select(MoveId.PROTECT, 1);
|
||||
await game.toNextTurn();
|
||||
game.move.use(MoveId.ASSIST);
|
||||
await game.toEndOfTurn();
|
||||
|
||||
expect(game.scene.getPlayerPokemon()!.getLastXMoves()[0].result).toBe(MoveResult.FAIL);
|
||||
});
|
||||
|
||||
it("should apply secondary effects of a move", async () => {
|
||||
game.override.moveset([MoveId.ASSIST, MoveId.WOOD_HAMMER, MoveId.WOOD_HAMMER, MoveId.WOOD_HAMMER]);
|
||||
await game.classicMode.startBattle([SpeciesId.FEEBAS, SpeciesId.SHUCKLE]);
|
||||
|
||||
const [feebas, shuckle] = game.scene.getPlayerField();
|
||||
game.move.changeMoveset(feebas, [MoveId.ASSIST, MoveId.SKETCH, MoveId.PROTECT, MoveId.DRAGON_TAIL]);
|
||||
game.move.changeMoveset(shuckle, [MoveId.ASSIST, MoveId.SKETCH, MoveId.PROTECT, MoveId.DRAGON_TAIL]);
|
||||
|
||||
game.move.select(MoveId.ASSIST, 0);
|
||||
await game.phaseInterceptor.to(CommandPhase);
|
||||
game.move.select(MoveId.ASSIST, 1);
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(game.scene.getPlayerPokemon()!.isFullHp()).toBeFalsy(); // should receive recoil damage from Wood Hammer
|
||||
expect(feebas.getLastXMoves(-1)).toHaveLength(1);
|
||||
expect(feebas.getLastXMoves()[0].result).toBe(MoveResult.FAIL);
|
||||
});
|
||||
});
|
||||
|
@ -3,7 +3,6 @@ import { RandomMoveAttr } from "#app/data/moves/move";
|
||||
import { Stat } from "#app/enums/stat";
|
||||
import { MoveResult } from "#enums/move-result";
|
||||
import { AbilityId } from "#enums/ability-id";
|
||||
import { MoveUseMode } from "#enums/move-use-mode";
|
||||
import { MoveId } from "#enums/move-id";
|
||||
import { SpeciesId } from "#enums/species-id";
|
||||
import GameManager from "#test/testUtils/gameManager";
|
||||
@ -37,57 +36,64 @@ describe("Moves - Copycat", () => {
|
||||
});
|
||||
|
||||
it("should copy the last move successfully executed", async () => {
|
||||
game.override.enemyMoveset(MoveId.SUCKER_PUNCH);
|
||||
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
|
||||
|
||||
game.move.select(MoveId.SWORDS_DANCE);
|
||||
await game.move.forceEnemyMove(MoveId.SPLASH);
|
||||
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
||||
await game.toNextTurn();
|
||||
|
||||
game.move.select(MoveId.COPYCAT); // Last successful move should be Swords Dance
|
||||
await game.move.forceEnemyMove(MoveId.SUCKER_PUNCH);
|
||||
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(game.scene.getPlayerPokemon()!.getStatStage(Stat.ATK)).toBe(4);
|
||||
const player = game.field.getPlayerPokemon();
|
||||
expect(player.getStatStage(Stat.ATK)).toBe(4);
|
||||
expect(player.getLastXMoves()[0].move).toBe(MoveId.SWORDS_DANCE);
|
||||
});
|
||||
|
||||
it("should fail when the last move used is not a valid Copycat move", async () => {
|
||||
game.override.enemyMoveset(MoveId.PROTECT); // Protect is not a valid move for Copycat to copy
|
||||
it("should fail if no prior moves have been made", async () => {
|
||||
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
|
||||
|
||||
game.move.select(MoveId.SPIKY_SHIELD); // Spiky Shield is not a valid move for Copycat to copy
|
||||
await game.toNextTurn();
|
||||
|
||||
game.move.select(MoveId.COPYCAT);
|
||||
await game.move.forceEnemyMove(MoveId.SPLASH);
|
||||
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(game.scene.getPlayerPokemon()!.getLastXMoves()[0].result).toBe(MoveResult.FAIL);
|
||||
expect(game.field.getPlayerPokemon().getLastXMoves()[0].result).toBe(MoveResult.FAIL);
|
||||
});
|
||||
|
||||
it("should fail if the last move used is not a valid Copycat move", async () => {
|
||||
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
|
||||
|
||||
game.move.use(MoveId.COPYCAT);
|
||||
await game.move.forceEnemyMove(MoveId.PROTECT);
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(game.field.getPlayerPokemon().getLastXMoves()[0].result).toBe(MoveResult.FAIL);
|
||||
});
|
||||
|
||||
it("should copy the called move when the last move successfully calls another", async () => {
|
||||
game.override.moveset([MoveId.SPLASH, MoveId.METRONOME]).enemyMoveset(MoveId.COPYCAT);
|
||||
await game.classicMode.startBattle([SpeciesId.DRAMPA]);
|
||||
vi.spyOn(RandomMoveAttr.prototype, "getMoveOverride").mockReturnValue(MoveId.SWORDS_DANCE);
|
||||
vi.spyOn(RandomMoveAttr.prototype, "getMove").mockReturnValue(MoveId.SWORDS_DANCE);
|
||||
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
|
||||
|
||||
game.move.select(MoveId.METRONOME);
|
||||
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]); // Player moves first so enemy can copy Swords Dance
|
||||
game.move.use(MoveId.METRONOME);
|
||||
await game.move.forceEnemyMove(MoveId.COPYCAT);
|
||||
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]); // Player moves first, so enemy can copy Swords Dance
|
||||
await game.toNextTurn();
|
||||
|
||||
const enemy = game.scene.getEnemyPokemon()!;
|
||||
expect(enemy.getLastXMoves()[0]).toMatchObject({
|
||||
move: MoveId.SWORDS_DANCE,
|
||||
result: MoveResult.SUCCESS,
|
||||
useMode: MoveUseMode.FOLLOW_UP,
|
||||
});
|
||||
expect(enemy.getStatStage(Stat.ATK)).toBe(2);
|
||||
expect(game.field.getEnemyPokemon().getStatStage(Stat.ATK)).toBe(2);
|
||||
});
|
||||
|
||||
it("should apply move secondary effects", async () => {
|
||||
game.override.enemyMoveset(MoveId.ACID_SPRAY); // Secondary effect lowers SpDef by 2 stages
|
||||
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
|
||||
|
||||
game.move.select(MoveId.COPYCAT);
|
||||
game.move.use(MoveId.COPYCAT);
|
||||
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(game.scene.getEnemyPokemon()!.getStatStage(Stat.SPDEF)).toBe(-2);
|
||||
expect(game.field.getEnemyPokemon().getStatStage(Stat.SPDEF)).toBe(-2);
|
||||
});
|
||||
});
|
||||
|
@ -129,7 +129,7 @@ describe("Moves - Disable", () => {
|
||||
{ name: "Copycat", moveId: MoveId.COPYCAT },
|
||||
{ name: "Metronome", moveId: MoveId.METRONOME },
|
||||
])("should ignore virtual moves called by $name", async ({ moveId }) => {
|
||||
vi.spyOn(RandomMoveAttr.prototype, "getMoveOverride").mockReturnValue(MoveId.ABSORB);
|
||||
vi.spyOn(RandomMoveAttr.prototype, "getMove").mockReturnValue(MoveId.ABSORB);
|
||||
await game.classicMode.startBattle([SpeciesId.PIKACHU]);
|
||||
|
||||
const playerMon = game.scene.getPlayerPokemon()!;
|
||||
|
@ -144,7 +144,7 @@ describe("Moves - Instruct", () => {
|
||||
});
|
||||
|
||||
it("should fail on metronomed moves, even if also in moveset", async () => {
|
||||
vi.spyOn(RandomMoveAttr.prototype, "getMoveOverride").mockReturnValue(MoveId.ABSORB);
|
||||
vi.spyOn(RandomMoveAttr.prototype, "getMove").mockReturnValue(MoveId.ABSORB);
|
||||
await game.classicMode.startBattle([SpeciesId.AMOONGUSS]);
|
||||
|
||||
const enemy = game.field.getEnemyPokemon();
|
||||
|
@ -1,11 +1,9 @@
|
||||
import { BattlerIndex } from "#enums/battler-index";
|
||||
import { RechargingTag, SemiInvulnerableTag } from "#app/data/battler-tags";
|
||||
import type { RandomMoveAttr } from "#app/data/moves/move";
|
||||
import { allMoves } from "#app/data/data-lists";
|
||||
import { AbilityId } from "#enums/ability-id";
|
||||
import { Stat } from "#app/enums/stat";
|
||||
import { MoveResult } from "#enums/move-result";
|
||||
import { CommandPhase } from "#app/phases/command-phase";
|
||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||
import { MoveUseMode } from "#enums/move-use-mode";
|
||||
import { MoveId } from "#enums/move-id";
|
||||
@ -18,7 +16,7 @@ describe("Moves - Metronome", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
let game: GameManager;
|
||||
|
||||
let randomMoveAttr: RandomMoveAttr;
|
||||
const randomMoveAttr = allMoves[MoveId.METRONOME].getAttrs("RandomMoveAttr")[0];
|
||||
|
||||
beforeAll(() => {
|
||||
phaserGame = new Phaser.Game({
|
||||
@ -31,7 +29,6 @@ describe("Moves - Metronome", () => {
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
randomMoveAttr = allMoves[MoveId.METRONOME].getAttrs("RandomMoveAttr")[0];
|
||||
game = new GameManager(phaserGame);
|
||||
game.override
|
||||
.moveset([MoveId.METRONOME, MoveId.SPLASH])
|
||||
@ -40,51 +37,91 @@ describe("Moves - Metronome", () => {
|
||||
.enemyLevel(100)
|
||||
.enemySpecies(SpeciesId.SHUCKLE)
|
||||
.enemyMoveset(MoveId.SPLASH)
|
||||
.enemyAbility(AbilityId.BALL_FETCH);
|
||||
.enemyAbility(AbilityId.STURDY);
|
||||
});
|
||||
|
||||
it("should have one semi-invulnerable turn and deal damage on the second turn when a semi-invulnerable move is called", async () => {
|
||||
it("should not be able to copy MoveId.NONE", async () => {
|
||||
await game.classicMode.startBattle([SpeciesId.REGIELEKI]);
|
||||
const player = game.scene.getPlayerPokemon()!;
|
||||
const enemy = game.scene.getEnemyPokemon()!;
|
||||
vi.spyOn(randomMoveAttr, "getMoveOverride").mockReturnValue(MoveId.DIVE);
|
||||
|
||||
// Pick the first move available to use
|
||||
const player = game.field.getPlayerPokemon();
|
||||
vi.spyOn(player, "randBattleSeedInt").mockReturnValue(0);
|
||||
game.move.select(MoveId.METRONOME);
|
||||
await game.toNextTurn();
|
||||
|
||||
const lastMoveStr = MoveId[player.getLastXMoves()[0].move];
|
||||
expect(lastMoveStr).not.toBe(MoveId[MoveId.NONE]);
|
||||
expect(lastMoveStr).toBe(MoveId[1]);
|
||||
});
|
||||
|
||||
it("should become semi-invulnerable when using phasing moves", async () => {
|
||||
vi.spyOn(randomMoveAttr, "getMove").mockReturnValue(MoveId.DIVE);
|
||||
await game.classicMode.startBattle([SpeciesId.REGIELEKI]);
|
||||
|
||||
const player = game.field.getPlayerPokemon();
|
||||
expect(player.getTag(SemiInvulnerableTag)).toBeUndefined();
|
||||
expect(player.visible).toBe(true);
|
||||
|
||||
game.move.select(MoveId.METRONOME);
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(player.getTag(SemiInvulnerableTag)).toBeTruthy();
|
||||
expect(player.getTag(SemiInvulnerableTag)).toBeDefined();
|
||||
expect(player.visible).toBe(false);
|
||||
|
||||
await game.toNextTurn();
|
||||
expect(player.getTag(SemiInvulnerableTag)).toBeFalsy();
|
||||
expect(enemy.isFullHp()).toBeFalsy();
|
||||
await game.phaseInterceptor.to("TurnEndPhase");
|
||||
expect(player.getTag(SemiInvulnerableTag)).toBeUndefined();
|
||||
expect(player.visible).toBe(true);
|
||||
|
||||
const enemy = game.field.getEnemyPokemon();
|
||||
expect(enemy.hp).toBeLessThan(enemy.getMaxHp());
|
||||
});
|
||||
|
||||
it("should apply secondary effects of a move", async () => {
|
||||
it("should apply secondary effects of the called move", async () => {
|
||||
vi.spyOn(randomMoveAttr, "getMove").mockReturnValue(MoveId.WOOD_HAMMER);
|
||||
await game.classicMode.startBattle([SpeciesId.REGIELEKI]);
|
||||
const player = game.scene.getPlayerPokemon()!;
|
||||
vi.spyOn(randomMoveAttr, "getMoveOverride").mockReturnValue(MoveId.WOOD_HAMMER);
|
||||
|
||||
game.move.select(MoveId.METRONOME);
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(player.isFullHp()).toBeFalsy();
|
||||
const player = game.field.getPlayerPokemon();
|
||||
const enemy = game.field.getEnemyPokemon();
|
||||
|
||||
expect(player.hp).toBeLessThan(player.getMaxHp());
|
||||
expect(enemy.hp).toBeLessThan(enemy.getMaxHp());
|
||||
});
|
||||
|
||||
it("should recharge after using recharge move", async () => {
|
||||
it("should count as last move used for Copycat/Mirror Move", async () => {
|
||||
vi.spyOn(randomMoveAttr, "getMove").mockReturnValue(MoveId.ABSORB);
|
||||
await game.classicMode.startBattle([SpeciesId.REGIELEKI]);
|
||||
const player = game.scene.getPlayerPokemon()!;
|
||||
vi.spyOn(randomMoveAttr, "getMoveOverride").mockReturnValue(MoveId.HYPER_BEAM);
|
||||
|
||||
game.move.select(MoveId.METRONOME);
|
||||
await game.move.forceEnemyMove(MoveId.MIRROR_MOVE);
|
||||
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY]);
|
||||
await game.toNextTurn();
|
||||
|
||||
const player = game.field.getPlayerPokemon();
|
||||
const enemy = game.field.getEnemyPokemon();
|
||||
|
||||
expect(player.hp).toBeLessThan(player.getMaxHp());
|
||||
expect(enemy.hp).toBeLessThan(enemy.getMaxHp());
|
||||
expect(enemy.getLastXMoves()[0].result).toBe(MoveResult.SUCCESS);
|
||||
});
|
||||
|
||||
it("should recharge after using recharge moves", async () => {
|
||||
await game.classicMode.startBattle([SpeciesId.REGIELEKI]);
|
||||
const player = game.field.getPlayerPokemon();
|
||||
vi.spyOn(randomMoveAttr, "getMove").mockReturnValue(MoveId.HYPER_BEAM);
|
||||
vi.spyOn(allMoves[MoveId.HYPER_BEAM], "accuracy", "get").mockReturnValue(100);
|
||||
|
||||
game.move.select(MoveId.METRONOME);
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(player.getTag(RechargingTag)).toBeTruthy();
|
||||
expect(player.getTag(RechargingTag)).toBeDefined();
|
||||
});
|
||||
|
||||
it("should charge for charging moves while still maintaining follow-up status", async () => {
|
||||
game.override.moveset([]).enemyMoveset(MoveId.SPITE);
|
||||
vi.spyOn(randomMoveAttr, "getMoveOverride").mockReturnValue(MoveId.SOLAR_BEAM);
|
||||
vi.spyOn(randomMoveAttr, "getMove").mockReturnValue(MoveId.SOLAR_BEAM);
|
||||
await game.classicMode.startBattle([SpeciesId.REGIELEKI]);
|
||||
|
||||
const player = game.field.getPlayerPokemon();
|
||||
@ -120,12 +157,12 @@ describe("Moves - Metronome", () => {
|
||||
it("should only target ally for Aromatic Mist", async () => {
|
||||
game.override.battleStyle("double");
|
||||
await game.classicMode.startBattle([SpeciesId.REGIELEKI, SpeciesId.RATTATA]);
|
||||
|
||||
const [leftPlayer, rightPlayer] = game.scene.getPlayerField();
|
||||
const [leftOpp, rightOpp] = game.scene.getEnemyField();
|
||||
vi.spyOn(randomMoveAttr, "getMoveOverride").mockReturnValue(MoveId.AROMATIC_MIST);
|
||||
vi.spyOn(randomMoveAttr, "getMove").mockReturnValue(MoveId.AROMATIC_MIST);
|
||||
|
||||
game.move.select(MoveId.METRONOME, 0);
|
||||
await game.phaseInterceptor.to(CommandPhase);
|
||||
game.move.select(MoveId.SPLASH, 1);
|
||||
await game.toNextTurn();
|
||||
|
||||
@ -135,19 +172,20 @@ describe("Moves - Metronome", () => {
|
||||
expect(rightOpp.getStatStage(Stat.SPDEF)).toBe(0);
|
||||
});
|
||||
|
||||
it("should cause opponent to flee, and not crash for Roar", async () => {
|
||||
it("should cause opponent to flee when using Roar", async () => {
|
||||
await game.classicMode.startBattle([SpeciesId.REGIELEKI]);
|
||||
vi.spyOn(randomMoveAttr, "getMoveOverride").mockReturnValue(MoveId.ROAR);
|
||||
vi.spyOn(randomMoveAttr, "getMove").mockReturnValue(MoveId.ROAR);
|
||||
|
||||
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||
const enemyPokemon = game.field.getEnemyPokemon();
|
||||
|
||||
game.move.select(MoveId.METRONOME);
|
||||
await game.phaseInterceptor.to("BerryPhase");
|
||||
|
||||
const isVisible = enemyPokemon.visible;
|
||||
const hasFled = enemyPokemon.switchOutStatus;
|
||||
expect(!isVisible && hasFled).toBe(true);
|
||||
expect(isVisible).toBe(false);
|
||||
expect(hasFled).toBe(true);
|
||||
|
||||
await game.phaseInterceptor.to("CommandPhase");
|
||||
await game.toNextTurn(); // Check no crash
|
||||
});
|
||||
});
|
||||
|
@ -48,7 +48,7 @@ describe("Moves - Moongeist Beam", () => {
|
||||
// Also covers Photon Geyser and Sunsteel Strike
|
||||
it("should not ignore enemy abilities when called by another move, such as metronome", async () => {
|
||||
await game.classicMode.startBattle([SpeciesId.MILOTIC]);
|
||||
vi.spyOn(allMoves[MoveId.METRONOME].getAttrs("RandomMoveAttr")[0], "getMoveOverride").mockReturnValue(
|
||||
vi.spyOn(allMoves[MoveId.METRONOME].getAttrs("RandomMoveAttr")[0], "getMove").mockReturnValue(
|
||||
MoveId.MOONGEIST_BEAM,
|
||||
);
|
||||
|
||||
|
85
test/moves/nature-power.test.ts
Normal file
85
test/moves/nature-power.test.ts
Normal file
@ -0,0 +1,85 @@
|
||||
import { allMoves } from "#app/data/data-lists";
|
||||
import { TerrainType } from "#app/data/terrain";
|
||||
import { getPokemonNameWithAffix } from "#app/messages";
|
||||
import { getEnumValues, toReadableString } from "#app/utils/common";
|
||||
import { AbilityId } from "#enums/ability-id";
|
||||
import { BiomeId } from "#enums/biome-id";
|
||||
import { MoveId } from "#enums/move-id";
|
||||
import { SpeciesId } from "#enums/species-id";
|
||||
import GameManager from "#test/testUtils/gameManager";
|
||||
import i18next from "i18next";
|
||||
import Phaser from "phaser";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||
|
||||
describe("Move - Nature 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
|
||||
.ability(AbilityId.BALL_FETCH)
|
||||
.battleStyle("single")
|
||||
.disableCrits()
|
||||
.enemySpecies(SpeciesId.MAGIKARP)
|
||||
.enemyAbility(AbilityId.NO_GUARD)
|
||||
.enemyMoveset(MoveId.SPLASH)
|
||||
.startingLevel(100)
|
||||
.enemyLevel(100);
|
||||
});
|
||||
|
||||
const getNaturePowerType = allMoves[MoveId.NATURE_POWER].getAttrs("NaturePowerAttr")[0]["getMoveIdForTerrain"];
|
||||
|
||||
it.each(
|
||||
getEnumValues(BiomeId).map(biome => ({
|
||||
move: getNaturePowerType(TerrainType.NONE, biome),
|
||||
moveName: toReadableString(MoveId[getNaturePowerType(TerrainType.NONE, biome)]),
|
||||
biome,
|
||||
biomeName: BiomeId[biome],
|
||||
})),
|
||||
)("should select $moveName if the current biome is $biomeName", async ({ move, biome }) => {
|
||||
game.override.startingBiome(biome);
|
||||
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
|
||||
|
||||
game.move.use(MoveId.NATURE_POWER);
|
||||
await game.toEndOfTurn();
|
||||
|
||||
const player = game.field.getPlayerPokemon();
|
||||
expect(player.getLastXMoves(-1).map(m => m.move)).toEqual([move, MoveId.NATURE_POWER]);
|
||||
expect(game.textInterceptor.logs).toContain(
|
||||
i18next.t("moveTriggers:naturePowerUse", {
|
||||
pokemonName: getPokemonNameWithAffix(player),
|
||||
moveName: allMoves[move].name,
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
// TODO: Add after terrain override is added
|
||||
it.todo.each(
|
||||
getEnumValues(TerrainType).map(terrain => ({
|
||||
move: getNaturePowerType(terrain, BiomeId.TOWN),
|
||||
moveName: toReadableString(MoveId[getNaturePowerType(terrain, BiomeId.TOWN)]),
|
||||
terrain: terrain,
|
||||
terrainName: TerrainType[terrain],
|
||||
})),
|
||||
)("should select $moveName if the current terrain is $terrainName", async ({ move /* terrain */ }) => {
|
||||
// game.override.terrain(terrainType);
|
||||
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
|
||||
|
||||
game.move.use(MoveId.NATURE_POWER);
|
||||
await game.toEndOfTurn();
|
||||
|
||||
const player = game.field.getPlayerPokemon();
|
||||
expect(player.getLastXMoves(-1).map(m => m.move)).toEqual([move, MoveId.NATURE_POWER]);
|
||||
});
|
||||
});
|
@ -84,7 +84,7 @@ describe("Moves - Sketch", () => {
|
||||
const randomMoveAttr = allMoves[MoveId.METRONOME].findAttr(
|
||||
attr => attr instanceof RandomMoveAttr,
|
||||
) as RandomMoveAttr;
|
||||
vi.spyOn(randomMoveAttr, "getMoveOverride").mockReturnValue(MoveId.FALSE_SWIPE);
|
||||
vi.spyOn(randomMoveAttr, "getMove").mockReturnValue(MoveId.FALSE_SWIPE);
|
||||
|
||||
game.override.enemyMoveset([MoveId.METRONOME]);
|
||||
await game.classicMode.startBattle([SpeciesId.REGIELEKI]);
|
||||
|
Loading…
Reference in New Issue
Block a user