Renamed class PlayerTrainer to class Player, implemented class Player#Pokedex

This commit is contained in:
Maruno17
2021-04-11 20:45:44 +01:00
parent dcd0fe8b21
commit e49ddde198
32 changed files with 637 additions and 475 deletions

View File

@@ -72,12 +72,12 @@ class PokemonPokedexInfo_Scene
@viewport.z = 99999
dexnum = species
dexnumshift = false
if $PokemonGlobal.pokedexUnlocked[$PokemonGlobal.pokedexUnlocked.length - 1]
dexnumshift = true if Settings::DEXES_WITH_OFFSETS.include?(-1) # National Dex
if $Trainer.pokedex.unlocked?(-1) # National Dex is unlocked
dexnumshift = true if Settings::DEXES_WITH_OFFSETS.include?(-1)
else
dexnum = 0
for i in 0...$PokemonGlobal.pokedexUnlocked.length - 1 # Regional Dexes
next if !$PokemonGlobal.pokedexUnlocked[i]
for i in 0...$Trainer.pokedex.dexes_count - 1 # Regional Dexes
next if !$Trainer.pokedex.unlocked?(i)
num = pbGetRegionalNumber(i,species)
next if num <= 0
dexnum = num
@@ -121,10 +121,7 @@ class PokemonPokedexInfo_Scene
def pbUpdateDummyPokemon
@species = @dexlist[@index][0]
$Trainer.last_seen_forms = {} if !$Trainer.last_seen_forms
$Trainer.last_seen_forms[@species] = [] if !$Trainer.last_seen_forms[@species]
@gender = $Trainer.last_seen_forms[@species][0] || 0
@form = $Trainer.last_seen_forms[@species][1] || 0
@gender, @form = $Trainer.pokedex.last_form_seen(@species)
species_data = GameData::Species.get_species_form(@species, @form)
@sprites["infosprite"].setSpeciesBitmap(@species,@gender,@form)
if @sprites["formfront"]
@@ -149,16 +146,15 @@ class PokemonPokedexInfo_Scene
next if sp.form != 0 && (!sp.real_form_name || sp.real_form_name.empty?)
next if sp.pokedex_form != sp.form
multiple_forms = true if sp.form > 0
$Trainer.seen_forms[@species] = [[], []] if !$Trainer.seen_forms[@species]
case sp.gender_ratio
when :AlwaysMale, :AlwaysFemale, :Genderless
real_gender = (sp.gender_ratio == :AlwaysFemale) ? 1 : 0
next if !$Trainer.seen_forms[@species][real_gender][sp.form] && !Settings::DEX_SHOWS_ALL_FORMS
next if !$Trainer.pokedex.seen_form?(@species, real_gender, sp.form) && !Settings::DEX_SHOWS_ALL_FORMS
real_gender = 2 if sp.gender_ratio == :Genderless
ret.push([sp.form_name, real_gender, sp.form])
else # Both male and female
for real_gender in 0...2
next if !$Trainer.seen_forms[@species][real_gender][sp.form] && !Settings::DEX_SHOWS_ALL_FORMS
next if !$Trainer.pokedex.seen_form?(@species, real_gender, sp.form) && !Settings::DEX_SHOWS_ALL_FORMS
ret.push([sp.form_name, real_gender, sp.form])
break if sp.form_name && !sp.form_name.empty? # Only show 1 entry for each non-0 form
end
@@ -415,10 +411,7 @@ class PokemonPokedexInfo_Scene
oldindex = -1
loop do
if oldindex!=index
$Trainer.last_seen_forms = {} if !$Trainer.last_seen_forms
$Trainer.last_seen_forms[@species] = [] if !$Trainer.last_seen_forms
$Trainer.last_seen_forms[@species][0] = @available[index][1]
$Trainer.last_seen_forms[@species][1] = @available[index][2]
$Trainer.pokedex.set_last_form_seen(@species, @available[index][1], @available[index][2])
pbUpdateDummyPokemon
drawPage(@page)
@sprites["uparrow"].visible = (index>0)
@@ -554,9 +547,9 @@ class PokemonPokedexInfoScreen
region = -1
if Settings::USE_CURRENT_REGION_DEX
region = pbGetCurrentRegion
region = -1 if region>=$PokemonGlobal.pokedexUnlocked.length-1
region = -1 if region >= $Trainer.pokedex.dexes_count - 1
else
region = $PokemonGlobal.pokedexDex # National Dex -1, regional dexes 0 etc.
region = $PokemonGlobal.pokedexDex # National Dex -1, regional Dexes 0, 1, etc.
end
dexnum = pbGetRegionalNumber(region,species)
dexnumshift = Settings::DEXES_WITH_OFFSETS.include?(region)