From c73906170a7de751d5fdd64992cc3f629a972de3 Mon Sep 17 00:00:00 2001 From: jonisavo Date: Sun, 20 Sep 2020 20:55:51 +0300 Subject: [PATCH] Rename PokeBattle_Pokemon to Pokemon Deprecate PokeBattle_Pokemon and pbNewPkmn --- Data/Scripts/011_Data/003_PBMove.rb | 2 +- .../004_Battle_ExpAndMoveLearning.rb | 8 ++-- .../005_Battle scene/008_Scene_Commands.rb | 2 +- .../013_Overworld/006_PField_Battles.rb | 2 +- .../009_PField_RoamingPokemon.rb | 2 +- .../014_Trainers/002_PTrainer_NPCTrainers.rb | 4 +- Data/Scripts/015_Items/001_PItem_Items.rb | 16 ++++---- ...1_PokeBattle_Pokemon.rb => 001_Pokemon.rb} | 41 +++++++++++-------- Data/Scripts/016_Pokemon/002_Pokemon_Forms.rb | 2 +- .../016_Pokemon/003_Pokemon_MegaEvolution.rb | 4 +- .../016_Pokemon/004_Pokemon_ShadowPokemon.rb | 14 +++---- .../016_Pokemon/006_Pokemon_Chatter.rb | 2 +- .../016_Pokemon/008_Pokemon_Storage.rb | 2 +- Data/Scripts/017_UI/006_PScreen_Summary.rb | 2 +- .../Scripts/017_UI/020_PScreen_EggHatching.rb | 4 +- Data/Scripts/017_UI/022_PScreen_Trading.rb | 2 +- .../017_UI/024_PScreen_PurifyChamber.rb | 12 +++--- .../003_PBattle_OrgBattle.rb | 2 +- .../004_PBattle_OrgBattleRules.rb | 8 ++-- .../003_PSystem_FileUtilities.rb | 2 +- .../004_PSystem_PokemonUtilities.rb | 6 +-- Data/Scripts/021_Debug/003_Debug_Pokemon.rb | 26 ++++++------ Data/Scripts/021_Debug/004_Editor_Screens.rb | 6 +-- .../Scripts/021_Debug/006_Editor_DataTypes.rb | 4 +- Data/Scripts/022_Compiler/002_Compiler_PBS.rb | 24 +++++------ 25 files changed, 102 insertions(+), 97 deletions(-) rename Data/Scripts/016_Pokemon/{001_PokeBattle_Pokemon.rb => 001_Pokemon.rb} (97%) diff --git a/Data/Scripts/011_Data/003_PBMove.rb b/Data/Scripts/011_Data/003_PBMove.rb index 7e0b3f3fd..ba026c502 100644 --- a/Data/Scripts/011_Data/003_PBMove.rb +++ b/Data/Scripts/011_Data/003_PBMove.rb @@ -45,7 +45,7 @@ def pbClearData end #=============================================================================== -# Move objects known by PokeBattle_Pokemon. +# Move objects known by Pokémon. #=============================================================================== class PBMove attr_reader(:id) # This move's ID diff --git a/Data/Scripts/012_Battle/003_Battle/004_Battle_ExpAndMoveLearning.rb b/Data/Scripts/012_Battle/003_Battle/004_Battle_ExpAndMoveLearning.rb index b7e6511cc..7dc1b83d4 100644 --- a/Data/Scripts/012_Battle/003_Battle/004_Battle_ExpAndMoveLearning.rb +++ b/Data/Scripts/012_Battle/003_Battle/004_Battle_ExpAndMoveLearning.rb @@ -75,12 +75,12 @@ class PokeBattle_Battle PBStats.eachStat do |s| evGain = evYield[s] # Can't exceed overall limit - if evTotal+evGain>PokeBattle_Pokemon::EV_LIMIT - evGain = PokeBattle_Pokemon::EV_LIMIT-evTotal + if evTotal+evGain>Pokemon::EV_LIMIT + evGain = Pokemon::EV_LIMIT-evTotal end # Can't exceed individual stat limit - if pkmn.ev[s]+evGain>PokeBattle_Pokemon::EV_STAT_LIMIT - evGain = PokeBattle_Pokemon::EV_STAT_LIMIT-pkmn.ev[s] + if pkmn.ev[s]+evGain>Pokemon::EV_STAT_LIMIT + evGain = Pokemon::EV_STAT_LIMIT-pkmn.ev[s] end # Add EV gain pkmn.ev[s] += evGain diff --git a/Data/Scripts/012_Battle/005_Battle scene/008_Scene_Commands.rb b/Data/Scripts/012_Battle/005_Battle scene/008_Scene_Commands.rb index e438dac1c..14ec36425 100644 --- a/Data/Scripts/012_Battle/005_Battle scene/008_Scene_Commands.rb +++ b/Data/Scripts/012_Battle/005_Battle scene/008_Scene_Commands.rb @@ -450,7 +450,7 @@ class PokeBattle_Scene # Opens the nicknaming screen for a newly caught Pokémon #============================================================================= def pbNameEntry(helpText,pkmn) - return pbEnterPokemonName(helpText,0,PokeBattle_Pokemon::MAX_POKEMON_NAME_SIZE,"",pkmn) + return pbEnterPokemonName(helpText, 0, Pokemon::MAX_POKEMON_NAME_SIZE, "", pkmn) end #============================================================================= diff --git a/Data/Scripts/013_Overworld/006_PField_Battles.rb b/Data/Scripts/013_Overworld/006_PField_Battles.rb index 87b40282c..959cfe28f 100644 --- a/Data/Scripts/013_Overworld/006_PField_Battles.rb +++ b/Data/Scripts/013_Overworld/006_PField_Battles.rb @@ -231,7 +231,7 @@ def pbWildBattleCore(*args) foeParty = [] sp = nil for arg in args - if arg.is_a?(PokeBattle_Pokemon) + if arg.is_a?(Pokemon) foeParty.push(arg) elsif arg.is_a?(Array) species = getID(PBSpecies,arg[0]) diff --git a/Data/Scripts/013_Overworld/009_PField_RoamingPokemon.rb b/Data/Scripts/013_Overworld/009_PField_RoamingPokemon.rb index 8750f930d..c869d3064 100644 --- a/Data/Scripts/013_Overworld/009_PField_RoamingPokemon.rb +++ b/Data/Scripts/013_Overworld/009_PField_RoamingPokemon.rb @@ -220,7 +220,7 @@ def pbRoamingPokemonBattle(species, level) # level if it doesn't already exist idxRoamer = $PokemonTemp.roamerIndex if !$PokemonGlobal.roamPokemon[idxRoamer] || - !$PokemonGlobal.roamPokemon[idxRoamer].is_a?(PokeBattle_Pokemon) + !$PokemonGlobal.roamPokemon[idxRoamer].is_a?(Pokemon) $PokemonGlobal.roamPokemon[idxRoamer] = pbGenerateWildPokemon(species,level,true) end # Set some battle rules diff --git a/Data/Scripts/014_Trainers/002_PTrainer_NPCTrainers.rb b/Data/Scripts/014_Trainers/002_PTrainer_NPCTrainers.rb index 3aff3bfc7..93a7a4196 100644 --- a/Data/Scripts/014_Trainers/002_PTrainer_NPCTrainers.rb +++ b/Data/Scripts/014_Trainers/002_PTrainer_NPCTrainers.rb @@ -99,12 +99,12 @@ def pbLoadTrainer(trainerid,trainername,partyid=0) if poke[TPIV] && poke[TPIV].length>0 pokemon.iv[i] = (i0 pokemon.ev[i] = (iPokeBattle_Pokemon::EV_LIMIT - evgain = PokeBattle_Pokemon::EV_LIMIT-totalev + if totalev+evgain>Pokemon::EV_LIMIT + evgain = Pokemon::EV_LIMIT-totalev end - if pkmn.ev[ev]+evgain>PokeBattle_Pokemon::EV_STAT_LIMIT - evgain = PokeBattle_Pokemon::EV_STAT_LIMIT-pkmn.ev[ev] + if pkmn.ev[ev]+evgain>Pokemon::EV_STAT_LIMIT + evgain = Pokemon::EV_STAT_LIMIT-pkmn.ev[ev] end if evgain>0 pkmn.ev[ev] += evgain @@ -503,11 +503,11 @@ def pbRaiseEffortValues(pkmn,ev,evgain=10,evlimit=true) for i in 0...6 totalev += pkmn.ev[i] end - if totalev+evgain>PokeBattle_Pokemon::EV_LIMIT - evgain = PokeBattle_Pokemon::EV_LIMIT-totalev + if totalev+evgain>Pokemon::EV_LIMIT + evgain = Pokemon::EV_LIMIT-totalev end - if pkmn.ev[ev]+evgain>PokeBattle_Pokemon::EV_STAT_LIMIT - evgain = PokeBattle_Pokemon::EV_STAT_LIMIT-pkmn.ev[ev] + if pkmn.ev[ev]+evgain>Pokemon::EV_STAT_LIMIT + evgain = Pokemon::EV_STAT_LIMIT-pkmn.ev[ev] end if evlimit && pkmn.ev[ev]+evgain>100 evgain = 100-pkmn.ev[ev] diff --git a/Data/Scripts/016_Pokemon/001_PokeBattle_Pokemon.rb b/Data/Scripts/016_Pokemon/001_Pokemon.rb similarity index 97% rename from Data/Scripts/016_Pokemon/001_PokeBattle_Pokemon.rb rename to Data/Scripts/016_Pokemon/001_Pokemon.rb index 283cebbbd..88c76a4c0 100644 --- a/Data/Scripts/016_Pokemon/001_PokeBattle_Pokemon.rb +++ b/Data/Scripts/016_Pokemon/001_Pokemon.rb @@ -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] 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 diff --git a/Data/Scripts/016_Pokemon/002_Pokemon_Forms.rb b/Data/Scripts/016_Pokemon/002_Pokemon_Forms.rb index ecada1c63..c70952686 100644 --- a/Data/Scripts/016_Pokemon/002_Pokemon_Forms.rb +++ b/Data/Scripts/016_Pokemon/002_Pokemon_Forms.rb @@ -1,4 +1,4 @@ -class PokeBattle_Pokemon +class Pokemon attr_accessor :formTime # Time when Furfrou's/Hoopa's form was set attr_accessor :forcedForm diff --git a/Data/Scripts/016_Pokemon/003_Pokemon_MegaEvolution.rb b/Data/Scripts/016_Pokemon/003_Pokemon_MegaEvolution.rb index 2fd26d52f..32d1f744f 100644 --- a/Data/Scripts/016_Pokemon/003_Pokemon_MegaEvolution.rb +++ b/Data/Scripts/016_Pokemon/003_Pokemon_MegaEvolution.rb @@ -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 diff --git a/Data/Scripts/016_Pokemon/004_Pokemon_ShadowPokemon.rb b/Data/Scripts/016_Pokemon/004_Pokemon_ShadowPokemon.rb index a41b3f8cf..13bd3433d 100644 --- a/Data/Scripts/016_Pokemon/004_Pokemon_ShadowPokemon.rb +++ b/Data/Scripts/016_Pokemon/004_Pokemon_ShadowPokemon.rb @@ -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 diff --git a/Data/Scripts/016_Pokemon/006_Pokemon_Chatter.rb b/Data/Scripts/016_Pokemon/006_Pokemon_Chatter.rb index d50e8671f..779b79045 100644 --- a/Data/Scripts/016_Pokemon/006_Pokemon_Chatter.rb +++ b/Data/Scripts/016_Pokemon/006_Pokemon_Chatter.rb @@ -1,4 +1,4 @@ -class PokeBattle_Pokemon +class Pokemon attr_accessor :chatter end diff --git a/Data/Scripts/016_Pokemon/008_Pokemon_Storage.rb b/Data/Scripts/016_Pokemon/008_Pokemon_Storage.rb index 04e40fc4c..0b2c49786 100644 --- a/Data/Scripts/016_Pokemon/008_Pokemon_Storage.rb +++ b/Data/Scripts/016_Pokemon/008_Pokemon_Storage.rb @@ -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 diff --git a/Data/Scripts/017_UI/006_PScreen_Summary.rb b/Data/Scripts/017_UI/006_PScreen_Summary.rb index fa9e861c5..463e1f085 100644 --- a/Data/Scripts/017_UI/006_PScreen_Summary.rb +++ b/Data/Scripts/017_UI/006_PScreen_Summary.rb @@ -362,7 +362,7 @@ class PokemonSummary_Scene dexNumShadow = (@pokemon.shiny?) ? Color.new(224,152,144) : Color.new(176,176,176) # If a Shadow Pokémon, draw the heart gauge area and bar if @pokemon.shadowPokemon? - shadowfract = @pokemon.heartgauge*1.0/PokeBattle_Pokemon::HEARTGAUGESIZE + shadowfract = @pokemon.heartgauge*1.0/Pokemon::HEARTGAUGESIZE imagepos = [ ["Graphics/Pictures/Summary/overlay_shadow",224,240], ["Graphics/Pictures/Summary/overlay_shadowbar",242,280,0,0,(shadowfract*248).floor,-1] diff --git a/Data/Scripts/017_UI/020_PScreen_EggHatching.rb b/Data/Scripts/017_UI/020_PScreen_EggHatching.rb index b3714b32c..ebfea00d9 100644 --- a/Data/Scripts/017_UI/020_PScreen_EggHatching.rb +++ b/Data/Scripts/017_UI/020_PScreen_EggHatching.rb @@ -109,7 +109,7 @@ class PokemonEggHatch_Scene if pbConfirmMessage( _INTL("Would you like to nickname the newly hatched {1}?",@pokemon.name)) { update } nickname=pbEnterPokemonName(_INTL("{1}'s nickname?",@pokemon.name), - 0,PokeBattle_Pokemon::MAX_POKEMON_NAME_SIZE,"",@pokemon,true) + 0, Pokemon::MAX_POKEMON_NAME_SIZE, "", @pokemon, true) @pokemon.name=nickname if nickname!="" @nicknamed=true end @@ -209,7 +209,7 @@ def pbHatch(pokemon) pbMessage(_INTL("{1} hatched from the Egg!",speciesname)) if pbConfirmMessage(_INTL("Would you like to nickname the newly hatched {1}?",speciesname)) nickname = pbEnterPokemonName(_INTL("{1}'s nickname?",speciesname), - 0,PokeBattle_Pokemon::MAX_POKEMON_NAME_SIZE,"",pokemon) + 0, Pokemon::MAX_POKEMON_NAME_SIZE, "", pokemon) pokemon.name = nickname if nickname!="" end end diff --git a/Data/Scripts/017_UI/022_PScreen_Trading.rb b/Data/Scripts/017_UI/022_PScreen_Trading.rb index 55ae16dea..059d269ea 100644 --- a/Data/Scripts/017_UI/022_PScreen_Trading.rb +++ b/Data/Scripts/017_UI/022_PScreen_Trading.rb @@ -194,7 +194,7 @@ def pbStartTrade(pokemonIndex,newpoke,nickname,trainerName,trainerGender=0) opponent = PokeBattle_Trainer.new(trainerName,trainerGender) opponent.setForeignID($Trainer) yourPokemon = nil; resetmoves = true - if newpoke.is_a?(PokeBattle_Pokemon) + if newpoke.is_a?(Pokemon) newpoke.trainerID = opponent.id newpoke.ot = opponent.name newpoke.otgender = opponent.gender diff --git a/Data/Scripts/017_UI/024_PScreen_PurifyChamber.rb b/Data/Scripts/017_UI/024_PScreen_PurifyChamber.rb index 941819788..a06830d2f 100644 --- a/Data/Scripts/017_UI/024_PScreen_PurifyChamber.rb +++ b/Data/Scripts/017_UI/024_PScreen_PurifyChamber.rb @@ -676,9 +676,9 @@ class Window_PurifyChamberSets < Window_DrawableCommand Color.new(0,0,256),@chamber[index].tempo,PurifyChamber.maximumTempo()) end if @chamber.getShadow(index) - pbDrawGauge(self.contents,Rect.new(rect.x+16,rect.y+18,48,8), - Color.new(192,0,256),@chamber.getShadow(index).heartgauge, - PokeBattle_Pokemon::HEARTGAUGESIZE) + pbDrawGauge(self.contents, Rect.new(rect.x+16,rect.y+18,48,8), + Color.new(192,0,256), @chamber.getShadow(index).heartgauge, + Pokemon::HEARTGAUGESIZE) end pbDrawTextPositions(self.contents,textpos) end @@ -964,9 +964,9 @@ class PurifyChamberSetView < SpriteWrapper textpos.push([_INTL("FLOW"),2+@info.bitmap.width/2,24,0, Color.new(248,248,248),Color.new(128,128,128)]) # draw heart gauge - pbDrawGauge(@info.bitmap,Rect.new(@info.bitmap.width*3/4,8,@info.bitmap.width*1/4,8), - Color.new(192,0,256),pkmn.heartgauge, - PokeBattle_Pokemon::HEARTGAUGESIZE) + pbDrawGauge(@info.bitmap, Rect.new(@info.bitmap.width*3/4,8,@info.bitmap.width*1/4,8), + Color.new(192,0,256), pkmn.heartgauge, + Pokemon::HEARTGAUGESIZE) # draw flow gauge pbDrawGauge(@info.bitmap,Rect.new(@info.bitmap.width*3/4,24+8,@info.bitmap.width*1/4,8), Color.new(0,0,248),@chamber.chamberFlow(@set),6) diff --git a/Data/Scripts/019_Other battles/003_PBattle_OrgBattle.rb b/Data/Scripts/019_Other battles/003_PBattle_OrgBattle.rb index cc846814b..e767e51e5 100644 --- a/Data/Scripts/019_Other battles/003_PBattle_OrgBattle.rb +++ b/Data/Scripts/019_Other battles/003_PBattle_OrgBattle.rb @@ -175,7 +175,7 @@ class PBPokemon for i in 0...6 evcount+=1 if ((@ev&(1<(maxHeightInMeters*10).round end def pbTooHeavy?(pkmn,maxWeightInKg) - species = (pkmn.is_a?(PokeBattle_Pokemon)) ? pkmn.species : pkmn - form = (pkmn.is_a?(PokeBattle_Pokemon)) ? pkmn.form : 0 + species = (pkmn.is_a?(Pokemon)) ? pkmn.species : pkmn + form = (pkmn.is_a?(Pokemon)) ? pkmn.form : 0 weight = pbGetSpeciesData(species,form,SpeciesWeight) return weight>(maxWeightInKg*10).round end diff --git a/Data/Scripts/020_System and utilities/003_PSystem_FileUtilities.rb b/Data/Scripts/020_System and utilities/003_PSystem_FileUtilities.rb index 95f8f968c..7f45d85a6 100644 --- a/Data/Scripts/020_System and utilities/003_PSystem_FileUtilities.rb +++ b/Data/Scripts/020_System and utilities/003_PSystem_FileUtilities.rb @@ -459,7 +459,7 @@ def pbPlayCry(pokemon,volume=90,pitch=nil) return if !pokemon if pokemon.is_a?(Numeric) || pokemon.is_a?(String) || pokemon.is_a?(Symbol) pbPlayCrySpecies(pokemon,0,volume,pitch) - elsif pokemon.is_a?(PokeBattle_Pokemon) + elsif pokemon.is_a?(Pokemon) pbPlayCryPokemon(pokemon,volume,pitch) end end diff --git a/Data/Scripts/020_System and utilities/004_PSystem_PokemonUtilities.rb b/Data/Scripts/020_System and utilities/004_PSystem_PokemonUtilities.rb index 725f808e0..377bcb1ab 100644 --- a/Data/Scripts/020_System and utilities/004_PSystem_PokemonUtilities.rb +++ b/Data/Scripts/020_System and utilities/004_PSystem_PokemonUtilities.rb @@ -9,7 +9,7 @@ def pbNickname(pokemon) speciesname = PBSpecies.getName(pokemon.species) if pbConfirmMessage(_INTL("Would you like to give a nickname to {1}?",speciesname)) helptext = _INTL("{1}'s nickname?",speciesname) - newname = pbEnterPokemonName(helptext,0,PokeBattle_Pokemon::MAX_POKEMON_NAME_SIZE,"",pokemon) + newname = pbEnterPokemonName(helptext, 0, Pokemon::MAX_POKEMON_NAME_SIZE, "", pokemon) pokemon.name = newname if newname!="" end end @@ -146,7 +146,7 @@ def pbAddForeignPokemon(pokemon,level=nil,ownerName=nil,nickname=nil,ownerGender pokemon.otgender = ownerGender end # Set nickname - pokemon.name = nickname[0,PokeBattle_Pokemon::MAX_POKEMON_NAME_SIZE] if nickname && nickname!="" + pokemon.name = nickname[0, Pokemon::MAX_POKEMON_NAME_SIZE] if nickname && nickname!="" # Recalculate stats pokemon.calcStats if ownerName @@ -206,7 +206,7 @@ end def pbSeenForm(pkmn,gender=0,form=0) $Trainer.formseen = [] if !$Trainer.formseen $Trainer.formlastseen = [] if !$Trainer.formlastseen - if pkmn.is_a?(PokeBattle_Pokemon) + if pkmn.is_a?(Pokemon) gender = pkmn.gender form = (pkmn.form rescue 0) species = pkmn.species diff --git a/Data/Scripts/021_Debug/003_Debug_Pokemon.rb b/Data/Scripts/021_Debug/003_Debug_Pokemon.rb index 4bb29341b..52579bbe7 100644 --- a/Data/Scripts/021_Debug/003_Debug_Pokemon.rb +++ b/Data/Scripts/021_Debug/003_Debug_Pokemon.rb @@ -218,8 +218,8 @@ module PokemonDebugMixin evcommands.push(_INTL("Randomise all")) evcommands.push(_INTL("Max randomise all")) cmd2 = pbShowCommands(_INTL("Change which EV?\nTotal: {1}/{2} ({3}%)", - totalev,PokeBattle_Pokemon::EV_LIMIT, - 100*totalev/PokeBattle_Pokemon::EV_LIMIT),evcommands,cmd2) + totalev, Pokemon::EV_LIMIT, + 100*totalev/Pokemon::EV_LIMIT), evcommands, cmd2) break if cmd2<0 if cmd20 r = rand(numstats) - next if pkmn.ev[r]>=PokeBattle_Pokemon::EV_STAT_LIMIT - addVal = 1+rand(PokeBattle_Pokemon::EV_STAT_LIMIT/4) + next if pkmn.ev[r]>=Pokemon::EV_STAT_LIMIT + addVal = 1+rand(Pokemon::EV_STAT_LIMIT/4) addVal = evTotalTarget if addVal>evTotalTarget - addVal = [addVal,PokeBattle_Pokemon::EV_STAT_LIMIT-pkmn.ev[r]].min + addVal = [addVal, Pokemon::EV_STAT_LIMIT-pkmn.ev[r]].min next if addVal==0 pkmn.ev[r] += addVal evTotalTarget -= addVal @@ -292,7 +292,7 @@ module PokemonDebugMixin end elsif cmd2==ivcommands.length-1 # Randomise for i in 0...numstats - pkmn.iv[i] = rand(PokeBattle_Pokemon::IV_STAT_LIMIT+1) + pkmn.iv[i] = rand(Pokemon::IV_STAT_LIMIT+1) end pkmn.calcStats pbRefreshSingle(pkmnid) @@ -601,7 +601,7 @@ module PokemonDebugMixin when 0 # Rename oldname = (pkmn.name && pkmn.name!=speciesname) ? pkmn.name : "" newname = pbEnterPokemonName(_INTL("{1}'s nickname?",speciesname), - 0,PokeBattle_Pokemon::MAX_POKEMON_NAME_SIZE,oldname,pkmn) + 0, Pokemon::MAX_POKEMON_NAME_SIZE, oldname, pkmn) if newname && newname!="" pkmn.name = newname pbRefreshSingle(pkmnid) @@ -759,10 +759,10 @@ module PokemonDebugMixin if pkmn.shadowPokemon? oldheart = pkmn.heartgauge params = ChooseNumberParams.new - params.setRange(0,PokeBattle_Pokemon::HEARTGAUGESIZE) + params.setRange(0, Pokemon::HEARTGAUGESIZE) params.setDefaultValue(pkmn.heartgauge) val = pbMessageChooseNumber( - _INTL("Set the heart gauge (max. {1}).",PokeBattle_Pokemon::HEARTGAUGESIZE), + _INTL("Set the heart gauge (max. {1}).", Pokemon::HEARTGAUGESIZE), params) { pbUpdate } if val!=oldheart pkmn.adjustHeart(val-oldheart) diff --git a/Data/Scripts/021_Debug/004_Editor_Screens.rb b/Data/Scripts/021_Debug/004_Editor_Screens.rb index 8f0410600..23ef33eb8 100644 --- a/Data/Scripts/021_Debug/004_Editor_Screens.rb +++ b/Data/Scripts/021_Debug/004_Editor_Screens.rb @@ -514,12 +514,12 @@ module TrainerPokemonProperty [_INTL("Form"),LimitProperty2.new(999),_INTL("Form of the Pokémon.")], [_INTL("Shiny"),BooleanProperty2,_INTL("If set to true, the Pokémon is a different-colored Pokémon.")], [_INTL("Nature"),NatureProperty,_INTL("Nature of the Pokémon.")], - [_INTL("IVs"),IVsProperty.new(PokeBattle_Pokemon::IV_STAT_LIMIT),_INTL("Individual values for each of the Pokémon's stats.")], + [_INTL("IVs"), IVsProperty.new(Pokemon::IV_STAT_LIMIT), _INTL("Individual values for each of the Pokémon's stats.")], [_INTL("Happiness"),LimitProperty2.new(255),_INTL("Happiness of the Pokémon (0-255).")], [_INTL("Nickname"),StringProperty,_INTL("Name of the Pokémon.")], [_INTL("Shadow"),BooleanProperty2,_INTL("If set to true, the Pokémon is a Shadow Pokémon.")], [_INTL("Ball"),BallProperty.new(oldsetting),_INTL("The kind of Poké Ball the Pokémon is kept in.")], - [_INTL("EVs"),EVsProperty.new(PokeBattle_Pokemon::EV_STAT_LIMIT),_INTL("Effort values for each of the Pokémon's stats.")] + [_INTL("EVs"), EVsProperty.new(Pokemon::EV_STAT_LIMIT), _INTL("Effort values for each of the Pokémon's stats.")] ] pbPropertyList(settingname,oldsetting,properties,false) return nil if !oldsetting[TPSPECIES] || oldsetting[TPSPECIES]==0 @@ -741,7 +741,7 @@ def pbPokemonEditor metrics = pbLoadSpeciesMetrics selection = 0 species = [ - [_INTL("Name"),LimitStringProperty.new(PokeBattle_Pokemon::MAX_POKEMON_NAME_SIZE),_INTL("Name of the Pokémon.")], + [_INTL("Name"), LimitStringProperty.new(Pokemon::MAX_POKEMON_NAME_SIZE), _INTL("Name of the Pokémon.")], [_INTL("InternalName"),ReadOnlyProperty,_INTL("Internal name of the Pokémon.")], [_INTL("Type1"),TypeProperty,_INTL("Pokémon's type. If same as Type2, this Pokémon has a single type.")], [_INTL("Type2"),TypeProperty,_INTL("Pokémon's type. If same as Type1, this Pokémon has a single type.")], diff --git a/Data/Scripts/021_Debug/006_Editor_DataTypes.rb b/Data/Scripts/021_Debug/006_Editor_DataTypes.rb index 6cf4e0f05..d726d3e9c 100644 --- a/Data/Scripts/021_Debug/006_Editor_DataTypes.rb +++ b/Data/Scripts/021_Debug/006_Editor_DataTypes.rb @@ -466,9 +466,9 @@ class EVsProperty for i in 0...6 evtotal += oldsetting[i] if oldsetting[i] end - if evtotal>PokeBattle_Pokemon::EV_LIMIT + if evtotal>Pokemon::EV_LIMIT pbMessage(_INTL("Total EVs ({1}) are greater than allowed ({2}). Please reduce them.", - evtotal,PokeBattle_Pokemon::EV_LIMIT)) + evtotal, Pokemon::EV_LIMIT)) else break end diff --git a/Data/Scripts/022_Compiler/002_Compiler_PBS.rb b/Data/Scripts/022_Compiler/002_Compiler_PBS.rb index c36f32120..02f957bf3 100644 --- a/Data/Scripts/022_Compiler/002_Compiler_PBS.rb +++ b/Data/Scripts/022_Compiler/002_Compiler_PBS.rb @@ -1443,30 +1443,30 @@ def pbCompileTrainers record = [record] if record.is_a?(Integer) record.compact! for i in record - next if i<=PokeBattle_Pokemon::IV_STAT_LIMIT - raise _INTL("Bad IV: {1} (must be 0-{2})\r\n{3}",i,PokeBattle_Pokemon::IV_STAT_LIMIT,FileLineData.linereport) + next if i<=Pokemon::IV_STAT_LIMIT + raise _INTL("Bad IV: {1} (must be 0-{2})\r\n{3}", i, Pokemon::IV_STAT_LIMIT, FileLineData.linereport) end when "EV" record = [record] if record.is_a?(Integer) record.compact! for i in record - next if i<=PokeBattle_Pokemon::EV_STAT_LIMIT - raise _INTL("Bad EV: {1} (must be 0-{2})\r\n{3}",i,PokeBattle_Pokemon::EV_STAT_LIMIT,FileLineData.linereport) + next if i<=Pokemon::EV_STAT_LIMIT + raise _INTL("Bad EV: {1} (must be 0-{2})\r\n{3}", i, Pokemon::EV_STAT_LIMIT, FileLineData.linereport) end evtotal = 0 for i in 0...6 evtotal += (iPokeBattle_Pokemon::EV_LIMIT - raise _INTL("Total EVs are greater than allowed ({1})\r\n{2}",PokeBattle_Pokemon::EV_LIMIT,FileLineData.linereport) + if evtotal>Pokemon::EV_LIMIT + raise _INTL("Total EVs are greater than allowed ({1})\r\n{2}", Pokemon::EV_LIMIT, FileLineData.linereport) end when "Happiness" if record>255 raise _INTL("Bad happiness: {1} (must be 0-255)\r\n{2}",record,FileLineData.linereport) end when "Name" - if record.length>PokeBattle_Pokemon::MAX_POKEMON_NAME_SIZE - raise _INTL("Bad nickname: {1} (must be 1-{2} characters)\r\n{3}",record,PokeBattle_Pokemon::MAX_POKEMON_NAME_SIZE,FileLineData.linereport) + if record.length>Pokemon::MAX_POKEMON_NAME_SIZE + raise _INTL("Bad nickname: {1} (must be 1-{2} characters)\r\n{3}", record, Pokemon::MAX_POKEMON_NAME_SIZE, FileLineData.linereport) end end # Record XXX=YYY setting @@ -1546,8 +1546,8 @@ def pbCompileTrainers end record[i] = [record[i]] when TPEV+3 - if record[i]>PokeBattle_Pokemon::EV_STAT_LIMIT - raise _INTL("Bad EV: {1} (must be 0-{2})\r\n{3}",record[i],PokeBattle_Pokemon::EV_STAT_LIMIT,FileLineData.linereport) + if record[i]>Pokemon::EV_STAT_LIMIT + raise _INTL("Bad EV: {1} (must be 0-{2})\r\n{3}", record[i], Pokemon::EV_STAT_LIMIT, FileLineData.linereport) end record[i] = [record[i]] when TPHAPPINESS+3 @@ -1555,8 +1555,8 @@ def pbCompileTrainers raise _INTL("Bad happiness: {1} (must be 0-255)\r\n{2}",record[i],FileLineData.linereport) end when TPNAME+3 - if record[i].length>PokeBattle_Pokemon::MAX_POKEMON_NAME_SIZE - raise _INTL("Bad nickname: {1} (must be 1-{2} characters)\r\n{3}",record[i],PokeBattle_Pokemon::MAX_POKEMON_NAME_SIZE,FileLineData.linereport) + if record[i].length>Pokemon::MAX_POKEMON_NAME_SIZE + raise _INTL("Bad nickname: {1} (must be 1-{2} characters)\r\n{3}", record[i], Pokemon::MAX_POKEMON_NAME_SIZE, FileLineData.linereport) end end end