Merge branch 'dev' into ai

This commit is contained in:
Maruno17
2022-12-31 17:28:56 +00:00
75 changed files with 4599 additions and 3590 deletions

View File

@@ -2,7 +2,6 @@
# Data caches.
#===============================================================================
class Game_Temp
attr_accessor :town_map_data
attr_accessor :regional_dexes_data
attr_accessor :battle_animations_data
attr_accessor :move_to_battle_animation_data
@@ -11,7 +10,6 @@ end
def pbClearData
if $game_temp
$game_temp.town_map_data = nil
$game_temp.regional_dexes_data = nil
$game_temp.battle_animations_data = nil
$game_temp.move_to_battle_animation_data = nil
@@ -24,17 +22,6 @@ def pbClearData
end
end
#===============================================================================
# Method to get Town Map data.
#===============================================================================
def pbLoadTownMapData
$game_temp = Game_Temp.new if !$game_temp
if !$game_temp.town_map_data
$game_temp.town_map_data = load_data("Data/town_map.dat")
end
return $game_temp.town_map_data
end
#===============================================================================
# Method to get Regional Dexes data.
#===============================================================================

View File

@@ -0,0 +1,43 @@
module GameData
class TownMap
attr_reader :id
attr_reader :real_name
attr_reader :filename
attr_reader :point
attr_reader :flags
attr_reader :pbs_file_suffix
DATA = {}
DATA_FILENAME = "town_map.dat"
PBS_BASE_FILENAME = "town_map"
SCHEMA = {
"SectionName" => [:id, "u"],
"Name" => [:real_name, "s"],
"Filename" => [:filename, "s"],
"Point" => [:point, "^uussUUUU"],
"Flags" => [:flags, "*s"]
}
extend ClassMethodsIDNumbers
include InstanceMethods
def initialize(hash)
@id = hash[:id]
@real_name = hash[:real_name] || "???"
@filename = hash[:filename]
@point = hash[:point] || []
@flags = hash[:flags] || []
@pbs_file_suffix = hash[:pbs_file_suffix] || ""
end
# @return [String] the translated name of this region
def name
return pbGetMessage(MessageTypes::RegionNames, @id)
end
def has_flag?(flag)
return @flags.any? { |f| f.downcase == flag.downcase }
end
end
end

View File

@@ -1,140 +0,0 @@
module GameData
class Type
attr_reader :id
attr_reader :real_name
attr_reader :special_type
attr_reader :pseudo_type
attr_reader :flags
attr_reader :weaknesses
attr_reader :resistances
attr_reader :immunities
attr_reader :icon_position # Where this type's icon is within types.png
DATA = {}
DATA_FILENAME = "types.dat"
SCHEMA = {
"Name" => [0, "s"],
"InternalName" => [0, "s"],
"IsSpecialType" => [0, "b"],
"IsPseudoType" => [0, "b"],
"Flags" => [0, "*s"],
"Weaknesses" => [0, "*s"],
"Resistances" => [0, "*s"],
"Immunities" => [0, "*s"],
"IconPosition" => [0, "u"]
}
extend ClassMethodsSymbols
include InstanceMethods
def initialize(hash)
@id = hash[:id]
@real_name = hash[:name] || "Unnamed"
@special_type = hash[:special_type] || false
@pseudo_type = hash[:pseudo_type] || false
@flags = hash[:flags] || []
@weaknesses = hash[:weaknesses] || []
@weaknesses = [@weaknesses] if !@weaknesses.is_a?(Array)
@resistances = hash[:resistances] || []
@resistances = [@resistances] if !@resistances.is_a?(Array)
@immunities = hash[:immunities] || []
@immunities = [@immunities] if !@immunities.is_a?(Array)
@icon_position = hash[:icon_position] || 0
end
# @return [String] the translated name of this item
def name
return pbGetMessageFromHash(MessageTypes::Types, @real_name)
end
def physical?; return !@special_type; end
def special?; return @special_type; end
def has_flag?(flag)
return @flags.any? { |f| f.downcase == flag.downcase }
end
def effectiveness(other_type)
return Effectiveness::NORMAL_EFFECTIVE_ONE if !other_type
return Effectiveness::SUPER_EFFECTIVE_ONE if @weaknesses.include?(other_type)
return Effectiveness::NOT_VERY_EFFECTIVE_ONE if @resistances.include?(other_type)
return Effectiveness::INEFFECTIVE if @immunities.include?(other_type)
return Effectiveness::NORMAL_EFFECTIVE_ONE
end
end
end
#===============================================================================
module Effectiveness
INEFFECTIVE = 0
NOT_VERY_EFFECTIVE_ONE = 1
NORMAL_EFFECTIVE_ONE = 2
SUPER_EFFECTIVE_ONE = 4
NORMAL_EFFECTIVE = NORMAL_EFFECTIVE_ONE**3
module_function
def ineffective?(value)
return value == INEFFECTIVE
end
def not_very_effective?(value)
return value > INEFFECTIVE && value < NORMAL_EFFECTIVE
end
def resistant?(value)
return value < NORMAL_EFFECTIVE
end
def normal?(value)
return value == NORMAL_EFFECTIVE
end
def super_effective?(value)
return value > NORMAL_EFFECTIVE
end
def ineffective_type?(attack_type, defend_type1, defend_type2 = nil, defend_type3 = nil)
value = calculate(attack_type, defend_type1, defend_type2, defend_type3)
return ineffective?(value)
end
def not_very_effective_type?(attack_type, defend_type1, defend_type2 = nil, defend_type3 = nil)
value = calculate(attack_type, defend_type1, defend_type2, defend_type3)
return not_very_effective?(value)
end
def resistant_type?(attack_type, defend_type1, defend_type2 = nil, defend_type3 = nil)
value = calculate(attack_type, defend_type1, defend_type2, defend_type3)
return resistant?(value)
end
def normal_type?(attack_type, defend_type1, defend_type2 = nil, defend_type3 = nil)
value = calculate(attack_type, defend_type1, defend_type2, defend_type3)
return normal?(value)
end
def super_effective_type?(attack_type, defend_type1, defend_type2 = nil, defend_type3 = nil)
value = calculate(attack_type, defend_type1, defend_type2, defend_type3)
return super_effective?(value)
end
def calculate_one(attack_type, defend_type)
return GameData::Type.get(defend_type).effectiveness(attack_type)
end
def calculate(attack_type, defend_type1, defend_type2 = nil, defend_type3 = nil)
mod1 = (defend_type1) ? calculate_one(attack_type, defend_type1) : NORMAL_EFFECTIVE_ONE
mod2 = NORMAL_EFFECTIVE_ONE
mod3 = NORMAL_EFFECTIVE_ONE
if defend_type2 && defend_type1 != defend_type2
mod2 = calculate_one(attack_type, defend_type2)
end
if defend_type3 && defend_type1 != defend_type3 && defend_type2 != defend_type3
mod3 = calculate_one(attack_type, defend_type3)
end
return mod1 * mod2 * mod3
end
end

View File

@@ -0,0 +1,141 @@
module GameData
class Type
attr_reader :id
attr_reader :real_name
attr_reader :icon_position # Where this type's icon is within types.png
attr_reader :special_type
attr_reader :pseudo_type
attr_reader :weaknesses
attr_reader :resistances
attr_reader :immunities
attr_reader :flags
attr_reader :pbs_file_suffix
DATA = {}
DATA_FILENAME = "types.dat"
PBS_BASE_FILENAME = "types"
SCHEMA = {
"SectionName" => [:id, "m"],
"Name" => [:real_name, "s"],
"IconPosition" => [:icon_position, "u"],
"IsSpecialType" => [:special_type, "b"],
"IsPseudoType" => [:pseudo_type, "b"],
"Weaknesses" => [:weaknesses, "*m"],
"Resistances" => [:resistances, "*m"],
"Immunities" => [:immunities, "*m"],
"Flags" => [:flags, "*s"]
}
extend ClassMethodsSymbols
include InstanceMethods
def initialize(hash)
@id = hash[:id]
@real_name = hash[:real_name] || "Unnamed"
@icon_position = hash[:icon_position] || 0
@special_type = hash[:special_type] || false
@pseudo_type = hash[:pseudo_type] || false
@weaknesses = hash[:weaknesses] || []
@weaknesses = [@weaknesses] if !@weaknesses.is_a?(Array)
@resistances = hash[:resistances] || []
@resistances = [@resistances] if !@resistances.is_a?(Array)
@immunities = hash[:immunities] || []
@immunities = [@immunities] if !@immunities.is_a?(Array)
@flags = hash[:flags] || []
@pbs_file_suffix = hash[:pbs_file_suffix] || ""
end
# @return [String] the translated name of this item
def name
return pbGetMessageFromHash(MessageTypes::Types, @real_name)
end
def physical?; return !@special_type; end
def special?; return @special_type; end
def has_flag?(flag)
return @flags.any? { |f| f.downcase == flag.downcase }
end
def effectiveness(other_type)
return Effectiveness::NORMAL_EFFECTIVE if !other_type
return Effectiveness::SUPER_EFFECTIVE if @weaknesses.include?(other_type)
return Effectiveness::NOT_VERY_EFFECTIVE if @resistances.include?(other_type)
return Effectiveness::INEFFECTIVE if @immunities.include?(other_type)
return Effectiveness::NORMAL_EFFECTIVE
end
end
end
#===============================================================================
module Effectiveness
INEFFECTIVE = 0
NOT_VERY_EFFECTIVE = 1
NORMAL_EFFECTIVE = 2
SUPER_EFFECTIVE = 4
INEFFECTIVE_MULTIPLIER = INEFFECTIVE.to_f / NORMAL_EFFECTIVE
NOT_VERY_EFFECTIVE_MULTIPLIER = NOT_VERY_EFFECTIVE.to_f / NORMAL_EFFECTIVE
NORMAL_EFFECTIVE_MULTIPLIER = 1.0
SUPER_EFFECTIVE_MULTIPLIER = SUPER_EFFECTIVE.to_f / NORMAL_EFFECTIVE
module_function
def ineffective?(value)
return value == INEFFECTIVE_MULTIPLIER
end
def not_very_effective?(value)
return value > INEFFECTIVE_MULTIPLIER && value < NORMAL_EFFECTIVE_MULTIPLIER
end
def resistant?(value)
return value < NORMAL_EFFECTIVE_MULTIPLIER
end
def normal?(value)
return value == NORMAL_EFFECTIVE_MULTIPLIER
end
def super_effective?(value)
return value > NORMAL_EFFECTIVE_MULTIPLIER
end
def ineffective_type?(attack_type, *defend_types)
value = calculate(attack_type, *defend_types)
return ineffective?(value)
end
def not_very_effective_type?(attack_type, *defend_types)
value = calculate(attack_type, *defend_types)
return not_very_effective?(value)
end
def resistant_type?(attack_type, *defend_types)
value = calculate(attack_type, *defend_types)
return resistant?(value)
end
def normal_type?(attack_type, *defend_types)
value = calculate(attack_type, *defend_types)
return normal?(value)
end
def super_effective_type?(attack_type, *defend_types)
value = calculate(attack_type, *defend_types)
return super_effective?(value)
end
def get_type_effectiveness(attack_type, defend_type)
return GameData::Type.get(defend_type).effectiveness(attack_type)
end
def calculate(attack_type, *defend_types)
ret = NORMAL_EFFECTIVE_MULTIPLIER
defend_types.each do |type|
ret *= get_type_effectiveness(attack_type, type) / NORMAL_EFFECTIVE.to_f
end
return ret
end
end

