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

@@ -196,9 +196,8 @@ def pbHatch(pokemon)
pokemon.timeEggHatched = pbGetTimeNow
pokemon.obtain_method = 1 # hatched from egg
pokemon.hatched_map = $game_map.map_id
$Trainer.set_seen(pokemon.species)
$Trainer.set_owned(pokemon.species)
pbSeenForm(pokemon)
$Trainer.pokedex.register(pokemon)
$Trainer.pokedex.set_owned(pokemon.species)
pokemon.record_first_moves
if !pbHatchAnimation(pokemon)
pbMessage(_INTL("Huh?\1"))

View File

@@ -588,9 +588,8 @@ class PokemonEvolutionScene
@pokemon.form = 0 if @pokemon.isSpecies?(:MOTHIM)
@pokemon.calc_stats
# See and own evolved species
$Trainer.set_seen(@newspecies)
$Trainer.set_owned(@newspecies)
pbSeenForm(@pokemon)
$Trainer.pokedex.register(@pokemon)
$Trainer.pokedex.set_owned(@newspecies)
# Learn moves upon evolution for evolved species
movelist = @pokemon.getMoveList
for i in movelist
@@ -616,8 +615,7 @@ class PokemonEvolutionScene
# Add duplicate Pokémon to party
$Trainer.party.push(new_pkmn)
# See and own duplicate Pokémon
$Trainer.set_seen(new_species)
$Trainer.set_owned(new_species)
pbSeenForm(new_pkmn)
$Trainer.pokedex.register(new_pkmn)
$Trainer.pokedex.set_owned(new_species)
end
end

View File

@@ -228,9 +228,8 @@ def pbStartTrade(pokemonIndex,newpoke,nickname,trainerName,trainerGender=0)
yourPokemon.obtain_method = 2 # traded
yourPokemon.reset_moves if resetmoves
yourPokemon.record_first_moves
$Trainer.set_seen(yourPokemon.species)
$Trainer.set_owned(yourPokemon.species)
pbSeenForm(yourPokemon)
$Trainer.pokedex.register(yourPokemon)
$Trainer.pokedex.set_owned(yourPokemon.species)
pbFadeOutInWithMusic {
evo = PokemonTrade_Scene.new
evo.pbStartScreen(myPokemon,yourPokemon,$Trainer.name,opponent.name)

View File

@@ -281,7 +281,7 @@ class HallOfFame_Scene
lefttext+=_INTL("IDNo.<r>{1}<br>",pubid)
lefttext+=_ISPRINTF("Time<r>{1:02d}:{2:02d}<br>",hour,min)
lefttext+=_INTL("Pokédex<r>{1}/{2}<br>",
$Trainer.owned_count,$Trainer.seen_count)
$Trainer.pokedex.owned_count,$Trainer.pokedex.seen_count)
@sprites["messagebox"]=Window_AdvancedTextPokemon.new(lefttext)
@sprites["messagebox"].viewport=@viewport
@sprites["messagebox"].width=192 if @sprites["messagebox"].width<192

View File

