From 2e7f6a2f4f3e68bd58a1af35a16a4ca9b517d973 Mon Sep 17 00:00:00 2001 From: ImperialSympathizer <110984302+ben-lear@users.noreply.github.com> Date: Fri, 27 Sep 2024 20:07:47 -0400 Subject: [PATCH 1/4] [Hotfix] hotfix for expert breeder ME crashing if player loses with queued enemy stat changes (#4476) Co-authored-by: ImperialSympathizer --- .../encounters/the-expert-pokemon-breeder-encounter.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/data/mystery-encounters/encounters/the-expert-pokemon-breeder-encounter.ts b/src/data/mystery-encounters/encounters/the-expert-pokemon-breeder-encounter.ts index e41b3ab03ef..e75e7e9f580 100644 --- a/src/data/mystery-encounters/encounters/the-expert-pokemon-breeder-encounter.ts +++ b/src/data/mystery-encounters/encounters/the-expert-pokemon-breeder-encounter.ts @@ -558,6 +558,10 @@ function onGameOver(scene: BattleScene) { // Revert BGM scene.playBgm(scene.arena.bgm); + // Clear any leftover battle phases + scene.clearPhaseQueue(); + scene.clearPhaseQueueSplice(); + // Return enemy Pokemon const pokemon = scene.getEnemyPokemon(); if (pokemon) { From c9664b66d360961284e7a99c19fda00faa7e6fab Mon Sep 17 00:00:00 2001 From: NightKev <34855794+DayKev@users.noreply.github.com> Date: Fri, 27 Sep 2024 18:26:19 -0700 Subject: [PATCH 2/4] [Hotfix] Prevent bosses from being forced to flee by Dragon Tail/etc (#4478) --- src/data/move.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/data/move.ts b/src/data/move.ts index 74ecead73fa..59417f52e02 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -5244,6 +5244,9 @@ export class ForceSwitchOutAttr extends MoveEffectAttr { false, false), MoveEndPhase); } } else { + if (switchOutTarget.isBoss()) { + return false; + } // Switch out logic for everything else (eg: WILD battles) switchOutTarget.leaveField(false); From 1b6593d24274596f48c92a1f21c16c08f4203bb4 Mon Sep 17 00:00:00 2001 From: ImperialSympathizer <110984302+ben-lear@users.noreply.github.com> Date: Fri, 27 Sep 2024 21:38:15 -0400 Subject: [PATCH 3/4] [Hotfix] Fix ME lapsing non flinch or endure battler tags (#4479) * Fix tag lapsing on battle start in MEs with free enemy moves * lapse endure tag as well --------- Co-authored-by: ImperialSympathizer --- src/phases/mystery-encounter-phases.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/phases/mystery-encounter-phases.ts b/src/phases/mystery-encounter-phases.ts index 60755095cca..0efaf1bf4ca 100644 --- a/src/phases/mystery-encounter-phases.ts +++ b/src/phases/mystery-encounter-phases.ts @@ -25,6 +25,7 @@ import { GameOverPhase } from "#app/phases/game-over-phase"; import { SwitchPhase } from "#app/phases/switch-phase"; import { SeenEncounterData } from "#app/data/mystery-encounters/mystery-encounter-save-data"; import { SwitchType } from "#enums/switch-type"; +import { BattlerTagType } from "#enums/battler-tag-type"; /** * Will handle (in order): @@ -218,9 +219,17 @@ export class MysteryEncounterBattleStartCleanupPhase extends Phase { start() { super.start(); + // Lapse any residual flinches/endures but ignore all other turn-end battle tags + const includedLapseTags = [BattlerTagType.FLINCHED, BattlerTagType.ENDURING]; const field = this.scene.getField(true).filter(p => p.summonData); field.forEach(pokemon => { - pokemon.lapseTags(BattlerTagLapseType.TURN_END); + const tags = pokemon.summonData.tags; + tags.filter(t => includedLapseTags.includes(t.tagType) + && t.lapseTypes.includes(BattlerTagLapseType.TURN_END) + && !(t.lapse(pokemon, BattlerTagLapseType.TURN_END))).forEach(t => { + t.onRemove(pokemon); + tags.splice(tags.indexOf(t), 1); + }); }); // Remove any status tick phases From 7eb755ca9c9949626bb34bc4b418032005c29307 Mon Sep 17 00:00:00 2001 From: NightKev <34855794+DayKev@users.noreply.github.com> Date: Fri, 27 Sep 2024 19:07:42 -0700 Subject: [PATCH 4/4] Prevent the last valid pokemon from being forced to switch (#4481) --- src/data/move.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/data/move.ts b/src/data/move.ts index 59417f52e02..494cffbc677 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -5226,6 +5226,9 @@ export class ForceSwitchOutAttr extends MoveEffectAttr { */ const switchOutTarget = this.selfSwitch ? user : target; if (switchOutTarget instanceof PlayerPokemon) { + if (switchOutTarget.scene.getParty().filter((p) => p.isAllowedInBattle() && !p.isOnField()).length < 1) { + return false; + } switchOutTarget.leaveField(this.switchType === SwitchType.SWITCH); if (switchOutTarget.hp > 0) { @@ -5234,6 +5237,9 @@ export class ForceSwitchOutAttr extends MoveEffectAttr { } return false; } else if (user.scene.currentBattle.battleType !== BattleType.WILD) { + if (switchOutTarget.scene.getEnemyParty().filter((p) => p.isAllowedInBattle() && !p.isOnField()).length < 1) { + return false; + } // Switch out logic for trainer battles switchOutTarget.leaveField(this.switchType === SwitchType.SWITCH);