From 8457fb96fe71b4141536d13841f4e8799356df6a Mon Sep 17 00:00:00 2001 From: AJ Fontaine <36677462+Fontbane@users.noreply.github.com> Date: Fri, 20 Dec 2024 21:41:07 -0500 Subject: [PATCH] [Hotfix] Fix off-by-one error for event encounters (#5022) * Fix off-by-one error for event encounters * Increment version to 1.4.1 --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> --- package-lock.json | 4 ++-- package.json | 2 +- .../encounters/berries-abound-encounter.ts | 6 +++--- .../encounters/fight-or-flight-encounter.ts | 6 +++--- .../encounters/uncommon-breed-encounter.ts | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index ca6041e7048..0ef89a8831f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "pokemon-rogue-battle", - "version": "1.4.0", + "version": "1.4.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "pokemon-rogue-battle", - "version": "1.4.0", + "version": "1.4.1", "hasInstallScript": true, "dependencies": { "@material/material-color-utilities": "^0.2.7", diff --git a/package.json b/package.json index fd756fd3937..980bcd2034e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "pokemon-rogue-battle", "private": true, - "version": "1.4.0", + "version": "1.4.1", "type": "module", "scripts": { "start": "vite", diff --git a/src/data/mystery-encounters/encounters/berries-abound-encounter.ts b/src/data/mystery-encounters/encounters/berries-abound-encounter.ts index 090653e7ca9..eca358e51f3 100644 --- a/src/data/mystery-encounters/encounters/berries-abound-encounter.ts +++ b/src/data/mystery-encounters/encounters/berries-abound-encounter.ts @@ -31,7 +31,7 @@ import { BerryType } from "#enums/berry-type"; import { PERMANENT_STATS, Stat } from "#enums/stat"; import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase"; import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode"; -import PokemonSpecies, { allSpecies } from "#app/data/pokemon-species"; +import PokemonSpecies, { getPokemonSpecies } from "#app/data/pokemon-species"; /** the i18n namespace for the encounter */ const namespace = "mysteryEncounters/berriesAbound"; @@ -62,8 +62,8 @@ export const BerriesAboundEncounter: MysteryEncounter = let bossSpecies: PokemonSpecies; if (scene.eventManager.isEventActive() && scene.eventManager.activeEvent()?.uncommonBreedEncounters && randSeedInt(2) === 1) { const eventEncounter = randSeedItem(scene.eventManager.activeEvent()!.uncommonBreedEncounters!); - bossSpecies = allSpecies[eventEncounter.species]; - bossSpecies.speciesId = bossSpecies.getSpeciesForLevel(level, eventEncounter.allowEvolution); + const levelSpecies = getPokemonSpecies(eventEncounter.species).getWildSpeciesForLevel(level, eventEncounter.allowEvolution ?? false, true, scene.gameMode); + bossSpecies = getPokemonSpecies( levelSpecies ); } else { bossSpecies = scene.arena.randomSpecies(scene.currentBattle.waveIndex, level, 0, getPartyLuckValue(scene.getPlayerParty()), true); } diff --git a/src/data/mystery-encounters/encounters/fight-or-flight-encounter.ts b/src/data/mystery-encounters/encounters/fight-or-flight-encounter.ts index 07e7a15c65c..e238fd51e66 100644 --- a/src/data/mystery-encounters/encounters/fight-or-flight-encounter.ts +++ b/src/data/mystery-encounters/encounters/fight-or-flight-encounter.ts @@ -29,7 +29,7 @@ import { queueEncounterMessage } from "#app/data/mystery-encounters/utils/encoun import { randSeedInt, randSeedItem } from "#app/utils"; import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase"; import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode"; -import PokemonSpecies, { allSpecies } from "#app/data/pokemon-species"; +import PokemonSpecies, { getPokemonSpecies } from "#app/data/pokemon-species"; /** the i18n namespace for the encounter */ const namespace = "mysteryEncounters/fightOrFlight"; @@ -60,8 +60,8 @@ export const FightOrFlightEncounter: MysteryEncounter = let bossSpecies: PokemonSpecies; if (scene.eventManager.isEventActive() && scene.eventManager.activeEvent()?.uncommonBreedEncounters && randSeedInt(2) === 1) { const eventEncounter = randSeedItem(scene.eventManager.activeEvent()!.uncommonBreedEncounters!); - bossSpecies = allSpecies[eventEncounter.species]; - bossSpecies.speciesId = bossSpecies.getSpeciesForLevel(level, eventEncounter.allowEvolution); + const levelSpecies = getPokemonSpecies(eventEncounter.species).getWildSpeciesForLevel(level, eventEncounter.allowEvolution ?? false, true, scene.gameMode); + bossSpecies = getPokemonSpecies( levelSpecies ); } else { bossSpecies = scene.arena.randomSpecies(scene.currentBattle.waveIndex, level, 0, getPartyLuckValue(scene.getPlayerParty()), true); } diff --git a/src/data/mystery-encounters/encounters/uncommon-breed-encounter.ts b/src/data/mystery-encounters/encounters/uncommon-breed-encounter.ts index 15f7bce8945..ebea34253d1 100644 --- a/src/data/mystery-encounters/encounters/uncommon-breed-encounter.ts +++ b/src/data/mystery-encounters/encounters/uncommon-breed-encounter.ts @@ -23,7 +23,7 @@ import { BerryModifier } from "#app/modifier/modifier"; import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase"; import { Stat } from "#enums/stat"; import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode"; -import PokemonSpecies, { allSpecies } from "#app/data/pokemon-species"; +import PokemonSpecies, { getPokemonSpecies } from "#app/data/pokemon-species"; /** the i18n namespace for the encounter */ const namespace = "mysteryEncounters/uncommonBreed"; @@ -55,8 +55,8 @@ export const UncommonBreedEncounter: MysteryEncounter = let species: PokemonSpecies; if (scene.eventManager.isEventActive() && scene.eventManager.activeEvent()?.uncommonBreedEncounters && randSeedInt(2) === 1) { const eventEncounter = randSeedItem(scene.eventManager.activeEvent()!.uncommonBreedEncounters!); - species = allSpecies[eventEncounter.species]; - species.speciesId = species.getSpeciesForLevel(level, eventEncounter.allowEvolution); + const levelSpecies = getPokemonSpecies(eventEncounter.species).getWildSpeciesForLevel(level, eventEncounter.allowEvolution ?? false, true, scene.gameMode); + species = getPokemonSpecies( levelSpecies ); } else { species = scene.arena.randomSpecies(scene.currentBattle.waveIndex, level, 0, getPartyLuckValue(scene.getPlayerParty()), true); }