From 4ca2500d6bc9c51dce060faa23c8fc7c353f7116 Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Wed, 12 Jul 2023 21:08:02 +0100 Subject: [PATCH] =?UTF-8?q?The=20Pok=C3=A9dex=20entry=20of=20a=20newly=20o?= =?UTF-8?q?btained=20species=20now=20only=20shows=20if=20that=20species=20?= =?UTF-8?q?is=20in=20an=20unlocked=20Dex=20list?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../005_Battle_CatchAndStoreMixin.rb | 2 +- .../015_Trainers and player/005_Player_Pokedex.rb | 9 +++++++++ .../016_UI/001_Non-interactive UI/003_UI_EggHatching.rb | 6 ++++-- .../016_UI/001_Non-interactive UI/004_UI_Evolution.rb | 3 ++- .../016_UI/001_Non-interactive UI/005_UI_Trading.rb | 3 ++- Data/Scripts/016_UI/024_UI_MysteryGift.rb | 3 ++- Data/Scripts/019_Utilities/002_Utilities_Pokemon.rb | 9 ++++++--- 7 files changed, 26 insertions(+), 9 deletions(-) diff --git a/Data/Scripts/011_Battle/007_Other battle code/005_Battle_CatchAndStoreMixin.rb b/Data/Scripts/011_Battle/007_Other battle code/005_Battle_CatchAndStoreMixin.rb index 22e3febce..dae58025d 100644 --- a/Data/Scripts/011_Battle/007_Other battle code/005_Battle_CatchAndStoreMixin.rb +++ b/Data/Scripts/011_Battle/007_Other battle code/005_Battle_CatchAndStoreMixin.rb @@ -86,7 +86,7 @@ module Battle::CatchAndStoreMixin # Record the Pokémon's species as owned in the Pokédex if !pbPlayer.owned?(pkmn.species) pbPlayer.pokedex.set_owned(pkmn.species) - if $player.has_pokedex + if $player.has_pokedex && $player.pokedex.species_in_unlocked_dex?(pkmn.species) pbDisplayPaused(_INTL("{1}'s data was added to the Pokédex.", pkmn.name)) pbPlayer.pokedex.register_last_seen(pkmn) @scene.pbShowPokedex(pkmn.species) diff --git a/Data/Scripts/015_Trainers and player/005_Player_Pokedex.rb b/Data/Scripts/015_Trainers and player/005_Player_Pokedex.rb index 020f04ab5..fb3afe4df 100644 --- a/Data/Scripts/015_Trainers and player/005_Player_Pokedex.rb +++ b/Data/Scripts/015_Trainers and player/005_Player_Pokedex.rb @@ -332,6 +332,15 @@ class Player < Trainer end end + def species_in_unlocked_dex?(species) + return true if @unlocked_dexes.last + (@unlocked_dexes.length - 1).times do |i| + next if !self.unlocked?(i) + return true if pbGetRegionalNumber(i, species) > 0 + end + return false + end + #--------------------------------------------------------------------------- private diff --git a/Data/Scripts/016_UI/001_Non-interactive UI/003_UI_EggHatching.rb b/Data/Scripts/016_UI/001_Non-interactive UI/003_UI_EggHatching.rb index 4037ee9a1..51d9447ba 100644 --- a/Data/Scripts/016_UI/001_Non-interactive UI/003_UI_EggHatching.rb +++ b/Data/Scripts/016_UI/001_Non-interactive UI/003_UI_EggHatching.rb @@ -108,7 +108,8 @@ class PokemonEggHatch_Scene $player.pokedex.set_owned(@pokemon.species) $player.pokedex.set_seen_egg(@pokemon.species) # Show Pokédex entry for new species if it hasn't been owned before - if Settings::SHOW_NEW_SPECIES_POKEDEX_ENTRY_MORE_OFTEN && !was_owned && $player.has_pokedex + if Settings::SHOW_NEW_SPECIES_POKEDEX_ENTRY_MORE_OFTEN && !was_owned && + $player.has_pokedex && $player.pokedex.species_in_unlocked_dex?(@pokemon.species) pbMessage(_INTL("{1}'s data was added to the Pokédex.", @pokemon.name)) { update } $player.pokedex.register_last_seen(@pokemon) pbFadeOutIn do @@ -227,7 +228,8 @@ def pbHatch(pokemon) $player.pokedex.set_owned(pokemon.species) $player.pokedex.set_seen_egg(pokemon.species) # Show Pokédex entry for new species if it hasn't been owned before - if Settings::SHOW_NEW_SPECIES_POKEDEX_ENTRY_MORE_OFTEN && !was_owned && $player.has_pokedex + if Settings::SHOW_NEW_SPECIES_POKEDEX_ENTRY_MORE_OFTEN && !was_owned && + $player.has_pokedex && $player.pokedex.species_in_unlocked_dex?(pokemon.species) pbMessage(_INTL("{1}'s data was added to the Pokédex.", speciesname)) $player.pokedex.register_last_seen(pokemon) pbFadeOutIn do diff --git a/Data/Scripts/016_UI/001_Non-interactive UI/004_UI_Evolution.rb b/Data/Scripts/016_UI/001_Non-interactive UI/004_UI_Evolution.rb index d9a28da33..84c44da75 100644 --- a/Data/Scripts/016_UI/001_Non-interactive UI/004_UI_Evolution.rb +++ b/Data/Scripts/016_UI/001_Non-interactive UI/004_UI_Evolution.rb @@ -230,7 +230,8 @@ class PokemonEvolutionScene moves_to_learn.push(i[1]) end # Show Pokédex entry for new species if it hasn't been owned before - if Settings::SHOW_NEW_SPECIES_POKEDEX_ENTRY_MORE_OFTEN && !was_owned && $player.has_pokedex + if Settings::SHOW_NEW_SPECIES_POKEDEX_ENTRY_MORE_OFTEN && !was_owned && + $player.has_pokedex && $player.pokedex.species_in_unlocked_dex?(@pokemon.species) pbMessageDisplay(@sprites["msgwindow"], _INTL("{1}'s data was added to the Pokédex.", newspeciesname)) { pbUpdate } $player.pokedex.register_last_seen(@pokemon) diff --git a/Data/Scripts/016_UI/001_Non-interactive UI/005_UI_Trading.rb b/Data/Scripts/016_UI/001_Non-interactive UI/005_UI_Trading.rb index 762c3bf79..a6774145d 100644 --- a/Data/Scripts/016_UI/001_Non-interactive UI/005_UI_Trading.rb +++ b/Data/Scripts/016_UI/001_Non-interactive UI/005_UI_Trading.rb @@ -191,7 +191,8 @@ class PokemonTrade_Scene pbMessageDisplay(@sprites["msgwindow"], _INTL("Take good care of {1}.", speciesname2)) { pbUpdate } # Show Pokédex entry for new species if it hasn't been owned before - if Settings::SHOW_NEW_SPECIES_POKEDEX_ENTRY_MORE_OFTEN && !was_owned && $player.has_pokedex + if Settings::SHOW_NEW_SPECIES_POKEDEX_ENTRY_MORE_OFTEN && !was_owned && + $player.has_pokedex && $player.pokedex.species_in_unlocked_dex?(@pokemon2.species) pbMessageDisplay(@sprites["msgwindow"], _INTL("{1}'s data was added to the Pokédex.", speciesname2)) { pbUpdate } $player.pokedex.register_last_seen(@pokemon2) diff --git a/Data/Scripts/016_UI/024_UI_MysteryGift.rb b/Data/Scripts/016_UI/024_UI_MysteryGift.rb index 00e399755..d6ea1aa15 100644 --- a/Data/Scripts/016_UI/024_UI_MysteryGift.rb +++ b/Data/Scripts/016_UI/024_UI_MysteryGift.rb @@ -384,7 +384,8 @@ def pbReceiveMysteryGift(id) pbMessage("\\me[Pkmn get]" + _INTL("{1} received {2}!", $player.name, gift[2].name)) $player.mystery_gifts[index] = [id] # Show Pokédex entry for new species if it hasn't been owned before - if Settings::SHOW_NEW_SPECIES_POKEDEX_ENTRY_MORE_OFTEN && !was_owned && $player.has_pokedex + if Settings::SHOW_NEW_SPECIES_POKEDEX_ENTRY_MORE_OFTEN && !was_owned && + $player.has_pokedex && $player.pokedex.species_in_unlocked_dex?(gift[2].species) pbMessage(_INTL("{1}'s data was added to the Pokédex.", gift[2].name)) $player.pokedex.register_last_seen(gift[2]) pbFadeOutIn do diff --git a/Data/Scripts/019_Utilities/002_Utilities_Pokemon.rb b/Data/Scripts/019_Utilities/002_Utilities_Pokemon.rb index b69dd8c5e..15432c818 100644 --- a/Data/Scripts/019_Utilities/002_Utilities_Pokemon.rb +++ b/Data/Scripts/019_Utilities/002_Utilities_Pokemon.rb @@ -60,7 +60,8 @@ def pbAddPokemon(pkmn, level = 1, see_form = true) $player.pokedex.set_owned(pkmn.species) $player.pokedex.register(pkmn) if see_form # Show Pokédex entry for new species if it hasn't been owned before - if Settings::SHOW_NEW_SPECIES_POKEDEX_ENTRY_MORE_OFTEN && see_form && !was_owned && $player.has_pokedex + if Settings::SHOW_NEW_SPECIES_POKEDEX_ENTRY_MORE_OFTEN && see_form && !was_owned && + $player.has_pokedex && $player.pokedex.species_in_unlocked_dex?(pkmn.species) pbMessage(_INTL("{1}'s data was added to the Pokédex.", species_name)) $player.pokedex.register_last_seen(pkmn) pbFadeOutIn do @@ -102,7 +103,8 @@ def pbAddToParty(pkmn, level = 1, see_form = true) $player.pokedex.set_owned(pkmn.species) $player.pokedex.register(pkmn) if see_form # Show Pokédex entry for new species if it hasn't been owned before - if Settings::SHOW_NEW_SPECIES_POKEDEX_ENTRY_MORE_OFTEN && see_form && !was_owned && $player.has_pokedex + if Settings::SHOW_NEW_SPECIES_POKEDEX_ENTRY_MORE_OFTEN && see_form && !was_owned && + $player.has_pokedex && $player.pokedex.species_in_unlocked_dex?(pkmn.species) pbMessage(_INTL("{1}'s data was added to the Pokédex.", species_name)) $player.pokedex.register_last_seen(pkmn) pbFadeOutIn do @@ -142,7 +144,8 @@ def pbAddForeignPokemon(pkmn, level = 1, owner_name = nil, nickname = nil, owner $player.pokedex.set_owned(pkmn.species) $player.pokedex.register(pkmn) if see_form # Show Pokédex entry for new species if it hasn't been owned before - if Settings::SHOW_NEW_SPECIES_POKEDEX_ENTRY_MORE_OFTEN && see_form && !was_owned && $player.has_pokedex + if Settings::SHOW_NEW_SPECIES_POKEDEX_ENTRY_MORE_OFTEN && see_form && !was_owned && + $player.has_pokedex && $player.pokedex.species_in_unlocked_dex?(pkmn.species) pbMessage(_INTL("The Pokémon's data was added to the Pokédex.")) $player.pokedex.register_last_seen(pkmn) pbFadeOutIn do