The Data/EditorScripts/ folder contains all the Ruby source code for Pokémon Essentials during development. These scripts are compiled into Data/Scripts.rxdata when you playtest or release your game.
class PokeBattle_Pokemon attr_reader(:totalhp) # Current Total HP attr_reader(:attack) # Current Attack stat attr_reader(:defense) # Current Defense stat attr_reader(:speed) # Current Speed stat attr_reader(:spatk) # Current Special Attack stat attr_reader(:spdef) # Current Special Defense stat attr_accessor(:iv) # Individual Values attr_accessor(:ev) # Effort Values attr_accessor(:species) # Species (National Pokédex number) attr_accessor(:hp) # Current HP attr_accessor(:item) # Held item attr_accessor(:name) # Nickname attr_accessor(:exp) # Current experience points attr_accessor(:moves) # Moves (PBMove) EVLIMIT = 510 # Max total EVs EVSTATLIMIT = 252 # Max EVs that a single stat can haveend
# Gets the value of a variable.def pbGet(id) return 0 if !id || !$game_variables return $game_variables[id]end# Sets the value of a variable.def pbSet(id,value) if id && id>=0 $game_variables[id]=value if $game_variables $game_map.need_refresh = true if $game_map endend# Runs a common event and waits until the common event is finished.def pbCommonEvent(id) return false if id<0 ce=$data_common_events[id] return false if !ce celist=ce.list interp=Interpreter.new interp.setup(celist,0) begin Graphics.update Input.update interp.update pbUpdateSceneMap end while interp.running? return trueend
# Returns this Pokémon's level.def level return PBExperience.pbGetLevelFromExperience(@exp,self.growthrate)end# Sets this Pokemon's level by changing its Exp. Points.def level=(value) if value<1 || value>PBExperience::MAXLEVEL raise ArgumentError.new(_INTL("The level number ({1}) is invalid.",value)) end self.exp=PBExperience.pbGetStartExperience(value,self.growthrate) end
$Trainer.party[0] # First Pokémon in party$PokemonBag.pbQuantity(item) # Count items in bag$game_switches[50] = true # Set a game switch$game_variables[10] = 5 # Set a game variable
# Creates a new Pokémon object.# species - Pokémon species.# level - Pokémon level.# player - PokeBattle_Trainer object for the original trainer.# withMoves - If false, this Pokémon has no moves.def initialize(species,level,player=nil,withMoves=true) if species.is_a?(String) || species.is_a?(Symbol) species=getID(PBSpecies,species) end # ... initialization codeend