Added Gen 8's shiny chance increase with number battled, fixed other shiny chance-boosting effects not working

This commit is contained in:
Maruno17
2021-08-31 16:54:03 +01:00
parent 3c88c897f0
commit 218307d993
12 changed files with 172 additions and 40 deletions

View File

@@ -411,10 +411,26 @@ def pbGenerateWildPokemon(species,level,isRoamer=false)
elsif itemrnd<(chances[0]+chances[1]+chances[2])
genwildpoke.item = items[2]
end
# Shiny Charm makes shiny Pokémon more likely to generate
if GameData::Item.exists?(:SHINYCHARM) && $PokemonBag.pbHasItem?(:SHINYCHARM)
2.times do # 3 times as likely
# Improve chances of shiny Pokémon with Shiny Charm and battling more of the
# same species
shiny_retries = 0
shiny_retries += 2 if GameData::Item.exists?(:SHINYCHARM) && $PokemonBag.pbHasItem?(:SHINYCHARM)
if Settings::HIGHER_SHINY_CHANCES_WITH_NUMBER_BATTLED
values = [0, 0]
case $Trainer.pokedex.battled_count(species)
when 0...50 then values = [0, 0]
when 50...100 then values = [1, 15]
when 100...200 then values = [2, 20]
when 200...300 then values = [3, 25]
when 300...500 then values = [4, 30]
else values = [5, 30]
end
shiny_retries += values[0] if values[1] > 0 && rand(1000) < values[1]
end
if shiny_retries > 0
shiny_retries.times do
break if genwildpoke.shiny?
genwildpoke.shiny = nil # Make it recalculate shininess
genwildpoke.personalID = rand(2**16) | rand(2**16) << 16
end
end

View File

@@ -324,6 +324,7 @@ def pbDayCareGenerateEgg
if shinyretries>0
shinyretries.times do
break if egg.shiny?
egg.shiny = nil # Make it recalculate shininess
egg.personalID = rand(2**16) | rand(2**16) << 16
end
end