View File

@@ -4,24 +4,28 @@ module GameData
attr_reader :real_name
attr_reader :real_description
attr_reader :flags
attr_reader :pbs_file_suffix
DATA = {}
DATA_FILENAME = "abilities.dat"
PBS_BASE_FILENAME = "abilities"
extend ClassMethodsSymbols
include InstanceMethods
SCHEMA = {
"Name" => [:name, "s"],
"Description" => [:description, "q"],
"Flags" => [:flags, "*s"]
"SectionName" => [:id, "m"],
"Name" => [:real_name, "s"],
"Description" => [:real_description, "q"],
"Flags" => [:flags, "*s"]
}
def initialize(hash)
@id = hash[:id]
@real_name = hash[:name] || "Unnamed"
@real_description = hash[:description] || "???"
@flags = hash[:flags] || []
@real_name = hash[:real_name] || "Unnamed"
@real_description = hash[:real_description] || "???"
@flags = hash[:flags] || []
@pbs_file_suffix = hash[:pbs_file_suffix] || ""
end
# @return [String] the translated name of this ability

View File

@@ -14,26 +14,26 @@ module GameData
attr_reader :flags
attr_reader :effect_chance
attr_reader :real_description
attr_reader :pbs_file_suffix
DATA = {}
DATA_FILENAME = "moves.dat"
PBS_BASE_FILENAME = "moves"
SCHEMA = {
"Name" => [:name, "s"],
"Type" => [:type, "e", :Type],
"Category" => [:category, "e", ["Physical", "Special", "Status"]],
"Power" => [:base_damage, "u"],
"Accuracy" => [:accuracy, "u"],
"TotalPP" => [:total_pp, "u"],
"Target" => [:target, "e", :Target],
"Priority" => [:priority, "i"],
"FunctionCode" => [:function_code, "s"],
"Flags" => [:flags, "*s"],
"EffectChance" => [:effect_chance, "u"],
"Description" => [:description, "q"],
# All properties below here are old names for some properties above.
# They will be removed in v21.
"BaseDamage" => [:base_damage, "u"]
"SectionName" => [:id, "m"],
"Name" => [:real_name, "s"],
"Type" => [:type, "e", :Type],
"Category" => [:category, "e", ["Physical", "Special", "Status"]],
"Power" => [:base_damage, "u"],
"Accuracy" => [:accuracy, "u"],
"TotalPP" => [:total_pp, "u"],
"Target" => [:target, "e", :Target],
"Priority" => [:priority, "i"],
"FunctionCode" => [:function_code, "s"],
"Flags" => [:flags, "*s"],
"EffectChance" => [:effect_chance, "u"],
"Description" => [:real_description, "q"]
}
extend ClassMethodsSymbols
@@ -42,19 +42,20 @@ module GameData
def initialize(hash)
convert_move_data(hash)
@id = hash[:id]
@real_name = hash[:name] || "Unnamed"
@type = hash[:type] || :NONE
@category = hash[:category] || 2
@base_damage = hash[:base_damage] || 0
@accuracy = hash[:accuracy] || 100
@total_pp = hash[:total_pp] || 5
@target = hash[:target] || :None
@priority = hash[:priority] || 0
@function_code = hash[:function_code] || "None"
@flags = hash[:flags] || []
@real_name = hash[:real_name] || "Unnamed"
@type = hash[:type] || :NONE
@category = hash[:category] || 2
@base_damage = hash[:base_damage] || 0
@accuracy = hash[:accuracy] || 100
@total_pp = hash[:total_pp] || 5
@target = hash[:target] || :None
@priority = hash[:priority] || 0
@function_code = hash[:function_code] || "None"
@flags = hash[:flags] || []
@flags = [@flags] if !@flags.is_a?(Array)
@effect_chance = hash[:effect_chance] || 0
@real_description = hash[:description] || "???"
@effect_chance = hash[:effect_chance] || 0
@real_description = hash[:real_description] || "???"
@pbs_file_suffix = hash[:pbs_file_suffix] || ""
end
# @return [String] the translated name of this move
@@ -816,5 +817,12 @@ module GameData
data[:function_code] = new_code
return data
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)
ret = nil if ["Power", "Priority", "EffectChance"].include?(key) && ret == 0
return ret
end
end
end

View File

@@ -6,35 +6,62 @@ module GameData
attr_reader :pocket
attr_reader :price
attr_reader :sell_price
attr_reader :real_description
attr_reader :bp_price
attr_reader :field_use
attr_reader :battle_use
attr_reader :consumable
attr_reader :flags
attr_reader :consumable
attr_reader :move
attr_reader :real_description
attr_reader :pbs_file_suffix
DATA = {}
DATA_FILENAME = "items.dat"
PBS_BASE_FILENAME = "items"
SCHEMA = {
"Name" => [:name, "s"],
"NamePlural" => [:name_plural, "s"],
"Pocket" => [:pocket, "v"],
"Price" => [:price, "u"],
"SellPrice" => [:sell_price, "u"],
"Description" => [:description, "q"],
"FieldUse" => [:field_use, "e", { "OnPokemon" => 1, "Direct" => 2, "TM" => 3,
"HM" => 4, "TR" => 5 }],
"BattleUse" => [:battle_use, "e", { "OnPokemon" => 1, "OnMove" => 2, "OnBattler" => 3,
"OnFoe" => 4, "Direct" => 5 }],
"Consumable" => [:consumable, "b"],
"Flags" => [:flags, "*s"],
"Move" => [:move, "e", :Move]
"SectionName" => [:id, "m"],
"Name" => [:real_name, "s"],
"NamePlural" => [:real_name_plural, "s"],
"Pocket" => [:pocket, "v"],
"Price" => [:price, "u"],
"SellPrice" => [:sell_price, "u"],
"BPPrice" => [:bp_price, "u"],
"FieldUse" => [:field_use, "e", { "OnPokemon" => 1, "Direct" => 2, "TM" => 3,
"HM" => 4, "TR" => 5 }],
"BattleUse" => [:battle_use, "e", { "OnPokemon" => 1, "OnMove" => 2, "OnBattler" => 3,
"OnFoe" => 4, "Direct" => 5 }],
"Flags" => [:flags, "*s"],
"Consumable" => [:consumable, "b"],
"Move" => [:move, "e", :Move],
"Description" => [:real_description, "q"]
}
extend ClassMethodsSymbols
include InstanceMethods
def self.editor_properties
field_use_array = [_INTL("Can't use in field")]
self.schema["FieldUse"][2].each { |key, value| field_use_array[value] = key if !field_use_array[value] }
battle_use_array = [_INTL("Can't use in battle")]
self.schema["BattleUse"][2].each { |key, value| battle_use_array[value] = key if !battle_use_array[value] }
return [
["ID", ReadOnlyProperty, _INTL("ID of this item (used as a symbol like :XXX).")],
["Name", ItemNameProperty, _INTL("Name of this item as displayed by the game.")],
["NamePlural", ItemNameProperty, _INTL("Plural name of this item as displayed by the game.")],
["Pocket", PocketProperty, _INTL("Pocket in the Bag where this item is stored.")],
["Price", LimitProperty.new(Settings::MAX_MONEY), _INTL("Purchase price of this item.")],
["SellPrice", LimitProperty2.new(Settings::MAX_MONEY), _INTL("Sell price of this item. If blank, is half the purchase price.")],
["BPPrice", LimitProperty.new(Settings::MAX_BATTLE_POINTS), _INTL("Purchase price of this item in Battle Points (BP).")],
["FieldUse", EnumProperty.new(field_use_array), _INTL("How this item can be used outside of battle.")],
["BattleUse", EnumProperty.new(battle_use_array), _INTL("How this item can be used within a battle.")],
["Flags", StringListProperty, _INTL("Words/phrases that can be used to group certain kinds of items.")],
["Consumable", BooleanProperty, _INTL("Whether this item is consumed after use.")],
["Move", MoveProperty, _INTL("Move taught by this HM, TM or TR.")],
["Description", StringProperty, _INTL("Description of this item.")]
]
end
def self.icon_filename(item)
return "Graphics/Items/back" if item.nil?
item_data = self.try_get(item)
@@ -82,18 +109,20 @@ module GameData
def initialize(hash)
@id = hash[:id]
@real_name = hash[:name] || "Unnamed"
@real_name_plural = hash[:name_plural] || "Unnamed"
@pocket = hash[:pocket] || 1
@price = hash[:price] || 0
@sell_price = hash[:sell_price] || (@price / 2)
@real_description = hash[:description] || "???"
@field_use = hash[:field_use] || 0
@battle_use = hash[:battle_use] || 0
@flags = hash[:flags] || []
@real_name = hash[:real_name] || "Unnamed"
@real_name_plural = hash[:real_name_plural] || "Unnamed"
@pocket = hash[:pocket] || 1
@price = hash[:price] || 0
@sell_price = hash[:sell_price] || (@price / 2)
@bp_price = hash[:bp_price] || 1
@field_use = hash[:field_use] || 0
@battle_use = hash[:battle_use] || 0
@flags = hash[:flags] || []
@consumable = hash[:consumable]
@consumable = !is_important? if @consumable.nil?
@move = hash[:move]
@real_description = hash[:real_description] || "???"
@pbs_file_suffix = hash[:pbs_file_suffix] || ""
end
# @return [String] the translated name of this item
@@ -138,7 +167,7 @@ module GameData
return false
end
def can_hold?; return !is_important?; end
def can_hold?; return !is_important?; end
def consumed_after_use?
return !is_important? && @consumable
@@ -191,5 +220,23 @@ module GameData
}
return combos[species]&.include?(@id)
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)
key = "SectionName" if key == "ID"
ret = __orig__get_property_for_PBS(key)
case key
when "SellPrice"
ret = nil if ret == @price / 2
when "BPPrice"
ret = nil if ret == 1
when "FieldUse", "BattleUse"
ret = nil if ret == 0
when "Consumable"
ret = @consumable
ret = nil if ret || is_important? # Only return false, only for non-important items
end
return ret
end
end
end

