mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Added Gen 8's shiny chance increase with number battled, fixed other shiny chance-boosting effects not working
This commit is contained in:
@@ -28,17 +28,20 @@ module Settings
|
||||
#=============================================================================
|
||||
|
||||
# The maximum level Pokémon can reach.
|
||||
MAXIMUM_LEVEL = 100
|
||||
MAXIMUM_LEVEL = 100
|
||||
# The level of newly hatched Pokémon.
|
||||
EGG_LEVEL = 1
|
||||
EGG_LEVEL = 1
|
||||
# The odds of a newly generated Pokémon being shiny (out of 65536).
|
||||
SHINY_POKEMON_CHANCE = (MECHANICS_GENERATION >= 6) ? 16 : 8
|
||||
SHINY_POKEMON_CHANCE = (MECHANICS_GENERATION >= 6) ? 16 : 8
|
||||
# Whether super shininess is enabled (uses a different shiny animation).
|
||||
SUPER_SHINY = (MECHANICS_GENERATION >= 8)
|
||||
SUPER_SHINY = (MECHANICS_GENERATION >= 8)
|
||||
# Whether shiny wild Pokémon are more likely to appear if the player has
|
||||
# previously defeated/caught lots of other Pokémon of the same species.
|
||||
HIGHER_SHINY_CHANCES_WITH_NUMBER_BATTLED = (MECHANICS_GENERATION >= 8)
|
||||
# The odds of a wild Pokémon/bred egg having Pokérus (out of 65536).
|
||||
POKERUS_CHANCE = 3
|
||||
# Whether a bred baby Pokémon can inherit any TM/HM moves from its father. It
|
||||
# can never inherit TM/HM moves from its mother.
|
||||
POKERUS_CHANCE = 3
|
||||
# Whether a bred baby Pokémon can inherit any TM/TR/HM moves from its father.
|
||||
# It can never inherit TM/TR/HM moves from its mother.
|
||||
BREEDING_CAN_INHERIT_MACHINE_MOVES = (MECHANICS_GENERATION <= 5)
|
||||
# Whether a bred baby Pokémon can inherit egg moves from its mother. It can
|
||||
# always inherit egg moves from its father.
|
||||
|
||||
@@ -88,3 +88,14 @@ SaveData.register_conversion(:v19_2_fix_berry_plants) do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
SaveData.register_conversion(:v20_add_battled_counts) do
|
||||
essentials_version 20
|
||||
display_title 'Adding Pokédex battle counts'
|
||||
to_value :player do |player|
|
||||
player.pokedex.instance_eval do
|
||||
@caught_counts = {} if @caught_counts.nil?
|
||||
@defeated_counts = {} if @defeated_counts.nil?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -55,6 +55,7 @@ class PokeBattle_Battler
|
||||
@battle.pbDisplayBrief(_INTL("{1} fainted!",pbThis)) if showMessage
|
||||
PBDebug.log("[Pokémon fainted] #{pbThis} (#{@index})") if !showMessage
|
||||
@battle.scene.pbFaintBattler(self)
|
||||
@battle.pbSetDefeated(self) if opposes?
|
||||
pbInitEffects(false)
|
||||
# Reset status
|
||||
self.status = :NONE
|
||||
|
||||
@@ -42,7 +42,8 @@ module PokeBattle_BattleCommon
|
||||
# Register all caught Pokémon in the Pokédex, and store them.
|
||||
def pbRecordAndStoreCaughtPokemon
|
||||
@caughtPokemon.each do |pkmn|
|
||||
pbPlayer.pokedex.register(pkmn) # In case the form changed upon leaving battle
|
||||
pbSetCaught(pkmn)
|
||||
pbSetSeen(pkmn) # In case the form changed upon leaving battle
|
||||
# Record the Pokémon's species as owned in the Pokédex
|
||||
if !pbPlayer.owned?(pkmn.species)
|
||||
pbPlayer.pokedex.set_owned(pkmn.species)
|
||||
|
||||
@@ -628,7 +628,29 @@ class PokeBattle_Battle
|
||||
|
||||
def pbSetSeen(battler)
|
||||
return if !battler || !@internalBattle
|
||||
pbPlayer.pokedex.register(battler.displaySpecies,battler.displayGender,battler.displayForm)
|
||||
if battler.is_a?(PokeBattle_Battler)
|
||||
pbPlayer.pokedex.register(battler.displaySpecies,battler.displayGender,battler.displayForm)
|
||||
else
|
||||
pbPlayer.pokedex.register(battler)
|
||||
end
|
||||
end
|
||||
|
||||
def pbSetCaught(battler)
|
||||
return if !battler || !@internalBattle
|
||||
if battler.is_a?(PokeBattle_Battler)
|
||||
pbPlayer.pokedex.register_caught(battler.displaySpecies)
|
||||
else
|
||||
pbPlayer.pokedex.register_caught(battler.species)
|
||||
end
|
||||
end
|
||||
|
||||
def pbSetDefeated(battler)
|
||||
return if !battler || !@internalBattle
|
||||
if battler.is_a?(PokeBattle_Battler)
|
||||
pbPlayer.pokedex.register_defeated(battler.displaySpecies)
|
||||
else
|
||||
pbPlayer.pokedex.register_defeated(battler.species)
|
||||
end
|
||||
end
|
||||
|
||||
def nextPickupUse
|
||||
|
||||
@@ -355,6 +355,24 @@ class PokeBattle_SafariZone
|
||||
|
||||
def pbGetOwnerFromBattlerIndex(idxBattler); return pbPlayer; end
|
||||
|
||||
def pbSetSeen(battler)
|
||||
return if !battler || !@internalBattle
|
||||
if battler.is_a?(PokeBattle_Battler)
|
||||
pbPlayer.pokedex.register(battler.displaySpecies,battler.displayGender,battler.displayForm)
|
||||
else
|
||||
pbPlayer.pokedex.register(battler)
|
||||
end
|
||||
end
|
||||
|
||||
def pbSetCaught(battler)
|
||||
return if !battler || !@internalBattle
|
||||
if battler.is_a?(PokeBattle_Battler)
|
||||
pbPlayer.pokedex.register_caught(battler.displaySpecies)
|
||||
else
|
||||
pbPlayer.pokedex.register_caught(battler.species)
|
||||
end
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Get party info (counts all teams on the same side)
|
||||
#=============================================================================
|
||||
@@ -417,7 +435,7 @@ class PokeBattle_SafariZone
|
||||
def pbStartBattle
|
||||
begin
|
||||
pkmn = @party2[0]
|
||||
self.pbPlayer.pokedex.register(pkmn)
|
||||
pbSetSeen(pkmn)
|
||||
@scene.pbStartBattle(self)
|
||||
pbDisplayPaused(_INTL("Wild {1} appeared!",pkmn.name))
|
||||
@scene.pbSafariStart
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -338,7 +338,7 @@ class Pokemon
|
||||
else @gender = 2
|
||||
end
|
||||
else
|
||||
female_chance = GameData::GenderRatio.get(gender_ratio).female_chance
|
||||
female_chance = GameData::GenderRatio.get(species_data.gender_ratio).female_chance
|
||||
@gender = ((@personalID & 0xFF) < female_chance) ? 1 : 0
|
||||
end
|
||||
end
|
||||
|
||||
@@ -27,6 +27,8 @@ class Player < Trainer
|
||||
@seen_forms = {}
|
||||
@last_seen_forms = {}
|
||||
@owned_shadow = {}
|
||||
@caught_counts = {}
|
||||
@defeated_counts = {}
|
||||
self.refresh_accessible_dexes
|
||||
end
|
||||
|
||||
@@ -199,6 +201,51 @@ class Player < Trainer
|
||||
|
||||
#===========================================================================
|
||||
|
||||
# @param species [Symbol, GameData::Species] species to check
|
||||
# @return [Integer] the number of Pokémon of the given species that have
|
||||
# been caught by the player
|
||||
def caught_count(species)
|
||||
species_id = GameData::Species.try_get(species)&.species
|
||||
return 0 if species_id.nil?
|
||||
return @caught_counts[species] || 0
|
||||
end
|
||||
|
||||
# @param species [Symbol, GameData::Species] species to check
|
||||
# @return [Integer] the number of Pokémon of the given species that have
|
||||
# been defeated by the player
|
||||
def defeated_count(species)
|
||||
species_id = GameData::Species.try_get(species)&.species
|
||||
return 0 if species_id.nil?
|
||||
return @defeated_counts[species] || 0
|
||||
end
|
||||
|
||||
# @param species [Symbol, GameData::Species] species to check
|
||||
# @return [Integer] the number of Pokémon of the given species that have
|
||||
# been defeated or caught by the player
|
||||
def battled_count(species)
|
||||
species_id = GameData::Species.try_get(species)&.species
|
||||
return 0 if species_id.nil?
|
||||
return (@defeated_counts[species] || 0) + (@caught_counts[species] || 0)
|
||||
end
|
||||
|
||||
# @param species [Symbol, GameData::Species] species to count as caught
|
||||
def register_caught(species)
|
||||
species_id = GameData::Species.try_get(species)&.species
|
||||
return if species_id.nil?
|
||||
@caught_counts[species] = 0 if @caught_counts[species].nil?
|
||||
@caught_counts[species] += 1
|
||||
end
|
||||
|
||||
# @param species [Symbol, GameData::Species] species to count as defeated
|
||||
def register_defeated(species)
|
||||
species_id = GameData::Species.try_get(species)&.species
|
||||
return if species_id.nil?
|
||||
@defeated_counts[species] = 0 if @defeated_counts[species].nil?
|
||||
@defeated_counts[species] += 1
|
||||
end
|
||||
|
||||
#===========================================================================
|
||||
|
||||
# Unlocks the given Dex, -1 being the National Dex.
|
||||
# @param dex [Integer] Dex ID (-1 is the National Dex)
|
||||
def unlock(dex)
|
||||
|
||||
@@ -9,6 +9,7 @@ class PokemonPokedexInfo_Scene
|
||||
@index = index
|
||||
@region = region
|
||||
@page = 1
|
||||
@show_battled_count = false
|
||||
@typebitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Pokedex/icon_types"))
|
||||
@sprites = {}
|
||||
@sprites["background"] = IconSprite.new(0,0,@viewport)
|
||||
@@ -219,24 +220,31 @@ class PokemonPokedexInfo_Scene
|
||||
end
|
||||
textpos = [
|
||||
[_INTL("{1}{2} {3}", indexText, " ", species_data.name),
|
||||
246, 36, 0, Color.new(248, 248, 248), Color.new(0, 0, 0)],
|
||||
[_INTL("Height"), 314, 152, 0, base, shadow],
|
||||
[_INTL("Weight"), 314, 184, 0, base, shadow]
|
||||
246, 36, 0, Color.new(248, 248, 248), Color.new(0, 0, 0)]
|
||||
]
|
||||
if @show_battled_count
|
||||
textpos.push([_INTL("Number Battled"), 314, 152, 0, base, shadow])
|
||||
textpos.push([$Trainer.pokedex.battled_count(@species).to_s, 452, 184, 1, base, shadow])
|
||||
else
|
||||
textpos.push([_INTL("Height"), 314, 152, 0, base, shadow])
|
||||
textpos.push([_INTL("Weight"), 314, 184, 0, base, shadow])
|
||||
end
|
||||
if $Trainer.owned?(@species)
|
||||
# Write the category
|
||||
textpos.push([_INTL("{1} Pokémon", species_data.category), 246, 68, 0, base, shadow])
|
||||
# Write the height and weight
|
||||
height = species_data.height
|
||||
weight = species_data.weight
|
||||
if System.user_language[3..4] == "US" # If the user is in the United States
|
||||
inches = (height / 0.254).round
|
||||
pounds = (weight / 0.45359).round
|
||||
textpos.push([_ISPRINTF("{1:d}'{2:02d}\"", inches / 12, inches % 12), 460, 152, 1, base, shadow])
|
||||
textpos.push([_ISPRINTF("{1:4.1f} lbs.", pounds / 10.0), 494, 184, 1, base, shadow])
|
||||
else
|
||||
textpos.push([_ISPRINTF("{1:.1f} m", height / 10.0), 470, 152, 1, base, shadow])
|
||||
textpos.push([_ISPRINTF("{1:.1f} kg", weight / 10.0), 482, 184, 1, base, shadow])
|
||||
if !@show_battled_count
|
||||
height = species_data.height
|
||||
weight = species_data.weight
|
||||
if System.user_language[3..4] == "US" # If the user is in the United States
|
||||
inches = (height / 0.254).round
|
||||
pounds = (weight / 0.45359).round
|
||||
textpos.push([_ISPRINTF("{1:d}'{2:02d}\"", inches / 12, inches % 12), 460, 152, 1, base, shadow])
|
||||
textpos.push([_ISPRINTF("{1:4.1f} lbs.", pounds / 10.0), 494, 184, 1, base, shadow])
|
||||
else
|
||||
textpos.push([_ISPRINTF("{1:.1f} m", height / 10.0), 470, 152, 1, base, shadow])
|
||||
textpos.push([_ISPRINTF("{1:.1f} kg", weight / 10.0), 482, 184, 1, base, shadow])
|
||||
end
|
||||
end
|
||||
# Draw the Pokédex entry text
|
||||
drawTextEx(overlay, 40, 244, Graphics.width - (40 * 2), 4, # overlay, x, y, width, num lines
|
||||
@@ -263,12 +271,14 @@ class PokemonPokedexInfo_Scene
|
||||
# Write the category
|
||||
textpos.push([_INTL("????? Pokémon"), 246, 68, 0, base, shadow])
|
||||
# Write the height and weight
|
||||
if System.user_language[3..4] == "US" # If the user is in the United States
|
||||
textpos.push([_INTL("???'??\""), 460, 152, 1, base, shadow])
|
||||
textpos.push([_INTL("????.? lbs."), 494, 184, 1, base, shadow])
|
||||
else
|
||||
textpos.push([_INTL("????.? m"), 470, 152, 1, base, shadow])
|
||||
textpos.push([_INTL("????.? kg"), 482, 184, 1, base, shadow])
|
||||
if !@show_battled_count
|
||||
if System.user_language[3..4] == "US" # If the user is in the United States
|
||||
textpos.push([_INTL("???'??\""), 460, 152, 1, base, shadow])
|
||||
textpos.push([_INTL("????.? lbs."), 494, 184, 1, base, shadow])
|
||||
else
|
||||
textpos.push([_INTL("????.? m"), 470, 152, 1, base, shadow])
|
||||
textpos.push([_INTL("????.? kg"), 482, 184, 1, base, shadow])
|
||||
end
|
||||
end
|
||||
end
|
||||
# Draw all text
|
||||
@@ -458,9 +468,12 @@ class PokemonPokedexInfo_Scene
|
||||
pbPlayCloseMenuSE
|
||||
break
|
||||
elsif Input.trigger?(Input::USE)
|
||||
if @page==2 # Area
|
||||
if @page == 1 # Info
|
||||
@show_battled_count = !@show_battled_count
|
||||
dorefresh = true
|
||||
elsif @page == 2 # Area
|
||||
# dorefresh = true
|
||||
elsif @page==3 # Forms
|
||||
elsif @page == 3 # Forms
|
||||
if @available.length>1
|
||||
pbPlayDecisionSE
|
||||
pbChooseForm
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
# To do
|
||||
#===============================================================================
|
||||
|
||||
The game records, for each species, how many have been caught or defeated
|
||||
(counts both wild and trainer battles), and the shiny chance increases for that
|
||||
species because of this. This value is also shown in the Pokédex entry screen.
|
||||
(Will be implemented by me in the next PR)
|
||||
|
||||
Some moves have changed properties/effects:
|
||||
- Parting Shot is able to make the user switch out if its effect is redirected
|
||||
by Mirror Armor. Throat Spray is triggered and applies before the switch.
|
||||
@@ -173,4 +168,8 @@ In Gen 7+, Shaymin/Hoopa revert their form when withdrawn from storage rather
|
||||
than when deposited. It still also reverts under other conditions. Shaymin
|
||||
reverts its form when deposited in the Day Care (all Gens).
|
||||
|
||||
The game records, for each species, how many have been caught or defeated
|
||||
(counts both wild and trainer battles), and the shiny chance increases for that
|
||||
species because of this. This value is also shown in the Pokédex entry screen.
|
||||
|
||||
=end
|
||||
|
||||
Reference in New Issue
Block a user