mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
error handling in case the randomizer picks a pokemon that does not exist
This commit is contained in:
Binary file not shown.
@@ -340,7 +340,11 @@ def pbWildBattle(species, level, outcomeVar=1, canRun=true, canLose=false)
|
|||||||
dexnum = getDexNumberForSpecies(species)
|
dexnum = getDexNumberForSpecies(species)
|
||||||
if $game_switches[SWITCH_RANDOM_STATIC_ENCOUNTERS] && dexnum <= NB_POKEMON
|
if $game_switches[SWITCH_RANDOM_STATIC_ENCOUNTERS] && dexnum <= NB_POKEMON
|
||||||
newSpecies = $PokemonGlobal.psuedoBSTHash[dexnum]
|
newSpecies = $PokemonGlobal.psuedoBSTHash[dexnum]
|
||||||
species = getSpecies(newSpecies)
|
if !newSpecies
|
||||||
|
displayRandomizerErrorMessage()
|
||||||
|
else
|
||||||
|
species = getSpecies(newSpecies)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Potentially call a different pbWildBattle-type method instead (for roaming
|
# Potentially call a different pbWildBattle-type method instead (for roaming
|
||||||
|
|||||||
@@ -700,8 +700,11 @@ def regirock_steel_move_boulder()
|
|||||||
pbSEPlay("Entering Door")
|
pbSEPlay("Entering Door")
|
||||||
pbSetSelfSwitch(switch_event.id, "A", true) if switch_event
|
pbSetSelfSwitch(switch_event.id, "A", true) if switch_event
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def displayRandomizerErrorMessage()
|
||||||
|
Kernel.pbMessage(_INTL("The randomizer has encountered an error. You should try to re-randomize your game as soon as possible."))
|
||||||
|
Kernel.pbMessage(_INTL("You can do this on the top floor of Pokémon Centers."))
|
||||||
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -214,8 +214,7 @@ def getFusionSpeciesSymbol(body, head)
|
|||||||
nb_pokemon = Settings::NB_POKEMON
|
nb_pokemon = Settings::NB_POKEMON
|
||||||
id = body_num * nb_pokemon + head_num
|
id = body_num * nb_pokemon + head_num
|
||||||
if id > (nb_pokemon*nb_pokemon)+nb_pokemon
|
if id > (nb_pokemon*nb_pokemon)+nb_pokemon
|
||||||
Kernel.pbMessage(_INTL("The randomizer has encountered an error. You should try to re-randomize your game as soon as possible."))
|
displayRandomizerErrorMessage()
|
||||||
Kernel.pbMessage(_INTL("You can do this on the top floor of Pokémon Centers."))
|
|
||||||
return body
|
return body
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user