This commit is contained in:
Dean 2025-08-05 13:31:51 -07:00 committed by GitHub
commit aadfcfceae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 409 additions and 104 deletions

View File

@ -10,6 +10,7 @@ import { allMoves } from "#data/data-lists";
import { AbilityId } from "#enums/ability-id";
import { ArenaTagSide } from "#enums/arena-tag-side";
import { ArenaTagType } from "#enums/arena-tag-type";
import type { BattlerIndex } from "#enums/battler-index";
import { BattlerTagType } from "#enums/battler-tag-type";
import { HitResult } from "#enums/hit-result";
import { CommonAnim } from "#enums/move-anims-common";
@ -28,7 +29,7 @@ import type {
SerializableArenaTagType,
} from "#types/arena-tags";
import type { Mutable } from "#types/type-helpers";
import { BooleanHolder, NumberHolder, toDmgValue } from "#utils/common";
import { BooleanHolder, isNullOrUndefined, NumberHolder, toDmgValue } from "#utils/common";
import i18next from "i18next";
/**
@ -1583,6 +1584,138 @@ export class SuppressAbilitiesTag extends SerializableArenaTag {
}
}
/**
* Interface containing data related to a queued healing effect from
* {@link https://bulbapedia.bulbagarden.net/wiki/Healing_Wish_(move) | Healing Wish}
* or {@link https://bulbapedia.bulbagarden.net/wiki/Lunar_Dance_(move) | Lunar Dance}.
*/
interface PendingHealEffect {
/** The {@linkcode Pokemon.id | PID} of the {@linkcode Pokemon} that created the effect. */
readonly sourceId: number;
/** The {@linkcode MoveId} of the move that created the effect. */
readonly moveId: MoveId;
/** If `true`, also restores the target's PP when the effect activates. */
readonly restorePP: boolean;
/** The message to display when the effect activates */
readonly healMessage: string;
}
/**
* Arena tag to contain stored healing effects, namely from
* {@link https://bulbapedia.bulbagarden.net/wiki/Healing_Wish_(move) | Healing Wish}
* and {@link https://bulbapedia.bulbagarden.net/wiki/Lunar_Dance_(move) | Lunar Dance}.
* When a damaged Pokemon first enters the effect's {@linkcode BattlerIndex | field position},
* their HP is fully restored, and they are cured of any non-volatile status condition.
* If the effect is from Lunar Dance, their PP is also restored.
*/
export class PendingHealTag extends SerializableArenaTag {
public readonly tagType = ArenaTagType.PENDING_HEAL;
/** All pending healing effects, organized by {@linkcode BattlerIndex} */
public readonly pendingHeals: Partial<Record<BattlerIndex, PendingHealEffect[]>> = {};
constructor() {
super(0);
}
/**
* Adds a pending healing effect to the field. Effects under the same move *and*
* target index as an existing effect are ignored.
* @param targetIndex - The {@linkcode BattlerIndex} under which the effect applies
* @param healEffect - The {@linkcode PendingHealEffect | data} for the pending heal effect
*/
public queueHeal(targetIndex: BattlerIndex, healEffect: PendingHealEffect): void {
const existingHealEffects = this.pendingHeals[targetIndex];
if (existingHealEffects) {
if (!existingHealEffects.some(he => he.moveId === healEffect.moveId)) {
existingHealEffects.push(healEffect);
}
} else {
this.pendingHeals[targetIndex] = [healEffect];
}
}
/** Removes default on-remove message */
override onRemove(_arena: Arena): void {}
/** This arena tag is removed at the end of the turn if no pending healing effects are on the field */
override lapse(_arena: Arena): boolean {
for (const key in this.pendingHeals) {
if (this.pendingHeals[key].length > 0) {
return true;
}
}
return false;
}
/**
* Applies a pending healing effect on the given target index. If an effect is found for
* the index, the Pokemon at that index is healed to full HP, is cured of any non-volatile status,
* and has its PP fully restored (if the effect is from Lunar Dance).
* @param arena - The {@linkcode Arena} containing this tag
* @param simulated - If `true`, suppresses changes to game state
* @param pokemon - The {@linkcode Pokemon} receiving the healing effect
* @returns `true` if the target Pokemon was healed by this effect
* @todo This should also be called when a Pokemon moves into a new position via Ally Switch
*/
override apply(arena: Arena, simulated: boolean, pokemon: Pokemon): boolean {
const targetIndex = pokemon.getBattlerIndex();
const targetEffects = this.pendingHeals[targetIndex];
if (simulated) {
return !!targetEffects?.length;
}
const healEffect = targetEffects?.find(effect => this.canApply(effect, pokemon));
if (targetEffects && healEffect) {
const { sourceId, moveId, restorePP, healMessage } = healEffect;
const sourcePokemon = globalScene.getPokemonById(sourceId);
if (!sourcePokemon) {
console.warn(`Source of pending ${allMoves[moveId].name} effect is undefined!`);
targetEffects.splice(targetEffects.indexOf(healEffect), 1);
// Re-evaluate after the invalid heal effect is removed
return this.apply(arena, simulated, pokemon);
}
globalScene.phaseManager.unshiftNew(
"PokemonHealPhase",
targetIndex,
pokemon.getMaxHp(),
healMessage,
true,
false,
false,
true,
false,
restorePP,
);
targetEffects.splice(targetEffects.indexOf(healEffect), 1);
}
return !isNullOrUndefined(healEffect);
}
/**
* Determines if the given {@linkcode PendingHealEffect} can immediately heal
* the given target {@linkcode Pokemon}.
* @param healEffect - The {@linkcode PendingHealEffect} to evaluate
* @param pokemon - The {@linkcode Pokemon} to evaluate against
* @returns `true` if the Pokemon can be healed by the effect
*/
private canApply(healEffect: PendingHealEffect, pokemon: Pokemon): boolean {
return (
!pokemon.isFullHp() ||
!isNullOrUndefined(pokemon.status) ||
(healEffect.restorePP && pokemon.getMoveset().some(mv => mv.ppUsed > 0))
);
}
override loadTag(source: BaseArenaTag & Pick<PendingHealTag, "tagType" | "pendingHeals">): void {
super.loadTag(source);
(this as Mutable<this>).pendingHeals = source.pendingHeals;
}
}
// TODO: swap `sourceMove` and `sourceId` and make `sourceMove` an optional parameter
export function getArenaTag(
tagType: ArenaTagType,
@ -1646,6 +1779,8 @@ export function getArenaTag(
return new FairyLockTag(turnCount, sourceId);
case ArenaTagType.NEUTRALIZING_GAS:
return new SuppressAbilitiesTag(sourceId);
case ArenaTagType.PENDING_HEAL:
return new PendingHealTag();
default:
return null;
}
@ -1694,5 +1829,6 @@ export type ArenaTagTypeMap = {
[ArenaTagType.GRASS_WATER_PLEDGE]: GrassWaterPledgeTag;
[ArenaTagType.FAIRY_LOCK]: FairyLockTag;
[ArenaTagType.NEUTRALIZING_GAS]: SuppressAbilitiesTag;
[ArenaTagType.PENDING_HEAL]: PendingHealTag;
[ArenaTagType.NONE]: NoneTag;
};

View File

@ -6,7 +6,7 @@ import { loggedInUser } from "#app/account";
import type { GameMode } from "#app/game-mode";
import { globalScene } from "#app/global-scene";
import { getPokemonNameWithAffix } from "#app/messages";
import type { ArenaTrapTag } from "#data/arena-tag";
import type { ArenaTrapTag, PendingHealTag } from "#data/arena-tag";
import { WeakenMoveTypeTag } from "#data/arena-tag";
import { MoveChargeAnim } from "#data/battle-anims";
import {
@ -2094,24 +2094,15 @@ export class SacrificialFullRestoreAttr extends SacrificialAttr {
return false;
}
// We don't know which party member will be chosen, so pick the highest max HP in the party
const party = user.isPlayer() ? globalScene.getPlayerParty() : globalScene.getEnemyParty();
const maxPartyMemberHp = party.map(p => p.getMaxHp()).reduce((maxHp: number, hp: number) => Math.max(hp, maxHp), 0);
const pm = globalScene.phaseManager;
pm.pushPhase(
pm.create("PokemonHealPhase",
user.getBattlerIndex(),
maxPartyMemberHp,
i18next.t(this.moveMessage, { pokemonName: getPokemonNameWithAffix(user) }),
true,
false,
false,
true,
false,
this.restorePP),
true);
// Add a tag to the field if it doesn't already exist, then queue a delayed healing effect in the user's current slot.
globalScene.arena.addTag(ArenaTagType.PENDING_HEAL, 0, move.id, user.id); // Arguments after first go completely unused
const tag = globalScene.arena.getTag(ArenaTagType.PENDING_HEAL) as PendingHealTag;
tag.queueHeal(user.getBattlerIndex(), {
sourceId: user.id,
moveId: move.id,
restorePP: this.restorePP,
healMessage: i18next.t(this.moveMessage, { pokemonName: getPokemonNameWithAffix(user) }),
});
return true;
}

View File

@ -36,5 +36,6 @@ export enum ArenaTagType {
WATER_FIRE_PLEDGE = "WATER_FIRE_PLEDGE",
GRASS_WATER_PLEDGE = "GRASS_WATER_PLEDGE",
FAIRY_LOCK = "FAIRY_LOCK",
NEUTRALIZING_GAS = "NEUTRALIZING_GAS"
NEUTRALIZING_GAS = "NEUTRALIZING_GAS",
PENDING_HEAL = "PENDING_HEAL"
}

View File

@ -229,7 +229,6 @@ export class PhaseManager {
/** overrides default of inserting phases to end of phaseQueuePrepend array. Useful for inserting Phases "out of order" */
private phaseQueuePrependSpliceIndex = -1;
private nextCommandPhaseQueue: Phase[] = [];
/** Storage for {@linkcode PhasePriorityQueue}s which hold phases whose order dynamically changes */
private dynamicPhaseQueues: PhasePriorityQueue[];
@ -285,13 +284,12 @@ export class PhaseManager {
/**
* Adds a phase to nextCommandPhaseQueue, as long as boolean passed in is false
* @param phase {@linkcode Phase} the phase to add
* @param defer boolean on which queue to add to, defaults to false, and adds to phaseQueue
*/
pushPhase(phase: Phase, defer = false): void {
pushPhase(phase: Phase): void {
if (this.getDynamicPhaseType(phase) !== undefined) {
this.pushDynamicPhase(phase);
} else {
(!defer ? this.phaseQueue : this.nextCommandPhaseQueue).push(phase);
this.phaseQueue.push(phase);
}
}
@ -318,7 +316,7 @@ export class PhaseManager {
* Clears all phase-related stuff, including all phase queues, the current and standby phases, and a splice index
*/
clearAllPhases(): void {
for (const queue of [this.phaseQueue, this.phaseQueuePrepend, this.conditionalQueue, this.nextCommandPhaseQueue]) {
for (const queue of [this.phaseQueue, this.phaseQueuePrepend, this.conditionalQueue]) {
queue.splice(0, queue.length);
}
this.dynamicPhaseQueues.forEach(queue => queue.clear());
@ -600,10 +598,6 @@ export class PhaseManager {
* Moves everything from nextCommandPhaseQueue to phaseQueue (keeping order)
*/
private populatePhaseQueue(): void {
if (this.nextCommandPhaseQueue.length) {
this.phaseQueue.push(...this.nextCommandPhaseQueue);
this.nextCommandPhaseQueue.splice(0, this.nextCommandPhaseQueue.length);
}
this.phaseQueue.push(new TurnInitPhase());
}

View File

@ -63,7 +63,8 @@ export class PokemonHealPhase extends CommonAnimPhase {
}
const hasMessage = !!this.message;
const healOrDamage = !pokemon.isFullHp() || this.hpHealed < 0;
const canRestorePP = this.fullRestorePP && pokemon.getMoveset().some(mv => mv.ppUsed > 0);
const healOrDamage = !pokemon.isFullHp() || this.hpHealed < 0 || canRestorePP;
const healBlock = pokemon.getTag(BattlerTagType.HEAL_BLOCK) as HealBlockTag;
let lastStatusEffect = StatusEffect.NONE;

View File

@ -2,6 +2,7 @@ import { applyAbAttrs } from "#abilities/apply-ab-attrs";
import { globalScene } from "#app/global-scene";
import { ArenaTrapTag } from "#data/arena-tag";
import { MysteryEncounterPostSummonTag } from "#data/battler-tags";
import { ArenaTagType } from "#enums/arena-tag-type";
import { BattlerTagType } from "#enums/battler-tag-type";
import { StatusEffect } from "#enums/status-effect";
import { PokemonPhase } from "#phases/pokemon-phase";
@ -16,6 +17,9 @@ export class PostSummonPhase extends PokemonPhase {
if (pokemon.status?.effect === StatusEffect.TOXIC) {
pokemon.status.toxicTurnCount = 0;
}
globalScene.arena.applyTags(ArenaTagType.PENDING_HEAL, false, pokemon);
globalScene.arena.applyTags(ArenaTrapTag, false, pokemon);
// If this is mystery encounter and has post summon phase tag, apply post summon effects

View File

@ -287,6 +287,12 @@ export class ArenaFlyout extends Phaser.GameObjects.Container {
switch (arenaEffectChangedEvent.constructor) {
case TagAddedEvent: {
const tagAddedEvent = arenaEffectChangedEvent as TagAddedEvent;
const excludedTags = [ArenaTagType.PENDING_HEAL];
if (excludedTags.includes(tagAddedEvent.arenaTagType)) {
return;
}
const isArenaTrapTag = globalScene.arena.getTag(tagAddedEvent.arenaTagType) instanceof ArenaTrapTag;
let arenaEffectType: ArenaEffectType;

View File

@ -0,0 +1,245 @@
import { AbilityId } from "#enums/ability-id";
import { ArenaTagType } from "#enums/arena-tag-type";
import { Challenges } from "#enums/challenges";
import { MoveId } from "#enums/move-id";
import { MoveResult } from "#enums/move-result";
import { PokemonType } from "#enums/pokemon-type";
import { SpeciesId } from "#enums/species-id";
import { StatusEffect } from "#enums/status-effect";
import { GameManager } from "#test/test-utils/game-manager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Moves - Lunar Dance and Healing Wish", () => {
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.battleStyle("double").enemyAbility(AbilityId.BALL_FETCH).enemyMoveset(MoveId.SPLASH);
});
describe.each([
{ moveName: "Healing Wish", moveId: MoveId.HEALING_WISH },
{ moveName: "Lunar Dance", moveId: MoveId.LUNAR_DANCE },
])("$moveName", ({ moveId }) => {
it("should sacrifice the user to restore the switched in Pokemon's HP", async () => {
await game.classicMode.startBattle([SpeciesId.BULBASAUR, SpeciesId.CHARMANDER, SpeciesId.SQUIRTLE]);
const [bulbasaur, charmander, squirtle] = game.scene.getPlayerParty();
squirtle.hp = 1;
game.move.use(MoveId.SPLASH, 0);
game.move.use(moveId, 1);
game.doSelectPartyPokemon(2);
await game.toNextTurn();
expect(bulbasaur.isFullHp()).toBe(true);
expect(charmander.isFainted()).toBe(true);
expect(squirtle.isFullHp()).toBe(true);
});
it("should sacrifice the user to cure the switched in Pokemon's status", async () => {
game.override.statusEffect(StatusEffect.BURN);
await game.classicMode.startBattle([SpeciesId.BULBASAUR, SpeciesId.CHARMANDER, SpeciesId.SQUIRTLE]);
const [bulbasaur, charmander, squirtle] = game.scene.getPlayerParty();
game.move.use(MoveId.SPLASH, 0);
game.move.use(moveId, 1);
game.doSelectPartyPokemon(2);
await game.toNextTurn();
expect(bulbasaur.status?.effect).toBe(StatusEffect.BURN);
expect(charmander.isFainted()).toBe(true);
expect(squirtle.status?.effect).toBeUndefined();
});
it("should fail if the user has no non-fainted allies in their party", async () => {
game.override.battleStyle("single");
await game.classicMode.startBattle([SpeciesId.BULBASAUR, SpeciesId.CHARMANDER]);
const [bulbasaur, charmander] = game.scene.getPlayerParty();
game.move.use(MoveId.MEMENTO);
game.doSelectPartyPokemon(1);
await game.toNextTurn();
expect(bulbasaur.isFainted()).toBe(true);
expect(charmander.isActive(true)).toBe(true);
game.move.use(moveId);
await game.toEndOfTurn();
expect(charmander.isFullHp());
expect(charmander.getLastXMoves()[0].result).toBe(MoveResult.FAIL);
});
it("should fail if the user has no challenge-eligible allies", async () => {
game.override.battleStyle("single");
// Mono normal challenge
game.challengeMode.addChallenge(Challenges.SINGLE_TYPE, PokemonType.NORMAL + 1, 0);
await game.challengeMode.startBattle([SpeciesId.RATICATE, SpeciesId.ODDISH]);
const raticate = game.field.getPlayerPokemon();
game.move.use(moveId);
await game.toNextTurn();
expect(raticate.isFullHp()).toBe(true);
expect(raticate.getLastXMoves()[0].result).toEqual(MoveResult.FAIL);
});
it("should store its effect if the switched-in Pokemon would be unaffected", async () => {
game.override.battleStyle("single");
await game.classicMode.startBattle([SpeciesId.BULBASAUR, SpeciesId.CHARMANDER, SpeciesId.SQUIRTLE]);
const [bulbasaur, charmander, squirtle] = game.scene.getPlayerParty();
squirtle.hp = 1;
game.move.use(moveId);
game.doSelectPartyPokemon(1);
await game.toNextTurn();
// Bulbasaur fainted and stored a healing effect
expect(bulbasaur.isFainted()).toBe(true);
expect(charmander.isFullHp()).toBe(true);
expect(game.phaseInterceptor.log).not.toContain("PokemonHealPhase");
expect(game.scene.arena.getTag(ArenaTagType.PENDING_HEAL)).toBeDefined();
await game.toNextTurn();
// Switch to damaged Squirtle. HW/LD's effect should activate
await game.toEndOfTurn();
expect(squirtle.isFullHp()).toBe(true);
expect(game.scene.arena.getTag(ArenaTagType.PENDING_HEAL)).toBeUndefined();
// Set Charmander's HP to 1, then switch back to Charmander.
// HW/LD shouldn't activate again
charmander.hp = 1;
game.doSwitchPokemon(2);
await game.toEndOfTurn();
expect(charmander.hp).toBe(1);
});
it("should only store one charge of the effect at a time", async () => {
game.override.battleStyle("single");
await game.classicMode.startBattle([
SpeciesId.BULBASAUR,
SpeciesId.CHARMANDER,
SpeciesId.SQUIRTLE,
SpeciesId.PIKACHU,
]);
const [bulbasaur, charmander, squirtle, pikachu] = game.scene.getPlayerParty();
[squirtle, pikachu].forEach(p => (p.hp = 1));
// Use HW/LD and send in Charmander. HW/LD's effect should be stored
game.move.use(moveId);
game.doSelectPartyPokemon(1);
await game.toNextTurn();
expect(bulbasaur.isFainted()).toBe(true);
expect(charmander.isFullHp()).toBe(true);
expect(charmander.isFullHp());
expect(game.phaseInterceptor.log).not.toContain("PokemonHealPhase");
expect(game.scene.arena.getTag(ArenaTagType.PENDING_HEAL)).toBeDefined();
// Use HW/LD again, sending in Squirtle. HW/LD should activate and heal Squirtle
game.move.use(moveId);
game.doSelectPartyPokemon(2);
expect(charmander.isFainted()).toBe(true);
expect(squirtle.isFullHp()).toBe(true);
expect(squirtle.isFullHp());
// Switch again to Pikachu. HW/LD's effect shouldn't be present
game.doSwitchPokemon(3);
expect(pikachu.isFullHp()).toBe(false);
});
});
it("Lunar Dance should sacrifice the user to restore the switched in Pokemon's PP", async () => {
game.override.battleStyle("single");
await game.classicMode.startBattle([SpeciesId.BULBASAUR, SpeciesId.CHARMANDER]);
const [bulbasaur, charmander] = game.scene.getPlayerParty();
game.move.use(MoveId.SPLASH);
await game.toNextTurn();
game.doSwitchPokemon(1);
await game.toNextTurn();
game.move.use(MoveId.LUNAR_DANCE);
game.doSelectPartyPokemon(1);
await game.toNextTurn();
expect(charmander.isFainted()).toBeTruthy();
bulbasaur.getMoveset().forEach(mv => expect(mv.ppUsed).toBe(0));
});
it("should stack with each other", async () => {
game.override.battleStyle("single");
await game.classicMode.startBattle([
SpeciesId.BULBASAUR,
SpeciesId.CHARMANDER,
SpeciesId.SQUIRTLE,
SpeciesId.PIKACHU,
]);
const [bulbasaur, charmander, squirtle, pikachu] = game.scene.getPlayerParty();
[squirtle, pikachu].forEach(p => {
p.hp = 1;
p.getMoveset().forEach(mv => (mv.ppUsed = 1));
});
game.move.use(MoveId.LUNAR_DANCE);
game.doSelectPartyPokemon(1);
await game.toNextTurn();
expect(bulbasaur.isFainted()).toBe(true);
expect(charmander.isFullHp()).toBe(true);
expect(game.phaseInterceptor.log).not.toContain("PokemonHealPhase");
expect(game.scene.arena.getTag(ArenaTagType.PENDING_HEAL)).toBeDefined();
game.move.use(MoveId.HEALING_WISH);
game.doSelectPartyPokemon(2);
// Lunar Dance should apply first since it was used first, restoring Squirtle's HP and PP
await game.toNextTurn();
expect(squirtle.isFullHp()).toBe(true);
squirtle.getMoveset().forEach(mv => expect(mv.ppUsed).toBe(0));
expect(game.scene.arena.getTag(ArenaTagType.PENDING_HEAL)).toBeDefined();
game.doSwitchPokemon(3);
// Healing Wish should apply on the next switch, restoring Pikachu's HP
await game.toEndOfTurn();
expect(pikachu.isFullHp()).toBe(true);
pikachu.getMoveset().forEach(mv => expect(mv.ppUsed).toBe(1));
expect(game.scene.arena.getTag(ArenaTagType.PENDING_HEAL)).toBeUndefined();
});
});

View File

@ -1,73 +0,0 @@
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id";
import { StatusEffect } from "#enums/status-effect";
import { GameManager } from "#test/test-utils/game-manager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Moves - Lunar Dance", () => {
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
.statusEffect(StatusEffect.BURN)
.battleStyle("double")
.enemyAbility(AbilityId.BALL_FETCH)
.enemyMoveset(MoveId.SPLASH);
});
it("should full restore HP, PP and status of switched in pokemon, then fail second use because no remaining backup pokemon in party", async () => {
await game.classicMode.startBattle([SpeciesId.BULBASAUR, SpeciesId.ODDISH, SpeciesId.RATTATA]);
const [bulbasaur, oddish, rattata] = game.scene.getPlayerParty();
game.move.changeMoveset(bulbasaur, [MoveId.LUNAR_DANCE, MoveId.SPLASH]);
game.move.changeMoveset(oddish, [MoveId.LUNAR_DANCE, MoveId.SPLASH]);
game.move.changeMoveset(rattata, [MoveId.LUNAR_DANCE, MoveId.SPLASH]);
game.move.select(MoveId.SPLASH, 0);
game.move.select(MoveId.SPLASH, 1);
await game.toNextTurn();
// Bulbasaur should still be burned and have used a PP for splash and not at max hp
expect(bulbasaur.status?.effect).toBe(StatusEffect.BURN);
expect(bulbasaur.moveset[1]?.ppUsed).toBe(1);
expect(bulbasaur.hp).toBeLessThan(bulbasaur.getMaxHp());
// Switch out Bulbasaur for Rattata so we can swtich bulbasaur back in with lunar dance
game.doSwitchPokemon(2);
game.move.select(MoveId.SPLASH, 1);
await game.toNextTurn();
game.move.select(MoveId.SPLASH, 0);
game.move.select(MoveId.LUNAR_DANCE);
game.doSelectPartyPokemon(2);
await game.phaseInterceptor.to("SwitchPhase", false);
await game.toNextTurn();
// Bulbasaur should NOT have any status and have full PP for splash and be at max hp
expect(bulbasaur.status?.effect).toBeUndefined();
expect(bulbasaur.moveset[1]?.ppUsed).toBe(0);
expect(bulbasaur.isFullHp()).toBe(true);
game.move.select(MoveId.SPLASH, 0);
game.move.select(MoveId.LUNAR_DANCE);
await game.toNextTurn();
// Using Lunar dance again should fail because nothing in party and rattata should be alive
expect(rattata.status?.effect).toBe(StatusEffect.BURN);
expect(rattata.hp).toBeLessThan(rattata.getMaxHp());
});
});