View File

@@ -4,11 +4,14 @@ module GameData
attr_reader :hours_per_stage
attr_reader :drying_per_hour
attr_reader :yield
attr_reader :pbs_file_suffix
DATA = {}
DATA_FILENAME = "berry_plants.dat"
PBS_BASE_FILENAME = "berry_plants"
SCHEMA = {
"SectionName" => [:id, "m"],
"HoursPerStage" => [:hours_per_stage, "v"],
"DryingPerHour" => [:drying_per_hour, "u"],
"Yield" => [:yield, "uv"]
@@ -28,6 +31,7 @@ module GameData
@drying_per_hour = hash[:drying_per_hour] || 15
@yield = hash[:yield] || [2, 5]
@yield.reverse! if @yield[1] < @yield[0]
@pbs_file_suffix = hash[:pbs_file_suffix] || ""
end
def minimum_yield

View File

@@ -40,13 +40,112 @@ module GameData
attr_reader :mega_move
attr_reader :unmega_form
attr_reader :mega_message
attr_reader :pbs_file_suffix
DATA = {}
DATA_FILENAME = "species.dat"
PBS_BASE_FILENAME = ["pokemon", "pokemon_forms"]
extend ClassMethodsSymbols
include InstanceMethods
def self.schema(compiling_forms = false)
ret = {}
if compiling_forms
ret["SectionName"] = [:id, "ev", :Species]
else
ret["SectionName"] = [:id, "m"]
ret["Name"] = [:real_name, "s"]
end
ret["FormName"] = [:real_form_name, "q"]
if compiling_forms
ret["PokedexForm"] = [:pokedex_form, "u"]
ret["MegaStone"] = [:mega_stone, "e", :Item]
ret["MegaMove"] = [:mega_move, "e", :Move]
ret["UnmegaForm"] = [:unmega_form, "u"]
ret["MegaMessage"] = [:mega_message, "u"]
end
ret["Types"] = [:types, "*e", :Type]
ret["BaseStats"] = [:base_stats, "vvvvvv"]
if !compiling_forms
ret["GenderRatio"] = [:gender_ratio, "e", :GenderRatio]
ret["GrowthRate"] = [:growth_rate, "e", :GrowthRate]
end
ret["BaseExp"] = [:base_exp, "v"]
ret["EVs"] = [:evs, "*ev", :Stat]
ret["CatchRate"] = [:catch_rate, "u"]
ret["Happiness"] = [:happiness, "u"]
ret["Abilities"] = [:abilities, "*e", :Ability]
ret["HiddenAbilities"] = [:hidden_abilities, "*e", :Ability]
ret["Moves"] = [:moves, "*ue", nil, :Move]
ret["TutorMoves"] = [:tutor_moves, "*e", :Move]
ret["EggMoves"] = [:egg_moves, "*e", :Move]
ret["EggGroups"] = [:egg_groups, "*e", :EggGroup]
ret["HatchSteps"] = [:hatch_steps, "v"]
if compiling_forms
ret["Offspring"] = [:offspring, "*e", :Species]
else
ret["Incense"] = [:incense, "e", :Item]
ret["Offspring"] = [:offspring, "*s"]
end
ret["Height"] = [:height, "f"]
ret["Weight"] = [:weight, "f"]
ret["Color"] = [:color, "e", :BodyColor]
ret["Shape"] = [:shape, "e", :BodyShape]
ret["Habitat"] = [:habitat, "e", :Habitat]
ret["Category"] = [:real_category, "s"]
ret["Pokedex"] = [:real_pokedex_entry, "q"]
ret["Generation"] = [:generation, "i"]
ret["Flags"] = [:flags, "*s"]
ret["WildItemCommon"] = [:wild_item_common, "*e", :Item]
ret["WildItemUncommon"] = [:wild_item_uncommon, "*e", :Item]
ret["WildItemRare"] = [:wild_item_rare, "*e", :Item]
if compiling_forms
ret["Evolutions"] = [:evolutions, "*ees", :Species, :Evolution, nil]
else
ret["Evolutions"] = [:evolutions, "*ses", nil, :Evolution, nil]
end
return ret
end
def self.editor_properties
return [
["ID", ReadOnlyProperty, _INTL("The ID of the Pokémon.")],
["Name", LimitStringProperty.new(Pokemon::MAX_NAME_SIZE), _INTL("Name of the Pokémon.")],
["FormName", StringProperty, _INTL("Name of this form of the Pokémon.")],
["Types", GameDataPoolProperty.new(:Type, false), _INTL("The Pokémon's type(s).")],
["BaseStats", BaseStatsProperty, _INTL("Base stats of the Pokémon.")],
["GenderRatio", GameDataProperty.new(:GenderRatio), _INTL("Proportion of males to females for this species.")],
["GrowthRate", GameDataProperty.new(:GrowthRate), _INTL("Pokémon's growth rate.")],
["BaseExp", LimitProperty.new(9999), _INTL("Base experience earned when this species is defeated.")],
["EVs", EffortValuesProperty, _INTL("Effort Value points earned when this species is defeated.")],
["CatchRate", LimitProperty.new(255), _INTL("Catch rate of this species (0-255).")],
["Happiness", LimitProperty.new(255), _INTL("Base happiness of this species (0-255).")],
["Abilities", AbilitiesProperty.new, _INTL("Abilities which the Pokémon can have (max. 2).")],
["HiddenAbilities", AbilitiesProperty.new, _INTL("Secret abilities which the Pokémon can have.")],
["Moves", LevelUpMovesProperty, _INTL("Moves which the Pokémon learns while levelling up.")],
["TutorMoves", EggMovesProperty.new, _INTL("Moves which the Pokémon can be taught by TM/HM/Move Tutor.")],
["EggMoves", EggMovesProperty.new, _INTL("Moves which the Pokémon can learn via breeding.")],
["EggGroups", EggGroupsProperty.new, _INTL("Egg groups that the Pokémon belongs to for breeding purposes.")],
["HatchSteps", LimitProperty.new(99_999), _INTL("Number of steps until an egg of this species hatches.")],
["Incense", ItemProperty, _INTL("Item needed to be held by a parent to produce an egg of this species.")],
["Offspring", GameDataPoolProperty.new(:Species), _INTL("All possible species that an egg can be when breeding for an egg of this species (if blank, the egg can only be this species).")],
["Height", NonzeroLimitProperty.new(999), _INTL("Height of the Pokémon in 0.1 metres (e.g. 42 = 4.2m).")],
["Weight", NonzeroLimitProperty.new(9999), _INTL("Weight of the Pokémon in 0.1 kilograms (e.g. 42 = 4.2kg).")],
["Color", GameDataProperty.new(:BodyColor), _INTL("Pokémon's body color.")],
["Shape", GameDataProperty.new(:BodyShape), _INTL("Body shape of this species.")],
["Habitat", GameDataProperty.new(:Habitat), _INTL("The habitat of this species.")],
["Category", StringProperty, _INTL("Kind of Pokémon species.")],
["Pokedex", StringProperty, _INTL("Description of the Pokémon as displayed in the Pokédex.")],
["Generation", LimitProperty.new(99_999), _INTL("The number of the generation the Pokémon debuted in.")],
["Flags", StringListProperty, _INTL("Words/phrases that distinguish this species from others.")],
["WildItemCommon", GameDataPoolProperty.new(:Item), _INTL("Item(s) commonly held by wild Pokémon of this species.")],
["WildItemUncommon", GameDataPoolProperty.new(:Item), _INTL("Item(s) uncommonly held by wild Pokémon of this species.")],
["WildItemRare", GameDataPoolProperty.new(:Item), _INTL("Item(s) rarely held by wild Pokémon of this species.")],
["Evolutions", EvolutionsProperty.new, _INTL("Evolution paths of this species.")]
]
end
# @param species [Symbol, self, String]
# @param form [Integer]
# @return [self, nil]
@@ -71,84 +170,14 @@ module GameData
return ret
end
def self.schema(compiling_forms = false)
ret = {
"FormName" => [0, "q"],
"Category" => [0, "s"],
"Pokedex" => [0, "q"],
"Types" => [0, "eE", :Type, :Type],
"BaseStats" => [0, "vvvvvv"],
"EVs" => [0, "*ev", :Stat],
"BaseExp" => [0, "v"],
"CatchRate" => [0, "u"],
"Happiness" => [0, "u"],
"Moves" => [0, "*ue", nil, :Move],
"TutorMoves" => [0, "*e", :Move],
"EggMoves" => [0, "*e", :Move],
"Abilities" => [0, "*e", :Ability],
"HiddenAbilities" => [0, "*e", :Ability],
"WildItemCommon" => [0, "*e", :Item],
"WildItemUncommon" => [0, "*e", :Item],
"WildItemRare" => [0, "*e", :Item],
"EggGroups" => [0, "*e", :EggGroup],
"HatchSteps" => [0, "v"],
"Height" => [0, "f"],
"Weight" => [0, "f"],
"Color" => [0, "e", :BodyColor],
"Shape" => [0, "e", :BodyShape],
"Habitat" => [0, "e", :Habitat],
"Generation" => [0, "i"],
"Flags" => [0, "*s"],
"BattlerPlayerX" => [0, "i"],
"BattlerPlayerY" => [0, "i"],
"BattlerEnemyX" => [0, "i"],
"BattlerEnemyY" => [0, "i"],
"BattlerAltitude" => [0, "i"],
"BattlerShadowX" => [0, "i"],
"BattlerShadowSize" => [0, "u"],
# All properties below here are old names for some properties above.
# They will be removed in v21.
"Type1" => [0, "e", :Type],
"Type2" => [0, "e", :Type],
"Rareness" => [0, "u"],
"Compatibility" => [0, "*e", :EggGroup],
"Kind" => [0, "s"],
"BaseEXP" => [0, "v"],
"EffortPoints" => [0, "*ev", :Stat],
"HiddenAbility" => [0, "*e", :Ability],
"StepsToHatch" => [0, "v"]
}
if compiling_forms
ret["PokedexForm"] = [0, "u"]
ret["Offspring"] = [0, "*e", :Species]
ret["Evolutions"] = [0, "*ees", :Species, :Evolution, nil]
ret["MegaStone"] = [0, "e", :Item]
ret["MegaMove"] = [0, "e", :Move]
ret["UnmegaForm"] = [0, "u"]
ret["MegaMessage"] = [0, "u"]
else
ret["InternalName"] = [0, "n"]
ret["Name"] = [0, "s"]
ret["GrowthRate"] = [0, "e", :GrowthRate]
ret["GenderRatio"] = [0, "e", :GenderRatio]
ret["Incense"] = [0, "e", :Item]
ret["Offspring"] = [0, "*s"]
ret["Evolutions"] = [0, "*ses", nil, :Evolution, nil]
# All properties below here are old names for some properties above.
# They will be removed in v21.
ret["GenderRate"] = [0, "e", :GenderRatio]
end
return ret
end
def initialize(hash)
@id = hash[:id]
@species = hash[:species] || @id
@form = hash[:form] || 0
@real_name = hash[:name] || "Unnamed"
@real_form_name = hash[:form_name]
@real_category = hash[:category] || "???"
@real_pokedex_entry = hash[:pokedex_entry] || "???"
@real_name = hash[:real_name] || "Unnamed"
@real_form_name = hash[:real_form_name]
@real_category = hash[:real_category] || "???"
@real_pokedex_entry = hash[:real_pokedex_entry] || "???"
@pokedex_form = hash[:pokedex_form] || @form
@types = hash[:types] || [:NORMAL]
@base_stats = hash[:base_stats] || {}
@@ -186,6 +215,7 @@ module GameData
@mega_move = hash[:mega_move]
@unmega_form = hash[:unmega_form] || 0
@mega_message = hash[:mega_message] || 0
@pbs_file_suffix = hash[:pbs_file_suffix] || ""
end
# @return [String] the translated name of this species
@@ -352,5 +382,67 @@ module GameData
end
return 1
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, writing_form = false)
key = "SectionName" if key == "ID"
ret = nil
if self.class.schema(writing_form).include?(key)
ret = self.send(self.class.schema(writing_form)[key][0])
ret = nil if ret == false || (ret.is_a?(Array) && ret.length == 0)
end
case key
when "SectionName"
ret = [@species, @form] if writing_form
when "FormName"
ret = nil if nil_or_empty?(ret)
when "PokedexForm"
ret = nil if ret == @form
when "UnmegaForm", "MegaMessage", "Generation"
ret = nil if ret == 0
when "BaseStats"
new_ret = []
GameData::Stat.each_main do |s|
new_ret[s.pbs_order] = ret[s.id] if s.pbs_order >= 0
end
ret = new_ret
when "EVs"
new_ret = []
GameData::Stat.each_main do |s|
new_ret.push([s.id, ret[s.id]]) if ret[s.id] > 0 && s.pbs_order >= 0
end
ret = new_ret
when "Height", "Weight"
ret = ret.to_f / 10
when "Habitat"
ret = nil if ret == :None
when "Evolutions"
if ret
ret = ret.select { |evo| !evo[3] } # Remove prevolutions
ret.each do |evo|
param_type = GameData::Evolution.get(evo[1]).parameter
if !param_type.nil?
if param_type.is_a?(Symbol) && !GameData.const_defined?(param_type)
evo[2] = getConstantName(param_type, evo[2])
else
evo[2] = evo[2].to_s
end
end
end
ret.each_with_index { |evo, i| ret[i] = evo[0, 3] }
ret = nil if ret.length == 0
end
end
if writing_form && !ret.nil?
base_form = GameData::Species.get(@species)
if !["WildItemCommon", "WildItemUncommon", "WildItemRare"].include?(key) ||
(base_form.wild_item_common == @wild_item_common &&
base_form.wild_item_uncommon == @wild_item_uncommon &&
base_form.wild_item_rare == @wild_item_rare)
ret = nil if base_form.get_property_for_PBS(key) == ret
end
end
return ret
end
end
end

