Changed format of "EVs" property in pokemon.txt/pokemon_forms.txt

This commit is contained in:
Maruno17
2022-03-09 23:03:02 +00:00
parent 91f8d06797
commit a0612b907f
13 changed files with 4163 additions and 4121 deletions

View File

@@ -78,7 +78,7 @@ module GameData
"Pokedex" => [0, "q"],
"Types" => [0, "eE", :Type, :Type],
"BaseStats" => [0, "vvvvvv"],
"EVs" => [0, "uuuuuu"],
"EVs" => [0, "*ev", :Stat],
"BaseExp" => [0, "v"],
"CatchRate" => [0, "u"],
"Happiness" => [0, "u"],
@@ -114,7 +114,7 @@ module GameData
"Compatibility" => [0, "*e", :EggGroup],
"Kind" => [0, "s"],
"BaseEXP" => [0, "v"],
"EffortPoints" => [0, "uuuuuu"],
"EffortPoints" => [0, "*ev", :Stat],
"HiddenAbility" => [0, "*e", :Ability],
"StepsToHatch" => [0, "v"]
}

View File

@@ -623,17 +623,34 @@ module Compiler
next if nil_or_empty?(contents[key])
FileLineData.setSection(species_id, key, contents[key]) # For error reporting
# Compile value for key
value = pbGetCsvRecord(contents[key], key, schema[key])
if ["EVs", "EffortPoints"].include?(key) && contents[key].split(",")[0].numeric?
value = pbGetCsvRecord(contents[key], key, [0, "uuuuuu"]) # Old format
else
value = pbGetCsvRecord(contents[key], key, schema[key])
end
value = nil if value.is_a?(Array) && value.empty?
contents[key] = value
# Sanitise data
case key
when "BaseStats", "EVs", "EffortPoints"
when "BaseStats"
value_hash = {}
GameData::Stat.each_main do |s|
value_hash[s.id] = value[s.pbs_order] if s.pbs_order >= 0
end
contents[key] = value_hash
when "EVs", "EffortPoints"
if value[0].is_a?(Array) # New format
value_hash = {}
value.each { |val| value_hash[val[0]] = val[1] }
GameData::Stat.each_main { |s| value_hash[s.id] ||= 0 }
contents[key] = value_hash
else # Old format
value_hash = {}
GameData::Stat.each_main do |s|
value_hash[s.id] = value[s.pbs_order] if s.pbs_order >= 0
end
contents[key] = value_hash
end
when "Height", "Weight"
# Convert height/weight to 1 decimal place and multiply by 10
value = (value * 10).round
@@ -801,17 +818,34 @@ module Compiler
end
FileLineData.setSection(section_name, key, contents[key]) # For error reporting
# Compile value for key
value = pbGetCsvRecord(contents[key], key, schema[key])
if ["EVs", "EffortPoints"].include?(key) && contents[key].split(",")[0].numeric?
value = pbGetCsvRecord(contents[key], key, [0, "uuuuuu"]) # Old format
else
value = pbGetCsvRecord(contents[key], key, schema[key])
end
value = nil if value.is_a?(Array) && value.length == 0
contents[key] = value
# Sanitise data
case key
when "BaseStats", "EVs", "EffortPoints"
when "BaseStats"
value_hash = {}
GameData::Stat.each_main do |s|
value_hash[s.id] = value[s.pbs_order] if s.pbs_order >= 0
end
contents[key] = value_hash
when "EVs", "EffortPoints"
if value[0].is_a?(Array) # New format
value_hash = {}
value.each { |val| value_hash[val[0]] = val[1] }
GameData::Stat.each_main { |s| value_hash[s.id] ||= 0 }
contents[key] = value_hash
else # Old format
value_hash = {}
GameData::Stat.each_main do |s|
value_hash[s.id] = value[s.pbs_order] if s.pbs_order >= 0
end
contents[key] = value_hash
end
when "Height", "Weight"
# Convert height/weight to 1 decimal place and multiply by 10
value = (value * 10).round

View File

@@ -281,7 +281,7 @@ module Compiler
GameData::Stat.each_main do |s|
next if s.pbs_order < 0
stats_array[s.pbs_order] = species.base_stats[s.id]
evs_array[s.pbs_order] = species.evs[s.id]
evs_array.concat([s.id.to_s, species.evs[s.id]]) if species.evs[s.id] > 0
end
f.write(sprintf("BaseStats = %s\r\n", stats_array.join(",")))
f.write(sprintf("GenderRatio = %s\r\n", species.gender_ratio))
@@ -381,7 +381,7 @@ module Compiler
GameData::Stat.each_main do |s|
next if s.pbs_order < 0
stats_array[s.pbs_order] = species.base_stats[s.id]
evs_array[s.pbs_order] = species.evs[s.id]
evs_array.concat([s.id.to_s, species.evs[s.id]]) if species.evs[s.id] > 0
end
f.write(sprintf("BaseStats = %s\r\n", stats_array.join(","))) if species.base_stats != base_species.base_stats
f.write(sprintf("BaseExp = %d\r\n", species.base_exp)) if species.base_exp != base_species.base_exp