Rename PokeBattle_Pokemon to Pokemon

Deprecate PokeBattle_Pokemon and pbNewPkmn
This commit is contained in:
jonisavo
2020-09-20 20:55:51 +03:00
parent 4517a16537
commit c73906170a
25 changed files with 102 additions and 97 deletions

View File

@@ -2,7 +2,7 @@
# Instances of this class are individual Pokémon.
# The player's party Pokémon are stored in the array $Trainer.party.
#===============================================================================
class PokeBattle_Pokemon
class Pokemon
# @return [String] the nickname of this Pokémon
attr_accessor :name
# @return [Integer] this Pokémon's national Pokédex number
@@ -55,7 +55,7 @@ class PokeBattle_Pokemon
attr_reader :statusCount
# Another Pokémon which has been fused with this Pokémon (or nil if there is none).
# Currently only used by Kyurem, to record a fused Reshiram or Zekrom.
# @return [PokeBattle_Pokemon, nil] the Pokémon fused into this one (nil if there is none)
# @return [Pokemon, nil] the Pokémon fused into this one (nil if there is none)
attr_accessor :fused
# @return [Array<Integer>] an array of IV values for HP, Atk, Def, Speed, Sp. Atk and Sp. Def
attr_accessor :iv
@@ -780,7 +780,7 @@ class PokeBattle_Pokemon
#=============================================================================
# Sets this Pokémon's status. See {PBStatuses} for all possible status effects.
# @param new_status [Integer, Symbol, String] status to set (from PBStatuses)
# @param value [Integer, Symbol, String] status to set (from {PBStatuses})
def status=(value)
new_status = getID(PBStatuses, value)
if !new_status
@@ -1044,7 +1044,7 @@ class PokeBattle_Pokemon
#=============================================================================
# Creates a copy of this Pokémon and returns it.
# @return [PokeBattle_Pokemon] a copy of this Pokémon
# @return [Pokemon] a copy of this Pokémon
def clone
ret = super
ret.iv = @iv.clone
@@ -1059,9 +1059,9 @@ class PokeBattle_Pokemon
# Creates a new Pokémon object.
# @param species [Integer, Symbol, String] Pokémon species
# @param level [Integer] Pokémon level
# @param player [PokeBattle_Trainer] object for the original trainer
# @param owner [PokeBattle_Trainer] object for the original trainer
# @param withMoves [Boolean] whether the Pokémon should have moves
def initialize(species, level, player = nil, withMoves = true)
def initialize(species, level, owner = nil, withMoves = true)
ospecies = species.to_s
species = getID(PBSpecies, species)
cname = getConstantName(PBSpecies, species) rescue nil
@@ -1090,11 +1090,11 @@ class PokeBattle_Pokemon
@ribbons = []
@ballused = 0
@eggsteps = 0
if player
@trainerID = player.id
@ot = player.name
@otgender = player.gender
@language = player.language
if owner
@trainerID = owner.id
@ot = owner.name
@otgender = owner.gender
@language = owner.language
else
@trainerID = 0
@ot = ""
@@ -1122,16 +1122,21 @@ class PokeBattle_Pokemon
end
#===============================================================================
#
# Deprecated classes & methods
#===============================================================================
# Creates a new Pokémon object.
# @param species [Integer, Symbol, String] Pokémon species
# @param level [Integer] Pokémon level
# @param owner [PokeBattle_Trainer] object for the original trainer
# @param withMoves [Boolean] whether the Pokémon should have moves
# @deprecated Use {Pokemon} instead. PokeBattle_Pokemon has been turned into an alias
# and is slated to be removed in vXX.
class PokeBattle_Pokemon; end
PokeBattle_Pokemon = Pokemon
# (see Pokemon#initialize)
# @deprecated Use +Pokemon.new+ instead. This method and its aliases are
# slated to be removed in vXX.
def pbNewPkmn(species, level, owner = $Trainer, withMoves = true)
return PokeBattle_Pokemon.new(species, level, owner, withMoves)
Kernel.echoln("WARN: pbNewPkmn and its aliases are deprecated and slated to be removed in Essentials vXX")
return Pokemon.new(species, level, owner, withMoves)
end
alias pbGenPkmn pbNewPkmn
alias pbGenPoke pbNewPkmn