@@ -100,7 +100,6 @@ class PokemonPauseMenu
end
return
end
pbSetViableDexes
@scene.pbStartScene
endscene = true
commands = []
@@ -114,7 +113,7 @@ class PokemonPauseMenu
cmdDebug = -1
cmdQuit = -1
cmdEndGame = -1
commands[cmdPokedex = commands.length] = _INTL("Pokédex") if $Trainer.pokedex && $PokemonGlobal.pokedexViable.length>0
commands[cmdPokedex = commands.length] = _INTL("Pokédex") if $Trainer.has_pokedex && $Trainer.pokedex.accessible_dexes_count > 0
commands[cmdPokemon = commands.length] = _INTL("Pokémon") if $Trainer.party.length>0
commands[cmdBag = commands.length] = _INTL("Bag") if !pbInBugContest?
commands[cmdPokegear = commands.length] = _INTL("Pokégear") if $Trainer.pokegear
@@ -155,9 +154,8 @@ class PokemonPauseMenu
@scene.pbRefresh
}
else
if $PokemonGlobal.pokedexViable.length==1
$PokemonGlobal.pokedexDex = $PokemonGlobal.pokedexViable[0]
$PokemonGlobal.pokedexDex = -1 if $PokemonGlobal.pokedexDex==$PokemonGlobal.pokedexUnlocked.length-1
if $Trainer.pokedex.accessible_dexes_count == 1
$PokemonGlobal.pokedexDex = $Trainer.pokedex.accessible_dexes[0]
pbFadeOutIn {
scene = PokemonPokedex_Scene.new
screen = PokemonPokedexScreen.new(scene)

View File

@@ -1,7 +1,7 @@
#===============================================================================
# Pokédex Regional Dexes list menu screen
# * For choosing which region list to view. Only appears when there is more
# than one viable region list to choose from, and if
# than one accessible region list to choose from, and if
# Settings::USE_CURRENT_REGION_DEX is false.
#===============================================================================
class Window_DexesList < Window_CommandPokemon
@@ -94,29 +94,24 @@ class PokemonPokedexMenuScreen
commands = []
commands2 = []
dexnames = Settings.pokedex_names
for i in 0...$PokemonGlobal.pokedexViable.length
index = $PokemonGlobal.pokedexViable[i]
if dexnames[index]==nil
commands[i] = _INTL("Pokédex")
$Trainer.pokedex.accessible_dexes.each do |dex|
if dexnames[dex].nil?
commands.push(_INTL("Pokédex"))
elsif dexnames[dex].is_a?(Array)
commands.push(dexnames[dex][0])
else
if dexnames[index].is_a?(Array)
commands[i] = dexnames[index][0]
else
commands[i] = dexnames[index]
end
commands.push(dexnames[dex])
end
index = -1 if index >= $PokemonGlobal.pokedexUnlocked.length - 1
commands2[i] = [$Trainer.seen_count(index),
$Trainer.owned_count(index),
pbGetRegionalDexLength(index)]
commands2.push([$Trainer.pokedex.seen_count(dex),
$Trainer.pokedex.owned_count(dex),
pbGetRegionalDexLength(dex)])
end
commands.push(_INTL("Exit"))
@scene.pbStartScene(commands,commands2)
loop do
cmd = @scene.pbScene
break if cmd<0 || cmd>=commands2.length # Cancel/Exit
$PokemonGlobal.pokedexDex = $PokemonGlobal.pokedexViable[cmd]
$PokemonGlobal.pokedexDex = -1 if $PokemonGlobal.pokedexDex==$PokemonGlobal.pokedexUnlocked.length-1
$PokemonGlobal.pokedexDex = $Trainer.pokedex.accessible_dexes[cmd]
pbFadeOutIn {
scene = PokemonPokedex_Scene.new
screen = PokemonPokedexScreen.new(scene)

View File

@@ -284,10 +284,10 @@ class PokemonPokedex_Scene
def pbGetPokedexRegion
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
return region
else
return $PokemonGlobal.pokedexDex # National Dex -1, regional dexes 0 etc.
return $PokemonGlobal.pokedexDex # National Dex -1, regional Dexes 0, 1, etc.
end
end
@@ -297,8 +297,8 @@ class PokemonPokedex_Scene
def pbGetSavePositionIndex
index = pbGetPokedexRegion
if index==-1 # National Dex
index = $PokemonGlobal.pokedexUnlocked.length-1 # National Dex index comes
end # after regional Dex indices
index = $Trainer.pokedex.dexes_count - 1 # National Dex index comes
end # after regional Dex indices
return index
end
@@ -385,7 +385,7 @@ class PokemonPokedex_Scene
iconspecies = nil if !$Trainer.seen?(iconspecies)
# Write various bits of text
dexname = _INTL("Pokédex")
if $PokemonGlobal.pokedexUnlocked.length>1
if $Trainer.pokedex.dexes_count > 1
thisdex = Settings.pokedex_names[pbGetSavePositionIndex]
if thisdex!=nil
dexname = (thisdex.is_a?(Array)) ? thisdex[0] : thisdex
@@ -400,9 +400,9 @@ class PokemonPokedex_Scene
textpos.push([@dexlist.length.to_s,112,334,2,base,shadow])
else
textpos.push([_INTL("Seen:"),42,302,0,base,shadow])
textpos.push([$Trainer.seen_count(pbGetPokedexRegion).to_s,182,302,1,base,shadow])
textpos.push([$Trainer.pokedex.seen_count(pbGetPokedexRegion).to_s,182,302,1,base,shadow])
textpos.push([_INTL("Owned:"),42,334,0,base,shadow])
textpos.push([$Trainer.owned_count(pbGetPokedexRegion).to_s,182,334,1,base,shadow])
textpos.push([$Trainer.pokedex.owned_count(pbGetPokedexRegion).to_s,182,334,1,base,shadow])
end
# Draw all text
pbDrawTextPositions(overlay,textpos)
@@ -690,10 +690,7 @@ class PokemonPokedex_Scene
end
def setIconBitmap(species)
$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)
@sprites["icon"].setSpeciesBitmap(species, gender, form)
end

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)

