Merge branch 'dev' into ai

This commit is contained in:
Maruno17
2023-01-08 21:56:33 +00:00
46 changed files with 1701 additions and 848 deletions

View File

@@ -15,7 +15,7 @@ module GameData
"SectionName" => [:id, "u"],
"Name" => [:real_name, "s"],
"Filename" => [:filename, "s"],
"Point" => [:point, "^uussUUUU"],
"Point" => [:point, "^uusSUUUU"],
"Flags" => [:flags, "*s"]
}
@@ -33,7 +33,7 @@ module GameData
# @return [String] the translated name of this region
def name
return pbGetMessage(MessageTypes::RegionNames, @id)
return pbGetMessageFromHash(MessageTypes::Regions, @real_name)
end
def has_flag?(flag)

View File

@@ -35,7 +35,7 @@ module GameData
# @return [String] the translated description of this ability
def description
return pbGetMessageFromHash(MessageTypes::AbilityDescs, @real_description)
return pbGetMessageFromHash(MessageTypes::AbilityDescriptions, @real_description)
end
def has_flag?(flag)

View File

@@ -3,6 +3,8 @@ module GameData
attr_reader :id
attr_reader :real_name
attr_reader :real_name_plural
attr_reader :real_portion_name
attr_reader :real_portion_name_plural
attr_reader :pocket
attr_reader :price
attr_reader :sell_price
@@ -20,21 +22,23 @@ module GameData
PBS_BASE_FILENAME = "items"
SCHEMA = {
"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"]
"SectionName" => [:id, "m"],
"Name" => [:real_name, "s"],
"NamePlural" => [:real_name_plural, "s"],
"PortionName" => [:real_portion_name, "s"],
"PortionNamePlural" => [:real_portion_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
@@ -108,21 +112,23 @@ module GameData
end
def initialize(hash)
@id = hash[:id]
@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] || ""
@id = hash[:id]
@real_name = hash[:real_name] || "Unnamed"
@real_name_plural = hash[:real_name_plural] || "Unnamed"
@real_portion_name = hash[:real_portion_name]
@real_portion_name_plural = hash[:real_portion_name_plural]
@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
@@ -135,6 +141,18 @@ module GameData
return pbGetMessageFromHash(MessageTypes::ItemPlurals, @real_name_plural)
end
# @return [String] the translated portion name of this item
def portion_name
return pbGetMessageFromHash(MessageTypes::ItemPortions, @real_portion_name) if @real_portion_name
return name
end
# @return [String] the translated plural version of the portion name of this item
def portion_name_plural
return pbGetMessageFromHash(MessageTypes::ItemPortionPlurals, @real_portion_name_plural) if @real_portion_name_plural
return name_plural
end
# @return [String] the translated description of this item
def description
return pbGetMessageFromHash(MessageTypes::ItemDescriptions, @real_description)

View File

@@ -225,17 +225,17 @@ module GameData
# @return [String] the translated name of this form of this species
def form_name
return pbGetMessageFromHash(MessageTypes::FormNames, @real_form_name)
return pbGetMessageFromHash(MessageTypes::SpeciesForms, @real_form_name)
end
# @return [String] the translated Pokédex category of this species
def category
return pbGetMessageFromHash(MessageTypes::Kinds, @real_category)
return pbGetMessageFromHash(MessageTypes::SpeciesCategories, @real_category)
end
# @return [String] the translated Pokédex entry of this species
def pokedex_entry
return pbGetMessageFromHash(MessageTypes::Entries, @real_pokedex_entry)
return pbGetMessageFromHash(MessageTypes::PokedexEntries, @real_pokedex_entry)
end
def default_form

View File

@@ -107,7 +107,7 @@ module GameData
# @return [String] the translated in-battle lose message of this trainer
def lose_text
return pbGetMessageFromHash(MessageTypes::TrainerLoseText, @real_lose_text)
return pbGetMessageFromHash(MessageTypes::TrainerLoseTexts, @real_lose_text)
end
# Creates a battle-ready version of a trainer's data.

View File

@@ -115,7 +115,10 @@ module GameData
# @return [String] the translated name of this map
def name
return pbGetMapNameFromId(@id)
ret = pbGetMessageFromHash(MessageTypes::MapNames, @real_name)
ret = pbGetBasicMapNameFromId(@id) if nil_or_empty?(ret)
ret.gsub!(/\\PN/, $player.name) if $player
return ret
end
def has_flag?(flag)