From 68d0e24ef422454abcd65b83b334dd148afdbad0 Mon Sep 17 00:00:00 2001 From: infinitefusion Date: Sun, 1 May 2022 15:35:03 -0400 Subject: [PATCH] randomizer - gift pokemon --- Data/MapInfos.rxdata | Bin 36404 -> 36404 bytes .../019_Utilities/002_Utilities_Pokemon.rb | 6 ++++-- Data/Scripts/025-Randomizer/randomizer.rb | 7 +++++++ Data/Scripts/049_Compatibility/Constants.rb | 1 + Data/System.rxdata | Bin 27388 -> 27387 bytes 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Data/MapInfos.rxdata b/Data/MapInfos.rxdata index 5e7108e88440144441aaa1fd029523405cef48f5..5562facb8ae37412a4fc3cc567ef0146904ced6d 100644 GIT binary patch delta 26 icmdlohiS_krVR_cx!tTeGli|WGMU~pZeH!(=>!0SRtaSQ delta 26 icmdlohiS_krVR_cxkIcuGli|WGMVz2H?Q{YbOHc?y9o3E diff --git a/Data/Scripts/019_Utilities/002_Utilities_Pokemon.rb b/Data/Scripts/019_Utilities/002_Utilities_Pokemon.rb index 9d5d5c55f..0b5c10358 100644 --- a/Data/Scripts/019_Utilities/002_Utilities_Pokemon.rb +++ b/Data/Scripts/019_Utilities/002_Utilities_Pokemon.rb @@ -62,7 +62,7 @@ end #=============================================================================== # Giving Pokémon to the player (will send to storage if party is full) #=============================================================================== -def pbAddPokemon(pkmn, level = 1, see_form = true) +def pbAddPokemon(pkmn, level = 1, see_form = true, dontRandomize=false) return false if !pkmn if pbBoxesFull? pbMessage(_INTL("There's no more room for Pokémon!\1")) @@ -70,6 +70,7 @@ def pbAddPokemon(pkmn, level = 1, see_form = true) return false end pkmn = Pokemon.new(pkmn, level) if !pkmn.is_a?(Pokemon) + tryRandomizeGiftPokemon(pkmn,dontRandomize) species_name = pkmn.speciesName pbMessage(_INTL("{1} obtained {2}!\\me[Pkmn get]\\wtnp[80]\1", $Trainer.name, species_name)) pbNicknameAndStore(pkmn) @@ -94,9 +95,10 @@ end #=============================================================================== # Giving Pokémon/eggs to the player (can only add to party) #=============================================================================== -def pbAddToParty(pkmn, level = 1, see_form = true) +def pbAddToParty(pkmn, level = 1, see_form = true, dontRandomize=false) return false if !pkmn || $Trainer.party_full? pkmn = Pokemon.new(pkmn, level) if !pkmn.is_a?(Pokemon) + tryRandomizeGiftPokemon(pkmn,dontRandomize) species_name = pkmn.speciesName pbMessage(_INTL("{1} obtained {2}!\\me[Pkmn get]\\wtnp[80]\1", $Trainer.name, species_name)) pbNicknameAndStore(pkmn) diff --git a/Data/Scripts/025-Randomizer/randomizer.rb b/Data/Scripts/025-Randomizer/randomizer.rb index 3ac7610e2..8d5ca0036 100644 --- a/Data/Scripts/025-Randomizer/randomizer.rb +++ b/Data/Scripts/025-Randomizer/randomizer.rb @@ -188,3 +188,10 @@ def getRandomizedTo(species) return $PokemonGlobal.psuedoBSTHash[dexNum(species)] # code here end + +def tryRandomizeGiftPokemon(pokemon,dontRandomize=false) + if $game_switches[SWITCH_RANDOM_GIFT_POKEMON] && $game_switches[SWITCH_RANDOM_WILD] && !dontRandomize + oldSpecies = dexNum(pokemon.species) + pokemon.species = getSpecies($PokemonGlobal.psuedoBSTHash[oldSpecies]) + end +end \ No newline at end of file diff --git a/Data/Scripts/049_Compatibility/Constants.rb b/Data/Scripts/049_Compatibility/Constants.rb index 1897fd5e5..98531623e 100644 --- a/Data/Scripts/049_Compatibility/Constants.rb +++ b/Data/Scripts/049_Compatibility/Constants.rb @@ -55,6 +55,7 @@ SWITCH_GYM_RANDOM_EACH_BATTLE = 668 SWITCH_RANDOM_GYM_CUSTOMS=662 SWITCH_RANDOMIZE_GYMS_SEPARATELY = 667 SWITCH_RANDOMIZED_GYM_TYPES=921 +SWITCH_RANDOM_GIFT_POKEMON = 780 #Other switches SWITCH_RACE_BIKE = 984 diff --git a/Data/System.rxdata b/Data/System.rxdata index 6622ee1aaabd704de24795b5bd6747d9788b62b2..f35e02f6a6f947d0dc2e84f98a9f418727d5fac8 100644 GIT binary patch delta 40 wcmex!mGSpg#tjF>_*jc$rm#m8|$3Qj3!l3sNV4$dKIpLhN+_Gm|>w<}2yy%m8Q^5CZ@J