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
return species_data[s][species_data_type] if species_data[s] && species_data[s][species_data_type]
case species_data_type
when SpeciesType2; return nil
when SpeciesBaseStats; return [1, 1, 1, 1, 1, 1]
when SpeciesEffortPoints; return [0, 0, 0, 0, 0, 0]
when SpeciesStepsToHatch, SpeciesHeight, SpeciesWeight; return 1
when SpeciesData::TYPE2; return nil
when SpeciesData::BASE_STATS; return [1, 1, 1, 1, 1, 1]
when SpeciesData::EFFORT_POINTS; return [0, 0, 0, 0, 0, 0]
when SpeciesData::STEPS_TO_HATCH, SpeciesData::HEIGHT, SpeciesData::WEIGHT
return 1
end
return 0
end

View File

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