View File

@@ -1,32 +0,0 @@
module GameData
class ShadowPokemon
attr_reader :id
attr_reader :moves
attr_reader :gauge_size
attr_reader :flags
DATA = {}
DATA_FILENAME = "shadow_pokemon.dat"
SCHEMA = {
"GaugeSize" => [:gauge_size, "v"],
"Moves" => [:moves, "*s"], # Not enumerated when compiled
"Flags" => [:flags, "*s"]
}
HEART_GAUGE_SIZE = 4000 # Default gauge size
extend ClassMethodsSymbols
include InstanceMethods
def initialize(hash)
@id = hash[:id]
@moves = hash[:moves] || []
@gauge_size = hash[:gauge_size] || HEART_GAUGE_SIZE
@flags = hash[:flags] || []
end
def has_flag?(flag)
return @flags.any? { |f| f.downcase == flag.downcase }
end
end
end

View File

@@ -8,16 +8,19 @@ module GameData
attr_accessor :front_sprite_altitude
attr_accessor :shadow_x
attr_accessor :shadow_size
attr_reader :pbs_file_suffix
DATA = {}
DATA_FILENAME = "species_metrics.dat"
PBS_BASE_FILENAME = "pokemon_metrics"
SCHEMA = {
"BackSprite" => [0, "ii"],
"FrontSprite" => [0, "ii"],
"FrontSpriteAltitude" => [0, "i"],
"ShadowX" => [0, "i"],
"ShadowSize" => [0, "u"]
"SectionName" => [:id, "eV", :Species],
"BackSprite" => [:back_sprite, "ii"],
"FrontSprite" => [:front_sprite, "ii"],
"FrontSpriteAltitude" => [:front_sprite_altitude, "i"],
"ShadowX" => [:shadow_x, "i"],
"ShadowSize" => [:shadow_size, "u"]
}
extend ClassMethodsSymbols
@@ -62,6 +65,7 @@ module GameData
@front_sprite_altitude = hash[:front_sprite_altitude] || 0
@shadow_x = hash[:shadow_x] || 0
@shadow_size = hash[:shadow_size] || 2
@pbs_file_suffix = hash[:pbs_file_suffix] || ""
end
def apply_metrics_to_sprite(sprite, index, shadow = false)
@@ -83,5 +87,17 @@ module GameData
return true
# return @front_sprite_altitude > 0
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]
when "FrontSpriteAltitude"
ret = nil if ret == 0
end
return ret
end
end
end

