Split "Evolutions" line in PBS files into multiple "Evolution" lines

This commit is contained in:
Maruno17
2023-10-14 19:15:38 +01:00
parent 389d43941d
commit 5cab0f407d
12 changed files with 2013 additions and 1872 deletions

View File

@@ -101,9 +101,11 @@ module GameData
ret["WildItemUncommon"] = [:wild_item_uncommon, "*e", :Item]
ret["WildItemRare"] = [:wild_item_rare, "*e", :Item]
if compiling_forms
ret["Evolutions"] = [:evolutions, "*ees", :Species, :Evolution, nil]
ret["Evolutions"] = [:evolutions, "*ees", :Species, :Evolution]
ret["Evolution"] = [:evolutions, "^eeS", :Species, :Evolution]
else
ret["Evolutions"] = [:evolutions, "*ses", nil, :Evolution, nil]
ret["Evolutions"] = [:evolutions, "*ses", nil, :Evolution]
ret["Evolution"] = [:evolutions, "^seS", nil, :Evolution]
end
return ret
end
@@ -420,6 +422,8 @@ module GameData
when "Habitat"
ret = nil if ret == :None
when "Evolutions"
ret = nil # Want to use "Evolution" instead
when "Evolution"
if ret
ret = ret.reject { |evo| evo[3] } # Remove prevolutions
ret.each do |evo|

View File

@@ -308,6 +308,16 @@ module Compiler
# Convert height and weight to integer values of tenths of a unit
hash[:height] = [(hash[:height] * 10).round, 1].max if hash[:height]
hash[:weight] = [(hash[:weight] * 10).round, 1].max if hash[:weight]
# Ensure evolutions have a parameter if they need one (don't need to ensure
# the parameter makes sense; that happens below)
if hash[:evolutions]
hash[:evolutions].each do |evo|
FileLineData.setSection(hash[:id].to_s, "Evolution", "Evolution = #{evo[0]},#{evo[1]}") # For error reporting
param_type = GameData::Evolution.get(evo[1]).parameter
next if evo[2] || param_type.nil?
raise _INTL("Evolution method {1} requires a parameter, but none was given.", evo[1]) + "\n" + FileLineData.linereport
end
end
# Record all evolutions as not being prevolutions
if hash[:evolutions].is_a?(Array)
hash[:evolutions].each { |evo| evo[3] = false }