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

@@ -547,9 +547,8 @@ DebugMenuCommands.register("demoparty", {
party.each do |species|
pkmn = Pokemon.new(species, 20)
$Trainer.party.push(pkmn)
$Trainer.set_seen(species)
$Trainer.set_owned(species)
pbSeenForm(pkmn)
$Trainer.pokedex.register(pkmn)
$Trainer.pokedex.set_owned(species)
case species
when :PIDGEOTTO
pkmn.learn_move(:FLY)
@@ -601,8 +600,6 @@ DebugMenuCommands.register("fillboxes", {
"name" => _INTL("Fill Storage Boxes"),
"description" => _INTL("Add one Pokémon of each species (at Level 50) to storage."),
"effect" => proc {
$Trainer.seen_forms = {} if !$Trainer.seen_forms
$Trainer.last_seen_forms = {} if !$Trainer.last_seen_forms
added = 0
box_qty = $PokemonStorage.maxPokemon(0)
completed = true
@@ -610,22 +607,18 @@ DebugMenuCommands.register("fillboxes", {
sp = species_data.species
f = species_data.form
# Record each form of each species as seen and owned
$Trainer.seen_forms[sp] = [[], []] if !$Trainer.seen_forms[sp]
if f == 0
$Trainer.set_seen(sp)
$Trainer.set_owned(sp)
if [:AlwaysMale, :AlwaysFemale, :Genderless].include?(species_data.gender_ratio)
g = (species_data.gender_ratio == :AlwaysFemale) ? 1 : 0
$Trainer.seen_forms[sp][g][f] = true
$Trainer.last_seen_forms[sp] = [g, f] if f == 0
$Trainer.pokedex.register(sp, g, f)
else # Both male and female
$Trainer.seen_forms[sp][0][f] = true
$Trainer.seen_forms[sp][1][f] = true
$Trainer.last_seen_forms[sp] = [0, f] if f == 0
$Trainer.pokedex.register(sp, 0, f)
$Trainer.pokedex.register(sp, 1, f)
end
$Trainer.pokedex.set_owned(sp)
elsif species_data.real_form_name && !species_data.real_form_name.empty?
g = (species_data.gender_ratio == :AlwaysFemale) ? 1 : 0
$Trainer.seen_forms[sp][g][f] = true
$Trainer.pokedex.register(sp, g, f)
end
# Add Pokémon (if form 0)
next if f != 0
@@ -762,25 +755,23 @@ DebugMenuCommands.register("dexlists", {
dexescmd = 0
loop do
dexescmds = []
dexescmds.push(_INTL("Have Pokédex: {1}", $Trainer.pokedex ? "[YES]" : "[NO]"))
d = Settings.pokedex_names
for i in 0...d.length
name = d[i]
name = name[0] if name.is_a?(Array)
dexindex = i
unlocked = $PokemonGlobal.pokedexUnlocked[dexindex]
dexescmds.push(_INTL("Have Pokédex: {1}", $Trainer.has_pokedex ? "[YES]" : "[NO]"))
dex_names = Settings.pokedex_names
for i in 0...dex_names.length
name = (dex_names[i].is_a?(Array)) ? dex_names[i][0] : dex_names[i]
unlocked = $Trainer.pokedex.unlocked?(i)
dexescmds.push(_INTL("{1} {2}", unlocked ? "[Y]" : "[ ]", name))
end
dexescmd = pbShowCommands(nil, dexescmds, -1, dexescmd)
break if dexescmd < 0
dexindex = dexescmd - 1
if dexindex < 0 # Toggle Pokédex ownership
$Trainer.pokedex = !$Trainer.pokedex
$Trainer.has_pokedex = !$Trainer.has_pokedex
else # Toggle Regional Dex accessibility
if $PokemonGlobal.pokedexUnlocked[dexindex]
pbLockDex(dexindex)
if $Trainer.pokedex.unlocked?(dexindex)
$Trainer.pokedex.lock(dexindex)
else
pbUnlockDex(dexindex)
$Trainer.pokedex.unlock(dexindex)
end
end
end