View File

@@ -0,0 +1,36 @@
module GameData
class ShadowPokemon
attr_reader :id
attr_reader :moves
attr_reader :gauge_size
attr_reader :flags
attr_reader :pbs_file_suffix
DATA = {}
DATA_FILENAME = "shadow_pokemon.dat"
PBS_BASE_FILENAME = "shadow_pokemon"
SCHEMA = {
"SectionName" => [:id, "e", :Species],
"GaugeSize" => [:gauge_size, "v"],
"Moves" => [:moves, "*m"], # Not enumerated when compiled
"Flags" => [:flags, "*s"]
}
HEART_GAUGE_SIZE = 4000 # Default gauge size
extend ClassMethodsSymbols
include InstanceMethods
def initialize(hash)
@id = hash[:id]
@gauge_size = hash[:gauge_size] || HEART_GAUGE_SIZE
@moves = hash[:moves] || []
@flags = hash[:flags] || []
@pbs_file_suffix = hash[:pbs_file_suffix] || ""
end
def has_flag?(flag)
return @flags.any? { |f| f.downcase == flag.downcase }
end
end
end

View File

@@ -5,15 +5,18 @@ module GameData
attr_reader :icon_position # Where this ribbon's graphic is within ribbons.png
attr_reader :real_description
attr_reader :flags
attr_reader :pbs_file_suffix
DATA = {}
DATA_FILENAME = "ribbons.dat"
PBS_BASE_FILENAME = "ribbons"
SCHEMA = {
"Name" => [:name, "s"],
"IconPosition" => [:icon_position, "u"],
"Description" => [:description, "q"],
"Flags" => [:flags, "*s"]
"SectionName" => [:id, "m"],
"Name" => [:real_name, "s"],
"IconPosition" => [:icon_position, "u"],
"Description" => [:real_description, "q"],
"Flags" => [:flags, "*s"]
}
extend ClassMethodsSymbols
@@ -21,10 +24,11 @@ module GameData
def initialize(hash)
@id = hash[:id]
@real_name = hash[:name] || "Unnamed"
@icon_position = hash[:icon_position] || 0
@real_description = hash[:description] || "???"
@flags = hash[:flags] || []
@real_name = hash[:real_name] || "Unnamed"
@icon_position = hash[:icon_position] || 0
@real_description = hash[:real_description] || "???"
@flags = hash[:flags] || []
@pbs_file_suffix = hash[:pbs_file_suffix] || ""
end
# @return [String] the translated name of this ribbon

View File

@@ -3,11 +3,13 @@ module GameData
attr_accessor :id
attr_accessor :map
attr_accessor :version
attr_reader :step_chances
attr_reader :types
attr_reader :step_chances
attr_reader :types
attr_reader :pbs_file_suffix
DATA = {}
DATA_FILENAME = "encounters.dat"
PBS_BASE_FILENAME = "encounters"
extend ClassMethodsSymbols
include InstanceMethods
@@ -58,11 +60,12 @@ module GameData
end
def initialize(hash)
@id = hash[:id]
@map = hash[:map]
@version = hash[:version] || 0
@step_chances = hash[:step_chances]
@types = hash[:types] || {}
@id = hash[:id]
@map = hash[:map]
@version = hash[:version] || 0
@step_chances = hash[:step_chances]
@types = hash[:types] || {}
@pbs_file_suffix = hash[:pbs_file_suffix] || ""
end
end
end

View File

@@ -1,106 +0,0 @@
module GameData
class TrainerType
attr_reader :id
attr_reader :real_name
attr_reader :gender
attr_reader :base_money
attr_reader :skill_level
attr_reader :flags
attr_reader :intro_BGM
attr_reader :battle_BGM
attr_reader :victory_BGM
DATA = {}
DATA_FILENAME = "trainer_types.dat"
SCHEMA = {
"Name" => [:name, "s"],
"Gender" => [:gender, "e", { "Male" => 0, "male" => 0, "M" => 0, "m" => 0, "0" => 0,
"Female" => 1, "female" => 1, "F" => 1, "f" => 1, "1" => 1,
"Unknown" => 2, "unknown" => 2, "Other" => 2, "other" => 2,
"Mixed" => 2, "mixed" => 2, "X" => 2, "x" => 2, "2" => 2 }],
"BaseMoney" => [:base_money, "u"],
"SkillLevel" => [:skill_level, "u"],
"Flags" => [:flags, "*s"],
"IntroBGM" => [:intro_BGM, "s"],
"BattleBGM" => [:battle_BGM, "s"],
"VictoryBGM" => [:victory_BGM, "s"]
}
extend ClassMethodsSymbols
include InstanceMethods
def self.check_file(tr_type, path, optional_suffix = "", suffix = "")
tr_type_data = self.try_get(tr_type)
return nil if tr_type_data.nil?
# Check for files
if optional_suffix && !optional_suffix.empty?
ret = path + tr_type_data.id.to_s + optional_suffix + suffix
return ret if pbResolveBitmap(ret)
end
ret = path + tr_type_data.id.to_s + suffix
return (pbResolveBitmap(ret)) ? ret : nil
end
def self.charset_filename(tr_type)
return self.check_file(tr_type, "Graphics/Characters/trainer_")
end
def self.charset_filename_brief(tr_type)
ret = self.charset_filename(tr_type)
ret&.slice!("Graphics/Characters/")
return ret
end
def self.front_sprite_filename(tr_type)
return self.check_file(tr_type, "Graphics/Trainers/")
end
def self.player_front_sprite_filename(tr_type)
outfit = ($player) ? $player.outfit : 0
return self.check_file(tr_type, "Graphics/Trainers/", sprintf("_%d", outfit))
end
def self.back_sprite_filename(tr_type)
return self.check_file(tr_type, "Graphics/Trainers/", "", "_back")
end
def self.player_back_sprite_filename(tr_type)
outfit = ($player) ? $player.outfit : 0
return self.check_file(tr_type, "Graphics/Trainers/", sprintf("_%d", outfit), "_back")
end
def self.map_icon_filename(tr_type)
return self.check_file(tr_type, "Graphics/UI/Town Map/player_")
end
def self.player_map_icon_filename(tr_type)
outfit = ($player) ? $player.outfit : 0
return self.check_file(tr_type, "Graphics/UI/Town Map/player_", sprintf("_%d", outfit))
end
def initialize(hash)
@id = hash[:id]
@real_name = hash[:name] || "Unnamed"
@gender = hash[:gender] || 2
@base_money = hash[:base_money] || 30
@skill_level = hash[:skill_level] || @base_money
@flags = hash[:flags] || []
@intro_BGM = hash[:intro_BGM]
@battle_BGM = hash[:battle_BGM]
@victory_BGM = hash[:victory_BGM]
end
# @return [String] the translated name of this trainer type
def name
return pbGetMessageFromHash(MessageTypes::TrainerTypes, @real_name)
end
def male?; return @gender == 0; end
def female?; return @gender == 1; end
def has_flag?(flag)
return @flags.any? { |f| f.downcase == flag.downcase }
end
end
end

View File

