[wip] generate fusions dynamically

This commit is contained in:
infinitefusion
2023-08-05 22:10:03 -04:00
parent 41acb265da
commit 9f44271b99
30 changed files with 283 additions and 36 deletions

View File

@@ -24,12 +24,28 @@ module GameData
# @return [self]
def get(other)
validate other => [Symbol, self, String, Integer]
return other if other.is_a?(self)
other = other.to_sym if other.is_a?(String)
# if other.is_a?(Integer)
# p "Please switch to symbols, thanks."
# end
if other.to_s.match?(/\AB\d+H\d+\z/)
species = GameData::FusedSpecies.new(other)
return species
end
if other.is_a?(Integer) #assume it's a species
if other > NB_POKEMON
body_id = getBodyID(other)
head_id = getHeadID(other,body_id)
pokemon_id = getFusedPokemonIdFromDexNum(body_id,head_id)
return GameData::FusedSpecies.new(pokemon_id)
end
end
raise "Unknown ID #{other}." unless self::DATA.has_key?(other)
#if other == :Species
# end
return self::DATA[other]
end

View File

@@ -59,18 +59,19 @@ module GameData
# @param form [Integer]
# @return [self, nil]
def self.get_species_form(species, form)
return nil if !species || !form
validate species => [Symbol, self, String, Integer]
validate form => Integer
# if other.is_a?(Integer)
# p "Please switch to symbols, thanks."
# end
species = species.species if species.is_a?(self)
species = DATA[species].species if species.is_a?(Integer)
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
return GameData::Species.get(species) rescue nil
# return nil if !species || !form
# validate species => [Symbol, self, String, Integer]
# validate form => Integer
# # if other.is_a?(Integer)
# # p "Please switch to symbols, thanks."
# # end
# species = species.species if species.is_a?(self)
# species = DATA[species].species if species.is_a?(Integer)
# 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 self.schema(compiling_forms = false)
@@ -191,22 +192,26 @@ module GameData
end
# @return [String] the translated name of this species
def name
return pbGetMessage(MessageTypes::Species, @id_number)
return @real_name
#return pbGetMessage(MessageTypes::Species, @id_number)
end
# @return [String] the translated name of this form of this species
def form_name
return pbGetMessage(MessageTypes::FormNames, @id_number)
return @real_form_name
#return pbGetMessage(MessageTypes::FormNames, @id_number)
end
# @return [String] the translated Pokédex category of this species
def category
return pbGetMessage(MessageTypes::Kinds, @id_number)
return @real_category
#return pbGetMessage(MessageTypes::Kinds, @id_number)
end
# @return [String] the translated Pokédex entry of this species
def pokedex_entry
return pbGetMessage(MessageTypes::Entries, @id_number)
return @real_pokedex_entry
#return pbGetMessage(MessageTypes::Entries, @id_number)
end
def is_fusion

View File

@@ -210,10 +210,10 @@ module GameData
species_data = GameData::Species.get(getHeadID(species_data))
end
if form > 0
ret = sprintf("Cries/%s_%d", species_data.species, form)
return ret if pbResolveAudioSE(ret)
end
# if form > 0
# ret = sprintf("Cries/%s_%d", species_data.species, form)
# return ret if pbResolveAudioSE(ret)
# end
ret = sprintf("Cries/%s", species_data.species)
return (pbResolveAudioSE(ret)) ? ret : nil
end