Moved species data constants into module SpeciesData

This commit is contained in:
Maruno17
2020-10-17 00:17:40 +01:00
parent e82b5409fb
commit d3ec5c2c53
25 changed files with 348 additions and 347 deletions

View File

@@ -134,10 +134,11 @@ def pbGetSpeciesData(species, form = 0, species_data_type = -1)
end end
return species_data[s][species_data_type] if species_data[s] && species_data[s][species_data_type] return species_data[s][species_data_type] if species_data[s] && species_data[s][species_data_type]
case species_data_type case species_data_type
when SpeciesType2; return nil when SpeciesData::TYPE2; return nil
when SpeciesBaseStats; return [1, 1, 1, 1, 1, 1] when SpeciesData::BASE_STATS; return [1, 1, 1, 1, 1, 1]
when SpeciesEffortPoints; return [0, 0, 0, 0, 0, 0] when SpeciesData::EFFORT_POINTS; return [0, 0, 0, 0, 0, 0]
when SpeciesStepsToHatch, SpeciesHeight, SpeciesWeight; return 1 when SpeciesData::STEPS_TO_HATCH, SpeciesData::HEIGHT, SpeciesData::WEIGHT
return 1
end end
return 0 return 0
end end

View File

@@ -31,7 +31,7 @@ module PhoneMsgType
end end
#=============================================================================== #===============================================================================
# Global and map metadata # Global metadata
#=============================================================================== #===============================================================================
module Metadata module Metadata
HOME = 1 HOME = 1
@@ -123,64 +123,64 @@ end
#=============================================================================== #===============================================================================
# Pokémon data # Pokémon data
#=============================================================================== #===============================================================================
SpeciesType1 = 0 module SpeciesData
SpeciesType2 = 1 TYPE1 = 0
SpeciesBaseStats = 2 TYPE2 = 1
SpeciesGenderRate = 3 BASE_STATS = 2
SpeciesGrowthRate = 4 GENDER_RATE = 3
SpeciesBaseExp = 5 GROWTH_RATE = 4
SpeciesEffortPoints = 6 BASE_EXP = 5
SpeciesRareness = 7 EFFORT_POINTS = 6
SpeciesHappiness = 8 RARENESS = 7
SpeciesAbilities = 9 HAPPINESS = 8
SpeciesHiddenAbility = 10 ABILITIES = 9
SpeciesCompatibility = 11 HIDDEN_ABILITY = 10
SpeciesStepsToHatch = 12 COMPATIBILITY = 11
SpeciesHeight = 13 STEPS_TO_HATCH = 12
SpeciesWeight = 14 HEIGHT = 13
SpeciesColor = 15 WEIGHT = 14
SpeciesShape = 16 COLOR = 15
SpeciesHabitat = 17 SHAPE = 16
SpeciesWildItemCommon = 18 HABITAT = 17
SpeciesWildItemUncommon = 19 WILD_ITEM_COMMON = 18
SpeciesWildItemRare = 20 WILD_ITEM_UNCOMMON = 19
SpeciesIncense = 21 WILD_ITEM_RARE = 20
SpeciesPokedexForm = 22 # For alternate forms INCENSE = 21
SpeciesMegaStone = 23 # For alternate forms POKEDEX_FORM = 22 # For alternate forms
SpeciesMegaMove = 24 # For alternate forms MEGA_STONE = 23 # For alternate forms
SpeciesUnmegaForm = 25 # For alternate forms MEGA_MOVE = 24 # For alternate forms
SpeciesMegaMessage = 26 # For alternate forms UNMEGA_FORM = 25 # For alternate forms
MEGA_MESSAGE = 26 # For alternate forms
MetricBattlerPlayerX = 0 METRIC_PLAYER_X = 0
MetricBattlerPlayerY = 1 METRIC_PLAYER_Y = 1
MetricBattlerEnemyX = 2 METRIC_ENEMY_X = 2
MetricBattlerEnemyY = 3 METRIC_ENEMY_Y = 3
MetricBattlerAltitude = 4 METRIC_ALTITUDE = 4
MetricBattlerShadowX = 5 METRIC_SHADOW_X = 5
MetricBattlerShadowSize = 6 METRIC_SHADOW_SIZE = 6
module PokemonSpeciesData def self.requiredValues(compilingForms = false)
def self.requiredValues(compilingForms=false)
ret = { ret = {
"Type1" => [SpeciesType1, "e", :PBTypes], "Type1" => [TYPE1, "e", :PBTypes],
"BaseStats" => [SpeciesBaseStats, "vvvvvv"], "BaseStats" => [BASE_STATS, "vvvvvv"],
"BaseEXP" => [SpeciesBaseExp, "v"], "BaseEXP" => [BASE_EXP, "v"],
"EffortPoints" => [SpeciesEffortPoints, "uuuuuu"], "EffortPoints" => [EFFORT_POINTS, "uuuuuu"],
"Rareness" => [SpeciesRareness, "u"], "Rareness" => [RARENESS, "u"],
"Happiness" => [SpeciesHappiness, "u"], "Happiness" => [HAPPINESS, "u"],
"Compatibility" => [SpeciesCompatibility, "eE", :PBEggGroups, :PBEggGroups], "Compatibility" => [COMPATIBILITY, "eE", :PBEggGroups, :PBEggGroups],
"StepsToHatch" => [SpeciesStepsToHatch, "v"], "StepsToHatch" => [STEPS_TO_HATCH, "v"],
"Height" => [SpeciesHeight, "f"], "Height" => [HEIGHT, "f"],
"Weight" => [SpeciesWeight, "f"], "Weight" => [WEIGHT, "f"],
"Color" => [SpeciesColor, "e", :PBColors], "Color" => [COLOR, "e", :PBColors],
"Shape" => [SpeciesShape, "u"], "Shape" => [SHAPE, "u"],
"Moves" => [0, "*ue", nil, :PBMoves], "Moves" => [0, "*ue", nil, :PBMoves],
"Kind" => [0, "s"], "Kind" => [0, "s"],
"Pokedex" => [0, "q"] "Pokedex" => [0, "q"]
} }
if !compilingForms if !compilingForms
ret["GenderRate"] = [SpeciesGenderRate, "e", :PBGenderRates] ret["GenderRate"] = [GENDER_RATE, "e", :PBGenderRates]
ret["GrowthRate"] = [SpeciesGrowthRate, "e", :PBGrowthRates] ret["GrowthRate"] = [GROWTH_RATE, "e", :PBGrowthRates]
ret["Name"] = [0, "s"] ret["Name"] = [0, "s"]
ret["InternalName"] = [0, "n"] ret["InternalName"] = [0, "n"]
end end
@@ -189,33 +189,33 @@ module PokemonSpeciesData
def self.optionalValues(compilingForms = false) def self.optionalValues(compilingForms = false)
ret = { ret = {
"Type2" => [SpeciesType2, "e", :PBTypes], "Type2" => [TYPE2, "e", :PBTypes],
"Abilities" => [SpeciesAbilities, "eE", :PBAbilities, :PBAbilities], "Abilities" => [ABILITIES, "eE", :PBAbilities, :PBAbilities],
"HiddenAbility" => [SpeciesHiddenAbility, "eEEE", :PBAbilities, :PBAbilities, "HiddenAbility" => [HIDDEN_ABILITY, "eEEE", :PBAbilities, :PBAbilities,
:PBAbilities, :PBAbilities], :PBAbilities, :PBAbilities],
"Habitat" => [SpeciesHabitat, "e", :PBHabitats], "Habitat" => [HABITAT, "e", :PBHabitats],
"WildItemCommon" => [SpeciesWildItemCommon, "e", :PBItems], "WildItemCommon" => [WILD_ITEM_COMMON, "e", :PBItems],
"WildItemUncommon" => [SpeciesWildItemUncommon, "e", :PBItems], "WildItemUncommon" => [WILD_ITEM_UNCOMMON, "e", :PBItems],
"WildItemRare" => [SpeciesWildItemRare, "e", :PBItems], "WildItemRare" => [WILD_ITEM_RARE, "e", :PBItems],
"BattlerPlayerX" => [MetricBattlerPlayerX, "i"], "BattlerPlayerX" => [METRIC_PLAYER_X, "i"],
"BattlerPlayerY" => [MetricBattlerPlayerY, "i"], "BattlerPlayerY" => [METRIC_PLAYER_Y, "i"],
"BattlerEnemyX" => [MetricBattlerEnemyX, "i"], "BattlerEnemyX" => [METRIC_ENEMY_X, "i"],
"BattlerEnemyY" => [MetricBattlerEnemyY, "i"], "BattlerEnemyY" => [METRIC_ENEMY_Y, "i"],
"BattlerAltitude" => [MetricBattlerAltitude, "i"], "BattlerAltitude" => [METRIC_ALTITUDE, "i"],
"BattlerShadowX" => [MetricBattlerShadowX, "i"], "BattlerShadowX" => [METRIC_SHADOW_X, "i"],
"BattlerShadowSize" => [MetricBattlerShadowSize, "u"], "BattlerShadowSize" => [METRIC_SHADOW_SIZE, "u"],
"EggMoves" => [0, "*e", :PBMoves], "EggMoves" => [0, "*e", :PBMoves],
"FormName" => [0, "q"], "FormName" => [0, "q"],
"Evolutions" => [0, "*ses", nil, :PBEvolution, nil] "Evolutions" => [0, "*ses", nil, :PBEvolution, nil]
} }
if compilingForms if compilingForms
ret["PokedexForm"] = [SpeciesPokedexForm, "u"] ret["PokedexForm"] = [POKEDEX_FORM, "u"]
ret["MegaStone"] = [SpeciesMegaStone, "e", :PBItems] ret["MegaStone"] = [MEGA_STONE, "e", :PBItems]
ret["MegaMove"] = [SpeciesMegaMove, "e", :PBMoves] ret["MegaMove"] = [MEGA_MOVE, "e", :PBMoves]
ret["UnmegaForm"] = [SpeciesUnmegaForm, "u"] ret["UnmegaForm"] = [UNMEGA_FORM, "u"]
ret["MegaMessage"] = [SpeciesMegaMessage, "u"] ret["MegaMessage"] = [MEGA_MESSAGE, "u"]
else else
ret["Incense"] = [SpeciesIncense, "e", :PBItems] ret["Incense"] = [INCENSE, "e", :PBItems]
ret["RegionalNumbers"] = [0, "*u"] ret["RegionalNumbers"] = [0, "*u"]
end end
return ret return ret

View File

