diff --git a/Data/Scripts/001_Settings.rb b/Data/Scripts/001_Settings.rb index 9519ac754..8f2aacb86 100644 --- a/Data/Scripts/001_Settings.rb +++ b/Data/Scripts/001_Settings.rb @@ -135,6 +135,9 @@ module Settings SHINY_POKEMON_CHANCE = (MECHANICS_GENERATION >= 6) ? 16 : 8 # Whether super shininess is enabled (uses a different shiny animation). SUPER_SHINY = (MECHANICS_GENERATION >= 8) + # Whether Pokémon with the "Legendary", "Mythical" or "Ultra Beast" flags will + # have at least 3 perfect IVs. + LEGENDARIES_HAVE_SOME_PERFECT_IVS = (MECHANICS_GENERATION >= 6) # The odds of a wild Pokémon/bred egg having Pokérus (out of 65536). POKERUS_CHANCE = 3 # Whether IVs and EVs are treated as 0 when calculating a Pokémon's stats. diff --git a/Data/Scripts/012_Overworld/002_Battle triggering/004_Overworld_EncounterModifiers.rb b/Data/Scripts/012_Overworld/002_Battle triggering/004_Overworld_EncounterModifiers.rb index c0b6d74b3..8221684cb 100644 --- a/Data/Scripts/012_Overworld/002_Battle triggering/004_Overworld_EncounterModifiers.rb +++ b/Data/Scripts/012_Overworld/002_Battle triggering/004_Overworld_EncounterModifiers.rb @@ -12,6 +12,38 @@ EventHandlers.add(:on_wild_pokemon_created, :make_shiny_switch, } ) +# In the Safari Zone and Bug-Catching Contests, wild Pokémon reroll their IVs up +# to 4 times if they don't have a perfect IV. +EventHandlers.add(:on_wild_pokemon_created, :reroll_ivs_in_safari_and_bug_contest, + proc { |pkmn| + next if !pbInSafari? && !pbInBugContest? + rerolled = false + 4.times do + break if pkmn.iv.any? { |_stat, val| val == Pokemon::IV_STAT_LIMIT } + rerolled = true + GameData::Stat.each_main do |s| + pkmn.iv[s.id] = rand(Pokemon::IV_STAT_LIMIT + 1) + end + end + pkmn.calc_stats if rerolled + } +) + +# In Gen 6 and later, Legendary/Mythical/Ultra Beast Pokémon are guaranteed to +# have at least 3 perfect IVs. +EventHandlers.add(:on_wild_pokemon_created, :some_perfect_ivs_for_legendaries, + proc { |pkmn| + next if !Settings::LEGENDARIES_HAVE_SOME_PERFECT_IVS + data = pkmn.species_data + next if !data.has_flag?("Legendary") && !data.has_flag?("Mythical") && !data.has_flag?("UltraBeast") + stats = [] + GameData::Stat.each_main { |s| stats.push(s.id) } + perfect_stats = stats.sample(3) + perfect_stats.each { |s| pkmn.iv[s] = Pokemon::IV_STAT_LIMIT } + pkmn.calc_stats + } +) + # Used in the random dungeon map. Makes the levels of all wild Pokémon in that # map depend on the levels of Pokémon in the player's party. # This is a simple method, and can/should be modified to account for evolutions diff --git a/PBS/Gen 8 backup/items.txt b/PBS/Gen 8 backup/items.txt index fb9f93285..f0d40d5e1 100644 --- a/PBS/Gen 8 backup/items.txt +++ b/PBS/Gen 8 backup/items.txt @@ -523,7 +523,7 @@ Name = Big Nugget NamePlural = Big Nuggets Pocket = 1 Price = 40000 -Flags = Fling_30 +Flags = Fling_130 Description = A big nugget of pure gold that gives off a lustrous gleam. A maniac will buy it for a high price. #------------------------------- [HEARTSCALE] diff --git a/PBS/items.txt b/PBS/items.txt index fb9f93285..f0d40d5e1 100644 --- a/PBS/items.txt +++ b/PBS/items.txt @@ -523,7 +523,7 @@ Name = Big Nugget NamePlural = Big Nuggets Pocket = 1 Price = 40000 -Flags = Fling_30 +Flags = Fling_130 Description = A big nugget of pure gold that gives off a lustrous gleam. A maniac will buy it for a high price. #------------------------------- [HEARTSCALE]