|
|
|
|
@@ -121,9 +121,9 @@ class Pokemon
|
|
|
|
|
return @evolution_counter
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#=============================================================================
|
|
|
|
|
# Species and form
|
|
|
|
|
#=============================================================================
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
# Species and form.
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
# Changes the Pokémon's species and re-calculates its statistics.
|
|
|
|
|
# @param species_id [Symbol, String, GameData::Species] ID of the species to change this Pokémon to
|
|
|
|
|
@@ -190,9 +190,9 @@ class Pokemon
|
|
|
|
|
calc_stats
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#=============================================================================
|
|
|
|
|
# Level
|
|
|
|
|
#=============================================================================
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
# Level.
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
# @return [Integer] this Pokémon's level
|
|
|
|
|
def level
|
|
|
|
|
@@ -244,9 +244,9 @@ class Pokemon
|
|
|
|
|
return (@exp - start_exp).to_f / (end_exp - start_exp)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#=============================================================================
|
|
|
|
|
# Status
|
|
|
|
|
#=============================================================================
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
# Status.
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
# Sets the Pokémon's health.
|
|
|
|
|
# @param value [Integer] new HP value
|
|
|
|
|
@@ -314,9 +314,9 @@ class Pokemon
|
|
|
|
|
@ready_to_evolve = false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#=============================================================================
|
|
|
|
|
# Types
|
|
|
|
|
#=============================================================================
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
# Types.
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
# @return [Array<Symbol>] an array of this Pokémon's types
|
|
|
|
|
def types
|
|
|
|
|
@@ -342,9 +342,9 @@ class Pokemon
|
|
|
|
|
return self.types.include?(type)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#=============================================================================
|
|
|
|
|
# Gender
|
|
|
|
|
#=============================================================================
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
# Gender.
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
# @return [0, 1, 2] this Pokémon's gender (0 = male, 1 = female, 2 = genderless)
|
|
|
|
|
def gender
|
|
|
|
|
@@ -391,9 +391,9 @@ class Pokemon
|
|
|
|
|
return species_data.single_gendered?
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#=============================================================================
|
|
|
|
|
# Shininess
|
|
|
|
|
#=============================================================================
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
# Shininess.
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
# @return [Boolean] whether this Pokémon is shiny (differently colored)
|
|
|
|
|
def shiny?
|
|
|
|
|
@@ -426,9 +426,9 @@ class Pokemon
|
|
|
|
|
@shiny = true if @super_shiny
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#=============================================================================
|
|
|
|
|
# Ability
|
|
|
|
|
#=============================================================================
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
# Ability.
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
# The index of this Pokémon's ability (0, 1 are natural abilities, 2+ are
|
|
|
|
|
# hidden abilities) as defined for its species/form. An ability may not be
|
|
|
|
|
@@ -498,9 +498,9 @@ class Pokemon
|
|
|
|
|
return ret
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#=============================================================================
|
|
|
|
|
# Nature
|
|
|
|
|
#=============================================================================
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
# Nature.
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
# @return [GameData::Nature, nil] a Nature object corresponding to this Pokémon's nature
|
|
|
|
|
def nature
|
|
|
|
|
@@ -553,9 +553,9 @@ class Pokemon
|
|
|
|
|
return self.nature == check_nature
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#=============================================================================
|
|
|
|
|
# Items
|
|
|
|
|
#=============================================================================
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
# Items.
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
# @return [GameData::Item, nil] an Item object corresponding to this Pokémon's item
|
|
|
|
|
def item
|
|
|
|
|
@@ -607,9 +607,9 @@ class Pokemon
|
|
|
|
|
@mail = mail
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#=============================================================================
|
|
|
|
|
# Moves
|
|
|
|
|
#=============================================================================
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
# Moves.
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
# @return [Integer] the number of moves known by the Pokémon
|
|
|
|
|
def numMoves
|
|
|
|
|
@@ -731,9 +731,9 @@ class Pokemon
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#=============================================================================
|
|
|
|
|
# Ribbons
|
|
|
|
|
#=============================================================================
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
# Ribbons.
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
# @return [Integer] the number of ribbons this Pokémon has
|
|
|
|
|
def numRibbons
|
|
|
|
|
@@ -792,9 +792,9 @@ class Pokemon
|
|
|
|
|
@ribbons.clear
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#=============================================================================
|
|
|
|
|
# Pokérus
|
|
|
|
|
#=============================================================================
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
# Pokérus.
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
# @return [Integer] the Pokérus infection stage for this Pokémon
|
|
|
|
|
def pokerusStrain
|
|
|
|
|
@@ -840,9 +840,9 @@ class Pokemon
|
|
|
|
|
@pokerus -= @pokerus % 16
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#=============================================================================
|
|
|
|
|
# Ownership, obtained information
|
|
|
|
|
#=============================================================================
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
# Ownership, obtained information.
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
# Changes this Pokémon's owner.
|
|
|
|
|
# @param new_owner [Owner] the owner to change to
|
|
|
|
|
@@ -879,9 +879,9 @@ class Pokemon
|
|
|
|
|
@timeEggHatched = value.to_i
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#=============================================================================
|
|
|
|
|
# Other
|
|
|
|
|
#=============================================================================
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
# Other.
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
# @return [String] the name of this Pokémon
|
|
|
|
|
def name
|
|
|
|
|
@@ -977,9 +977,9 @@ class Pokemon
|
|
|
|
|
@happiness = (@happiness + gain).clamp(0, 255)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#=============================================================================
|
|
|
|
|
# Evolution checks
|
|
|
|
|
#=============================================================================
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
# Evolution checks.
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
# Checks whether this Pokemon can evolve because of levelling up.
|
|
|
|
|
# @return [Symbol, nil] the ID of the species to evolve into
|
|
|
|
|
@@ -1078,9 +1078,9 @@ class Pokemon
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#=============================================================================
|
|
|
|
|
# Stat calculations
|
|
|
|
|
#=============================================================================
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
# Stat calculations.
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
# @return [Hash<Integer>] this Pokémon's base stats, a hash with six key/value pairs
|
|
|
|
|
def baseStats
|
|
|
|
|
@@ -1146,9 +1146,9 @@ class Pokemon
|
|
|
|
|
@speed = stats[:SPEED]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#=============================================================================
|
|
|
|
|
# Pokémon creation
|
|
|
|
|
#=============================================================================
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
# Pokémon creation.
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
# Creates a copy of this Pokémon and returns it.
|
|
|
|
|
# @return [Pokemon] a copy of this Pokémon
|
|
|
|
|
|