Split PokeBattle_Trainer into PlayerTrainer and NPCTrainer

This commit is contained in:
Maruno17
2021-01-24 17:55:39 +00:00
parent 7de034957b
commit 4098b1cd11
60 changed files with 748 additions and 648 deletions

View File

@@ -395,7 +395,7 @@ MultipleForms.register(:GRENINJA,{
MultipleForms.register(:SCATTERBUG,{
"getFormOnCreation" => proc { |pkmn|
next $Trainer.secretID%18
next $Trainer.secret_ID % 18
}
})

View File

@@ -501,7 +501,7 @@ Events.onEndBattle += proc { |_sender,_e|
}
Events.onStepTaken += proc {
for pkmn in $Trainer.ablePokemonParty
for pkmn in $Trainer.able_party
next if pkmn.heart_gauge == 0
stage = pkmn.heartStage
pkmn.adjustHeart(-1)

View File

@@ -408,9 +408,7 @@ PBEvolution.register(:LevelDarkness, {
PBEvolution.register(:LevelDarkInParty, {
"levelUpCheck" => proc { |pkmn, parameter|
if pkmn.level >= parameter
next $Trainer.pokemonParty.any? { |p| p && p.hasType(:DARK) }
end
next $Trainer.has_pokemon_of_type?(:DARK) if pkmn.level >= parameter
}
})
@@ -647,7 +645,7 @@ PBEvolution.register(:HasInParty, {
"minimumLevel" => 1, # Needs any level up
"parameterType" => :Species,
"levelUpCheck" => proc { |pkmn, parameter|
next pbHasSpecies?(parameter)
next $Trainer.has_species?(parameter)
}
})

View File

@@ -752,7 +752,7 @@ class Pokemon
@owner = new_owner
end
# @param trainer [PokeBattle_Trainer] the trainer to compare to the original trainer
# @param trainer [PlayerTrainer, NPCTrainer] the trainer to compare to the original trainer
# @return [Boolean] whether the given trainer is not this Pokémon's original trainer
def foreign?(trainer)
return @owner.id != trainer.id || @owner.name != trainer.name
@@ -787,7 +787,7 @@ class Pokemon
# @return [String] the name of this Pokémon
def name
return (nicknamed?) ? @name || speciesName
return (nicknamed?) ? @name : speciesName
end
# @param value [String] the nickname of this Pokémon
@@ -942,7 +942,7 @@ class Pokemon
# Creates a new Pokémon object.
# @param species [Symbol, String, Integer] Pokémon species
# @param level [Integer] Pokémon level
# @param owner [Owner, PokeBattle_Trainer] Pokémon owner (the player by default)
# @param owner [Owner, PlayerTrainer, NPCTrainer] Pokémon owner (the player by default)
# @param withMoves [Boolean] whether the Pokémon should have moves
def initialize(species, level, owner = $Trainer, withMoves = true)
species_data = GameData::Species.get(species)
@@ -985,7 +985,7 @@ class Pokemon
end
if owner.is_a?(Owner)
@owner = owner
elsif owner.is_a?(PokeBattle_Trainer)
elsif owner.is_a?(PlayerTrainer) || owner.is_a?(NPCTrainer)
@owner = Owner.new_from_trainer(owner)
else
@owner = Owner.new(0, '', 2, 2)

View File

@@ -25,10 +25,10 @@ class Pokemon
end
# Returns a new Owner object populated with values taken from +trainer+.
# @param trainer [PokeBattle_Trainer] trainer object to read data from
# @param trainer [PlayerTrainer, NPCTrainer] trainer object to read data from
# @return [Owner] new Owner object
def self.new_from_trainer(trainer)
validate trainer => PokeBattle_Trainer
validate trainer => [PlayerTrainer, NPCTrainer]
return new(trainer.id, trainer.name, trainer.gender, trainer.language)
end
@@ -38,7 +38,7 @@ class Pokemon
# @param language [Integer] owner language
# @return [Owner] foreign Owner object
def self.new_foreign(name = '', gender = 2, language = 2)
return new($Trainer.getForeignID, name, gender, language)
return new($Trainer.make_foreign_ID, name, gender, language)
end
# @param new_id [Integer] new owner ID