[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