mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-08 05:34:58 +00:00
Make Pokemon.new accept Owner objects
Also, default the owner argument to $Trainer
This commit is contained in:
@@ -1113,9 +1113,9 @@ class Pokemon
|
|||||||
# Creates a new Pokémon object.
|
# Creates a new Pokémon object.
|
||||||
# @param species [Integer, Symbol, String] Pokémon species
|
# @param species [Integer, Symbol, String] Pokémon species
|
||||||
# @param level [Integer] Pokémon level
|
# @param level [Integer] Pokémon level
|
||||||
# @param owner [PokeBattle_Trainer] object for the original trainer
|
# @param owner [Owner, PokeBattle_Trainer] Pokémon owner (the player by default)
|
||||||
# @param withMoves [Boolean] whether the Pokémon should have moves
|
# @param withMoves [Boolean] whether the Pokémon should have moves
|
||||||
def initialize(species, level, owner = nil, withMoves = true)
|
def initialize(species, level, owner = $Trainer, withMoves = true)
|
||||||
ospecies = species.to_s
|
ospecies = species.to_s
|
||||||
species = getID(PBSpecies, species)
|
species = getID(PBSpecies, species)
|
||||||
cname = getConstantName(PBSpecies, species) rescue nil
|
cname = getConstantName(PBSpecies, species) rescue nil
|
||||||
@@ -1144,7 +1144,9 @@ class Pokemon
|
|||||||
@ribbons = []
|
@ribbons = []
|
||||||
@ballused = 0
|
@ballused = 0
|
||||||
@eggsteps = 0
|
@eggsteps = 0
|
||||||
if owner.is_a?(PokeBattle_Trainer)
|
if owner.is_a?(Owner)
|
||||||
|
@owner = owner
|
||||||
|
elsif owner.is_a?(PokeBattle_Trainer)
|
||||||
@owner = Owner.new_from_trainer(owner)
|
@owner = Owner.new_from_trainer(owner)
|
||||||
else
|
else
|
||||||
@owner = Owner.new(0, '', 2, 2)
|
@owner = Owner.new(0, '', 2, 2)
|
||||||
|
|||||||
Reference in New Issue
Block a user