@@ -167,7 +167,7 @@ module PokeBattle_BattleCommon
return 4 if $DEBUG && Input.press?(Input::CTRL) return 4 if $DEBUG && Input.press?(Input::CTRL)
# Get a rareness if one wasn't provided # Get a rareness if one wasn't provided
if !rareness if !rareness
rareness = pbGetSpeciesData(pkmn.species,pkmn.form,SpeciesRareness) rareness = pbGetSpeciesData(pkmn.species,pkmn.form,SpeciesData::RARENESS)
end end
# Modify rareness depending on the Poké Ball's effect # Modify rareness depending on the Poké Ball's effect
ultraBeast = (battler.isSpecies?(:NIHILEGO) || ultraBeast = (battler.isSpecies?(:NIHILEGO) ||

View File

@@ -428,7 +428,7 @@ class PokeBattle_SafariZone
@scene.pbSafariStart @scene.pbSafariStart
@scene.pbCommonAnimation(PBWeather.animationName(@weather)) @scene.pbCommonAnimation(PBWeather.animationName(@weather))
safariBall = getConst(PBItems,:SAFARIBALL) safariBall = getConst(PBItems,:SAFARIBALL)
rareness = pbGetSpeciesData(wildpoke.species,wildpoke.form,SpeciesRareness) rareness = pbGetSpeciesData(wildpoke.species,wildpoke.form,SpeciesData::RARENESS)
catchFactor = (rareness*100)/1275 catchFactor = (rareness*100)/1275
catchFactor = [[catchFactor,3].max,20].min catchFactor = [[catchFactor,3].max,20].min
escapeFactor = (pbEscapeRate(rareness)*100)/1275 escapeFactor = (pbEscapeRate(rareness)*100)/1275

View File

@@ -147,7 +147,7 @@ BallHandlers::ModifyCatchRate.add(:QUICKBALL,proc { |ball,catchRate,battle,battl
}) })
BallHandlers::ModifyCatchRate.add(:FASTBALL,proc { |ball,catchRate,battle,battler,ultraBeast| BallHandlers::ModifyCatchRate.add(:FASTBALL,proc { |ball,catchRate,battle,battler,ultraBeast|
baseStats = pbGetSpeciesData(battler.species,battler.form,SpeciesBaseStats) baseStats = pbGetSpeciesData(battler.species,battler.form,SpeciesData::BASE_STATS)
baseSpeed = baseStats[PBStats::SPEED] baseSpeed = baseStats[PBStats::SPEED]
catchRate *= 4 if baseSpeed>=100 catchRate *= 4 if baseSpeed>=100
next [catchRate,255].min next [catchRate,255].min

View File

@@ -253,8 +253,8 @@ class PokemonEncounters
newChances = [] newChances = []
speciesData = pbLoadSpeciesData speciesData = pbLoadSpeciesData
for i in 0...encList.length for i in 0...encList.length
t1 = speciesData[encList[i][0]][SpeciesType1] t1 = speciesData[encList[i][0]][SpeciesData::TYPE1]
t2 = speciesData[encList[i][0]][SpeciesType2] t2 = speciesData[encList[i][0]][SpeciesData::TYPE2]
next if t1!=favoredType && (!t2 || t2!=favoredType) next if t1!=favoredType && (!t2 || t2!=favoredType)
newEncList.push(encList[i]) newEncList.push(encList[i])
newChances.push(chances[i]) newChances.push(chances[i])

View File

@@ -105,7 +105,7 @@ end
# Check compatibility of Pokémon in the Day Care. # Check compatibility of Pokémon in the Day Care.
#=============================================================================== #===============================================================================
def pbIsDitto?(pkmn) def pbIsDitto?(pkmn)
compat = pbGetSpeciesData(pkmn.species,pkmn.form,SpeciesCompatibility) compat = pbGetSpeciesData(pkmn.species,pkmn.form,SpeciesData::COMPATIBILITY)
if compat.is_a?(Array) if compat.is_a?(Array)
return compat.include?(getConst(PBEggGroups,:Ditto)) return compat.include?(getConst(PBEggGroups,:Ditto))
end end
@@ -129,14 +129,14 @@ def pbDayCareGetCompat
return 0 if pkmn1.shadowPokemon? return 0 if pkmn1.shadowPokemon?
return 0 if pkmn2.shadowPokemon? return 0 if pkmn2.shadowPokemon?
# Insert code here if certain forms of certain species cannot breed # Insert code here if certain forms of certain species cannot breed
compat1 = pbGetSpeciesData(pkmn1.species,pkmn1.form,SpeciesCompatibility) compat1 = pbGetSpeciesData(pkmn1.species,pkmn1.form,SpeciesData::COMPATIBILITY)
if compat1.is_a?(Array) if compat1.is_a?(Array)
compat10 = compat1[0] || 0 compat10 = compat1[0] || 0
compat11 = compat1[1] || compat10 compat11 = compat1[1] || compat10
else else
compat10 = compat11 = compat || 0 compat10 = compat11 = compat || 0
end end
compat2 = pbGetSpeciesData(pkmn2.species,pkmn2.form,SpeciesCompatibility) compat2 = pbGetSpeciesData(pkmn2.species,pkmn2.form,SpeciesData::COMPATIBILITY)
if compat2.is_a?(Array) if compat2.is_a?(Array)
compat20 = compat2[0] || 0 compat20 = compat2[0] || 0
compat21 = compat2[1] || compat20 compat21 = compat2[1] || compat20
@@ -396,7 +396,7 @@ def pbDayCareGenerateEgg
egg.calcStats egg.calcStats
egg.obtainText = _INTL("Day-Care Couple") egg.obtainText = _INTL("Day-Care Couple")
egg.name = _INTL("Egg") egg.name = _INTL("Egg")
eggSteps = pbGetSpeciesData(babyspecies,egg.form,SpeciesStepsToHatch) eggSteps = pbGetSpeciesData(babyspecies,egg.form,SpeciesData::STEPS_TO_HATCH)
egg.eggsteps = eggSteps egg.eggsteps = eggSteps
egg.givePokerus if rand(65536)<POKERUS_CHANCE egg.givePokerus if rand(65536)<POKERUS_CHANCE
# Add egg to party # Add egg to party

View File

@@ -205,12 +205,12 @@ class Pokemon
# @return [Integer] this Pokémon's growth rate (from PBGrowthRates) # @return [Integer] this Pokémon's growth rate (from PBGrowthRates)
def growthrate def growthrate
return pbGetSpeciesData(@species, formSimple, SpeciesGrowthRate) return pbGetSpeciesData(@species, formSimple, SpeciesData::GROWTH_RATE)
end end
# @return [Integer] this Pokémon's base Experience value # @return [Integer] this Pokémon's base Experience value
def baseExp def baseExp
return pbGetSpeciesData(@species, formSimple, SpeciesBaseExp) return pbGetSpeciesData(@species, formSimple, SpeciesData::BASE_EXP)
end end
# @return [Float] a number between 0 and 1 indicating how much of the current level's # @return [Float] a number between 0 and 1 indicating how much of the current level's
@@ -231,7 +231,7 @@ class Pokemon
# @return [0, 1, 2] this Pokémon's gender (0 = male, 1 = female, 2 = genderless) # @return [0, 1, 2] this Pokémon's gender (0 = male, 1 = female, 2 = genderless)
def gender def gender
# Return sole gender option for all male/all female/genderless species # Return sole gender option for all male/all female/genderless species
gender_rate = pbGetSpeciesData(@species, formSimple, SpeciesGenderRate) gender_rate = pbGetSpeciesData(@species, formSimple, SpeciesData::GENDER_RATE)
case gender_rate case gender_rate
when PBGenderRates::AlwaysMale; return 0 when PBGenderRates::AlwaysMale; return 0
when PBGenderRates::AlwaysFemale; return 1 when PBGenderRates::AlwaysFemale; return 1
@@ -245,7 +245,7 @@ class Pokemon
# @return [Boolean] whether this Pokémon species is restricted to only ever being one # @return [Boolean] whether this Pokémon species is restricted to only ever being one
# gender (or genderless) # gender (or genderless)
def singleGendered? def singleGendered?
gender_rate = pbGetSpeciesData(@species, formSimple, SpeciesGenderRate) gender_rate = pbGetSpeciesData(@species, formSimple, SpeciesData::GENDER_RATE)
return gender_rate == PBGenderRates::AlwaysMale || return gender_rate == PBGenderRates::AlwaysMale ||
gender_rate == PBGenderRates::AlwaysFemale || gender_rate == PBGenderRates::AlwaysFemale ||
gender_rate == PBGenderRates::Genderless gender_rate == PBGenderRates::Genderless
@@ -295,7 +295,7 @@ class Pokemon
abilIndex = abilityIndex abilIndex = abilityIndex
# Hidden ability # Hidden ability
if abilIndex >= 2 if abilIndex >= 2
hiddenAbil = pbGetSpeciesData(@species, formSimple, SpeciesHiddenAbility) hiddenAbil = pbGetSpeciesData(@species, formSimple, SpeciesData::HIDDEN_ABILITY)
if hiddenAbil.is_a?(Array) if hiddenAbil.is_a?(Array)
ret = hiddenAbil[abilIndex - 2] ret = hiddenAbil[abilIndex - 2]
return ret if ret && ret > 0 return ret if ret && ret > 0
@@ -305,7 +305,7 @@ class Pokemon
abilIndex = (@personalID & 1) abilIndex = (@personalID & 1)
end end
# Natural ability # Natural ability
abilities = pbGetSpeciesData(@species, formSimple, SpeciesAbilities) abilities = pbGetSpeciesData(@species, formSimple, SpeciesData::ABILITIES)
if abilities.is_a?(Array) if abilities.is_a?(Array)
ret = abilities[abilIndex] ret = abilities[abilIndex]
ret = abilities[(abilIndex + 1) % 2] if !ret || ret == 0 ret = abilities[(abilIndex + 1) % 2] if !ret || ret == 0
@@ -341,13 +341,13 @@ class Pokemon
# where every element is [ability ID, ability index] # where every element is [ability ID, ability index]
def getAbilityList def getAbilityList
ret = [] ret = []
abilities = pbGetSpeciesData(@species, formSimple, SpeciesAbilities) abilities = pbGetSpeciesData(@species, formSimple, SpeciesData::ABILITIES)
if abilities.is_a?(Array) if abilities.is_a?(Array)
abilities.each_with_index { |a, i| ret.push([a, i]) if a && a > 0 } abilities.each_with_index { |a, i| ret.push([a, i]) if a && a > 0 }
else else
ret.push([abilities, 0]) if abilities > 0 ret.push([abilities, 0]) if abilities > 0
end end
hiddenAbil = pbGetSpeciesData(@species, formSimple, SpeciesHiddenAbility) hiddenAbil = pbGetSpeciesData(@species, formSimple, SpeciesData::HIDDEN_ABILITY)
if hiddenAbil.is_a?(Array) if hiddenAbil.is_a?(Array)
hiddenAbil.each_with_index { |a, i| ret.push([a, i + 2]) if a && a > 0 } hiddenAbil.each_with_index { |a, i| ret.push([a, i + 2]) if a && a > 0 }
else else
@@ -465,20 +465,20 @@ class Pokemon
# @return [Integer] this Pokémon's first type # @return [Integer] this Pokémon's first type
def type1 def type1
return pbGetSpeciesData(@species, formSimple, SpeciesType1) return pbGetSpeciesData(@species, formSimple, SpeciesData::TYPE1)
end end
# @return [Integer] this Pokémon's second type, or the first type if none is defined # @return [Integer] this Pokémon's second type, or the first type if none is defined
def type2 def type2
ret = pbGetSpeciesData(@species, formSimple, SpeciesType2) ret = pbGetSpeciesData(@species, formSimple, SpeciesData::TYPE2)
ret = pbGetSpeciesData(@species, formSimple, SpeciesType1) if !ret ret = pbGetSpeciesData(@species, formSimple, SpeciesData::TYPE1) if !ret
return ret return ret
end end
# @return [Array<Integer>] an array of this Pokémon's types # @return [Array<Integer>] an array of this Pokémon's types
def types def types
ret1 = pbGetSpeciesData(@species, formSimple, SpeciesType1) ret1 = pbGetSpeciesData(@species, formSimple, SpeciesData::TYPE1)
ret2 = pbGetSpeciesData(@species, formSimple, SpeciesType2) ret2 = pbGetSpeciesData(@species, formSimple, SpeciesData::TYPE2)
ret = [ret1] ret = [ret1]
ret.push(ret2) if ret2 && ret2 != ret1 ret.push(ret2) if ret2 && ret2 != ret1
return ret return ret
@@ -752,9 +752,9 @@ class Pokemon
# @return [Array<Integer>] the items this species can be found holding in the wild # @return [Array<Integer>] the items this species can be found holding in the wild
def wildHoldItems def wildHoldItems
ret = [] ret = []
ret.push(pbGetSpeciesData(@species, formSimple, SpeciesWildItemCommon)) ret.push(pbGetSpeciesData(@species, formSimple, SpeciesData::WILD_ITEM_COMMON))
ret.push(pbGetSpeciesData(@species, formSimple, SpeciesWildItemUncommon)) ret.push(pbGetSpeciesData(@species, formSimple, SpeciesData::WILD_ITEM_UNCOMMON))
ret.push(pbGetSpeciesData(@species, formSimple, SpeciesWildItemRare)) ret.push(pbGetSpeciesData(@species, formSimple, SpeciesData::WILD_ITEM_RARE))
return ret return ret
end end
@@ -890,12 +890,12 @@ class Pokemon
# @return [Integer] the height of this Pokémon in decimetres (0.1 metres) # @return [Integer] the height of this Pokémon in decimetres (0.1 metres)
def height def height
return pbGetSpeciesData(@species, formSimple, SpeciesHeight) return pbGetSpeciesData(@species, formSimple, SpeciesData::HEIGHT)
end end
# @return [Integer] the weight of this Pokémon in hectograms (0.1 kilograms) # @return [Integer] the weight of this Pokémon in hectograms (0.1 kilograms)
def weight def weight
return pbGetSpeciesData(@species, formSimple, SpeciesWeight) return pbGetSpeciesData(@species, formSimple, SpeciesData::WEIGHT)
end end
# Returns an array of booleans indicating whether a stat is made to have # Returns an array of booleans indicating whether a stat is made to have
@@ -918,7 +918,7 @@ class Pokemon
# @return [Array<Integer>] the EV yield of this Pokémon (an array of six values) # @return [Array<Integer>] the EV yield of this Pokémon (an array of six values)
def evYield def evYield
ret = pbGetSpeciesData(@species, formSimple, SpeciesEffortPoints) ret = pbGetSpeciesData(@species, formSimple, SpeciesData::EFFORT_POINTS)
return ret.clone return ret.clone
end end
@@ -998,7 +998,7 @@ class Pokemon
# @return [Array<Integer>] this Pokémon's base stats, an array of six values # @return [Array<Integer>] this Pokémon's base stats, an array of six values
def baseStats def baseStats
ret = pbGetSpeciesData(@species, formSimple, SpeciesBaseStats) ret = pbGetSpeciesData(@species, formSimple, SpeciesData::BASE_STATS)
return ret.clone return ret.clone
end end
@@ -1110,7 +1110,7 @@ class Pokemon
self.level = level self.level = level
calcStats calcStats
@hp = @totalhp @hp = @totalhp
@happiness = pbGetSpeciesData(@species, formSimple, SpeciesHappiness) @happiness = pbGetSpeciesData(@species, formSimple, SpeciesData::HAPPINESS)
if withMoves if withMoves
self.resetMoves self.resetMoves
else else

View File

@@ -11,12 +11,12 @@ class Pokemon
for i in 0...formData[@species].length for i in 0...formData[@species].length
fSpec = formData[@species][i] fSpec = formData[@species][i]
next if !fSpec || fSpec<=0 next if !fSpec || fSpec<=0
megaStone = speciesData[fSpec][SpeciesMegaStone] || 0 megaStone = speciesData[fSpec][SpeciesData::MEGA_STONE] || 0
if megaStone>0 && self.hasItem?(megaStone) if megaStone>0 && self.hasItem?(megaStone)
ret = i; break ret = i; break
end end
if !checkItemOnly if !checkItemOnly
megaMove = speciesData[fSpec][SpeciesMegaMove] || 0 megaMove = speciesData[fSpec][SpeciesData::MEGA_MOVE] || 0
if megaMove>0 && self.hasMove?(megaMove) if megaMove>0 && self.hasMove?(megaMove)
ret = i; break ret = i; break
end end
@@ -27,7 +27,7 @@ class Pokemon
def getUnmegaForm def getUnmegaForm
return -1 if !mega? return -1 if !mega?
unmegaForm = pbGetSpeciesData(@species,formSimple,SpeciesUnmegaForm) unmegaForm = pbGetSpeciesData(@species,formSimple,SpeciesData::UNMEGA_FORM)
return unmegaForm # form number return unmegaForm # form number
end end
@@ -58,7 +58,7 @@ class Pokemon
end end
def megaMessage # 0=default message, 1=Rayquaza message def megaMessage # 0=default message, 1=Rayquaza message
return pbGetSpeciesData(@species,getMegaForm,SpeciesMegaMessage) return pbGetSpeciesData(@species,getMegaForm,SpeciesData::MEGA_MESSAGE)
end end
end end

View File

@@ -156,7 +156,7 @@ def pbGetBabySpecies(species,item1=-1,item2=-1)
evoData.each do |evo| evoData.each do |evo|
next if !evo[3] next if !evo[3]
if item1>=0 && item2>=0 if item1>=0 && item2>=0
incense = pbGetSpeciesData(evo[0],0,SpeciesIncense) incense = pbGetSpeciesData(evo[0],0,SpeciesData::INCENSE)
ret = evo[0] if item1==incense || item2==incense ret = evo[0] if item1==incense || item2==incense
else else
ret = evo[0] # Species of prevolution ret = evo[0] # Species of prevolution

View File

@@ -341,16 +341,16 @@ def pbApplyBattlerMetricsToSprite(sprite,index,species,shadow=false,metrics=nil)
metrics = pbLoadSpeciesMetrics if !metrics metrics = pbLoadSpeciesMetrics if !metrics
if shadow if shadow
if (index&1)==1 # Foe Pokémon if (index&1)==1 # Foe Pokémon
sprite.x += (metrics[MetricBattlerShadowX][species] || 0)*2 sprite.x += (metrics[SpeciesData::METRIC_SHADOW_X][species] || 0)*2
end end
else else
if (index&1)==0 # Player's Pokémon if (index&1)==0 # Player's Pokémon
sprite.x += (metrics[MetricBattlerPlayerX][species] || 0)*2 sprite.x += (metrics[SpeciesData::METRIC_PLAYER_X][species] || 0)*2
sprite.y += (metrics[MetricBattlerPlayerY][species] || 0)*2 sprite.y += (metrics[SpeciesData::METRIC_PLAYER_Y][species] || 0)*2
else # Foe Pokémon else # Foe Pokémon
sprite.x += (metrics[MetricBattlerEnemyX][species] || 0)*2 sprite.x += (metrics[SpeciesData::METRIC_ENEMY_X][species] || 0)*2
sprite.y += (metrics[MetricBattlerEnemyY][species] || 0)*2 sprite.y += (metrics[SpeciesData::METRIC_ENEMY_Y][species] || 0)*2
sprite.y -= (metrics[MetricBattlerAltitude][species] || 0)*2 sprite.y -= (metrics[SpeciesData::METRIC_ALTITUDE][species] || 0)*2
end end
end end
end end
@@ -360,5 +360,5 @@ end
def showShadow?(species) def showShadow?(species)
return true return true
# metrics = pbLoadSpeciesMetrics # metrics = pbLoadSpeciesMetrics
# return (metrics[MetricBattlerAltitude][species] || 0)>0 # return (metrics[SpeciesData::METRIC_ALTITUDE][species] || 0)>0
end end

View File

@@ -327,12 +327,12 @@ class PokemonPokedex_Scene
if pbCanAddForModeList?($PokemonGlobal.pokedexMode,nationalSpecies) if pbCanAddForModeList?($PokemonGlobal.pokedexMode,nationalSpecies)
form = $Trainer.formlastseen[nationalSpecies][1] || 0 form = $Trainer.formlastseen[nationalSpecies][1] || 0
fspecies = pbGetFSpeciesFromForm(nationalSpecies,form) fspecies = pbGetFSpeciesFromForm(nationalSpecies,form)
color = speciesData[fspecies][SpeciesColor] || 0 color = speciesData[fspecies][SpeciesData::COLOR] || 0
type1 = speciesData[fspecies][SpeciesType1] || 0 type1 = speciesData[fspecies][SpeciesData::TYPE1] || 0
type2 = speciesData[fspecies][SpeciesType2] || type1 type2 = speciesData[fspecies][SpeciesData::TYPE2] || type1
shape = speciesData[fspecies][SpeciesShape] || 0 shape = speciesData[fspecies][SpeciesData::SHAPE] || 0
height = speciesData[fspecies][SpeciesHeight] || 1 height = speciesData[fspecies][SpeciesData::HEIGHT] || 1
weight = speciesData[fspecies][SpeciesWeight] || 1 weight = speciesData[fspecies][SpeciesData::WEIGHT] || 1
shift = DEXES_WITH_OFFSETS.include?(region) shift = DEXES_WITH_OFFSETS.include?(region)
dexlist.push([nationalSpecies,PBSpecies.getName(nationalSpecies), dexlist.push([nationalSpecies,PBSpecies.getName(nationalSpecies),
height,weight,i,shift,type1,type2,color,shape]) height,weight,i,shift,type1,type2,color,shape])

View File

@@ -142,7 +142,7 @@ class PokemonPokedexInfo_Scene
@sprites["formback"].setSpeciesBitmap(@species,(@gender==1),@form,false,false,true) @sprites["formback"].setSpeciesBitmap(@species,(@gender==1),@form,false,false,true)
@sprites["formback"].y = 256 @sprites["formback"].y = 256
fSpecies = pbGetFSpeciesFromForm(@species,@form) fSpecies = pbGetFSpeciesFromForm(@species,@form)
@sprites["formback"].y += (pbLoadSpeciesMetrics[MetricBattlerPlayerY][fSpecies] || 0)*2 @sprites["formback"].y += (pbLoadSpeciesMetrics[SpeciesData::METRIC_PLAYER_Y][fSpecies] || 0)*2
end end
if @sprites["formicon"] if @sprites["formicon"]
@sprites["formicon"].pbSetParams(@species,@gender,@form) @sprites["formicon"].pbSetParams(@species,@gender,@form)
@@ -158,7 +158,7 @@ class PokemonPokedexInfo_Scene
for i in 0...formdata[@species].length for i in 0...formdata[@species].length
fSpecies = pbGetFSpeciesFromForm(@species,i) fSpecies = pbGetFSpeciesFromForm(@species,i)
formname = pbGetMessage(MessageTypes::FormNames,fSpecies) formname = pbGetMessage(MessageTypes::FormNames,fSpecies)
genderRate = pbGetSpeciesData(@species,i,SpeciesGenderRate) genderRate = pbGetSpeciesData(@species,i,SpeciesData::GENDER_RATE)
if i==0 || (formname && formname!="") if i==0 || (formname && formname!="")
multiforms = true if i>0 multiforms = true if i>0
case genderRate case genderRate
@@ -248,8 +248,8 @@ class PokemonPokedexInfo_Scene
kind = pbGetMessage(MessageTypes::Kinds,@species) if !kind || kind=="" kind = pbGetMessage(MessageTypes::Kinds,@species) if !kind || kind==""
textpos.push([_INTL("{1} Pokémon",kind),246,74,0,base,shadow]) textpos.push([_INTL("{1} Pokémon",kind),246,74,0,base,shadow])
# Write the height and weight # Write the height and weight
height = speciesData[SpeciesHeight] || 1 height = speciesData[SpeciesData::HEIGHT] || 1
weight = speciesData[SpeciesWeight] || 1 weight = speciesData[SpeciesData::WEIGHT] || 1
if pbGetCountry==0xF4 # If the user is in the United States if pbGetCountry==0xF4 # If the user is in the United States
inches = (height/0.254).round inches = (height/0.254).round
pounds = (weight/0.45359).round pounds = (weight/0.45359).round
@@ -273,8 +273,8 @@ class PokemonPokedexInfo_Scene
# Show the owned icon # Show the owned icon
imagepos.push(["Graphics/Pictures/Pokedex/icon_own",212,44]) imagepos.push(["Graphics/Pictures/Pokedex/icon_own",212,44])
# Draw the type icon(s) # Draw the type icon(s)
type1 = speciesData[SpeciesType1] || 0 type1 = speciesData[SpeciesData::TYPE1] || 0
type2 = speciesData[SpeciesType2] || type1 type2 = speciesData[SpeciesData::TYPE2] || type1
type1rect = Rect.new(0,type1*32,96,32) type1rect = Rect.new(0,type1*32,96,32)
type2rect = Rect.new(0,type2*32,96,32) type2rect = Rect.new(0,type2*32,96,32)
overlay.blt(296,120,@typebitmap.bitmap,type1rect) overlay.blt(296,120,@typebitmap.bitmap,type1rect)

View File

@@ -13,16 +13,16 @@ class TriadCard
def initialize(species,form=0) def initialize(species,form=0)
@species = species @species = species
@form = form @form = form
baseStats = pbGetSpeciesData(species,form,SpeciesBaseStats) baseStats = pbGetSpeciesData(species,form,SpeciesData::BASE_STATS)
hp = baseStats[PBStats::HP] hp = baseStats[PBStats::HP]
attack = baseStats[PBStats::ATTACK] attack = baseStats[PBStats::ATTACK]
defense = baseStats[PBStats::DEFENSE] defense = baseStats[PBStats::DEFENSE]
spAtk = baseStats[PBStats::SPATK] spAtk = baseStats[PBStats::SPATK]
spDef = baseStats[PBStats::SPDEF] spDef = baseStats[PBStats::SPDEF]
speed = baseStats[PBStats::SPEED] speed = baseStats[PBStats::SPEED]
@type = pbGetSpeciesData(species,form,SpeciesType1) @type = pbGetSpeciesData(species,form,SpeciesData::TYPE1)
if isConst?(@type,PBTypes,:NORMAL) if isConst?(@type,PBTypes,:NORMAL)
type2 = pbGetSpeciesData(species,form,SpeciesType2) type2 = pbGetSpeciesData(species,form,SpeciesData::TYPE2)
@type = type2 if type2 @type = type2 if type2
end end
@west = baseStatToValue(attack+speed/3) @west = baseStatToValue(attack+speed/3)

View File

@@ -269,7 +269,7 @@ def pbBugContestScore(pokemon)
for i in pokemon.iv; ivscore+=i; end for i in pokemon.iv; ivscore+=i; end
ivscore=(ivscore*100/186).floor ivscore=(ivscore*100/186).floor
hpscore=(100*pokemon.hp/pokemon.totalhp).floor hpscore=(100*pokemon.hp/pokemon.totalhp).floor
rareness = pbGetSpeciesData(pokemon.species,pokemon.form,SpeciesRareness) rareness = pbGetSpeciesData(pokemon.species,pokemon.form,SpeciesData::RARENESS)
rarescore=60 rarescore=60
rarescore+=20 if rareness<=120 rarescore+=20 if rareness<=120
rarescore+=20 if rareness<=60 rarescore+=20 if rareness<=60

View File

@@ -1,5 +1,5 @@
def pbBaseStatTotal(species) def pbBaseStatTotal(species)
baseStats = pbGetSpeciesData(species,0,SpeciesBaseStats) baseStats = pbGetSpeciesData(species,0,SpeciesData::BASE_STATS)
ret = 0 ret = 0
baseStats.each { |s| ret += s } baseStats.each { |s| ret += s }
return ret return ret
@@ -12,14 +12,14 @@ end
def pbTooTall?(pkmn,maxHeightInMeters) def pbTooTall?(pkmn,maxHeightInMeters)
species = (pkmn.is_a?(Pokemon)) ? pkmn.species : pkmn species = (pkmn.is_a?(Pokemon)) ? pkmn.species : pkmn
form = (pkmn.is_a?(Pokemon)) ? pkmn.form : 0 form = (pkmn.is_a?(Pokemon)) ? pkmn.form : 0
height = pbGetSpeciesData(species,form,SpeciesHeight) height = pbGetSpeciesData(species,form,SpeciesData::HEIGHT)
return height>(maxHeightInMeters*10).round return height>(maxHeightInMeters*10).round
end end
def pbTooHeavy?(pkmn,maxWeightInKg) def pbTooHeavy?(pkmn,maxWeightInKg)
species = (pkmn.is_a?(Pokemon)) ? pkmn.species : pkmn species = (pkmn.is_a?(Pokemon)) ? pkmn.species : pkmn
form = (pkmn.is_a?(Pokemon)) ? pkmn.form : 0 form = (pkmn.is_a?(Pokemon)) ? pkmn.form : 0
weight = pbGetSpeciesData(species,form,SpeciesWeight) weight = pbGetSpeciesData(species,form,SpeciesData::WEIGHT)
return weight>(maxWeightInKg*10).round return weight>(maxWeightInKg*10).round
end end
@@ -396,7 +396,7 @@ class StandardRestriction
def isValid?(pokemon) def isValid?(pokemon)
return false if !pokemon || pokemon.egg? return false if !pokemon || pokemon.egg?
# Species with disadvantageous abilities are not banned # Species with disadvantageous abilities are not banned
abilities = pbGetSpeciesData(pokemon.species,pokemon.form,SpeciesAbilities) abilities = pbGetSpeciesData(pokemon.species,pokemon.form,SpeciesData::ABILITIES)
abilities = [abilities] if !abilities.is_a?(Array) abilities = [abilities] if !abilities.is_a?(Array)
abilities.each do |a| abilities.each do |a|
return true if isConst?(a,PBAbilities,:TRUANT) || return true if isConst?(a,PBAbilities,:TRUANT) ||
@@ -413,7 +413,7 @@ class StandardRestriction
return false if pokemon.isSpecies?(i) return false if pokemon.isSpecies?(i)
end end
# Species with total base stat 600 or more are banned # Species with total base stat 600 or more are banned
baseStats = pbGetSpeciesData(pokemon.species,pokemon.form,SpeciesBaseStats) baseStats = pbGetSpeciesData(pokemon.species,pokemon.form,SpeciesData::BASE_STATS)
bst = 0 bst = 0
baseStats.each { |s| bst += s } baseStats.each { |s| bst += s }
return false if bst>=600 return false if bst>=600

View File

@@ -190,7 +190,7 @@ end
class NonlegendaryRestriction class NonlegendaryRestriction
def isValid?(pkmn) def isValid?(pkmn)
return true if !pkmn.genderless? return true if !pkmn.genderless?
compatibility = pbGetSpeciesData(pkmn.species,pkmn.form,SpeciesCompatibility) compatibility = pbGetSpeciesData(pkmn.species,pkmn.form,SpeciesData::COMPATIBILITY)
compatibility = [compatibility] if !compatibility.is_a?(Array) compatibility = [compatibility] if !compatibility.is_a?(Array)
compatibility.each { |c| return false if isConst?(c,PBEggGroups,:Undiscovered) } compatibility.each { |c| return false if isConst?(c,PBEggGroups,:Undiscovered) }
return true return true
@@ -499,8 +499,8 @@ def pbRandomPokemonFromRule(rule,trainer)
item=getID(PBItems,:LEFTOVERS) item=getID(PBItems,:LEFTOVERS)
end end
if isConst?(item,PBItems,:BLACKSLUDGE) if isConst?(item,PBItems,:BLACKSLUDGE)
type1 = pbGetSpeciesData(species,0,SpeciesType1) type1 = pbGetSpeciesData(species,0,SpeciesData::TYPE1)
type2 = pbGetSpeciesData(species,0,SpeciesType2) || type1 type2 = pbGetSpeciesData(species,0,SpeciesData::TYPE2) || type1
if !isConst?(type1,PBTypes,:POISON) && !isConst?(type2,PBTypes,:POISON) if !isConst?(type1,PBTypes,:POISON) && !isConst?(type2,PBTypes,:POISON)
item=getID(PBItems,:LEFTOVERS) item=getID(PBItems,:LEFTOVERS)
end end
@@ -956,8 +956,8 @@ def pbRuledBattle(team1,team2,rule)
end end
def getTypes(species) def getTypes(species)
type1 = pbGetSpeciesData(species,0,SpeciesType1) type1 = pbGetSpeciesData(species,0,SpeciesData::TYPE1)
type2 = pbGetSpeciesData(species,0,SpeciesType2) || type1 type2 = pbGetSpeciesData(species,0,SpeciesData::TYPE2) || type1
return type1==type2 ? [type1] : [type1,type2] return type1==type2 ? [type1] : [type1,type2]
end end

View File

@@ -138,7 +138,7 @@ def pbCheckPokemonShadowBitmapFiles(species,form,fullmetrics=nil)
return bitmapFileName if ret return bitmapFileName if ret
# Load metrics and use that graphic # Load metrics and use that graphic
fullmetrics = pbLoadSpeciesMetrics if !fullmetrics fullmetrics = pbLoadSpeciesMetrics if !fullmetrics
size = (fullmetrics[MetricBattlerShadowSize][pbGetFSpeciesFromForm(species,form)] || 2) size = (fullmetrics[SpeciesData::METRIC_SHADOW_SIZE][pbGetFSpeciesFromForm(species,form)] || 2)
bitmapFileName = sprintf("Graphics/Pictures/Battle/battler_shadow_%d",size) bitmapFileName = sprintf("Graphics/Pictures/Battle/battler_shadow_%d",size)
return bitmapFileName if pbResolveBitmap(bitmapFileName) return bitmapFileName if pbResolveBitmap(bitmapFileName)
return nil return nil

View File

@@ -168,7 +168,7 @@ def pbGenerateEgg(pokemon,text="")
pokemon = Pokemon.new(pokemon,EGG_LEVEL) pokemon = Pokemon.new(pokemon,EGG_LEVEL)
end end
# Get egg steps # Get egg steps
eggSteps = pbGetSpeciesData(pokemon.species,pokemon.form,SpeciesStepsToHatch) eggSteps = pbGetSpeciesData(pokemon.species,pokemon.form,SpeciesData::STEPS_TO_HATCH)
# Set egg's details # Set egg's details
pokemon.name = _INTL("Egg") pokemon.name = _INTL("Egg")
pokemon.eggsteps = eggSteps pokemon.eggsteps = eggSteps
@@ -217,7 +217,7 @@ def pbSeenForm(pkmn,gender=0,form=0)
fSpecies = pbGetFSpeciesFromForm(species,form) fSpecies = pbGetFSpeciesFromForm(species,form)
species, form = pbGetSpeciesFromFSpecies(fSpecies) species, form = pbGetSpeciesFromFSpecies(fSpecies)
gender = 0 if gender>1 gender = 0 if gender>1
dexForm = pbGetSpeciesData(species,form,SpeciesPokedexForm) dexForm = pbGetSpeciesData(species,form,SpeciesData::POKEDEX_FORM)
form = dexForm if dexForm>0 form = dexForm if dexForm>0
fSpecies = pbGetFSpeciesFromForm(species,form) fSpecies = pbGetFSpeciesFromForm(species,form)
formName = pbGetMessage(MessageTypes::FormNames,fSpecies) formName = pbGetMessage(MessageTypes::FormNames,fSpecies)
@@ -231,7 +231,7 @@ end
def pbUpdateLastSeenForm(pkmn) def pbUpdateLastSeenForm(pkmn)
$Trainer.formlastseen = [] if !$Trainer.formlastseen $Trainer.formlastseen = [] if !$Trainer.formlastseen
form = (pkmn.form rescue 0) form = (pkmn.form rescue 0)
dexForm = pbGetSpeciesData(pkmn.species,pkmn.form,SpeciesPokedexForm) dexForm = pbGetSpeciesData(pkmn.species,pkmn.form,SpeciesData::POKEDEX_FORM)
form = dexForm if dexForm>0 form = dexForm if dexForm>0
formName = pbGetMessage(MessageTypes::FormNames,pkmn.fSpecies) formName = pbGetMessage(MessageTypes::FormNames,pkmn.fSpecies)
form = 0 if !formName || formName=="" form = 0 if !formName || formName==""
@@ -452,7 +452,7 @@ end
# Calculates a Pokémon's size (in millimeters) # Calculates a Pokémon's size (in millimeters)
#=============================================================================== #===============================================================================
def pbSize(pkmn) def pbSize(pkmn)
baseheight = pbGetSpeciesData(pkmn.species,pkmn.form,SpeciesHeight) baseheight = pbGetSpeciesData(pkmn.species,pkmn.form,SpeciesData::HEIGHT)
hpiv = pkmn.iv[0]&15 hpiv = pkmn.iv[0]&15
ativ = pkmn.iv[1]&15 ativ = pkmn.iv[1]&15
dfiv = pkmn.iv[2]&15 dfiv = pkmn.iv[2]&15
@@ -493,7 +493,7 @@ def pbHasEgg?(species)
# species may be unbreedable, so check its evolution's compatibilities # species may be unbreedable, so check its evolution's compatibilities
evoSpecies = pbGetEvolvedFormData(species,true) evoSpecies = pbGetEvolvedFormData(species,true)
compatSpecies = (evoSpecies && evoSpecies[0]) ? evoSpecies[0][2] : species compatSpecies = (evoSpecies && evoSpecies[0]) ? evoSpecies[0][2] : species
compat = pbGetSpeciesData(compatSpecies,0,SpeciesCompatibility) compat = pbGetSpeciesData(compatSpecies,0,SpeciesData::COMPATIBILITY)
compat = [compat] if !compat.is_a?(Array) compat = [compat] if !compat.is_a?(Array)
return false if compat.include?(getConst(PBEggGroups,:Undiscovered)) return false if compat.include?(getConst(PBEggGroups,:Undiscovered))
return false if compat.include?(getConst(PBEggGroups,:Ditto)) return false if compat.include?(getConst(PBEggGroups,:Ditto))

View File

@@ -575,7 +575,7 @@ def pbDebugMenuActions(cmd="",sprites=nil,viewport=nil)
next if !formdata[i][form] || formdata[i][form]==0 next if !formdata[i][form] || formdata[i][form]==0
fSpecies = pbGetFSpeciesFromForm(i,form) fSpecies = pbGetFSpeciesFromForm(i,form)
formname = pbGetMessage(MessageTypes::FormNames,fSpecies) formname = pbGetMessage(MessageTypes::FormNames,fSpecies)
genderRate = speciesData[i][SpeciesGenderRate] || 0 genderRate = speciesData[i][SpeciesData::GENDER_RATE] || 0
gender = (genderRate==PBGenderRates::AlwaysFemale) ? 1 : 0 gender = (genderRate==PBGenderRates::AlwaysFemale) ? 1 : 0
if form==0 if form==0
case genderRate case genderRate

View File

@@ -719,7 +719,7 @@ module PokemonDebugMixin
pkmn.level = EGG_LEVEL pkmn.level = EGG_LEVEL
pkmn.calcStats pkmn.calcStats
pkmn.name = _INTL("Egg") pkmn.name = _INTL("Egg")
pkmn.eggsteps = pbGetSpeciesData(pkmn.species,pkmn.form,SpeciesStepsToHatch) pkmn.eggsteps = pbGetSpeciesData(pkmn.species,pkmn.form,SpeciesData::STEPS_TO_HATCH)
pkmn.hatchedMap = 0 pkmn.hatchedMap = 0
pkmn.obtainMode = 1 pkmn.obtainMode = 1
pbRefreshSingle(pkmnid) pbRefreshSingle(pkmnid)

View File

@@ -836,7 +836,7 @@ def pbPokemonEditor
entry = messages.get(MessageTypes::Entries,selection) entry = messages.get(MessageTypes::Entries,selection)
cname = getConstantName(PBSpecies,selection) rescue sprintf("POKE%03d",selection) cname = getConstantName(PBSpecies,selection) rescue sprintf("POKE%03d",selection)
formname = messages.get(MessageTypes::FormNames,selection) formname = messages.get(MessageTypes::FormNames,selection)
abilities = speciesData[SpeciesAbilities] abilities = speciesData[SpeciesData::ABILITIES]
if abilities.is_a?(Array) if abilities.is_a?(Array)
ability1 = abilities[0] ability1 = abilities[0]
ability2 = abilities[1] ability2 = abilities[1]
@@ -844,20 +844,20 @@ def pbPokemonEditor
ability1 = abilities ability1 = abilities
ability2 = nil ability2 = nil
end end
color = speciesData[SpeciesColor] color = speciesData[SpeciesData::COLOR]
habitat = speciesData[SpeciesHabitat] habitat = speciesData[SpeciesData::HABITAT]
type1 = speciesData[SpeciesType1] type1 = speciesData[SpeciesData::TYPE1]
type2 = speciesData[SpeciesType2] type2 = speciesData[SpeciesData::TYPE2]
type2 = nil if type2==type1 type2 = nil if type2==type1
baseStats = speciesData[SpeciesBaseStats].clone if speciesData[SpeciesBaseStats] baseStats = speciesData[SpeciesData::BASE_STATS].clone if speciesData[SpeciesData::BASE_STATS]
rareness = speciesData[SpeciesRareness] rareness = speciesData[SpeciesData::RARENESS]
shape = speciesData[SpeciesShape] shape = speciesData[SpeciesData::SHAPE]
genderrate = speciesData[SpeciesGenderRate] genderrate = speciesData[SpeciesData::GENDER_RATE]
happiness = speciesData[SpeciesHappiness] happiness = speciesData[SpeciesData::HAPPINESS]
growthrate = speciesData[SpeciesGrowthRate] growthrate = speciesData[SpeciesData::GROWTH_RATE]
stepstohatch = speciesData[SpeciesStepsToHatch] stepstohatch = speciesData[SpeciesData::STEPS_TO_HATCH]
effort = speciesData[SpeciesEffortPoints].clone if speciesData[SpeciesEffortPoints] effort = speciesData[SpeciesData::EFFORT_POINTS].clone if speciesData[SpeciesData::EFFORT_POINTS]
compats = speciesData[SpeciesCompatibility] compats = speciesData[SpeciesData::COMPATIBILITY]
if compats.is_a?(Array) if compats.is_a?(Array)
compat1 = compats[0] compat1 = compats[0]
compat2 = compats[1] compat2 = compats[1]
@@ -865,10 +865,10 @@ def pbPokemonEditor
compat1 = compats compat1 = compats
compat2 = nil compat2 = nil
end end
height = speciesData[SpeciesHeight] height = speciesData[SpeciesData::HEIGHT]
weight = speciesData[SpeciesWeight] weight = speciesData[SpeciesData::WEIGHT]
baseexp = speciesData[SpeciesBaseExp] baseexp = speciesData[SpeciesData::BASE_EXP]
hiddenAbils = speciesData[SpeciesHiddenAbility] hiddenAbils = speciesData[SpeciesData::HIDDEN_ABILITY]
if hiddenAbils.is_a?(Array) if hiddenAbils.is_a?(Array)
hiddenability1 = hiddenAbils[0] hiddenability1 = hiddenAbils[0]
hiddenability2 = hiddenAbils[1] hiddenability2 = hiddenAbils[1]
@@ -880,10 +880,10 @@ def pbPokemonEditor
hiddenability3 = nil hiddenability3 = nil
hiddenability4 = nil hiddenability4 = nil
end end
item1 = speciesData[SpeciesWildItemCommon] item1 = speciesData[SpeciesData::WILD_ITEM_COMMON]
item2 = speciesData[SpeciesWildItemUncommon] item2 = speciesData[SpeciesData::WILD_ITEM_UNCOMMON]
item3 = speciesData[SpeciesWildItemRare] item3 = speciesData[SpeciesData::WILD_ITEM_RARE]
incense = speciesData[SpeciesIncense] incense = speciesData[SpeciesData::INCENSE]
originalMoveset = pbGetSpeciesMoveset(selection) originalMoveset = pbGetSpeciesMoveset(selection)
movelist = [] movelist = []
originalMoveset.each_with_index { |m,i| movelist.push([m[0],m[1],i]) } originalMoveset.each_with_index { |m,i| movelist.push([m[0],m[1],i]) }
@@ -939,7 +939,7 @@ def pbPokemonEditor
for i in 0...6 for i in 0...6
data.push(metrics[i][selection] || 0) # 34, 35, 36, 37, 38, 39 data.push(metrics[i][selection] || 0) # 34, 35, 36, 37, 38, 39
end end
data.push(metrics[MetricBattlerShadowSize][selection] || 2) # 40 data.push(metrics[SpeciesData::METRIC_SHADOW_SIZE][selection] || 2) # 40
data.push(evolutions) # 41 data.push(evolutions) # 41
data.push(incense) # 42 data.push(incense) # 42
# Edit the properties # Edit the properties
@@ -966,28 +966,28 @@ def pbPokemonEditor
end end
hiddenAbils = hiddenAbils[0] if !shouldArray hiddenAbils = hiddenAbils[0] if !shouldArray
# Save data # Save data
speciesData[SpeciesAbilities] = abils speciesData[SpeciesData::ABILITIES] = abils
speciesData[SpeciesColor] = data[24] speciesData[SpeciesData::COLOR] = data[24]
speciesData[SpeciesHabitat] = data[26] speciesData[SpeciesData::HABITAT] = data[26]
speciesData[SpeciesType1] = data[2] speciesData[SpeciesData::TYPE1] = data[2]
speciesData[SpeciesType2] = data[3] speciesData[SpeciesData::TYPE2] = data[3]
speciesData[SpeciesBaseStats] = data[4] speciesData[SpeciesData::BASE_STATS] = data[4]
speciesData[SpeciesRareness] = data[9] speciesData[SpeciesData::RARENESS] = data[9]
speciesData[SpeciesShape] = data[25] speciesData[SpeciesData::SHAPE] = data[25]
speciesData[SpeciesGenderRate] = data[5] speciesData[SpeciesData::GENDER_RATE] = data[5]
speciesData[SpeciesHappiness] = data[10] speciesData[SpeciesData::HAPPINESS] = data[10]
speciesData[SpeciesGrowthRate] = data[6] speciesData[SpeciesData::GROWTH_RATE] = data[6]
speciesData[SpeciesStepsToHatch] = data[21] speciesData[SpeciesData::STEPS_TO_HATCH] = data[21]
speciesData[SpeciesEffortPoints] = data[8] speciesData[SpeciesData::EFFORT_POINTS] = data[8]
speciesData[SpeciesCompatibility] = compats speciesData[SpeciesData::COMPATIBILITY] = compats
speciesData[SpeciesHeight] = data[22] speciesData[SpeciesData::HEIGHT] = data[22]
speciesData[SpeciesWeight] = data[23] speciesData[SpeciesData::WEIGHT] = data[23]
speciesData[SpeciesBaseExp] = data[7] speciesData[SpeciesData::BASE_EXP] = data[7]
speciesData[SpeciesHiddenAbility] = hiddenAbils speciesData[SpeciesData::HIDDEN_ABILITY] = hiddenAbils
speciesData[SpeciesWildItemCommon] = data[31] speciesData[SpeciesData::WILD_ITEM_COMMON] = data[31]
speciesData[SpeciesWildItemUncommon] = data[32] speciesData[SpeciesData::WILD_ITEM_UNCOMMON] = data[32]
speciesData[SpeciesWildItemRare] = data[33] speciesData[SpeciesData::WILD_ITEM_RARE] = data[33]
speciesData[SpeciesIncense] = data[42] speciesData[SpeciesData::INCENSE] = data[42]
save_data(pbLoadSpeciesData,"Data/species.dat") save_data(pbLoadSpeciesData,"Data/species.dat")
namearray = [] namearray = []
kindarray = [] kindarray = []

View File

@@ -630,7 +630,7 @@ def pbSavePokemonData
kind = messages.get(MessageTypes::Kinds,i) kind = messages.get(MessageTypes::Kinds,i)
entry = messages.get(MessageTypes::Entries,i) entry = messages.get(MessageTypes::Entries,i)
formname = messages.get(MessageTypes::FormNames,i) formname = messages.get(MessageTypes::FormNames,i)
abilities = speciesData[i][SpeciesAbilities] abilities = speciesData[i][SpeciesData::ABILITIES]
if abilities.is_a?(Array) if abilities.is_a?(Array)
ability1 = abilities[0] || 0 ability1 = abilities[0] || 0
ability2 = abilities[1] || 0 ability2 = abilities[1] || 0
@@ -638,27 +638,27 @@ def pbSavePokemonData
ability1 = abilities || 0 ability1 = abilities || 0
ability2 = 0 ability2 = 0
end end
color = speciesData[i][SpeciesColor] || 0 color = speciesData[i][SpeciesData::COLOR] || 0
habitat = speciesData[i][SpeciesHabitat] || 0 habitat = speciesData[i][SpeciesData::HABITAT] || 0
type1 = speciesData[i][SpeciesType1] || 0 type1 = speciesData[i][SpeciesData::TYPE1] || 0
type2 = speciesData[i][SpeciesType2] || type1 type2 = speciesData[i][SpeciesData::TYPE2] || type1
if speciesData[i][SpeciesBaseStats] if speciesData[i][SpeciesData::BASE_STATS]
basestats = speciesData[i][SpeciesBaseStats].clone basestats = speciesData[i][SpeciesData::BASE_STATS].clone
else else
basestats = [1,1,1,1,1,1] basestats = [1,1,1,1,1,1]
end end
rareness = speciesData[i][SpeciesRareness] || 0 rareness = speciesData[i][SpeciesData::RARENESS] || 0
shape = speciesData[i][SpeciesShape] || 0 shape = speciesData[i][SpeciesData::SHAPE] || 0
gender = speciesData[i][SpeciesGenderRate] || 0 gender = speciesData[i][SpeciesData::GENDER_RATE] || 0
happiness = speciesData[i][SpeciesHappiness] || 0 happiness = speciesData[i][SpeciesData::HAPPINESS] || 0
growthrate = speciesData[i][SpeciesGrowthRate] || 0 growthrate = speciesData[i][SpeciesData::GROWTH_RATE] || 0
stepstohatch = speciesData[i][SpeciesStepsToHatch] || 1 stepstohatch = speciesData[i][SpeciesData::STEPS_TO_HATCH] || 1
if speciesData[i][SpeciesEffortPoints] if speciesData[i][SpeciesData::EFFORT_POINTS]
effort = speciesData[i][SpeciesEffortPoints].clone effort = speciesData[i][SpeciesData::EFFORT_POINTS].clone
else else
effort = [0,0,0,0,0,0] effort = [0,0,0,0,0,0]
end end
compats = speciesData[i][SpeciesCompatibility] compats = speciesData[i][SpeciesData::COMPATIBILITY]
if compats.is_a?(Array) if compats.is_a?(Array)
compat1 = compats[0] || 0 compat1 = compats[0] || 0
compat2 = compats[1] || compat1 compat2 = compats[1] || compat1
@@ -666,10 +666,10 @@ def pbSavePokemonData
compat1 = compats || 0 compat1 = compats || 0
compat2 = compat1 compat2 = compat1
end end
height = speciesData[i][SpeciesHeight] || 1 height = speciesData[i][SpeciesData::HEIGHT] || 1
weight = speciesData[i][SpeciesWeight] || 1 weight = speciesData[i][SpeciesData::WEIGHT] || 1
baseexp = speciesData[i][SpeciesBaseExp] || 0 baseexp = speciesData[i][SpeciesData::BASE_EXP] || 0
hiddenAbils = speciesData[i][SpeciesHiddenAbility] hiddenAbils = speciesData[i][SpeciesData::HIDDEN_ABILITY]
if hiddenAbils.is_a?(Array) if hiddenAbils.is_a?(Array)
hiddenability1 = hiddenAbils[0] || 0 hiddenability1 = hiddenAbils[0] || 0
hiddenability2 = hiddenAbils[1] || 0 hiddenability2 = hiddenAbils[1] || 0
@@ -681,10 +681,10 @@ def pbSavePokemonData
hiddenability3 = 0 hiddenability3 = 0
hiddenability4 = 0 hiddenability4 = 0
end end
item1 = speciesData[i][SpeciesWildItemCommon] || 0 item1 = speciesData[i][SpeciesData::WILD_ITEM_COMMON] || 0
item2 = speciesData[i][SpeciesWildItemUncommon] || 0 item2 = speciesData[i][SpeciesData::WILD_ITEM_UNCOMMON] || 0
item3 = speciesData[i][SpeciesWildItemRare] || 0 item3 = speciesData[i][SpeciesData::WILD_ITEM_RARE] || 0
incense = speciesData[i][SpeciesIncense] || 0 incense = speciesData[i][SpeciesData::INCENSE] || 0
pokedata.write("\#-------------------------------\r\n") pokedata.write("\#-------------------------------\r\n")
pokedata.write("[#{i}]\r\nName = #{speciesname}\r\n") pokedata.write("[#{i}]\r\nName = #{speciesname}\r\n")
pokedata.write("InternalName = #{cname}\r\n") pokedata.write("InternalName = #{cname}\r\n")
@@ -818,13 +818,13 @@ def pbSavePokemonData
pokedata.write("WildItemRare = #{citem3}\r\n") pokedata.write("WildItemRare = #{citem3}\r\n")
end end
if metrics && metrics.length>0 if metrics && metrics.length>0
pokedata.write("BattlerPlayerX = #{metrics[MetricBattlerPlayerX][i] || 0}\r\n") pokedata.write("BattlerPlayerX = #{metrics[SpeciesData::METRIC_PLAYER_X][i] || 0}\r\n")
pokedata.write("BattlerPlayerY = #{metrics[MetricBattlerPlayerY][i] || 0}\r\n") pokedata.write("BattlerPlayerY = #{metrics[SpeciesData::METRIC_PLAYER_Y][i] || 0}\r\n")
pokedata.write("BattlerEnemyX = #{metrics[MetricBattlerEnemyX][i] || 0}\r\n") pokedata.write("BattlerEnemyX = #{metrics[SpeciesData::METRIC_ENEMY_X][i] || 0}\r\n")
pokedata.write("BattlerEnemyY = #{metrics[MetricBattlerEnemyY][i] || 0}\r\n") pokedata.write("BattlerEnemyY = #{metrics[SpeciesData::METRIC_ENEMY_Y][i] || 0}\r\n")
pokedata.write("BattlerAltitude = #{metrics[MetricBattlerAltitude][i] || 0}\r\n") if metrics[MetricBattlerAltitude][i]!=0 pokedata.write("BattlerAltitude = #{metrics[SpeciesData::METRIC_ALTITUDE][i] || 0}\r\n") if metrics[SpeciesData::METRIC_ALTITUDE][i]!=0
pokedata.write("BattlerShadowX = #{metrics[MetricBattlerShadowX][i] || 0}\r\n") pokedata.write("BattlerShadowX = #{metrics[SpeciesData::METRIC_SHADOW_X][i] || 0}\r\n")
pokedata.write("BattlerShadowSize = #{metrics[MetricBattlerShadowSize][i] || 2}\r\n") pokedata.write("BattlerShadowSize = #{metrics[SpeciesData::METRIC_SHADOW_SIZE][i] || 2}\r\n")
end end
pokedata.write("Evolutions = ") pokedata.write("Evolutions = ")
count = 0 count = 0
@@ -896,7 +896,7 @@ def pbSavePokemonFormsData
entry = nil if entry==origentry || entry=="" entry = nil if entry==origentry || entry==""
formname = messages.get(MessageTypes::FormNames,i) formname = messages.get(MessageTypes::FormNames,i)
origdata = {} origdata = {}
abilities = speciesData[species][SpeciesAbilities] abilities = speciesData[species][SpeciesData::ABILITIES]
if abilities.is_a?(Array) if abilities.is_a?(Array)
origdata["ability1"] = abilities[0] || 0 origdata["ability1"] = abilities[0] || 0
origdata["ability2"] = abilities[1] || 0 origdata["ability2"] = abilities[1] || 0
@@ -904,27 +904,27 @@ def pbSavePokemonFormsData
origdata["ability1"] = abilities || 0 origdata["ability1"] = abilities || 0
origdata["ability2"] = 0 origdata["ability2"] = 0
end end
origdata["color"] = speciesData[species][SpeciesColor] || 0 origdata["color"] = speciesData[species][SpeciesData::COLOR] || 0
origdata["habitat"] = speciesData[species][SpeciesHabitat] || 0 origdata["habitat"] = speciesData[species][SpeciesData::HABITAT] || 0
origdata["type1"] = speciesData[species][SpeciesType1] || 0 origdata["type1"] = speciesData[species][SpeciesData::TYPE1] || 0
origdata["type2"] = speciesData[species][SpeciesType2] || type1 origdata["type2"] = speciesData[species][SpeciesData::TYPE2] || type1
if speciesData[species][SpeciesBaseStats] if speciesData[species][SpeciesData::BASE_STATS]
origdata["basestats"] = speciesData[species][SpeciesBaseStats].clone origdata["basestats"] = speciesData[species][SpeciesData::BASE_STATS].clone
else else
origdata["basestats"] = [1,1,1,1,1,1] origdata["basestats"] = [1,1,1,1,1,1]
end end
origdata["rareness"] = speciesData[species][SpeciesRareness] || 0 origdata["rareness"] = speciesData[species][SpeciesData::RARENESS] || 0
origdata["shape"] = speciesData[species][SpeciesShape] || 0 origdata["shape"] = speciesData[species][SpeciesData::SHAPE] || 0
origdata["gender"] = speciesData[species][SpeciesGenderRate] || 0 origdata["gender"] = speciesData[species][SpeciesData::GENDER_RATE] || 0
origdata["happiness"] = speciesData[species][SpeciesHappiness] || 0 origdata["happiness"] = speciesData[species][SpeciesData::HAPPINESS] || 0
origdata["growthrate"] = speciesData[species][SpeciesGrowthRate] || 0 origdata["growthrate"] = speciesData[species][SpeciesData::GROWTH_RATE] || 0
origdata["stepstohatch"] = speciesData[species][SpeciesStepsToHatch] || 1 origdata["stepstohatch"] = speciesData[species][SpeciesData::STEPS_TO_HATCH] || 1
if speciesData[species][SpeciesEffortPoints] if speciesData[species][SpeciesData::EFFORT_POINTS]
origdata["effort"] = speciesData[species][SpeciesEffortPoints].clone origdata["effort"] = speciesData[species][SpeciesData::EFFORT_POINTS].clone
else else
origdata["effort"] = [0,0,0,0,0,0] origdata["effort"] = [0,0,0,0,0,0]
end end
compats = speciesData[species][SpeciesCompatibility] compats = speciesData[species][SpeciesData::COMPATIBILITY]
if compats.is_a?(Array) if compats.is_a?(Array)
origdata["compat1"] = compats[0] || 0 origdata["compat1"] = compats[0] || 0
origdata["compat2"] = compats[1] || origdata["compat1"] origdata["compat2"] = compats[1] || origdata["compat1"]
@@ -932,10 +932,10 @@ def pbSavePokemonFormsData
origdata["compat1"] = compats || 0 origdata["compat1"] = compats || 0
origdata["compat2"] = origdata["compat1"] origdata["compat2"] = origdata["compat1"]
end end
origdata["height"] = speciesData[species][SpeciesHeight] || 1 origdata["height"] = speciesData[species][SpeciesData::HEIGHT] || 1
origdata["weight"] = speciesData[species][SpeciesWeight] || 1 origdata["weight"] = speciesData[species][SpeciesData::WEIGHT] || 1
origdata["baseexp"] = speciesData[species][SpeciesBaseExp] || 0 origdata["baseexp"] = speciesData[species][SpeciesData::BASE_EXP] || 0
hiddenAbils = speciesData[species][SpeciesHiddenAbility] hiddenAbils = speciesData[species][SpeciesData::HIDDEN_ABILITY]
if hiddenAbils.is_a?(Array) if hiddenAbils.is_a?(Array)
origdata["hiddenability1"] = hiddenAbils[0] || 0 origdata["hiddenability1"] = hiddenAbils[0] || 0
origdata["hiddenability2"] = hiddenAbils[1] || 0 origdata["hiddenability2"] = hiddenAbils[1] || 0
@@ -947,11 +947,11 @@ def pbSavePokemonFormsData
origdata["hiddenability3"] = 0 origdata["hiddenability3"] = 0
origdata["hiddenability4"] = 0 origdata["hiddenability4"] = 0
end end
origdata["item1"] = speciesData[species][SpeciesWildItemCommon] || 0 origdata["item1"] = speciesData[species][SpeciesData::WILD_ITEM_COMMON] || 0
origdata["item2"] = speciesData[species][SpeciesWildItemUncommon] || 0 origdata["item2"] = speciesData[species][SpeciesData::WILD_ITEM_UNCOMMON] || 0
origdata["item3"] = speciesData[species][SpeciesWildItemRare] || 0 origdata["item3"] = speciesData[species][SpeciesData::WILD_ITEM_RARE] || 0
origdata["incense"] = speciesData[species][SpeciesIncense] || 0 origdata["incense"] = speciesData[species][SpeciesData::INCENSE] || 0
abilities = speciesData[i][SpeciesAbilities] abilities = speciesData[i][SpeciesData::ABILITIES]
if abilities.is_a?(Array) if abilities.is_a?(Array)
ability1 = abilities[0] || 0 ability1 = abilities[0] || 0
ability2 = abilities[1] || 0 ability2 = abilities[1] || 0
@@ -962,17 +962,17 @@ def pbSavePokemonFormsData
if ability1==origdata["ability1"] && ability2==origdata["ability2"] if ability1==origdata["ability1"] && ability2==origdata["ability2"]
ability1 = ability2 = nil ability1 = ability2 = nil
end end
color = speciesData[i][SpeciesColor] || 0 color = speciesData[i][SpeciesData::COLOR] || 0
color = nil if color==origdata["color"] color = nil if color==origdata["color"]
habitat = speciesData[i][SpeciesHabitat] || 0 habitat = speciesData[i][SpeciesData::HABITAT] || 0
habitat = nil if habitat==origdata["habitat"] habitat = nil if habitat==origdata["habitat"]
type1 = speciesData[i][SpeciesType1] || 0 type1 = speciesData[i][SpeciesData::TYPE1] || 0
type2 = speciesData[i][SpeciesType2] || type1 type2 = speciesData[i][SpeciesData::TYPE2] || type1
if type1==origdata["type1"] && type2==origdata["type2"] if type1==origdata["type1"] && type2==origdata["type2"]
type1 = type2 = nil type1 = type2 = nil
end end
if speciesData[i][SpeciesBaseStats] if speciesData[i][SpeciesData::BASE_STATS]
basestats = speciesData[i][SpeciesBaseStats].clone basestats = speciesData[i][SpeciesData::BASE_STATS].clone
else else
basestats = [1,1,1,1,1,1] basestats = [1,1,1,1,1,1]
end end
@@ -982,20 +982,20 @@ def pbSavePokemonFormsData
diff = true; break diff = true; break
end end
basestats = nil if !diff basestats = nil if !diff
rareness = speciesData[i][SpeciesRareness] || 0 rareness = speciesData[i][SpeciesData::RARENESS] || 0
rareness = nil if rareness==origdata["rareness"] rareness = nil if rareness==origdata["rareness"]
shape = speciesData[i][SpeciesShape] || 0 shape = speciesData[i][SpeciesData::SHAPE] || 0
shape = nil if shape==origdata["shape"] shape = nil if shape==origdata["shape"]
gender = speciesData[i][SpeciesGenderRate] || 0 gender = speciesData[i][SpeciesData::GENDER_RATE] || 0
gender = nil if gender==origdata["gender"] gender = nil if gender==origdata["gender"]
happiness = speciesData[i][SpeciesHappiness] || 0 happiness = speciesData[i][SpeciesData::HAPPINESS] || 0
happiness = nil if happiness==origdata["happiness"] happiness = nil if happiness==origdata["happiness"]
growthrate = speciesData[i][SpeciesGrowthRate] || 0 growthrate = speciesData[i][SpeciesData::GROWTH_RATE] || 0
growthrate = nil if growthrate==origdata["growthrate"] growthrate = nil if growthrate==origdata["growthrate"]
stepstohatch = speciesData[i][SpeciesStepsToHatch] || 1 stepstohatch = speciesData[i][SpeciesData::STEPS_TO_HATCH] || 1
stepstohatch = nil if stepstohatch==origdata["stepstohatch"] stepstohatch = nil if stepstohatch==origdata["stepstohatch"]
if speciesData[i][SpeciesEffortPoints] if speciesData[i][SpeciesData::EFFORT_POINTS]
effort = speciesData[i][SpeciesEffortPoints].clone effort = speciesData[i][SpeciesData::EFFORT_POINTS].clone
else else
effort = [0,0,0,0,0,0] effort = [0,0,0,0,0,0]
end end
@@ -1005,7 +1005,7 @@ def pbSavePokemonFormsData
diff = true; break diff = true; break
end end
effort = nil if !diff effort = nil if !diff
compats = speciesData[i][SpeciesCompatibility] compats = speciesData[i][SpeciesData::COMPATIBILITY]
if compats.is_a?(Array) if compats.is_a?(Array)
compat1 = compats[0] || 0 compat1 = compats[0] || 0
compat2 = compats[1] || compat1 compat2 = compats[1] || compat1
@@ -1016,13 +1016,13 @@ def pbSavePokemonFormsData
if compat1==origdata["compat1"] && compat2==origdata["compat2"] if compat1==origdata["compat1"] && compat2==origdata["compat2"]
compat1 = compat2 = nil compat1 = compat2 = nil
end end
height = speciesData[i][SpeciesHeight] || 1 height = speciesData[i][SpeciesData::HEIGHT] || 1
height = nil if height==origdata["height"] height = nil if height==origdata["height"]
weight = speciesData[i][SpeciesWeight] || 1 weight = speciesData[i][SpeciesData::WEIGHT] || 1
weight = nil if weight==origdata["weight"] weight = nil if weight==origdata["weight"]
baseexp = speciesData[i][SpeciesBaseExp] || 0 baseexp = speciesData[i][SpeciesData::BASE_EXP] || 0
baseexp = nil if baseexp==origdata["baseexp"] baseexp = nil if baseexp==origdata["baseexp"]
hiddenAbils = speciesData[i][SpeciesHiddenAbility] hiddenAbils = speciesData[i][SpeciesData::HIDDEN_ABILITY]
if hiddenAbils.is_a?(Array) if hiddenAbils.is_a?(Array)
hiddenability1 = hiddenAbils[0] || 0 hiddenability1 = hiddenAbils[0] || 0
hiddenability2 = hiddenAbils[1] || 0 hiddenability2 = hiddenAbils[1] || 0
@@ -1040,19 +1040,19 @@ def pbSavePokemonFormsData
hiddenability4==origdata["hiddenability4"] hiddenability4==origdata["hiddenability4"]
hiddenability1 = hiddenability2 = hiddenability3 = hiddenability4 = nil hiddenability1 = hiddenability2 = hiddenability3 = hiddenability4 = nil
end end
item1 = speciesData[i][SpeciesWildItemCommon] || 0 item1 = speciesData[i][SpeciesData::WILD_ITEM_COMMON] || 0
item2 = speciesData[i][SpeciesWildItemUncommon] || 0 item2 = speciesData[i][SpeciesData::WILD_ITEM_UNCOMMON] || 0
item3 = speciesData[i][SpeciesWildItemRare] || 0 item3 = speciesData[i][SpeciesData::WILD_ITEM_RARE] || 0
if item1==origdata["item1"] && item2==origdata["item2"] && item3==origdata["item3"] if item1==origdata["item1"] && item2==origdata["item2"] && item3==origdata["item3"]
item1 = item2 = item3 = nil item1 = item2 = item3 = nil
end end
incense = speciesData[i][SpeciesIncense] || 0 incense = speciesData[i][SpeciesData::INCENSE] || 0
incense = nil if incense==origdata["incense"] incense = nil if incense==origdata["incense"]
pokedexform = speciesData[i][SpeciesPokedexForm] || 0 # No nil check pokedexform = speciesData[i][SpeciesData::POKEDEX_FORM] || 0 # No nil check
megastone = speciesData[i][SpeciesMegaStone] || 0 # No nil check megastone = speciesData[i][SpeciesData::MEGA_STONE] || 0 # No nil check
megamove = speciesData[i][SpeciesMegaMove] || 0 # No nil check megamove = speciesData[i][SpeciesData::MEGA_MOVE] || 0 # No nil check
unmega = speciesData[i][SpeciesUnmegaForm] || 0 # No nil check unmega = speciesData[i][SpeciesData::UNMEGA_FORM] || 0 # No nil check
megamessage = speciesData[i][SpeciesMegaMessage] || 0 # No nil check megamessage = speciesData[i][SpeciesData::MEGA_MESSAGE] || 0 # No nil check
pokedata.write("\#-------------------------------\r\n") pokedata.write("\#-------------------------------\r\n")
pokedata.write("[#{cname},#{form}]\r\n") pokedata.write("[#{cname},#{form}]\r\n")
pokedata.write("FormName = #{formname}\r\n") if formname && formname!="" pokedata.write("FormName = #{formname}\r\n") if formname && formname!=""
@@ -1253,8 +1253,8 @@ def pbSavePokemonFormsData
pokedata.write(met+" = #{metrics[j][i] || 0}\r\n") pokedata.write(met+" = #{metrics[j][i] || 0}\r\n")
end end
end end
if metrics[MetricBattlerShadowSize][i]!=metrics[MetricBattlerShadowSize][species] if metrics[SpeciesData::METRIC_SHADOW_SIZE][i]!=metrics[SpeciesData::METRIC_SHADOW_SIZE][species]
pokedata.write("BattlerShadowSize = #{metrics[MetricBattlerShadowSize][i] || 2}\r\n") pokedata.write("BattlerShadowSize = #{metrics[SpeciesData::METRIC_SHADOW_SIZE][i] || 2}\r\n")
end end
end end
origevos = [] origevos = []

View File

@@ -18,18 +18,18 @@ def pbAutoPositionAll
Graphics.update if i%50==0 Graphics.update if i%50==0
bitmap1 = pbLoadSpeciesBitmap(s[0],false,s[1],false,false,true) bitmap1 = pbLoadSpeciesBitmap(s[0],false,s[1],false,false,true)
bitmap2 = pbLoadSpeciesBitmap(s[0],false,s[1]) bitmap2 = pbLoadSpeciesBitmap(s[0],false,s[1])
metrics[MetricBattlerPlayerX][i] = 0 # Player's x metrics[SpeciesData::METRIC_PLAYER_X][i] = 0 # Player's x
if bitmap1 && bitmap1.bitmap # Player's y if bitmap1 && bitmap1.bitmap # Player's y
metrics[MetricBattlerPlayerY][i] = (bitmap1.height-(findBottom(bitmap1.bitmap)+1))/2 metrics[SpeciesData::METRIC_PLAYER_Y][i] = (bitmap1.height-(findBottom(bitmap1.bitmap)+1))/2
end end
metrics[MetricBattlerEnemyX][i] = 0 # Foe's x metrics[SpeciesData::METRIC_ENEMY_X][i] = 0 # Foe's x
if bitmap2 && bitmap2.bitmap # Foe's y if bitmap2 && bitmap2.bitmap # Foe's y
metrics[MetricBattlerEnemyY][i] = (bitmap2.height-(findBottom(bitmap2.bitmap)+1))/2 metrics[SpeciesData::METRIC_ENEMY_Y][i] = (bitmap2.height-(findBottom(bitmap2.bitmap)+1))/2
metrics[MetricBattlerEnemyY][i] += 4 # Just because metrics[SpeciesData::METRIC_ENEMY_Y][i] += 4 # Just because
end end
metrics[MetricBattlerAltitude][i] = 0 # Foe's altitude, not used now metrics[SpeciesData::METRIC_ALTITUDE][i] = 0 # Foe's altitude, not used now
metrics[MetricBattlerShadowX][i] = 0 # Shadow's x metrics[SpeciesData::METRIC_SHADOW_X][i] = 0 # Shadow's x
metrics[MetricBattlerShadowSize][i] = 2 # Shadow size metrics[SpeciesData::METRIC_SHADOW_SIZE][i] = 2 # Shadow size
bitmap1.dispose if bitmap1 bitmap1.dispose if bitmap1
bitmap2.dispose if bitmap2 bitmap2.dispose if bitmap2
end end
@@ -139,18 +139,18 @@ class SpritePositioner
end end
def pbAutoPosition def pbAutoPosition
oldmetric1 = (@metrics[MetricBattlerPlayerY][@species] || 0) oldmetric1 = (@metrics[SpeciesData::METRIC_PLAYER_Y][@species] || 0)
oldmetric3 = (@metrics[MetricBattlerEnemyY][@species] || 0) oldmetric3 = (@metrics[SpeciesData::METRIC_ENEMY_Y][@species] || 0)
oldmetric4 = (@metrics[MetricBattlerAltitude][@species] || 0) oldmetric4 = (@metrics[SpeciesData::METRIC_ALTITUDE][@species] || 0)
bitmap1 = @sprites["pokemon_0"].bitmap bitmap1 = @sprites["pokemon_0"].bitmap
bitmap2 = @sprites["pokemon_1"].bitmap bitmap2 = @sprites["pokemon_1"].bitmap
newmetric1 = (bitmap1.height-(findBottom(bitmap1)+1))/2 newmetric1 = (bitmap1.height-(findBottom(bitmap1)+1))/2
newmetric3 = (bitmap2.height-(findBottom(bitmap2)+1))/2 newmetric3 = (bitmap2.height-(findBottom(bitmap2)+1))/2
newmetric3 += 4 # Just because newmetric3 += 4 # Just because
if newmetric1!=oldmetric1 || newmetric3!=oldmetric3 || oldmetric4!=0 if newmetric1!=oldmetric1 || newmetric3!=oldmetric3 || oldmetric4!=0
@metrics[MetricBattlerPlayerY][@species] = newmetric1 @metrics[SpeciesData::METRIC_PLAYER_Y][@species] = newmetric1
@metrics[MetricBattlerEnemyY][@species] = newmetric3 @metrics[SpeciesData::METRIC_ENEMY_Y][@species] = newmetric3
@metrics[MetricBattlerAltitude][@species] = 0 @metrics[SpeciesData::METRIC_ALTITUDE][@species] = 0
@metricsChanged = true @metricsChanged = true
refresh refresh
end end
@@ -167,7 +167,7 @@ class SpritePositioner
def pbShadowSize def pbShadowSize
pbChangeSpecies(@species) pbChangeSpecies(@species)
refresh refresh
oldval = (@metrics[MetricBattlerShadowSize][@species] || 2) oldval = (@metrics[SpeciesData::METRIC_SHADOW_SIZE][@species] || 2)
cmdvals = [0]; commands = [_INTL("None")] cmdvals = [0]; commands = [_INTL("None")]
defindex = 0 defindex = 0
i = 0 i = 0
@@ -190,17 +190,17 @@ class SpritePositioner
self.update self.update
if cw.index!=oldindex if cw.index!=oldindex
oldindex = cw.index oldindex = cw.index
@metrics[MetricBattlerShadowSize][@species] = cmdvals[cw.index] @metrics[SpeciesData::METRIC_SHADOW_SIZE][@species] = cmdvals[cw.index]
pbChangeSpecies(@species) pbChangeSpecies(@species)
refresh refresh
end end
if Input.trigger?(Input::A) # Cycle to next option if Input.trigger?(Input::A) # Cycle to next option
pbPlayDecisionSE pbPlayDecisionSE
@metricsChanged = true if @metrics[MetricBattlerShadowSize][@species]!=oldval @metricsChanged = true if @metrics[SpeciesData::METRIC_SHADOW_SIZE][@species]!=oldval
ret = true ret = true
break break
elsif Input.trigger?(Input::B) elsif Input.trigger?(Input::B)
@metrics[MetricBattlerShadowSize][@species] = oldval @metrics[SpeciesData::METRIC_SHADOW_SIZE][@species] = oldval
pbPlayCancelSE pbPlayCancelSE
break break
elsif Input.trigger?(Input::C) elsif Input.trigger?(Input::C)
@@ -223,15 +223,15 @@ class SpritePositioner
case param case param
when 0 when 0
sprite = @sprites["pokemon_0"] sprite = @sprites["pokemon_0"]
xpos = (@metrics[MetricBattlerPlayerX][@species] || 0) xpos = (@metrics[SpeciesData::METRIC_PLAYER_X][@species] || 0)
ypos = (@metrics[MetricBattlerPlayerY][@species] || 0) ypos = (@metrics[SpeciesData::METRIC_PLAYER_Y][@species] || 0)
when 1 when 1
sprite = @sprites["pokemon_1"] sprite = @sprites["pokemon_1"]
xpos = (@metrics[MetricBattlerEnemyX][@species] || 0) xpos = (@metrics[SpeciesData::METRIC_ENEMY_X][@species] || 0)
ypos = (@metrics[MetricBattlerEnemyY][@species] || 0) ypos = (@metrics[SpeciesData::METRIC_ENEMY_Y][@species] || 0)
when 3 when 3
sprite = @sprites["shadow_1"] sprite = @sprites["shadow_1"]
xpos = (@metrics[MetricBattlerShadowX][@species] || 0) xpos = (@metrics[SpeciesData::METRIC_SHADOW_X][@species] || 0)
ypos = 0 ypos = 0
end end
oldxpos = xpos oldxpos = xpos
@@ -251,32 +251,32 @@ class SpritePositioner
if Input.repeat?(Input::UP) && param!=3 if Input.repeat?(Input::UP) && param!=3
ypos -= 1 ypos -= 1
case param case param
when 0; @metrics[MetricBattlerPlayerY][@species] = ypos when 0; @metrics[SpeciesData::METRIC_PLAYER_Y][@species] = ypos
when 1; @metrics[MetricBattlerEnemyY][@species] = ypos when 1; @metrics[SpeciesData::METRIC_ENEMY_Y][@species] = ypos
end end
refresh refresh
elsif Input.repeat?(Input::DOWN) && param!=3 elsif Input.repeat?(Input::DOWN) && param!=3
ypos += 1 ypos += 1
case param case param
when 0; @metrics[MetricBattlerPlayerY][@species] = ypos when 0; @metrics[SpeciesData::METRIC_PLAYER_Y][@species] = ypos
when 1; @metrics[MetricBattlerEnemyY][@species] = ypos when 1; @metrics[SpeciesData::METRIC_ENEMY_Y][@species] = ypos
end end
refresh refresh
end end
if Input.repeat?(Input::LEFT) if Input.repeat?(Input::LEFT)
xpos -= 1 xpos -= 1
case param case param
when 0; @metrics[MetricBattlerPlayerX][@species] = xpos when 0; @metrics[SpeciesData::METRIC_PLAYER_X][@species] = xpos
when 1; @metrics[MetricBattlerEnemyX][@species] = xpos when 1; @metrics[SpeciesData::METRIC_ENEMY_X][@species] = xpos
when 3; @metrics[MetricBattlerShadowX][@species] = xpos when 3; @metrics[SpeciesData::METRIC_SHADOW_X][@species] = xpos
end end
refresh refresh
elsif Input.repeat?(Input::RIGHT) elsif Input.repeat?(Input::RIGHT)
xpos += 1 xpos += 1
case param case param
when 0; @metrics[MetricBattlerPlayerX][@species] = xpos when 0; @metrics[SpeciesData::METRIC_PLAYER_X][@species] = xpos
when 1; @metrics[MetricBattlerEnemyX][@species] = xpos when 1; @metrics[SpeciesData::METRIC_ENEMY_X][@species] = xpos
when 3; @metrics[MetricBattlerShadowX][@species] = xpos when 3; @metrics[SpeciesData::METRIC_SHADOW_X][@species] = xpos
end end
refresh refresh
end end
@@ -288,13 +288,13 @@ class SpritePositioner
elsif Input.repeat?(Input::B) elsif Input.repeat?(Input::B)
case param case param
when 0 when 0
@metrics[MetricBattlerPlayerX][@species] = oldxpos @metrics[SpeciesData::METRIC_PLAYER_X][@species] = oldxpos
@metrics[MetricBattlerPlayerY][@species] = oldypos @metrics[SpeciesData::METRIC_PLAYER_Y][@species] = oldypos
when 1 when 1
@metrics[MetricBattlerEnemyX][@species] = oldxpos @metrics[SpeciesData::METRIC_ENEMY_X][@species] = oldxpos
@metrics[MetricBattlerEnemyY][@species] = oldypos @metrics[SpeciesData::METRIC_ENEMY_Y][@species] = oldypos
when 3 when 3
@metrics[MetricBattlerShadowX][@species] = oldxpos @metrics[SpeciesData::METRIC_SHADOW_X][@species] = oldxpos
end end
pbPlayCancelSE pbPlayCancelSE
refresh refresh

View File

@@ -702,8 +702,8 @@ end
#=============================================================================== #===============================================================================
def pbCompilePokemonData def pbCompilePokemonData
# Get schemas. # Get schemas.
requiredValues = PokemonSpeciesData.requiredValues requiredValues = SpeciesData.requiredValues
optionalValues = PokemonSpeciesData.optionalValues optionalValues = SpeciesData.optionalValues
# Prepare arrays for compiled data. # Prepare arrays for compiled data.
speciesData = [] speciesData = []
movesets = [] movesets = []
@@ -839,7 +839,7 @@ def pbCompilePokemonData
save_data(regionalDexes,"Data/regional_dexes.dat") save_data(regionalDexes,"Data/regional_dexes.dat")
# Save metrics data. # Save metrics data.
for i in 0...7 for i in 0...7
defaultValue = (i==MetricBattlerShadowSize) ? 2 : 0 # Shadow size 2, other metrics 0 defaultValue = (i==SpeciesData::METRIC_SHADOW_SIZE) ? 2 : 0 # Shadow size 2, other metrics 0
for j in 0..maxValue for j in 0..maxValue
spriteMetrics[i] = [] if !spriteMetrics[i] spriteMetrics[i] = [] if !spriteMetrics[i]
spriteMetrics[i][j] ||= defaultValue spriteMetrics[i][j] ||= defaultValue
@@ -895,8 +895,8 @@ end
#=============================================================================== #===============================================================================
def pbCompilePokemonForms def pbCompilePokemonForms
# Get schemas. # Get schemas.
requiredValues = PokemonSpeciesData.requiredValues(true) requiredValues = SpeciesData.requiredValues(true)
optionalValues = PokemonSpeciesData.optionalValues(true) optionalValues = SpeciesData.optionalValues(true)
# Prepare arrays for compiled data. # Prepare arrays for compiled data.
speciesData = pbLoadSpeciesData speciesData = pbLoadSpeciesData
movesets = [] movesets = []
@@ -966,9 +966,9 @@ def pbCompilePokemonForms
if (contents["WildItemCommon"] && contents["WildItemCommon"]!="") || if (contents["WildItemCommon"] && contents["WildItemCommon"]!="") ||
(contents["WildItemUncommon"] && contents["WildItemUncommon"]!="") || (contents["WildItemUncommon"] && contents["WildItemUncommon"]!="") ||
(contents["WildItemRare"] && contents["WildItemRare"]!="") (contents["WildItemRare"] && contents["WildItemRare"]!="")
speciesData[speciesID][SpeciesWildItemCommon] = nil speciesData[speciesID][SpeciesData::WILD_ITEM_COMMON] = nil
speciesData[speciesID][SpeciesWildItemUncommon] = nil speciesData[speciesID][SpeciesData::WILD_ITEM_UNCOMMON] = nil
speciesData[speciesID][SpeciesWildItemRare] = nil speciesData[speciesID][SpeciesData::WILD_ITEM_RARE] = nil
end end
# Go through hashes of compilable data and compile this section. # Go through hashes of compilable data and compile this section.
[requiredValues,optionalValues].each do |hash| [requiredValues,optionalValues].each do |hash|
@@ -1051,7 +1051,7 @@ def pbCompilePokemonForms
# Inherit base form metrics data. # Inherit base form metrics data.
newSpriteMetrics = pbLoadSpeciesMetrics newSpriteMetrics = pbLoadSpeciesMetrics
for i in 0...7 for i in 0...7
defaultValue = (i==MetricBattlerShadowSize) ? 2 : 0 # Shadow size 2, other metrics 0 defaultValue = (i==SpeciesData::METRIC_SHADOW_SIZE) ? 2 : 0 # Shadow size 2, other metrics 0
pbAppendToBaseFormData(PBSpecies.maxValue+1,maxValue,newSpriteMetrics[i], pbAppendToBaseFormData(PBSpecies.maxValue+1,maxValue,newSpriteMetrics[i],
spriteMetrics[i] || [],speciesToForm,false,defaultValue) spriteMetrics[i] || [],speciesToForm,false,defaultValue)
end end