The Pokédex entry of a newly obtained species now only shows if that species is in an unlocked Dex list

This commit is contained in:
Maruno17
2023-07-12 21:08:02 +01:00
parent 8287f32a5e
commit 4ca2500d6b
7 changed files with 26 additions and 9 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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