mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2026-01-23 06:46:00 +00:00
Renamed class PlayerTrainer to class Player, implemented class Player#Pokedex
This commit is contained in:
@@ -73,7 +73,7 @@ def pbPlayTrainerIntroME(trainer_type)
|
||||
pbMEPlay(bgm)
|
||||
end
|
||||
|
||||
def pbGetTrainerBattleBGM(trainer) # can be a PlayerTrainer, NPCTrainer or an array of them
|
||||
def pbGetTrainerBattleBGM(trainer) # can be a Player, NPCTrainer or an array of them
|
||||
if $PokemonGlobal.nextBattleBGM
|
||||
return $PokemonGlobal.nextBattleBGM.clone
|
||||
end
|
||||
@@ -123,7 +123,7 @@ def pbGetTrainerBattleBGMFromType(trainertype)
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbGetTrainerVictoryME(trainer) # can be a PlayerTrainer, NPCTrainer or an array of them
|
||||
def pbGetTrainerVictoryME(trainer) # can be a Player, NPCTrainer or an array of them
|
||||
if $PokemonGlobal.nextBattleME
|
||||
return $PokemonGlobal.nextBattleME.clone
|
||||
end
|
||||
|
||||
@@ -53,8 +53,8 @@ def pbNicknameAndStore(pkmn)
|
||||
pbMessage(_INTL("The Pokémon Boxes are full and can't accept any more!"))
|
||||
return
|
||||
end
|
||||
$Trainer.set_seen(pkmn.species)
|
||||
$Trainer.set_owned(pkmn.species)
|
||||
$Trainer.pokedex.set_seen(pkmn.species)
|
||||
$Trainer.pokedex.set_owned(pkmn.species)
|
||||
pbNickname(pkmn)
|
||||
pbStorePokemon(pkmn)
|
||||
end
|
||||
@@ -73,16 +73,15 @@ def pbAddPokemon(pkmn, level = 1, see_form = true)
|
||||
species_name = pkmn.speciesName
|
||||
pbMessage(_INTL("{1} obtained {2}!\\me[Pkmn get]\\wtnp[80]\1", $Trainer.name, species_name))
|
||||
pbNicknameAndStore(pkmn)
|
||||
pbSeenForm(pkmn) if see_form
|
||||
$Trainer.pokedex.register(pkmn) if see_form
|
||||
return true
|
||||
end
|
||||
|
||||
def pbAddPokemonSilent(pkmn, level = 1, see_form = true)
|
||||
return false if !pkmn || pbBoxesFull?
|
||||
pkmn = Pokemon.new(pkmn, level) if !pkmn.is_a?(Pokemon)
|
||||
$Trainer.set_seen(pkmn.species)
|
||||
$Trainer.set_owned(pkmn.species)
|
||||
pbSeenForm(pkmn) if see_form
|
||||
$Trainer.pokedex.register(pkmn) if see_form
|
||||
$Trainer.pokedex.set_owned(pkmn.species)
|
||||
pkmn.record_first_moves
|
||||
if $Trainer.party_full?
|
||||
$PokemonStorage.pbStoreCaught(pkmn)
|
||||
@@ -101,16 +100,15 @@ def pbAddToParty(pkmn, level = 1, see_form = true)
|
||||
species_name = pkmn.speciesName
|
||||
pbMessage(_INTL("{1} obtained {2}!\\me[Pkmn get]\\wtnp[80]\1", $Trainer.name, species_name))
|
||||
pbNicknameAndStore(pkmn)
|
||||
pbSeenForm(pkmn) if see_form
|
||||
$Trainer.pokedex.register(pkmn) if see_form
|
||||
return true
|
||||
end
|
||||
|
||||
def pbAddToPartySilent(pkmn, level = nil, see_form = true)
|
||||
return false if !pkmn || $Trainer.party_full?
|
||||
pkmn = Pokemon.new(pkmn, level) if !pkmn.is_a?(Pokemon)
|
||||
$Trainer.set_seen(pkmn.species)
|
||||
$Trainer.set_owned(pkmn.species)
|
||||
pbSeenForm(pkmn) if see_form
|
||||
$Trainer.pokedex.register(pkmn) if see_form
|
||||
$Trainer.pokedex.set_owned(pkmn.species)
|
||||
pkmn.record_first_moves
|
||||
$Trainer.party[$Trainer.party.length] = pkmn
|
||||
return true
|
||||
@@ -131,9 +129,8 @@ def pbAddForeignPokemon(pkmn, level = 1, owner_name = nil, nickname = nil, owner
|
||||
pbMessage(_INTL("\\me[Pkmn get]{1} received a Pokémon.\1", $Trainer.name))
|
||||
end
|
||||
pbStorePokemon(pkmn)
|
||||
$Trainer.set_seen(pkmn.species)
|
||||
$Trainer.set_owned(pkmn.species)
|
||||
pbSeenForm(pkmn) if see_form
|
||||
$Trainer.pokedex.register(pkmn) if see_form
|
||||
$Trainer.pokedex.set_owned(pkmn.species)
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -152,41 +149,6 @@ end
|
||||
alias pbAddEgg pbGenerateEgg
|
||||
alias pbGenEgg pbGenerateEgg
|
||||
|
||||
#===============================================================================
|
||||
# Recording Pokémon forms as seen
|
||||
#===============================================================================
|
||||
def pbSeenForm(species, gender = 0, form = 0)
|
||||
$Trainer.seen_forms = {} if !$Trainer.seen_forms
|
||||
$Trainer.last_seen_forms = {} if !$Trainer.last_seen_forms
|
||||
if species.is_a?(Pokemon)
|
||||
species_data = species.species_data
|
||||
gender = species.gender
|
||||
else
|
||||
species_data = GameData::Species.get_species_form(species, form)
|
||||
end
|
||||
return if !species_data
|
||||
species = species_data.species
|
||||
gender = 0 if gender >= 2
|
||||
form = species_data.form
|
||||
if form != species_data.pokedex_form
|
||||
species_data = GameData::Species.get_species_form(species, species_data.pokedex_form)
|
||||
form = species_data.form
|
||||
end
|
||||
form = 0 if species_data.form_name.nil? || species_data.form_name.empty?
|
||||
$Trainer.seen_forms[species] = [[], []] if !$Trainer.seen_forms[species]
|
||||
$Trainer.seen_forms[species][gender][form] = true
|
||||
$Trainer.last_seen_forms[species] = [] if !$Trainer.last_seen_forms[species]
|
||||
$Trainer.last_seen_forms[species] = [gender, form] if $Trainer.last_seen_forms[species] == []
|
||||
end
|
||||
|
||||
def pbUpdateLastSeenForm(pkmn)
|
||||
$Trainer.last_seen_forms = {} if !$Trainer.last_seen_forms
|
||||
species_data = pkmn.species_data
|
||||
form = species_data.pokedex_form
|
||||
form = 0 if species_data.form_name.nil? || species_data.form_name.empty?
|
||||
$Trainer.last_seen_forms[pkmn.species] = [pkmn.gender, form]
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Analyse Pokémon in the party
|
||||
#===============================================================================
|
||||
|
||||
@@ -230,7 +230,7 @@ def pbTrainerName(name = nil, outfit = 0)
|
||||
pbChangePlayer(0) if $PokemonGlobal.playerID < 0
|
||||
player_metadata = GameData::Metadata.get_player($PokemonGlobal.playerID)
|
||||
trainer_type = (player_metadata) ? player_metadata[0] : nil
|
||||
$Trainer = PlayerTrainer.new(name, trainer_type)
|
||||
$Trainer = Player.new(name, trainer_type)
|
||||
$Trainer.outfit = outfit
|
||||
$Trainer.character_ID = $PokemonGlobal.playerID
|
||||
if name.nil?
|
||||
@@ -394,53 +394,6 @@ def pbGetRegionalDexLength(region_dex)
|
||||
return (dex_list) ? dex_list.length : 0
|
||||
end
|
||||
|
||||
# Decides which Dex lists are able to be viewed (i.e. they are unlocked and have
|
||||
# at least 1 seen species in them), and saves all viable dex region numbers
|
||||
# (National Dex comes after regional dexes).
|
||||
# If the Dex list shown depends on the player's location, this just decides if
|
||||
# a species in the current region has been seen - doesn't look at other regions.
|
||||
# Here, just used to decide whether to show the Pokédex in the Pause menu.
|
||||
def pbSetViableDexes
|
||||
$PokemonGlobal.pokedexViable = []
|
||||
if Settings::USE_CURRENT_REGION_DEX
|
||||
region = pbGetCurrentRegion
|
||||
region = -1 if region>=$PokemonGlobal.pokedexUnlocked.length-1
|
||||
$PokemonGlobal.pokedexViable[0] = region if $Trainer.seen_any?(region)
|
||||
else
|
||||
numDexes = $PokemonGlobal.pokedexUnlocked.length
|
||||
if numDexes==1 # National Dex only
|
||||
if $PokemonGlobal.pokedexUnlocked[0]
|
||||
$PokemonGlobal.pokedexViable.push(0) if $Trainer.seen_any?
|
||||
end
|
||||
else # Regional dexes + National Dex
|
||||
for i in 0...numDexes
|
||||
regionToCheck = (i==numDexes-1) ? -1 : i
|
||||
if $PokemonGlobal.pokedexUnlocked[i]
|
||||
$PokemonGlobal.pokedexViable.push(i) if $Trainer.seen_any?(regionToCheck)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Unlocks a Dex list. The National Dex is -1 here (or nil argument).
|
||||
def pbUnlockDex(dex=-1)
|
||||
index = dex
|
||||
if index<0 || index>$PokemonGlobal.pokedexUnlocked.length-1
|
||||
index = $PokemonGlobal.pokedexUnlocked.length-1
|
||||
end
|
||||
$PokemonGlobal.pokedexUnlocked[index] = true
|
||||
end
|
||||
|
||||
# Locks a Dex list. The National Dex is -1 here (or nil argument).
|
||||
def pbLockDex(dex=-1)
|
||||
index = dex
|
||||
if index<0 || index>$PokemonGlobal.pokedexUnlocked.length-1
|
||||
index = $PokemonGlobal.pokedexUnlocked.length-1
|
||||
end
|
||||
$PokemonGlobal.pokedexUnlocked[index] = false
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
|
||||
Reference in New Issue
Block a user