Added min. 3 perfect IVS for legendaries, rerolling IVs for Safari/Bug Contest Pokémon, fixed Big Nugget's Fling power in Gen 8

This commit is contained in:
Maruno17
2023-11-27 18:26:07 +00:00
parent d3c9c6b360
commit c7e8848813
4 changed files with 37 additions and 2 deletions

View File

@@ -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.

View File

@@ -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

View File

@@ -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]

View File

@@ -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]