View File

@@ -1,4 +1,4 @@
class PokeBattle_Pokemon
class Pokemon
attr_accessor :formTime # Time when Furfrou's/Hoopa's form was set
attr_accessor :forcedForm

View File

@@ -2,7 +2,7 @@
# Mega Evolution
# NOTE: These are treated as form changes in Essentials.
#===============================================================================
class PokeBattle_Pokemon
class Pokemon
def getMegaForm(checkItemOnly=false)
formData = pbLoadFormToSpecies
return 0 if !formData[@species] || formData[@species].length==0
@@ -68,7 +68,7 @@ end
# Primal Reversion
# NOTE: These are treated as form changes in Essentials.
#===============================================================================
class PokeBattle_Pokemon
class Pokemon
def hasPrimalForm?
v = MultipleForms.call("getPrimalForm",self)
return v!=nil

View File

@@ -54,7 +54,7 @@ def pbPurify(pokemon,scene)
speciesname = PBSpecies.getName(pokemon.species)
if scene.pbConfirm(_INTL("Would you like to give a nickname to {1}?",speciesname))
newname = pbEnterPokemonName(_INTL("{1}'s nickname?",speciesname),
0,PokeBattle_Pokemon::MAX_POKEMON_NAME_SIZE,"",pokemon)
0, Pokemon::MAX_POKEMON_NAME_SIZE, "", pokemon)
pokemon.name = newname if newname!=""
end
end
@@ -64,11 +64,11 @@ def pbApplyEVGain(pokemon,ev,evgain)
for i in 0...6
totalev += pokemon.ev[i]
end
if totalev+evgain>PokeBattle_Pokemon::EV_LIMIT # Can't exceed overall limit
evgain -= totalev+evgain-PokeBattle_Pokemon::EV_LIMIT
if totalev+evgain>Pokemon::EV_LIMIT # Can't exceed overall limit
evgain -= totalev+evgain-Pokemon::EV_LIMIT
end
if pokemon.ev[ev]+evgain>PokeBattle_Pokemon::EV_STAT_LIMIT
evgain -= totalev+evgain-PokeBattle_Pokemon::EV_STAT_LIMIT
if pokemon.ev[ev]+evgain>Pokemon::EV_STAT_LIMIT
evgain -= totalev+evgain-Pokemon::EV_STAT_LIMIT
end
if evgain>0
pokemon.ev[ev] += evgain
@@ -231,7 +231,7 @@ end
#===============================================================================
# Pokémon class.
#===============================================================================
class PokeBattle_Pokemon
class Pokemon
attr_writer :heartgauge
attr_accessor :shadow
attr_writer :hypermode
@@ -398,7 +398,7 @@ class PokeBattle_Battler
def pbHyperMode
return if fainted? || !shadowPokemon? || inHyperMode?
p = self.pokemon
if @battle.pbRandom(p.heartgauge)<=PokeBattle_Pokemon::HEARTGAUGESIZE/4
if @battle.pbRandom(p.heartgauge)<=Pokemon::HEARTGAUGESIZE/4
p.hypermode = true
@battle.pbDisplay(_INTL("{1}'s emotions rose to a fever pitch!\nIt entered Hyper Mode!",self.pbThis))
end

View File

@@ -1,4 +1,4 @@
class PokeBattle_Pokemon
class Pokemon
attr_accessor :chatter
end

View File

@@ -148,7 +148,7 @@ class PokemonStorage
return (x==-1) ? self.party : @boxes[x]
else
for i in @boxes
raise "Box is a Pokémon, not a box" if i.is_a?(PokeBattle_Pokemon)
raise "Box is a Pokémon, not a box" if i.is_a?(Pokemon)
end
return (x==-1) ? self.party[y] : @boxes[x][y]
end