mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 21:24:59 +00:00
shadow_pokemon.txt now supports sections for individual forms of a species
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
module GameData
|
||||
class ShadowPokemon
|
||||
attr_reader :id
|
||||
attr_reader :species
|
||||
attr_reader :form
|
||||
attr_reader :moves
|
||||
attr_reader :gauge_size
|
||||
attr_reader :flags
|
||||
@@ -12,7 +14,7 @@ module GameData
|
||||
OPTIONAL = true
|
||||
|
||||
SCHEMA = {
|
||||
"SectionName" => [:id, "e", :Species],
|
||||
"SectionName" => [:id, "eV", :Species],
|
||||
"GaugeSize" => [:gauge_size, "v"],
|
||||
"Moves" => [:moves, "*e", :Move],
|
||||
"Flags" => [:flags, "*s"]
|
||||
@@ -27,8 +29,24 @@ module GameData
|
||||
__orig__load if safeExists?("Data/#{self::DATA_FILENAME}")
|
||||
end
|
||||
|
||||
# @param species [Symbol, self, String]
|
||||
# @param form [Integer]
|
||||
# @return [self, nil]
|
||||
def self.get_species_form(species, form)
|
||||
return nil if !species || !form
|
||||
validate species => [Symbol, self, String]
|
||||
validate form => Integer
|
||||
species = species.species if species.is_a?(self)
|
||||
species = species.to_sym if species.is_a?(String)
|
||||
trial = sprintf("%s_%d", species, form).to_sym
|
||||
species_form = (DATA[trial].nil?) ? species : trial
|
||||
return (DATA.has_key?(species_form)) ? DATA[species_form] : nil
|
||||
end
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@species = hash[:species] || @id
|
||||
@form = hash[:form] || 0
|
||||
@gauge_size = hash[:gauge_size] || HEART_GAUGE_SIZE
|
||||
@moves = hash[:moves] || []
|
||||
@flags = hash[:flags] || []
|
||||
@@ -38,5 +56,15 @@ module GameData
|
||||
def has_flag?(flag)
|
||||
return @flags.any? { |f| f.downcase == flag.downcase }
|
||||
end
|
||||
|
||||
alias __orig__get_property_for_PBS get_property_for_PBS unless method_defined?(:__orig__get_property_for_PBS)
|
||||
def get_property_for_PBS(key)
|
||||
ret = __orig__get_property_for_PBS(key)
|
||||
case key
|
||||
when "SectionName"
|
||||
ret = [@species, (@form > 0) ? @form : nil]
|
||||
end
|
||||
return ret
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -30,9 +30,7 @@ class Pokemon
|
||||
end
|
||||
|
||||
def shadow_data
|
||||
ret = GameData::ShadowPokemon.try_get(species_data.id)
|
||||
ret = GameData::ShadowPokemon.try_get(@species) if !ret
|
||||
return ret
|
||||
return GameData::ShadowPokemon.get_species_form(@species, form_simple)
|
||||
end
|
||||
|
||||
def max_gauge_size
|
||||
|
||||
@@ -551,6 +551,16 @@ module Compiler
|
||||
end
|
||||
|
||||
def validate_compiled_shadow_pokemon(hash)
|
||||
# Split species and form into their own values, generate compound ID from them
|
||||
if hash[:id].is_a?(Array)
|
||||
hash[:species] = hash[:id][0]
|
||||
hash[:form] = hash[:id][1] || 0
|
||||
if hash[:form] == 0
|
||||
hash[:id] = hash[:species]
|
||||
else
|
||||
hash[:id] = sprintf("%s_%d", hash[:species].to_s, hash[:form]).to_sym
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def validate_all_compiled_shadow_pokemon
|
||||
|
||||
Reference in New Issue
Block a user