@@ -0,0 +1,134 @@
module GameData
class TrainerType
attr_reader :id
attr_reader :real_name
attr_reader :gender
attr_reader :base_money
attr_reader :skill_level
attr_reader :flags
attr_reader :intro_BGM
attr_reader :battle_BGM
attr_reader :victory_BGM
attr_reader :pbs_file_suffix
DATA = {}
DATA_FILENAME = "trainer_types.dat"
PBS_BASE_FILENAME = "trainer_types"
SCHEMA = {
"SectionName" => [:id, "m"],
"Name" => [:real_name, "s"],
"Gender" => [:gender, "e", { "Male" => 0, "male" => 0, "M" => 0, "m" => 0, "0" => 0,
"Female" => 1, "female" => 1, "F" => 1, "f" => 1, "1" => 1,
"Unknown" => 2, "unknown" => 2, "Other" => 2, "other" => 2,
"Mixed" => 2, "mixed" => 2, "X" => 2, "x" => 2, "2" => 2 }],
"BaseMoney" => [:base_money, "u"],
"SkillLevel" => [:skill_level, "u"],
"Flags" => [:flags, "*s"],
"IntroBGM" => [:intro_BGM, "s"],
"BattleBGM" => [:battle_BGM, "s"],
"VictoryBGM" => [:victory_BGM, "s"]
}
extend ClassMethodsSymbols
include InstanceMethods
def self.editor_properties
gender_array = []
self.schema["Gender"][2].each { |key, value| gender_array[value] = key if !gender_array[value] }
return [
["ID", ReadOnlyProperty, _INTL("ID of this Trainer Type (used as a symbol like :XXX).")],
["Name", StringProperty, _INTL("Name of this Trainer Type as displayed by the game.")],
["Gender", EnumProperty.new(gender_array), _INTL("Gender of this Trainer Type.")],
["BaseMoney", LimitProperty.new(9999), _INTL("Player earns this much money times the highest level among the trainer's Pokémon.")],
["SkillLevel", LimitProperty2.new(9999), _INTL("Skill level of this Trainer Type.")],
["Flags", StringListProperty, _INTL("Words/phrases that can be used to make trainers of this type behave differently to others.")],
["IntroBGM", BGMProperty, _INTL("BGM played before battles against trainers of this type.")],
["BattleBGM", BGMProperty, _INTL("BGM played in battles against trainers of this type.")],
["VictoryBGM", BGMProperty, _INTL("BGM played when player wins battles against trainers of this type.")]
]
end
def self.check_file(tr_type, path, optional_suffix = "", suffix = "")
tr_type_data = self.try_get(tr_type)
return nil if tr_type_data.nil?
# Check for files
if optional_suffix && !optional_suffix.empty?
ret = path + tr_type_data.id.to_s + optional_suffix + suffix
return ret if pbResolveBitmap(ret)
end
ret = path + tr_type_data.id.to_s + suffix
return (pbResolveBitmap(ret)) ? ret : nil
end
def self.charset_filename(tr_type)
return self.check_file(tr_type, "Graphics/Characters/trainer_")
end
def self.charset_filename_brief(tr_type)
ret = self.charset_filename(tr_type)
ret&.slice!("Graphics/Characters/")
return ret
end
def self.front_sprite_filename(tr_type)
return self.check_file(tr_type, "Graphics/Trainers/")
end
def self.player_front_sprite_filename(tr_type)
outfit = ($player) ? $player.outfit : 0
return self.check_file(tr_type, "Graphics/Trainers/", sprintf("_%d", outfit))
end
def self.back_sprite_filename(tr_type)
return self.check_file(tr_type, "Graphics/Trainers/", "", "_back")
end
def self.player_back_sprite_filename(tr_type)
outfit = ($player) ? $player.outfit : 0
return self.check_file(tr_type, "Graphics/Trainers/", sprintf("_%d", outfit), "_back")
end
def self.map_icon_filename(tr_type)
return self.check_file(tr_type, "Graphics/UI/Town Map/player_")
end
def self.player_map_icon_filename(tr_type)
outfit = ($player) ? $player.outfit : 0
return self.check_file(tr_type, "Graphics/UI/Town Map/player_", sprintf("_%d", outfit))
end
def initialize(hash)
@id = hash[:id]
@real_name = hash[:real_name] || "Unnamed"
@gender = hash[:gender] || 2
@base_money = hash[:base_money] || 30
@skill_level = hash[:skill_level] || @base_money
@flags = hash[:flags] || []
@intro_BGM = hash[:intro_BGM]
@battle_BGM = hash[:battle_BGM]
@victory_BGM = hash[:victory_BGM]
@pbs_file_suffix = hash[:pbs_file_suffix] || ""
end
# @return [String] the translated name of this trainer type
def name
return pbGetMessageFromHash(MessageTypes::TrainerTypes, @real_name)
end
def male?; return @gender == 0; end
def female?; return @gender == 1; end
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)
key = "SectionName" if key == "ID"
ret = __orig__get_property_for_PBS(key)
ret = nil if key == "SkillLevel" && ret == @base_money
return ret
end
end
end

View File

@@ -7,16 +7,25 @@ module GameData
attr_reader :items
attr_reader :real_lose_text
attr_reader :pokemon
attr_reader :pbs_file_suffix
DATA = {}
DATA_FILENAME = "trainers.dat"
PBS_BASE_FILENAME = "trainers"
# "Pokemon" is specially mentioned in def compile_trainers and def
# write_trainers, and acts as a subheading for a particular Pokémon.
SCHEMA = {
"Items" => [:items, "*e", :Item],
"LoseText" => [:lose_text, "q"],
"Pokemon" => [:pokemon, "ev", :Species], # Species, level
"SectionName" => [:id, "esU", :TrainerType],
"Items" => [:items, "*e", :Item],
"LoseText" => [:real_lose_text, "q"],
"Pokemon" => [:pokemon, "ev", :Species] # Species, level
}
# This schema is for definable properties of individual Pokémon (apart from
# species and level which are above).
SUB_SCHEMA = {
"Form" => [:form, "u"],
"Name" => [:name, "s"],
"Name" => [:real_name, "s"],
"Moves" => [:moves, "*e", :Move],
"Ability" => [:ability, "e", :Ability],
"AbilityIndex" => [:ability_index, "u"],
@@ -36,6 +45,10 @@ module GameData
extend ClassMethodsSymbols
include InstanceMethods
def self.sub_schema
return SUB_SCHEMA
end
# @param tr_type [Symbol, String]
# @param tr_name [String]
# @param tr_version [Integer, nil]
@@ -71,19 +84,20 @@ module GameData
end
def initialize(hash)
@id = hash[:id]
@trainer_type = hash[:trainer_type]
@real_name = hash[:name] || "Unnamed"
@version = hash[:version] || 0
@items = hash[:items] || []
@real_lose_text = hash[:lose_text] || "..."
@pokemon = hash[:pokemon] || []
@id = hash[:id]
@trainer_type = hash[:trainer_type]
@real_name = hash[:real_name] || ""
@version = hash[:version] || 0
@items = hash[:items] || []
@real_lose_text = hash[:real_lose_text] || "..."
@pokemon = hash[:pokemon] || []
@pokemon.each do |pkmn|
GameData::Stat.each_main do |s|
pkmn[:iv][s.id] ||= 0 if pkmn[:iv]
pkmn[:ev][s.id] ||= 0 if pkmn[:ev]
end
end
@pbs_file_suffix = hash[:pbs_file_suffix] || ""
end
# @return [String] the translated name of this trainer
@@ -153,7 +167,7 @@ module GameData
end
end
pkmn.happiness = pkmn_data[:happiness] if pkmn_data[:happiness]
pkmn.name = pkmn_data[:name] if pkmn_data[:name] && !pkmn_data[:name].empty?
pkmn.name = pkmn_data[:real_name] if !nil_or_empty?(pkmn_data[:real_name])
if pkmn_data[:shadowness]
pkmn.makeShadow
pkmn.shiny = false
@@ -163,5 +177,38 @@ module GameData
end
return trainer
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, index = 0)
ret = __orig__get_property_for_PBS(key)
case key
when "SectionName"
ret = [@trainer_type, @real_name] if @version == 0
when "Pokemon"
ret = [@pokemon[index][:species], @pokemon[index][:level]]
end
return ret
end
def get_pokemon_property_for_PBS(key, index = 0)
return [@pokemon[index][:species], @pokemon[index][:level]] if key == "Pokemon"
ret = @pokemon[index][SUB_SCHEMA[key][0]]
ret = nil if ret == false || (ret.is_a?(Array) && ret.length == 0) || ret == ""
case key
when "Gender"
ret = ["male", "female"][ret] if ret
when "IV", "EV"
if ret
new_ret = []
GameData::Stat.each_main do |s|
new_ret[s.pbs_order] = ret[s.id] if s.pbs_order >= 0
end
ret = new_ret
end
when "Shiny"
ret = nil if @pokemon[index][:super_shininess]
end
return ret
end
end
end

View File

@@ -12,22 +12,25 @@ module GameData
attr_reader :wild_capture_ME
attr_reader :surf_BGM
attr_reader :bicycle_BGM
attr_reader :pbs_file_suffix
DATA = {}
DATA_FILENAME = "metadata.dat"
PBS_BASE_FILENAME = "metadata"
SCHEMA = {
"StartMoney" => [1, "u"],
"StartItemStorage" => [2, "*e", :Item],
"Home" => [3, "vuuu"],
"StorageCreator" => [4, "s"],
"WildBattleBGM" => [5, "s"],
"TrainerBattleBGM" => [6, "s"],
"WildVictoryBGM" => [7, "s"],
"TrainerVictoryBGM" => [8, "s"],
"WildCaptureME" => [9, "s"],
"SurfBGM" => [10, "s"],
"BicycleBGM" => [11, "s"]
"SectionName" => [:id, "u"],
"StartMoney" => [:start_money, "u"],
"StartItemStorage" => [:start_item_storage, "*e", :Item],
"Home" => [:home, "vuuu"],
"StorageCreator" => [:real_storage_creator, "s"],
"WildBattleBGM" => [:wild_battle_BGM, "s"],
"TrainerBattleBGM" => [:trainer_battle_BGM, "s"],
"WildVictoryBGM" => [:wild_victory_BGM, "s"],
"TrainerVictoryBGM" => [:trainer_victory_BGM, "s"],
"WildCaptureME" => [:wild_capture_ME, "s"],
"SurfBGM" => [:surf_BGM, "s"],
"BicycleBGM" => [:bicycle_BGM, "s"]
}
extend ClassMethodsIDNumbers
@@ -54,11 +57,11 @@ module GameData
end
def initialize(hash)
@id = hash[:id]
@start_money = hash[:start_money] || 3000
@id = hash[:id] || 0
@start_money = hash[:start_money] || 3000
@start_item_storage = hash[:start_item_storage] || []
@home = hash[:home]
@real_storage_creator = hash[:storage_creator]
@real_storage_creator = hash[:real_storage_creator]
@wild_battle_BGM = hash[:wild_battle_BGM]
@trainer_battle_BGM = hash[:trainer_battle_BGM]
@wild_victory_BGM = hash[:wild_victory_BGM]
@@ -66,29 +69,13 @@ module GameData
@wild_capture_ME = hash[:wild_capture_ME]
@surf_BGM = hash[:surf_BGM]
@bicycle_BGM = hash[:bicycle_BGM]
@pbs_file_suffix = hash[:pbs_file_suffix] || ""
end
# @return [String] the translated name of the Pokémon Storage creator
def storage_creator
ret = pbGetMessage(MessageTypes::StorageCreator, 0)
ret = pbGetMessageFromHash(MessageTypes::StorageCreator, @real_storage_creator)
return nil_or_empty?(ret) ? _INTL("Bill") : ret
end
def property_from_string(str)
case str
when "StartMoney" then return @start_money
when "StartItemStorage" then return @start_item_storage
when "Home" then return @home
when "StorageCreator" then return @real_storage_creator
when "WildBattleBGM" then return @wild_battle_BGM
when "TrainerBattleBGM" then return @trainer_battle_BGM
when "WildVictoryBGM" then return @wild_victory_BGM
when "TrainerVictoryBGM" then return @trainer_victory_BGM
when "WildCaptureME" then return @wild_capture_ME
when "SurfBGM" then return @surf_BGM
when "BicycleBGM" then return @bicycle_BGM
end
return nil
end
end
end