View File

@@ -396,12 +396,12 @@ class PokemonSummary_Scene
# Write the Regional/National Dex number
dexnum = GameData::Species.get(@pokemon.species).id_number
dexnumshift = false
if $PokemonGlobal.pokedexUnlocked[$PokemonGlobal.pokedexUnlocked.length-1]
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
next if !$PokemonGlobal.pokedexUnlocked[i]
for i in 0...$Trainer.pokedex.dexes_count - 1
next if !$Trainer.pokedex.unlocked?(i)
num = pbGetRegionalNumber(i,@pokemon.species)
next if num<=0
dexnum = num
@@ -1180,7 +1180,7 @@ class PokemonSummary_Scene
if !@pokemon.egg?
commands[cmdGiveItem = commands.length] = _INTL("Give item")
commands[cmdTakeItem = commands.length] = _INTL("Take item") if @pokemon.hasItem?
commands[cmdPokedex = commands.length] = _INTL("View Pokédex") if $Trainer.pokedex
commands[cmdPokedex = commands.length] = _INTL("View Pokédex") if $Trainer.has_pokedex
end
commands[cmdMark = commands.length] = _INTL("Mark")
commands[commands.length] = _INTL("Cancel")
@@ -1198,7 +1198,7 @@ class PokemonSummary_Scene
elsif cmdTakeItem>=0 && command==cmdTakeItem
dorefresh = pbTakeItemFromPokemon(@pokemon,self)
elsif cmdPokedex>=0 && command==cmdPokedex
pbUpdateLastSeenForm(@pokemon)
$Trainer.pokedex.register_last_seen(@pokemon)
pbFadeOutIn {
scene = PokemonPokedexInfo_Scene.new
screen = PokemonPokedexInfoScreen.new(scene)

View File

@@ -56,7 +56,7 @@ class PokemonTrainerCard_Scene
[_INTL("Money"),34,106,0,baseColor,shadowColor],
[_INTL("${1}",$Trainer.money.to_s_formatted),302,106,1,baseColor,shadowColor],
[_INTL("Pokédex"),34,154,0,baseColor,shadowColor],
[sprintf("%d/%d",$Trainer.owned_count,$Trainer.seen_count),302,154,1,baseColor,shadowColor],
[sprintf("%d/%d",$Trainer.pokedex.owned_count,$Trainer.pokedex.seen_count),302,154,1,baseColor,shadowColor],
[_INTL("Time"),34,202,0,baseColor,shadowColor],
[time,302,202,1,baseColor,shadowColor],
[_INTL("Started"),34,250,0,baseColor,shadowColor],

View File

@@ -66,7 +66,7 @@ class PokemonLoadPanel < SpriteWrapper
textpos.push([_INTL("Badges:"),16*2,53*2,0,TEXTCOLOR,TEXTSHADOWCOLOR])
textpos.push([@trainer.badge_count.to_s,103*2,53*2,1,TEXTCOLOR,TEXTSHADOWCOLOR])
textpos.push([_INTL("Pokédex:"),16*2,69*2,0,TEXTCOLOR,TEXTSHADOWCOLOR])
textpos.push([@trainer.seen_count.to_s,103*2,69*2,1,TEXTCOLOR,TEXTSHADOWCOLOR])
textpos.push([@trainer.pokedex.seen_count.to_s,103*2,69*2,1,TEXTCOLOR,TEXTSHADOWCOLOR])
textpos.push([_INTL("Time:"),16*2,85*2,0,TEXTCOLOR,TEXTSHADOWCOLOR])
hour = @totalsec / 60 / 60
min = @totalsec / 60 % 60

View File

@@ -48,8 +48,8 @@ class PokemonSave_Scene
loctext+=_INTL("Time<r><c3={1}>{2}m</c3><br>",textColor,min)
end
loctext+=_INTL("Badges<r><c3={1}>{2}</c3><br>",textColor,$Trainer.badge_count)
if $Trainer.pokedex
loctext+=_INTL("Pokédex<r><c3={1}>{2}/{3}</c3>",textColor,$Trainer.owned_count,$Trainer.seen_count)
if $Trainer.has_pokedex
loctext+=_INTL("Pokédex<r><c3={1}>{2}/{3}</c3>",textColor,$Trainer.pokedex.owned_count,$Trainer.pokedex.seen_count)
end
@sprites["locwindow"]=Window_AdvancedTextPokemon.new(loctext)
@sprites["locwindow"].viewport=@viewport