From b3e6f26afe23bc4bd94ba26dfc4e89b76b0acfda Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Thu, 21 Mar 2024 23:05:47 -0400 Subject: [PATCH] Properly implement Last Resort --- src/data/move.ts | 10 +++++++++- src/evolution-phase.ts | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/data/move.ts b/src/data/move.ts index 2fb231cbbe4..ff0ad64fd29 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -3550,7 +3550,15 @@ export function initMoves() { new StatusMove(Moves.GUARD_SWAP, "Guard Swap (N)", Type.PSYCHIC, -1, 10, "The user employs its psychic power to switch changes to its Defense and Sp. Def stats with the target.", -1, 0, 4), new AttackMove(Moves.PUNISHMENT, "Punishment (N)", Type.DARK, MoveCategory.PHYSICAL, -1, 100, 5, "The more the target has powered up with stat changes, the greater the move's power.", -1, 0, 4), new AttackMove(Moves.LAST_RESORT, "Last Resort", Type.NORMAL, MoveCategory.PHYSICAL, 140, 100, 5, "This move can be used only after the user has used all the other moves it knows in the battle.", -1, 0, 4) - .condition((user, target, move) => !user.getMoveset().filter(m => m.moveId !== move.id && m.getPpRatio() > 0).length), + .condition((user, target, move) => { + const uniqueUsedMoveIds = new Set(); + const movesetMoveIds = user.getMoveset().map(m => m.moveId); + user.getMoveHistory().map(m => { + if (m.move !== move.id && movesetMoveIds.find(mm => mm === m.move)) + uniqueUsedMoveIds.add(m.move); + }); + return uniqueUsedMoveIds.size >= movesetMoveIds.length - 1; + }), new StatusMove(Moves.WORRY_SEED, "Worry Seed (N)", Type.GRASS, 100, 10, "A seed that causes worry is planted on the target. It prevents sleep by making the target's Ability Insomnia.", -1, 0, 4), new AttackMove(Moves.SUCKER_PUNCH, "Sucker Punch (P)", Type.DARK, MoveCategory.PHYSICAL, 70, 100, 5, "This move enables the user to attack first. This move fails if the target is not readying an attack.", -1, 1, 4), new StatusMove(Moves.TOXIC_SPIKES, "Toxic Spikes", Type.POISON, -1, 20, "The user lays a trap of poison spikes at the feet of the opposing team. The spikes will poison opposing Pokémon that switch into battle.", -1, 0, 4) diff --git a/src/evolution-phase.ts b/src/evolution-phase.ts index 73b9e0d1b96..c71ae5da368 100644 --- a/src/evolution-phase.ts +++ b/src/evolution-phase.ts @@ -239,7 +239,7 @@ export class EvolutionPhase extends Phase { this.scene.playSoundWithoutBgm('evolution_fanfare'); evolvedPokemon.destroy(); - this.scene.ui.showText(`Congratulations! Your ${preName}\nevolved into ${this.pokemon.name}!`, null, () => this.end(), null, true, Utils.fixedInt(4000)); + this.scene.ui.showText(`Congratulations!\nYour ${preName} evolved into ${this.pokemon.name}!`, null, () => this.end(), null, true, Utils.fixedInt(4000)); this.scene.time.delayedCall(Utils.fixedInt(4250), () => this.scene.playBgm()); }); });