View File

@@ -4,20 +4,22 @@ module GameData
attr_reader :trainer_type
attr_reader :walk_charset
attr_reader :home
attr_reader :pbs_file_suffix
DATA = {}
DATA_FILENAME = "player_metadata.dat"
SCHEMA = {
"TrainerType" => [1, "e", :TrainerType],
"WalkCharset" => [2, "s"],
"RunCharset" => [3, "s"],
"CycleCharset" => [4, "s"],
"SurfCharset" => [5, "s"],
"DiveCharset" => [6, "s"],
"FishCharset" => [7, "s"],
"SurfFishCharset" => [8, "s"],
"Home" => [9, "vuuu"]
"SectionName" => [:id, "u"],
"TrainerType" => [:trainer_type, "e", :TrainerType],
"WalkCharset" => [:walk_charset, "s"],
"RunCharset" => [:run_charset, "s"],
"CycleCharset" => [:cycle_charset, "s"],
"SurfCharset" => [:surf_charset, "s"],
"DiveCharset" => [:dive_charset, "s"],
"FishCharset" => [:fish_charset, "s"],
"SurfFishCharset" => [:surf_fish_charset, "s"],
"Home" => [:home, "vuuu"]
}
extend ClassMethodsIDNumbers
@@ -25,6 +27,7 @@ module GameData
def self.editor_properties
return [
["ID", ReadOnlyProperty, _INTL("ID number of this player.")],
["TrainerType", TrainerTypeProperty, _INTL("Trainer type of this player.")],
["WalkCharset", CharacterProperty, _INTL("Charset used while the player is still or walking.")],
["RunCharset", CharacterProperty, _INTL("Charset used while the player is running. Uses WalkCharset if undefined.")],
@@ -56,6 +59,7 @@ module GameData
@fish_charset = hash[:fish_charset]
@surf_fish_charset = hash[:surf_fish_charset]
@home = hash[:home]
@pbs_file_suffix = hash[:pbs_file_suffix] || ""
end
def run_charset
@@ -82,19 +86,10 @@ module GameData
return @surf_fish_charset || fish_charset
end
def property_from_string(str)
case str
when "TrainerType" then return @trainer_type
when "WalkCharset" then return @walk_charset
when "RunCharset" then return @run_charset
when "CycleCharset" then return @cycle_charset
when "SurfCharset" then return @surf_charset
when "DiveCharset" then return @dive_charset
when "FishCharset" then return @fish_charset
when "SurfFishCharset" then return @surf_fish_charset
when "Home" then return @home
end
return nil
alias __orig__get_property_for_PBS get_property_for_PBS unless method_defined?(:__orig__get_property_for_PBS)
def get_property_for_PBS(key)
key = "SectionName" if key == "ID"
return __orig__get_property_for_PBS(key)
end
end
end

View File

@@ -23,33 +23,36 @@ module GameData
attr_reader :town_map_size
attr_reader :battle_environment
attr_reader :flags
attr_reader :pbs_file_suffix
DATA = {}
DATA_FILENAME = "map_metadata.dat"
PBS_BASE_FILENAME = "map_metadata"
SCHEMA = {
"Name" => [1, "s"],
"Outdoor" => [2, "b"],
"ShowArea" => [3, "b"],
"Bicycle" => [4, "b"],
"BicycleAlways" => [5, "b"],
"HealingSpot" => [6, "vuu"],
"Weather" => [7, "eu", :Weather],
"MapPosition" => [8, "uuu"],
"DiveMap" => [9, "v"],
"DarkMap" => [10, "b"],
"SafariMap" => [11, "b"],
"SnapEdges" => [12, "b"],
"Dungeon" => [13, "b"],
"BattleBack" => [14, "s"],
"WildBattleBGM" => [15, "s"],
"TrainerBattleBGM" => [16, "s"],
"WildVictoryBGM" => [17, "s"],
"TrainerVictoryBGM" => [18, "s"],
"WildCaptureME" => [19, "s"],
"MapSize" => [20, "us"],
"Environment" => [21, "e", :Environment],
"Flags" => [22, "*s"]
"SectionName" => [:id, "u"],
"Name" => [:real_name, "s"],
"Outdoor" => [:outdoor_map, "b"],
"ShowArea" => [:announce_location, "b"],
"Bicycle" => [:can_bicycle, "b"],
"BicycleAlways" => [:always_bicycle, "b"],
"HealingSpot" => [:teleport_destination, "vuu"],
"Weather" => [:weather, "eu", :Weather],
"MapPosition" => [:town_map_position, "uuu"],
"DiveMap" => [:dive_map_id, "v"],
"DarkMap" => [:dark_map, "b"],
"SafariMap" => [:safari_map, "b"],
"SnapEdges" => [:snap_edges, "b"],
"Dungeon" => [:random_dungeon, "b"],
"BattleBack" => [:battle_background, "s"],
"WildBattleBGM" => [:wild_battle_BGM, "s"],
"TrainerBattleBGM" => [:trainer_battle_BGM, "s"],
"WildVictoryBGM" => [:wild_victory_BGM, "s"],
"TrainerVictoryBGM" => [:trainer_victory_BGM, "s"],
"WildCaptureME" => [:wild_capture_ME, "s"],
"MapSize" => [:town_map_size, "us"],
"Environment" => [:battle_environment, "e", :Environment],
"Flags" => [:flags, "*s"]
}
extend ClassMethodsIDNumbers
@@ -57,6 +60,7 @@ module GameData
def self.editor_properties
return [
["ID", ReadOnlyProperty, _INTL("ID number of this map.")],
["Name", StringProperty, _INTL("The name of the map, as seen by the player. Can be different to the map's name as seen in RMXP.")],
["Outdoor", BooleanProperty, _INTL("If true, this map is an outdoor map and will be tinted according to time of day.")],
["ShowArea", BooleanProperty, _INTL("If true, the game will display the map's name upon entry.")],
@@ -84,7 +88,7 @@ module GameData
def initialize(hash)
@id = hash[:id]
@real_name = hash[:name]
@real_name = hash[:real_name]
@outdoor_map = hash[:outdoor_map]
@announce_location = hash[:announce_location]
@can_bicycle = hash[:can_bicycle]
@@ -105,35 +109,8 @@ module GameData
@wild_capture_ME = hash[:wild_capture_ME]
@town_map_size = hash[:town_map_size]
@battle_environment = hash[:battle_environment]
@flags = hash[:flags] || []
end
def property_from_string(str)
case str
when "Name" then return @real_name
when "Outdoor" then return @outdoor_map
when "ShowArea" then return @announce_location
when "Bicycle" then return @can_bicycle
when "BicycleAlways" then return @always_bicycle
when "HealingSpot" then return @teleport_destination
when "Weather" then return @weather
when "MapPosition" then return @town_map_position
when "DiveMap" then return @dive_map_id
when "DarkMap" then return @dark_map
when "SafariMap" then return @safari_map
when "SnapEdges" then return @snap_edges
when "Dungeon" then return @random_dungeon
when "BattleBack" then return @battle_background
when "WildBattleBGM" then return @wild_battle_BGM
when "TrainerBattleBGM" then return @trainer_battle_BGM
when "WildVictoryBGM" then return @wild_victory_BGM
when "TrainerVictoryBGM" then return @trainer_victory_BGM
when "WildCaptureME" then return @wild_capture_ME
when "MapSize" then return @town_map_size
when "Environment" then return @battle_environment
when "Flags" then return @flags
end
return nil
@flags = hash[:flags] || []
@pbs_file_suffix = hash[:pbs_file_suffix] || ""
end
# @return [String] the translated name of this map
@@ -144,5 +121,11 @@ 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)
key = "SectionName" if key == "ID"
return __orig__get_property_for_PBS(key)
end
end
end

View File

@@ -10,13 +10,16 @@ module GameData
attr_reader :floor_patch_under_walls
attr_reader :thin_north_wall_offset
attr_reader :flags
attr_reader :pbs_file_suffix
DATA = {}
DATA_FILENAME = "dungeon_tilesets.dat"
PBS_BASE_FILENAME = "dungeon_tilesets"
SCHEMA = {
"Autotile" => [:autotile, "us"],
"Tile" => [:tile, "us"],
"SectionName" => [:id, "u"],
"Autotile" => [:autotile, "^um"],
"Tile" => [:tile, "^um"],
"SnapToLargeGrid" => [:snap_to_large_grid, "b"],
"LargeVoidTiles" => [:large_void_tiles, "b"],
"LargeWallTiles" => [:large_wall_tiles, "b"],
@@ -50,13 +53,14 @@ module GameData
@flags = hash[:flags] || []
@tile_type_ids = {}
set_tile_type_ids(hash)
@pbs_file_suffix = hash[:pbs_file_suffix] || ""
end
def set_tile_type_ids(hash)
[hash[:autotile], hash[:tile]].each_with_index do |array, i|
array.each do |tile_info|
next if !tile_info
tile_type = tile_info[1].downcase.to_sym
tile_type = tile_info[1]
if tile_type == :walls
if @double_walls
if @large_wall_tiles
@@ -192,18 +196,27 @@ module GameData
return ret
end
def property_from_string(str)
case str
when "SnapToLargeGrid" then return @snap_to_large_grid
when "LargeVoidTiles" then return @large_void_tiles
when "LargeWallTiles" then return @large_wall_tiles
when "LargeFloorTiles" then return @large_floor_tiles
when "DoubleWalls" then return @double_walls
when "FloorPatchUnderWalls" then return @floor_patch_under_walls
when "ThinNorthWallOffset" then return @thin_north_wall_offset
when "Flags" then return @flags
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 "ThinNorthWallOffset"
ret = nil if ret == 0
when "Tile", "Autotile"
ret = []
@tile_type_ids.each do |tile_type, tile_ids|
tile_ids.each do |tile|
case key
when "Tile"
ret.push([tile[0] - 384, tile_type]) if !tile[1] && tile[0] >= 384
when "Autotile"
ret.push([tile[0] / 48, tile_type]) if !tile[1] && tile[0] < 384
end
end
end
ret = nil if ret.length == 0
end
return nil
return ret
end
end
end

View File

@@ -25,19 +25,22 @@ module GameData
attr_reader :void_decoration_density, :void_decoration_large_density
attr_reader :rng_seed
attr_reader :flags
attr_reader :pbs_file_suffix
DATA = {}
DATA_FILENAME = "dungeon_parameters.dat"
PBS_BASE_FILENAME = "dungeon_parameters"
SCHEMA = {
"SectionName" => [:id, "mV"],
"DungeonSize" => [:dungeon_size, "vv"],
"CellSize" => [:cell_size, "vv"],
"MinRoomSize" => [:min_room_size, "vv"],
"MaxRoomSize" => [:max_room_size, "vv"],
"CorridorWidth" => [:corridor_width, "v"],
"ShiftCorridors" => [:shift_corridors, "b"],
"NodeLayout" => [:node_layout, "s"],
"RoomLayout" => [:room_layout, "s"],
"ShiftCorridors" => [:random_corridor_shift, "b"],
"NodeLayout" => [:node_layout, "m"],
"RoomLayout" => [:room_layout, "m"],
"RoomChance" => [:room_chance, "v"],
"ExtraConnections" => [:extra_connections_count, "u"],
"FloorPatches" => [:floor_patches, "vvu"],
@@ -66,7 +69,7 @@ module GameData
def initialize(hash)
@id = hash[:id]
@area = hash[:area]
@version = hash[:version] || 0
@version = hash[:version] || 0
@cell_count_x = (hash[:dungeon_size]) ? hash[:dungeon_size][0] : 5
@cell_count_y = (hash[:dungeon_size]) ? hash[:dungeon_size][1] : 5
@cell_width = (hash[:cell_size]) ? hash[:cell_size][0] : 10
@@ -75,11 +78,11 @@ module GameData
@room_min_height = (hash[:min_room_size]) ? hash[:min_room_size][1] : 5
@room_max_width = (hash[:max_room_size]) ? hash[:max_room_size][0] : @cell_width - 1
@room_max_height = (hash[:max_room_size]) ? hash[:max_room_size][1] : @cell_height - 1
@corridor_width = hash[:corridor_width] || 2
@random_corridor_shift = hash[:shift_corridors]
@node_layout = hash[:node_layout]&.downcase&.to_sym || :full
@room_layout = hash[:room_layout]&.downcase&.to_sym || :full
@room_chance = hash[:room_chance] || 70
@corridor_width = hash[:corridor_width] || 2
@random_corridor_shift = hash[:random_corridor_shift]
@node_layout = hash[:node_layout] || :full
@room_layout = hash[:room_layout] || :full
@room_chance = hash[:room_chance] || 70
@extra_connections_count = hash[:extra_connections_count] || 2
@floor_patch_radius = (hash[:floor_patches]) ? hash[:floor_patches][0] : 3
@floor_patch_chance = (hash[:floor_patches]) ? hash[:floor_patches][1] : 75
@@ -89,7 +92,8 @@ module GameData
@void_decoration_density = (hash[:void_decorations]) ? hash[:void_decorations][0] : 50
@void_decoration_large_density = (hash[:void_decorations]) ? hash[:void_decorations][1] : 200
@rng_seed = hash[:rng_seed]
@flags = hash[:flags] || []
@flags = hash[:flags] || []
@pbs_file_suffix = hash[:pbs_file_suffix] || ""
end
def has_flag?(flag)
@@ -114,25 +118,19 @@ module GameData
return width, height
end
def property_from_string(str)
case str
alias __orig__get_property_for_PBS get_property_for_PBS unless method_defined?(:__orig__get_property_for_PBS)
def get_property_for_PBS(key)
case key
when "SectionName" then return [@area, (@version > 0) ? @version : nil]
when "DungeonSize" then return [@cell_count_x, @cell_count_y]
when "CellSize" then return [@cell_width, @cell_height]
when "MinRoomSize" then return [@room_min_width, @room_min_height]
when "MaxRoomSize" then return [@room_max_width, @room_max_height]
when "CorridorWidth" then return @corridor_width
when "ShiftCorridors" then return @random_corridor_shift
when "NodeLayout" then return @node_layout
when "RoomLayout" then return @room_layout
when "RoomChance" then return @room_chance
when "ExtraConnections" then return @extra_connections_count
when "FloorPatches" then return [@floor_patch_radius, @floor_patch_chance, @floor_patch_smooth_rate]
when "FloorDecorations" then return [@floor_decoration_density, @floor_decoration_large_density]
when "VoidDecorations" then return [@void_decoration_density, @void_decoration_large_density]
when "RNGSeed" then return @rng_seed
when "Flags" then return @flags
end
return nil
return __orig__get_property_for_PBS(key)
end
end
end

View File

@@ -6,34 +6,43 @@ module GameData
attr_reader :body, :body1, :body2
attr_reader :battle_request, :battle_remind
attr_reader :end
attr_reader :pbs_file_suffix
DATA = {}
DATA_FILENAME = "phone.dat"
PBS_BASE_FILENAME = "phone"
SCHEMA = {
"Intro" => [:intro, "q"],
"IntroMorning" => [:intro_morning, "q"],
"IntroAfternoon" => [:intro_afternoon, "q"],
"IntroEvening" => [:intro_evening, "q"],
"Body" => [:body, "q"],
"Body1" => [:body1, "q"],
"Body2" => [:body2, "q"],
"BattleRequest" => [:battle_request, "q"],
"BattleRemind" => [:battle_remind, "q"],
"End" => [:end, "q"]
"SectionName" => [:id, "q"],
"Intro" => [:intro, "^q"],
"IntroMorning" => [:intro_morning, "^q"],
"IntroAfternoon" => [:intro_afternoon, "^q"],
"IntroEvening" => [:intro_evening, "^q"],
"Body" => [:body, "^q"],
"Body1" => [:body1, "^q"],
"Body2" => [:body2, "^q"],
"BattleRequest" => [:battle_request, "^q"],
"BattleRemind" => [:battle_remind, "^q"],
"End" => [:end, "^q"]
}
extend ClassMethodsSymbols
include InstanceMethods
# @param tr_type [Symbol, String]
# @param tr_name [String]
# @param tr_name [String, nil] only nil for the default message set
# @param tr_version [Integer, nil]
# @return [Boolean] whether the given other is defined as a self
def self.exists?(tr_type, tr_name, tr_version = 0)
def self.exists?(tr_type, tr_name = nil, tr_version = 0)
if tr_type.is_a?(Array)
tr_name = tr_type[1]
tr_version = tr_type[2]
tr_type = tr_type[0]
end
validate tr_type => [Symbol, String]
validate tr_name => [String]
validate tr_name => [String, NilClass]
key = [tr_type.to_sym, tr_name, tr_version]
key = key[0] if key[1] == nil
return !self::DATA[key].nil?
end
@@ -63,8 +72,8 @@ module GameData
def initialize(hash)
@id = hash[:id]
@trainer_type = hash[:trainer_type]
@real_name = hash[:name]
@version = hash[:version] || 0
@real_name = hash[:real_name]
@version = hash[:version] || 0
@intro = hash[:intro]
@intro_morning = hash[:intro_morning]
@intro_afternoon = hash[:intro_afternoon]
@@ -75,22 +84,17 @@ module GameData
@battle_request = hash[:battle_request]
@battle_remind = hash[:battle_remind]
@end = hash[:end]
@pbs_file_suffix = hash[:pbs_file_suffix] || ""
end
def property_from_string(str)
case str
when "Intro" then return @intro
when "IntroMorning" then return @intro_morning
when "IntroAfternoon" then return @intro_afternoon
when "IntroEvening" then return @intro_evening
when "Body" then return @body
when "Body1" then return @body1
when "Body2" then return @body2
when "BattleRequest" then return @battle_request
when "BattleRemind" then return @battle_remind
when "End" then return @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)
if key == "SectionName"
return "Default" if @id == "default"
ret = [@trainer_type, @real_name, (@version > 0) ? @version : nil]
return ret.compact.join(",")
end
return nil
return __orig__get_property_for_PBS(key)
end
end
end