mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Removed all other uses of and support for ID numbers
This commit is contained in:
@@ -26,9 +26,6 @@ module GameData
|
||||
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
|
||||
raise "Unknown ID #{other}." unless self::DATA.has_key?(other)
|
||||
return self::DATA[other]
|
||||
end
|
||||
@@ -40,9 +37,6 @@ module GameData
|
||||
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
|
||||
return (self::DATA.has_key?(other)) ? self::DATA[other] : nil
|
||||
end
|
||||
|
||||
@@ -54,8 +48,8 @@ module GameData
|
||||
|
||||
# Yields all data in order of their id_number.
|
||||
def each
|
||||
keys = self::DATA.keys.sort { |a, b| self::DATA[a].id_number <=> self::DATA[b].id_number }
|
||||
keys.each { |key| yield self::DATA[key] if !key.is_a?(Integer) }
|
||||
sorted_keys = self::DATA.keys.sort { |a, b| self::DATA[a].id_number <=> self::DATA[b].id_number }
|
||||
sorted_keys.each { |key| yield self::DATA[key] if !key.is_a?(Integer) }
|
||||
end
|
||||
|
||||
def count
|
||||
@@ -218,7 +212,7 @@ module GameData
|
||||
elsif other.is_a?(self.class)
|
||||
return @id == other.id
|
||||
elsif other.is_a?(String)
|
||||
return @id_number == other.to_sym
|
||||
return @id == other.to_sym
|
||||
elsif other.is_a?(Integer)
|
||||
return @id_number == other
|
||||
end
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# The id_number value determines which order the stats are iterated through by
|
||||
# the "each" methods.
|
||||
# The pbs_order value determines the order in which the stats are written in
|
||||
# several PBS files, where base stats/IVs/EVs/EV yields are defined. Only stats
|
||||
# which are yielded by the "each_main" method can have stat numbers defined in
|
||||
@@ -8,7 +6,6 @@
|
||||
module GameData
|
||||
class Stat
|
||||
attr_reader :id
|
||||
attr_reader :id_number
|
||||
attr_reader :real_name
|
||||
attr_reader :real_name_brief
|
||||
attr_reader :type
|
||||
@@ -16,7 +13,7 @@ module GameData
|
||||
|
||||
DATA = {}
|
||||
|
||||
extend ClassMethods
|
||||
extend ClassMethodsSymbols
|
||||
include InstanceMethods
|
||||
|
||||
def self.load; end
|
||||
@@ -39,7 +36,6 @@ module GameData
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@id_number = hash[:id_number] || -1
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@real_name_brief = hash[:name_brief] || "None"
|
||||
@type = hash[:type] || :none
|
||||
@@ -62,7 +58,6 @@ end
|
||||
|
||||
GameData::Stat.register({
|
||||
:id => :HP,
|
||||
:id_number => 0,
|
||||
:name => _INTL("HP"),
|
||||
:name_brief => _INTL("HP"),
|
||||
:type => :main,
|
||||
@@ -71,7 +66,6 @@ GameData::Stat.register({
|
||||
|
||||
GameData::Stat.register({
|
||||
:id => :ATTACK,
|
||||
:id_number => 1,
|
||||
:name => _INTL("Attack"),
|
||||
:name_brief => _INTL("Atk"),
|
||||
:type => :main_battle,
|
||||
@@ -80,7 +74,6 @@ GameData::Stat.register({
|
||||
|
||||
GameData::Stat.register({
|
||||
:id => :DEFENSE,
|
||||
:id_number => 2,
|
||||
:name => _INTL("Defense"),
|
||||
:name_brief => _INTL("Def"),
|
||||
:type => :main_battle,
|
||||
@@ -89,7 +82,6 @@ GameData::Stat.register({
|
||||
|
||||
GameData::Stat.register({
|
||||
:id => :SPECIAL_ATTACK,
|
||||
:id_number => 3,
|
||||
:name => _INTL("Special Attack"),
|
||||
:name_brief => _INTL("SpAtk"),
|
||||
:type => :main_battle,
|
||||
@@ -98,7 +90,6 @@ GameData::Stat.register({
|
||||
|
||||
GameData::Stat.register({
|
||||
:id => :SPECIAL_DEFENSE,
|
||||
:id_number => 4,
|
||||
:name => _INTL("Special Defense"),
|
||||
:name_brief => _INTL("SpDef"),
|
||||
:type => :main_battle,
|
||||
@@ -107,7 +98,6 @@ GameData::Stat.register({
|
||||
|
||||
GameData::Stat.register({
|
||||
:id => :SPEED,
|
||||
:id_number => 5,
|
||||
:name => _INTL("Speed"),
|
||||
:name_brief => _INTL("Spd"),
|
||||
:type => :main_battle,
|
||||
@@ -116,7 +106,6 @@ GameData::Stat.register({
|
||||
|
||||
GameData::Stat.register({
|
||||
:id => :ACCURACY,
|
||||
:id_number => 6,
|
||||
:name => _INTL("accuracy"),
|
||||
:name_brief => _INTL("Acc"),
|
||||
:type => :battle
|
||||
@@ -124,7 +113,6 @@ GameData::Stat.register({
|
||||
|
||||
GameData::Stat.register({
|
||||
:id => :EVASION,
|
||||
:id_number => 7,
|
||||
:name => _INTL("evasiveness"),
|
||||
:name_brief => _INTL("Eva"),
|
||||
:type => :battle
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
module GameData
|
||||
class Nature
|
||||
attr_reader :id
|
||||
attr_reader :id_number
|
||||
attr_reader :real_name
|
||||
attr_reader :stat_changes
|
||||
|
||||
DATA = {}
|
||||
|
||||
extend ClassMethods
|
||||
extend ClassMethodsSymbols
|
||||
include InstanceMethods
|
||||
|
||||
def self.load; end
|
||||
@@ -15,7 +14,6 @@ module GameData
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@id_number = hash[:id_number] || -1
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@stat_changes = hash[:stat_changes] || []
|
||||
end
|
||||
@@ -31,170 +29,145 @@ end
|
||||
|
||||
GameData::Nature.register({
|
||||
:id => :HARDY,
|
||||
:id_number => 0,
|
||||
:name => _INTL("Hardy")
|
||||
})
|
||||
|
||||
GameData::Nature.register({
|
||||
:id => :LONELY,
|
||||
:id_number => 1,
|
||||
:name => _INTL("Lonely"),
|
||||
:stat_changes => [[:ATTACK, 10], [:DEFENSE, -10]]
|
||||
})
|
||||
|
||||
GameData::Nature.register({
|
||||
:id => :BRAVE,
|
||||
:id_number => 2,
|
||||
:name => _INTL("Brave"),
|
||||
:stat_changes => [[:ATTACK, 10], [:SPEED, -10]]
|
||||
})
|
||||
|
||||
GameData::Nature.register({
|
||||
:id => :ADAMANT,
|
||||
:id_number => 3,
|
||||
:name => _INTL("Adamant"),
|
||||
:stat_changes => [[:ATTACK, 10], [:SPECIAL_ATTACK, -10]]
|
||||
})
|
||||
|
||||
GameData::Nature.register({
|
||||
:id => :NAUGHTY,
|
||||
:id_number => 4,
|
||||
:name => _INTL("Naughty"),
|
||||
:stat_changes => [[:ATTACK, 10], [:SPECIAL_DEFENSE, -10]]
|
||||
})
|
||||
|
||||
GameData::Nature.register({
|
||||
:id => :BOLD,
|
||||
:id_number => 5,
|
||||
:name => _INTL("Bold"),
|
||||
:stat_changes => [[:DEFENSE, 10], [:ATTACK, -10]]
|
||||
})
|
||||
|
||||
GameData::Nature.register({
|
||||
:id => :DOCILE,
|
||||
:id_number => 6,
|
||||
:name => _INTL("Docile")
|
||||
})
|
||||
|
||||
GameData::Nature.register({
|
||||
:id => :RELAXED,
|
||||
:id_number => 7,
|
||||
:name => _INTL("Relaxed"),
|
||||
:stat_changes => [[:DEFENSE, 10], [:SPEED, -10]]
|
||||
})
|
||||
|
||||
GameData::Nature.register({
|
||||
:id => :IMPISH,
|
||||
:id_number => 8,
|
||||
:name => _INTL("Impish"),
|
||||
:stat_changes => [[:DEFENSE, 10], [:SPECIAL_ATTACK, -10]]
|
||||
})
|
||||
|
||||
GameData::Nature.register({
|
||||
:id => :LAX,
|
||||
:id_number => 9,
|
||||
:name => _INTL("Lax"),
|
||||
:stat_changes => [[:DEFENSE, 10], [:SPECIAL_DEFENSE, -10]]
|
||||
})
|
||||
|
||||
GameData::Nature.register({
|
||||
:id => :TIMID,
|
||||
:id_number => 10,
|
||||
:name => _INTL("Timid"),
|
||||
:stat_changes => [[:SPEED, 10], [:ATTACK, -10]]
|
||||
})
|
||||
|
||||
GameData::Nature.register({
|
||||
:id => :HASTY,
|
||||
:id_number => 11,
|
||||
:name => _INTL("Hasty"),
|
||||
:stat_changes => [[:SPEED, 10], [:DEFENSE, -10]]
|
||||
})
|
||||
|
||||
GameData::Nature.register({
|
||||
:id => :SERIOUS,
|
||||
:id_number => 12,
|
||||
:name => _INTL("Serious")
|
||||
})
|
||||
|
||||
GameData::Nature.register({
|
||||
:id => :JOLLY,
|
||||
:id_number => 13,
|
||||
:name => _INTL("Jolly"),
|
||||
:stat_changes => [[:SPEED, 10], [:SPECIAL_ATTACK, -10]]
|
||||
})
|
||||
|
||||
GameData::Nature.register({
|
||||
:id => :NAIVE,
|
||||
:id_number => 14,
|
||||
:name => _INTL("Naive"),
|
||||
:stat_changes => [[:SPEED, 10], [:SPECIAL_DEFENSE, -10]]
|
||||
})
|
||||
|
||||
GameData::Nature.register({
|
||||
:id => :MODEST,
|
||||
:id_number => 15,
|
||||
:name => _INTL("Modest"),
|
||||
:stat_changes => [[:SPECIAL_ATTACK, 10], [:ATTACK, -10]]
|
||||
})
|
||||
|
||||
GameData::Nature.register({
|
||||
:id => :MILD,
|
||||
:id_number => 16,
|
||||
:name => _INTL("Mild"),
|
||||
:stat_changes => [[:SPECIAL_ATTACK, 10], [:DEFENSE, -10]]
|
||||
})
|
||||
|
||||
GameData::Nature.register({
|
||||
:id => :QUIET,
|
||||
:id_number => 17,
|
||||
:name => _INTL("Quiet"),
|
||||
:stat_changes => [[:SPECIAL_ATTACK, 10], [:SPEED, -10]]
|
||||
})
|
||||
|
||||
GameData::Nature.register({
|
||||
:id => :BASHFUL,
|
||||
:id_number => 18,
|
||||
:name => _INTL("Bashful")
|
||||
})
|
||||
|
||||
GameData::Nature.register({
|
||||
:id => :RASH,
|
||||
:id_number => 19,
|
||||
:name => _INTL("Rash"),
|
||||
:stat_changes => [[:SPECIAL_ATTACK, 10], [:SPECIAL_DEFENSE, -10]]
|
||||
})
|
||||
|
||||
GameData::Nature.register({
|
||||
:id => :CALM,
|
||||
:id_number => 20,
|
||||
:name => _INTL("Calm"),
|
||||
:stat_changes => [[:SPECIAL_DEFENSE, 10], [:ATTACK, -10]]
|
||||
})
|
||||
|
||||
GameData::Nature.register({
|
||||
:id => :GENTLE,
|
||||
:id_number => 21,
|
||||
:name => _INTL("Gentle"),
|
||||
:stat_changes => [[:SPECIAL_DEFENSE, 10], [:DEFENSE, -10]]
|
||||
})
|
||||
|
||||
GameData::Nature.register({
|
||||
:id => :SASSY,
|
||||
:id_number => 22,
|
||||
:name => _INTL("Sassy"),
|
||||
:stat_changes => [[:SPECIAL_DEFENSE, 10], [:SPEED, -10]]
|
||||
})
|
||||
|
||||
GameData::Nature.register({
|
||||
:id => :CAREFUL,
|
||||
:id_number => 23,
|
||||
:name => _INTL("Careful"),
|
||||
:stat_changes => [[:SPECIAL_DEFENSE, 10], [:SPECIAL_ATTACK, -10]]
|
||||
})
|
||||
|
||||
GameData::Nature.register({
|
||||
:id => :QUIRKY,
|
||||
:id_number => 24,
|
||||
:name => _INTL("Quirky")
|
||||
})
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
module GameData
|
||||
class Move
|
||||
attr_reader :id
|
||||
attr_reader :id_number
|
||||
attr_reader :real_name
|
||||
attr_reader :function_code
|
||||
attr_reader :base_damage
|
||||
@@ -18,12 +17,11 @@ module GameData
|
||||
DATA = {}
|
||||
DATA_FILENAME = "moves.dat"
|
||||
|
||||
extend ClassMethods
|
||||
extend ClassMethodsSymbols
|
||||
include InstanceMethods
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@id_number = hash[:id_number] || -1
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@function_code = hash[:function_code]
|
||||
@base_damage = hash[:base_damage]
|
||||
@@ -40,12 +38,12 @@ module GameData
|
||||
|
||||
# @return [String] the translated name of this move
|
||||
def name
|
||||
return pbGetMessage(MessageTypes::Moves, @id_number)
|
||||
return pbGetMessage(MessageTypes::Moves, @real_name)
|
||||
end
|
||||
|
||||
# @return [String] the translated description of this move
|
||||
def description
|
||||
return pbGetMessage(MessageTypes::MoveDescriptions, @id_number)
|
||||
return pbGetMessage(MessageTypes::MoveDescriptions, @real_description)
|
||||
end
|
||||
|
||||
def physical?
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
module GameData
|
||||
class Item
|
||||
attr_reader :id
|
||||
attr_reader :id_number
|
||||
attr_reader :real_name
|
||||
attr_reader :real_name_plural
|
||||
attr_reader :pocket
|
||||
@@ -15,7 +14,7 @@ module GameData
|
||||
DATA = {}
|
||||
DATA_FILENAME = "items.dat"
|
||||
|
||||
extend ClassMethods
|
||||
extend ClassMethodsSymbols
|
||||
include InstanceMethods
|
||||
|
||||
def self.icon_filename(item)
|
||||
@@ -65,7 +64,6 @@ module GameData
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@id_number = hash[:id_number] || -1
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@real_name_plural = hash[:name_plural] || "Unnamed"
|
||||
@pocket = hash[:pocket] || 1
|
||||
@@ -79,17 +77,17 @@ module GameData
|
||||
|
||||
# @return [String] the translated name of this item
|
||||
def name
|
||||
return pbGetMessage(MessageTypes::Items, @id_number)
|
||||
return pbGetMessageFromHash(MessageTypes::Items, @real_name)
|
||||
end
|
||||
|
||||
# @return [String] the translated plural version of the name of this item
|
||||
def name_plural
|
||||
return pbGetMessage(MessageTypes::ItemPlurals, @id_number)
|
||||
return pbGetMessageFromHash(MessageTypes::ItemPlurals, @real_name_plural)
|
||||
end
|
||||
|
||||
# @return [String] the translated description of this item
|
||||
def description
|
||||
return pbGetMessage(MessageTypes::ItemDescriptions, @id_number)
|
||||
return pbGetMessageFromHash(MessageTypes::ItemDescriptions, @real_description)
|
||||
end
|
||||
|
||||
def is_TM?; return @field_use == 3; end
|
||||
|
||||
@@ -53,18 +53,14 @@ module GameData
|
||||
extend ClassMethodsSymbols
|
||||
include InstanceMethods
|
||||
|
||||
# @param species [Symbol, self, String, Integer]
|
||||
# @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, Integer]
|
||||
validate species => [Symbol, self, String]
|
||||
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
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
module GameData
|
||||
class Ribbon
|
||||
attr_reader :id
|
||||
attr_reader :id_number
|
||||
attr_reader :real_name
|
||||
attr_reader :real_description
|
||||
attr_reader :icon_position # Where this ribbon's graphic is within ribbons.png
|
||||
|
||||
DATA = {}
|
||||
DATA_FILENAME = "ribbons.dat"
|
||||
|
||||
extend ClassMethods
|
||||
extend ClassMethodsSymbols
|
||||
include InstanceMethods
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@id_number = hash[:id_number] || -1
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@real_description = hash[:description] || "???"
|
||||
@icon_position = hash[:icon_position] || -1
|
||||
end
|
||||
|
||||
# @return [String] the translated name of this ribbon
|
||||
def name
|
||||
return pbGetMessage(MessageTypes::RibbonNames, @id_number)
|
||||
return pbGetMessageFromHash(MessageTypes::RibbonNames, @real_name)
|
||||
end
|
||||
|
||||
# @return [String] the translated description of this ribbon
|
||||
def description
|
||||
return pbGetMessage(MessageTypes::RibbonDescriptions, @id_number)
|
||||
return pbGetMessageFromHash(MessageTypes::RibbonDescriptions, @real_description)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
module GameData
|
||||
class TrainerType
|
||||
attr_reader :id
|
||||
attr_reader :id_number
|
||||
attr_reader :real_name
|
||||
attr_reader :base_money
|
||||
attr_reader :battle_BGM
|
||||
@@ -14,7 +13,7 @@ module GameData
|
||||
DATA = {}
|
||||
DATA_FILENAME = "trainer_types.dat"
|
||||
|
||||
extend ClassMethods
|
||||
extend ClassMethodsSymbols
|
||||
include InstanceMethods
|
||||
|
||||
def self.check_file(tr_type, path, optional_suffix = "", suffix = "")
|
||||
@@ -68,7 +67,6 @@ module GameData
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@id_number = hash[:id_number] || -1
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@base_money = hash[:base_money] || 30
|
||||
@battle_BGM = hash[:battle_BGM]
|
||||
@@ -81,7 +79,7 @@ module GameData
|
||||
|
||||
# @return [String] the translated name of this trainer type
|
||||
def name
|
||||
return pbGetMessage(MessageTypes::TrainerTypes, @id_number)
|
||||
return pbGetMessageFromHash(MessageTypes::TrainerTypes, @real_name)
|
||||
end
|
||||
|
||||
def male?; return @gender == 0; end
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
module GameData
|
||||
class Trainer
|
||||
attr_reader :id
|
||||
attr_reader :id_number
|
||||
attr_reader :trainer_type
|
||||
attr_reader :real_name
|
||||
attr_reader :version
|
||||
@@ -33,7 +32,7 @@ module GameData
|
||||
"Ball" => [:poke_ball, "e", :Item],
|
||||
}
|
||||
|
||||
extend ClassMethods
|
||||
extend ClassMethodsSymbols
|
||||
include InstanceMethods
|
||||
|
||||
# @param tr_type [Symbol, String]
|
||||
@@ -72,7 +71,6 @@ module GameData
|
||||
|
||||
def initialize(hash)
|
||||
@id = hash[:id]
|
||||
@id_number = hash[:id_number]
|
||||
@trainer_type = hash[:trainer_type]
|
||||
@real_name = hash[:name] || "Unnamed"
|
||||
@version = hash[:version] || 0
|
||||
|
||||
@@ -33,7 +33,7 @@ class Pokemon
|
||||
attr_writer :ability_index
|
||||
# @return [Array<Pokemon::Move>] the moves known by this Pokémon
|
||||
attr_accessor :moves
|
||||
# @return [Array<Integer>] the IDs of moves known by this Pokémon when it was obtained
|
||||
# @return [Array<Symbol>] the IDs of moves known by this Pokémon when it was obtained
|
||||
attr_accessor :first_moves
|
||||
# @return [Array<Symbol>] an array of ribbons owned by this Pokémon
|
||||
attr_accessor :ribbons
|
||||
@@ -115,7 +115,7 @@ class Pokemon
|
||||
#=============================================================================
|
||||
|
||||
# Changes the Pokémon's species and re-calculates its statistics.
|
||||
# @param species_id [Integer] id of the species to change this Pokémon to
|
||||
# @param species_id [Symbol, String, GameData::Species] ID of the species to change this Pokémon to
|
||||
def species=(species_id)
|
||||
new_species_data = GameData::Species.get(species_id)
|
||||
return if @species == new_species_data.species
|
||||
@@ -127,7 +127,7 @@ class Pokemon
|
||||
calc_stats
|
||||
end
|
||||
|
||||
# @param check_species [Integer, Symbol, String] id of the species to check for
|
||||
# @param check_species [Symbol, String, GameData::Species] ID of the species to check for
|
||||
# @return [Boolean] whether this Pokémon is of the specified species
|
||||
def isSpecies?(check_species)
|
||||
return @species == check_species || (GameData::Species.exists?(check_species) &&
|
||||
@@ -239,7 +239,7 @@ class Pokemon
|
||||
end
|
||||
|
||||
# Sets this Pokémon's status. See {GameData::Status} for all possible status effects.
|
||||
# @param value [Integer, Symbol, String] status to set
|
||||
# @param value [Symbol, String, GameData::Status, Integer] status to set
|
||||
def status=(value)
|
||||
return if !able?
|
||||
new_status = GameData::Status.try_get(value)
|
||||
@@ -316,7 +316,7 @@ class Pokemon
|
||||
return ret
|
||||
end
|
||||
|
||||
# @param type [Symbol, String, Integer] type to check
|
||||
# @param type [Symbol, String, GameData::Type] type to check
|
||||
# @return [Boolean] whether this Pokémon has the specified type
|
||||
def hasType?(type)
|
||||
type = GameData::Type.get(type).id
|
||||
@@ -419,6 +419,7 @@ class Pokemon
|
||||
return @ability
|
||||
end
|
||||
|
||||
# @param value [Symbol, String, GameData::Ability, nil] ability to set
|
||||
def ability=(value)
|
||||
return if value && !GameData::Ability.exists?(value)
|
||||
@ability = (value) ? GameData::Ability.get(value).id : value
|
||||
@@ -426,7 +427,7 @@ class Pokemon
|
||||
|
||||
# Returns whether this Pokémon has a particular ability. If no value
|
||||
# is given, returns whether this Pokémon has an ability set.
|
||||
# @param check_ability [Symbol, GameData::Ability, Integer, nil] ability ID to check
|
||||
# @param check_ability [Symbol, String, GameData::Ability, nil] ability ID to check
|
||||
# @return [Boolean] whether this Pokémon has a particular ability or
|
||||
# an ability at all
|
||||
def hasAbility?(check_ability = nil)
|
||||
@@ -468,7 +469,7 @@ class Pokemon
|
||||
end
|
||||
|
||||
# Sets this Pokémon's nature to a particular nature.
|
||||
# @param value [Symbol, String, Integer, nil] nature to change to
|
||||
# @param value [Symbol, String, GameData::Nature, nil] nature to change to
|
||||
def nature=(value)
|
||||
return if value && !GameData::Nature.exists?(value)
|
||||
@nature = (value) ? GameData::Nature.get(value).id : value
|
||||
@@ -488,7 +489,7 @@ class Pokemon
|
||||
end
|
||||
|
||||
# If defined, this Pokémon's nature is considered to be this when calculating stats.
|
||||
# @param value [Integer, nil] ID of the nature to use for calculating stats
|
||||
# @param value [Symbol, String, GameData::Nature, nil] ID of the nature to use for calculating stats
|
||||
def nature_for_stats=(value)
|
||||
return if value && !GameData::Nature.exists?(value)
|
||||
@nature_for_stats = (value) ? GameData::Nature.get(value).id : value
|
||||
@@ -497,7 +498,7 @@ class Pokemon
|
||||
|
||||
# Returns whether this Pokémon has a particular nature. If no value is given,
|
||||
# returns whether this Pokémon has a nature set.
|
||||
# @param check_nature [Integer] nature ID to check
|
||||
# @param check_nature [Symbol, String, GameData::Nature, nil] nature ID to check
|
||||
# @return [Boolean] whether this Pokémon has a particular nature or a nature
|
||||
# at all
|
||||
def hasNature?(check_nature = nil)
|
||||
@@ -519,7 +520,7 @@ class Pokemon
|
||||
end
|
||||
|
||||
# Gives an item to this Pokémon to hold.
|
||||
# @param value [Symbol, GameData::Item, Integer, nil] ID of the item to give
|
||||
# @param value [Symbol, String, GameData::Item, nil] ID of the item to give
|
||||
# to this Pokémon
|
||||
def item=(value)
|
||||
return if value && !GameData::Item.exists?(value)
|
||||
@@ -528,7 +529,7 @@ class Pokemon
|
||||
|
||||
# Returns whether this Pokémon is holding an item. If an item id is passed,
|
||||
# returns whether the Pokémon is holding that item.
|
||||
# @param check_item [Symbol, GameData::Item, Integer] item ID to check
|
||||
# @param check_item [Symbol, String, GameData::Item, nil] item ID to check
|
||||
# @return [Boolean] whether the Pokémon is holding the specified item or
|
||||
# an item at all
|
||||
def hasItem?(check_item = nil)
|
||||
@@ -568,7 +569,7 @@ class Pokemon
|
||||
return @moves.length
|
||||
end
|
||||
|
||||
# @param move_id [Symbol, String, Integer] ID of the move to check
|
||||
# @param move_id [Symbol, String, GameData::Move] ID of the move to check
|
||||
# @return [Boolean] whether the Pokémon knows the given move
|
||||
def hasMove?(move_id)
|
||||
move_data = GameData::Move.try_get(move_id)
|
||||
@@ -603,7 +604,7 @@ class Pokemon
|
||||
end
|
||||
|
||||
# Silently learns the given move. Will erase the first known move if it has to.
|
||||
# @param move_id [Symbol, String, Integer] ID of the move to learn
|
||||
# @param move_id [Symbol, String, GameData::Move] ID of the move to learn
|
||||
def learn_move(move_id)
|
||||
move_data = GameData::Move.try_get(move_id)
|
||||
return if !move_data
|
||||
@@ -621,7 +622,7 @@ class Pokemon
|
||||
end
|
||||
|
||||
# Deletes the given move from the Pokémon.
|
||||
# @param move_id [Symbol, String, Integer] ID of the move to delete
|
||||
# @param move_id [Symbol, String, GameData::Move] ID of the move to delete
|
||||
def forget_move(move_id)
|
||||
move_data = GameData::Move.try_get(move_id)
|
||||
return if !move_data
|
||||
@@ -646,14 +647,14 @@ class Pokemon
|
||||
end
|
||||
|
||||
# Adds a move to this Pokémon's first moves.
|
||||
# @param move_id [Symbol, String, Integer] ID of the move to add
|
||||
# @param move_id [Symbol, String, GameData::Move] ID of the move to add
|
||||
def add_first_move(move_id)
|
||||
move_data = GameData::Move.try_get(move_id)
|
||||
@first_moves.push(move_data.id) if move_data && !@first_moves.include?(move_data.id)
|
||||
end
|
||||
|
||||
# Removes a move from this Pokémon's first moves.
|
||||
# @param move_id [Symbol, String, Integer] ID of the move to remove
|
||||
# @param move_id [Symbol, String, GameData::Move] ID of the move to remove
|
||||
def remove_first_move(move_id)
|
||||
move_data = GameData::Move.try_get(move_id)
|
||||
@first_moves.delete(move_data.id) if move_data
|
||||
@@ -664,7 +665,7 @@ class Pokemon
|
||||
@first_moves.clear
|
||||
end
|
||||
|
||||
# @param move_id [Symbol, String, Integer] ID of the move to check
|
||||
# @param move_id [Symbol, String, GameData::Move] ID of the move to check
|
||||
# @return [Boolean] whether the Pokémon is compatible with the given move
|
||||
def compatible_with_move?(move_id)
|
||||
move_data = GameData::Move.try_get(move_id)
|
||||
@@ -688,7 +689,7 @@ class Pokemon
|
||||
return @ribbons.length
|
||||
end
|
||||
|
||||
# @param ribbon [Symbol, String, GameData::Ribbon, Integer] ribbon ID to check for
|
||||
# @param ribbon [Symbol, String, GameData::Ribbon] ribbon ID to check for
|
||||
# @return [Boolean] whether this Pokémon has the specified ribbon
|
||||
def hasRibbon?(ribbon)
|
||||
ribbon_data = GameData::Ribbon.try_get(ribbon)
|
||||
@@ -696,7 +697,7 @@ class Pokemon
|
||||
end
|
||||
|
||||
# Gives a ribbon to this Pokémon.
|
||||
# @param ribbon [Symbol, String, GameData::Ribbon, Integer] ID of the ribbon to give
|
||||
# @param ribbon [Symbol, String, GameData::Ribbon] ID of the ribbon to give
|
||||
def giveRibbon(ribbon)
|
||||
ribbon_data = GameData::Ribbon.try_get(ribbon)
|
||||
return if !ribbon_data || @ribbons.include?(ribbon_data.id)
|
||||
@@ -705,7 +706,7 @@ class Pokemon
|
||||
|
||||
# Replaces one ribbon with the next one along, if possible. If none of the
|
||||
# given ribbons are owned, give the first one.
|
||||
# @return [Symbol, nil] ID of the ribbon that was gained
|
||||
# @return [Symbol, String, GameData::Ribbon] ID of the ribbon that was gained
|
||||
def upgradeRibbon(*arg)
|
||||
for i in 0...arg.length - 1
|
||||
this_ribbon_data = GameData::Ribbon.try_get(i)
|
||||
@@ -728,7 +729,7 @@ class Pokemon
|
||||
end
|
||||
|
||||
# Removes the specified ribbon from this Pokémon.
|
||||
# @param ribbon [Symbol, String, GameData::Ribbon, Integer] ID of the ribbon to remove
|
||||
# @param ribbon [Symbol, String, GameData::Ribbon] ID of the ribbon to remove
|
||||
def takeRibbon(ribbon)
|
||||
ribbon_data = GameData::Ribbon.try_get(ribbon)
|
||||
return if !ribbon_data
|
||||
@@ -944,7 +945,7 @@ class Pokemon
|
||||
|
||||
# Called after this Pokémon evolves, to remove its held item (if the evolution
|
||||
# required it to have a held item) or duplicate this Pokémon (Shedinja only).
|
||||
# @param new_species [Pokemon] the species that this Pokémon evolved into
|
||||
# @param new_species [Symbol] the species that this Pokémon evolved into
|
||||
def action_after_evolution(new_species)
|
||||
species_data.get_evolutions(true).each do |evo| # [new_species, method, parameter]
|
||||
break if GameData::Evolution.get(evo[1]).call_after_evolution(self, evo[0], evo[2], new_species)
|
||||
@@ -1058,7 +1059,7 @@ class Pokemon
|
||||
end
|
||||
|
||||
# Creates a new Pokémon object.
|
||||
# @param species [Symbol, String, Integer] Pokémon species
|
||||
# @param species [Symbol, String, GameData::Species] Pokémon species
|
||||
# @param level [Integer] Pokémon level
|
||||
# @param owner [Owner, Player, NPCTrainer] Pokémon owner (the player by default)
|
||||
# @param withMoves [TrueClass, FalseClass] whether the Pokémon should have moves
|
||||
|
||||
@@ -36,7 +36,6 @@ def pbNewTrainer(tr_type, tr_name, tr_version, save_changes = true)
|
||||
trainer = [tr_type, tr_name, [], party, tr_version]
|
||||
if save_changes
|
||||
trainer_hash = {
|
||||
:id_number => GameData::Trainer.count,
|
||||
:trainer_type => tr_type,
|
||||
:name => tr_name,
|
||||
:version => tr_version,
|
||||
@@ -60,8 +59,8 @@ end
|
||||
|
||||
def pbConvertTrainerData
|
||||
tr_type_names = []
|
||||
GameData::TrainerType.each { |t| tr_type_names[t.id_number] = t.real_name }
|
||||
MessageTypes.setMessages(MessageTypes::TrainerTypes, tr_type_names)
|
||||
GameData::TrainerType.each { |t| tr_type_names.push(t.real_name) }
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::TrainerTypes, tr_type_names)
|
||||
Compiler.write_trainer_types
|
||||
Compiler.write_trainers
|
||||
end
|
||||
|
||||
@@ -845,7 +845,7 @@ class PokemonSummary_Scene
|
||||
for i in @ribbonOffset*4...@ribbonOffset*4+12
|
||||
break if !@pokemon.ribbons[i]
|
||||
ribbon_data = GameData::Ribbon.get(@pokemon.ribbons[i])
|
||||
ribn = ribbon_data.id_number - 1
|
||||
ribn = ribbon_data.icon_position
|
||||
imagepos.push(["Graphics/Pictures/ribbons",
|
||||
230 + 68 * (coord % 4), 78 + 68 * (coord / 4).floor,
|
||||
64 * (ribn % 8), 64 * (ribn / 8).floor, 64, 64])
|
||||
|
||||
@@ -360,9 +360,7 @@ def pbTrainerTypeEditor
|
||||
if button == Input::ACTION
|
||||
if tr_type.is_a?(Symbol)
|
||||
if pbConfirmMessageSerious("Delete this trainer type?")
|
||||
id_number = GameData::TrainerType.get(tr_type).id_number
|
||||
GameData::TrainerType::DATA.delete(tr_type)
|
||||
GameData::TrainerType::DATA.delete(id_number)
|
||||
GameData::TrainerType.save
|
||||
pbConvertTrainerData
|
||||
pbMessage(_INTL("The Trainer type was deleted."))
|
||||
@@ -385,7 +383,6 @@ def pbTrainerTypeEditor
|
||||
if pbPropertyList(t_data.id.to_s, data, trainer_type_properties, true)
|
||||
# Construct trainer type hash
|
||||
type_hash = {
|
||||
:id_number => t_data.id_number,
|
||||
:id => t_data.id,
|
||||
:name => data[1],
|
||||
:base_money => data[2],
|
||||
@@ -410,10 +407,6 @@ def pbTrainerTypeEditor
|
||||
end
|
||||
|
||||
def pbTrainerTypeEditorNew(default_name)
|
||||
# Get an unused ID number for the new item
|
||||
max_id = 0
|
||||
GameData::TrainerType.each { |t| max_id = t.id_number if max_id < t.id_number }
|
||||
id_number = max_id + 1
|
||||
# Choose a name
|
||||
name = pbMessageFreeText(_INTL("Please enter the trainer type's name."),
|
||||
(default_name) ? default_name.gsub(/_+/, " ") : "", false, 30)
|
||||
@@ -426,7 +419,7 @@ def pbTrainerTypeEditorNew(default_name)
|
||||
id = id.gsub(/[^A-Za-z0-9_]/, "")
|
||||
id = id.upcase
|
||||
if id.length == 0
|
||||
id = sprintf("T_%03d", id_number)
|
||||
id = sprintf("T_%03d", GameData::TrainerType.count)
|
||||
elsif !id[0, 1][/[A-Z]/]
|
||||
id = "T_" + id
|
||||
end
|
||||
@@ -452,7 +445,6 @@ def pbTrainerTypeEditorNew(default_name)
|
||||
base_money = pbMessageChooseNumber(_INTL("Set the money per level won for defeating the Trainer."), params)
|
||||
# Construct trainer type hash
|
||||
tr_type_hash = {
|
||||
:id_number => id_number,
|
||||
:id => id.to_sym,
|
||||
:name => name,
|
||||
:base_money => base_money,
|
||||
@@ -510,7 +502,6 @@ def pbTrainerBattleEditor
|
||||
if pbConfirmMessageSerious("Delete this trainer battle?")
|
||||
tr_data = GameData::Trainer::DATA[trainer_id]
|
||||
GameData::Trainer::DATA.delete(trainer_id)
|
||||
GameData::Trainer::DATA.delete(tr_data.id_number)
|
||||
modified = true
|
||||
pbMessage(_INTL("The Trainer battle was deleted."))
|
||||
end
|
||||
@@ -552,7 +543,6 @@ def pbTrainerBattleEditor
|
||||
pbMessage(_INTL("Can't save. The Pokémon list is empty."))
|
||||
else
|
||||
trainer_hash = {
|
||||
:id_number => tr_data.id_number,
|
||||
:trainer_type => data[0],
|
||||
:name => data[1],
|
||||
:version => data[2],
|
||||
@@ -595,7 +585,6 @@ def pbTrainerBattleEditor
|
||||
t = pbNewTrainer(tr_type, tr_name, tr_version, false)
|
||||
if t
|
||||
trainer_hash = {
|
||||
:id_number => GameData::Trainer.count,
|
||||
:trainer_type => tr_type,
|
||||
:name => tr_name,
|
||||
:version => tr_version,
|
||||
@@ -837,9 +826,7 @@ def pbItemEditor
|
||||
if button == Input::ACTION
|
||||
if item.is_a?(Symbol)
|
||||
if pbConfirmMessageSerious("Delete this item?")
|
||||
id_number = GameData::Item.get(item).id_number
|
||||
GameData::Item::DATA.delete(item)
|
||||
GameData::Item::DATA.delete(id_number)
|
||||
GameData::Item.save
|
||||
Compiler.write_items
|
||||
pbMessage(_INTL("The item was deleted."))
|
||||
@@ -863,7 +850,6 @@ def pbItemEditor
|
||||
if pbPropertyList(itm.id.to_s, data, item_properties, true)
|
||||
# Construct item hash
|
||||
item_hash = {
|
||||
:id_number => itm.id_number,
|
||||
:id => itm.id,
|
||||
:name => data[1],
|
||||
:name_plural => data[2],
|
||||
@@ -889,10 +875,6 @@ def pbItemEditor
|
||||
end
|
||||
|
||||
def pbItemEditorNew(default_name)
|
||||
# Get an unused ID number for the new item
|
||||
max_id = 0
|
||||
GameData::Item.each { |i| max_id = i.id_number if max_id < i.id_number }
|
||||
id_number = max_id + 1
|
||||
# Choose a name
|
||||
name = pbMessageFreeText(_INTL("Please enter the item's name."),
|
||||
(default_name) ? default_name.gsub(/_+/, " ") : "", false, 30)
|
||||
@@ -905,7 +887,7 @@ def pbItemEditorNew(default_name)
|
||||
id = id.gsub(/[^A-Za-z0-9_]/, "")
|
||||
id = id.upcase
|
||||
if id.length == 0
|
||||
id = sprintf("ITEM_%03d", id_number)
|
||||
id = sprintf("ITEM_%03d", GameData::Item.count)
|
||||
elsif !id[0, 1][/[A-Z]/]
|
||||
id = "ITEM_" + id
|
||||
end
|
||||
@@ -931,7 +913,6 @@ def pbItemEditorNew(default_name)
|
||||
description = StringProperty.set(_INTL("Description"), "")
|
||||
# Construct item hash
|
||||
item_hash = {
|
||||
:id_number => id_number,
|
||||
:id => id.to_sym,
|
||||
:name => name,
|
||||
:name_plural => name + "s",
|
||||
|
||||
@@ -144,7 +144,7 @@ module Compiler
|
||||
schema = GameData::Type::SCHEMA
|
||||
pbEachFileSection3(f) { |contents, type_id|
|
||||
contents["InternalName"] = type_id if !type_id[/^\d+/]
|
||||
id_number = (type_id[/^\d+/]) ? type_id.to_i : nil
|
||||
icon_pos = (type_id[/^\d+/]) ? type_id.to_i : nil
|
||||
# Go through schema hash of compilable data and compile this section
|
||||
for key in schema.keys
|
||||
FileLineData.setSection(type_id, key, contents[key]) # For error reporting
|
||||
@@ -176,7 +176,7 @@ module Compiler
|
||||
:weaknesses => contents["Weaknesses"],
|
||||
:resistances => contents["Resistances"],
|
||||
:immunities => contents["Immunities"],
|
||||
:icon_position => contents["IconPosition"] || id_number
|
||||
:icon_position => contents["IconPosition"] || icon_pos
|
||||
}
|
||||
# Add type's data to records
|
||||
GameData::Type.register(type_hash)
|
||||
@@ -244,15 +244,12 @@ module Compiler
|
||||
move_descriptions = []
|
||||
# Read each line of moves.txt at a time and compile it into an move
|
||||
pbCompilerEachPreppedLine(path) { |line, line_no|
|
||||
line = pbGetCsvRecord(line, line_no, [0, "vnssueeuuueiss",
|
||||
line = pbGetCsvRecord(line, line_no, [0, "snssueeuuueiss",
|
||||
nil, nil, nil, nil, nil, :Type, ["Physical", "Special", "Status"],
|
||||
nil, nil, nil, :Target, nil, nil, nil
|
||||
])
|
||||
move_number = line[0]
|
||||
move_symbol = line[1].to_sym
|
||||
if GameData::Move::DATA[move_number]
|
||||
raise _INTL("Move ID number '{1}' is used twice.\r\n{2}", move_number, FileLineData.linereport)
|
||||
elsif GameData::Move::DATA[move_symbol]
|
||||
if GameData::Move::DATA[move_symbol]
|
||||
raise _INTL("Move ID '{1}' is used twice.\r\n{2}", move_symbol, FileLineData.linereport)
|
||||
end
|
||||
# Sanitise data
|
||||
@@ -264,7 +261,6 @@ module Compiler
|
||||
end
|
||||
# Construct move hash
|
||||
move_hash = {
|
||||
:id_number => move_number,
|
||||
:id => move_symbol,
|
||||
:name => line[2],
|
||||
:function_code => line[3],
|
||||
@@ -281,13 +277,13 @@ module Compiler
|
||||
}
|
||||
# Add move's data to records
|
||||
GameData::Move.register(move_hash)
|
||||
move_names[move_number] = move_hash[:name]
|
||||
move_descriptions[move_number] = move_hash[:description]
|
||||
move_names.push(move_hash[:name])
|
||||
move_descriptions.push(move_hash[:description])
|
||||
}
|
||||
# Save all data
|
||||
GameData::Move.save
|
||||
MessageTypes.setMessages(MessageTypes::Moves, move_names)
|
||||
MessageTypes.setMessages(MessageTypes::MoveDescriptions, move_descriptions)
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::Moves, move_names)
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::MoveDescriptions, move_descriptions)
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -301,17 +297,13 @@ module Compiler
|
||||
item_descriptions = []
|
||||
# Read each line of items.txt at a time and compile it into an item
|
||||
pbCompilerEachCommentedLine(path) { |line, line_no|
|
||||
line = pbGetCsvRecord(line, line_no, [0, "vnssuusuuUN"])
|
||||
item_number = line[0]
|
||||
line = pbGetCsvRecord(line, line_no, [0, "snssuusuuUN"])
|
||||
item_symbol = line[1].to_sym
|
||||
if GameData::Item::DATA[item_number]
|
||||
raise _INTL("Item ID number '{1}' is used twice.\r\n{2}", item_number, FileLineData.linereport)
|
||||
elsif GameData::Item::DATA[item_symbol]
|
||||
if GameData::Item::DATA[item_symbol]
|
||||
raise _INTL("Item ID '{1}' is used twice.\r\n{2}", item_symbol, FileLineData.linereport)
|
||||
end
|
||||
# Construct item hash
|
||||
item_hash = {
|
||||
:id_number => item_number,
|
||||
:id => item_symbol,
|
||||
:name => line[2],
|
||||
:name_plural => line[3],
|
||||
@@ -325,15 +317,15 @@ module Compiler
|
||||
item_hash[:move] = parseMove(line[10]) if !nil_or_empty?(line[10])
|
||||
# Add item's data to records
|
||||
GameData::Item.register(item_hash)
|
||||
item_names[item_number] = item_hash[:name]
|
||||
item_names_plural[item_number] = item_hash[:name_plural]
|
||||
item_descriptions[item_number] = item_hash[:description]
|
||||
item_names.push(item_hash[:name])
|
||||
item_names_plural.push(item_hash[:name_plural])
|
||||
item_descriptions.push(item_hash[:description])
|
||||
}
|
||||
# Save all data
|
||||
GameData::Item.save
|
||||
MessageTypes.setMessages(MessageTypes::Items, item_names)
|
||||
MessageTypes.setMessages(MessageTypes::ItemPlurals, item_names_plural)
|
||||
MessageTypes.setMessages(MessageTypes::ItemDescriptions, item_descriptions)
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::Items, item_names)
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::ItemPlurals, item_names_plural)
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::ItemDescriptions, item_descriptions)
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -785,30 +777,27 @@ module Compiler
|
||||
ribbon_names = []
|
||||
ribbon_descriptions = []
|
||||
pbCompilerEachPreppedLine(path) { |line, line_no|
|
||||
line = pbGetCsvRecord(line, line_no, [0, "vnss"])
|
||||
ribbon_number = line[0]
|
||||
line = pbGetCsvRecord(line, line_no, [0, "unss"])
|
||||
ribbon_symbol = line[1].to_sym
|
||||
if GameData::Ribbon::DATA[ribbon_number]
|
||||
raise _INTL("Ribbon ID number '{1}' is used twice.\r\n{2}", ribbon_number, FileLineData.linereport)
|
||||
elsif GameData::Ribbon::DATA[ribbon_symbol]
|
||||
if GameData::Ribbon::DATA[ribbon_symbol]
|
||||
raise _INTL("Ribbon ID '{1}' is used twice.\r\n{2}", ribbon_symbol, FileLineData.linereport)
|
||||
end
|
||||
# Construct ribbon hash
|
||||
ribbon_hash = {
|
||||
:id => ribbon_symbol,
|
||||
:id_number => ribbon_number,
|
||||
:name => line[2],
|
||||
:description => line[3]
|
||||
:description => line[3],
|
||||
:icon_position => line[0] - 1
|
||||
}
|
||||
# Add ribbon's data to records
|
||||
GameData::Ribbon.register(ribbon_hash)
|
||||
ribbon_names[ribbon_number] = ribbon_hash[:name]
|
||||
ribbon_descriptions[ribbon_number] = ribbon_hash[:description]
|
||||
ribbon_names.push(ribbon_hash[:name])
|
||||
ribbon_descriptions.push(ribbon_hash[:description])
|
||||
}
|
||||
# Save all data
|
||||
GameData::Ribbon.save
|
||||
MessageTypes.setMessages(MessageTypes::RibbonNames, ribbon_names)
|
||||
MessageTypes.setMessages(MessageTypes::RibbonDescriptions, ribbon_descriptions)
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::RibbonNames, ribbon_names)
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::RibbonDescriptions, ribbon_descriptions)
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -924,23 +913,19 @@ module Compiler
|
||||
tr_type_names = []
|
||||
# Read each line of trainertypes.txt at a time and compile it into a trainer type
|
||||
pbCompilerEachCommentedLine(path) { |line, line_no|
|
||||
line = pbGetCsvRecord(line, line_no, [0, "unsUSSSeUS",
|
||||
line = pbGetCsvRecord(line, line_no, [0, "snsUSSSeUS",
|
||||
nil, nil, nil, nil, nil, nil, nil, {
|
||||
"Male" => 0, "M" => 0, "0" => 0,
|
||||
"Female" => 1, "F" => 1, "1" => 1,
|
||||
"Mixed" => 2, "X" => 2, "2" => 2, "" => 2
|
||||
}, nil, nil]
|
||||
)
|
||||
type_number = line[0]
|
||||
type_symbol = line[1].to_sym
|
||||
if GameData::TrainerType::DATA[type_number]
|
||||
raise _INTL("Trainer type ID number '{1}' is used twice.\r\n{2}", type_number, FileLineData.linereport)
|
||||
elsif GameData::TrainerType::DATA[type_symbol]
|
||||
if GameData::TrainerType::DATA[type_symbol]
|
||||
raise _INTL("Trainer type ID '{1}' is used twice.\r\n{2}", type_symbol, FileLineData.linereport)
|
||||
end
|
||||
# Construct trainer type hash
|
||||
type_hash = {
|
||||
:id_number => type_number,
|
||||
:id => type_symbol,
|
||||
:name => line[2],
|
||||
:base_money => line[3],
|
||||
@@ -953,11 +938,11 @@ module Compiler
|
||||
}
|
||||
# Add trainer type's data to records
|
||||
GameData::TrainerType.register(type_hash)
|
||||
tr_type_names[type_number] = type_hash[:name]
|
||||
tr_type_names.push(type_hash[:name])
|
||||
}
|
||||
# Save all data
|
||||
GameData::TrainerType.save
|
||||
MessageTypes.setMessages(MessageTypes::TrainerTypes, tr_type_names)
|
||||
MessageTypes.setMessagesAsHash(MessageTypes::TrainerTypes, tr_type_names)
|
||||
Graphics.update
|
||||
end
|
||||
|
||||
@@ -971,7 +956,6 @@ module Compiler
|
||||
trainer_names = []
|
||||
trainer_lose_texts = []
|
||||
trainer_hash = nil
|
||||
trainer_id = -1
|
||||
current_pkmn = nil
|
||||
old_format_current_line = 0
|
||||
old_format_expected_lines = 0
|
||||
@@ -990,18 +974,16 @@ module Compiler
|
||||
trainer_hash[:id] = [trainer_hash[:trainer_type], trainer_hash[:name], trainer_hash[:version]]
|
||||
GameData::Trainer.register(trainer_hash)
|
||||
end
|
||||
trainer_id += 1
|
||||
line_data = pbGetCsvRecord($~[1], line_no, [0, "esU", :TrainerType])
|
||||
# Construct trainer hash
|
||||
trainer_hash = {
|
||||
:id_number => trainer_id,
|
||||
:trainer_type => line_data[0],
|
||||
:name => line_data[1],
|
||||
:version => line_data[2] || 0,
|
||||
:pokemon => []
|
||||
}
|
||||
current_pkmn = nil
|
||||
trainer_names[trainer_id] = trainer_hash[:name]
|
||||
trainer_names.push(trainer_hash[:name])
|
||||
elsif line[/^\s*(\w+)\s*=\s*(.*)$/]
|
||||
# XXX=YYY lines
|
||||
if !trainer_hash
|
||||
@@ -1063,7 +1045,7 @@ module Compiler
|
||||
case property_name
|
||||
when "Items", "LoseText"
|
||||
trainer_hash[line_schema[0]] = property_value
|
||||
trainer_lose_texts[trainer_id] = property_value if property_name == "LoseText"
|
||||
trainer_lose_texts.push(property_value) if property_name == "LoseText"
|
||||
when "Pokemon"
|
||||
current_pkmn = {
|
||||
:species => property_value[0],
|
||||
@@ -1097,11 +1079,9 @@ module Compiler
|
||||
trainer_hash[:id] = [trainer_hash[:trainer_type], trainer_hash[:name], trainer_hash[:version]]
|
||||
GameData::Trainer.register(trainer_hash)
|
||||
end
|
||||
trainer_id += 1
|
||||
old_format_expected_lines = 3
|
||||
# Construct trainer hash
|
||||
trainer_hash = {
|
||||
:id_number => trainer_id,
|
||||
:trainer_type => nil,
|
||||
:name => nil,
|
||||
:version => 0,
|
||||
@@ -1120,7 +1100,7 @@ module Compiler
|
||||
line_data = [line_data] if !line_data.is_a?(Array)
|
||||
trainer_hash[:name] = line_data[0]
|
||||
trainer_hash[:version] = line_data[1] if line_data[1]
|
||||
trainer_names[trainer_hash[:id_number]] = line_data[0]
|
||||
trainer_names.push(trainer_hash[:name])
|
||||
when 3 # Number of Pokémon, items
|
||||
line_data = pbGetCsvRecord(line, line_no,
|
||||
[0, "vEEEEEEEE", nil, :Item, :Item, :Item, :Item, :Item, :Item, :Item, :Item])
|
||||
|
||||
@@ -158,15 +158,12 @@ module Compiler
|
||||
File.open("PBS/abilities.txt", "wb") { |f|
|
||||
add_PBS_header_to_file(f)
|
||||
f.write("\#-------------------------------\r\n")
|
||||
idx = 1
|
||||
GameData::Ability.each do |a|
|
||||
f.write(sprintf("%s,%s,%s,%s\r\n",
|
||||
idx,
|
||||
f.write(sprintf("0,%s,%s,%s\r\n",
|
||||
csvQuote(a.id.to_s),
|
||||
csvQuote(a.real_name),
|
||||
csvQuoteAlways(a.real_description)
|
||||
))
|
||||
idx += 1
|
||||
end
|
||||
}
|
||||
Graphics.update
|
||||
@@ -184,8 +181,7 @@ module Compiler
|
||||
current_type = m.type
|
||||
f.write("\#-------------------------------\r\n")
|
||||
end
|
||||
f.write(sprintf("%d,%s,%s,%s,%d,%s,%s,%d,%d,%d,%s,%d,%s,%s\r\n",
|
||||
m.id_number,
|
||||
f.write(sprintf("0,%s,%s,%s,%d,%s,%s,%d,%d,%d,%s,%d,%s,%s\r\n",
|
||||
csvQuote(m.id.to_s),
|
||||
csvQuote(m.real_name),
|
||||
csvQuote(m.function_code),
|
||||
@@ -218,10 +214,9 @@ module Compiler
|
||||
f.write("\#-------------------------------\r\n")
|
||||
end
|
||||
move_name = (i.move) ? GameData::Move.get(i.move).id.to_s : ""
|
||||
sprintf_text = "%d,%s,%s,%s,%d,%d,%s,%d,%d,%d\r\n"
|
||||
sprintf_text = "%d,%s,%s,%s,%d,%d,%s,%d,%d,%d,%s\r\n" if move_name != ""
|
||||
sprintf_text = "0,%s,%s,%s,%d,%d,%s,%d,%d,%d\r\n"
|
||||
sprintf_text = "0,%s,%s,%s,%d,%d,%s,%d,%d,%d,%s\r\n" if move_name != ""
|
||||
f.write(sprintf(sprintf_text,
|
||||
i.id_number,
|
||||
csvQuote(i.id.to_s),
|
||||
csvQuote(i.real_name),
|
||||
csvQuote(i.real_name_plural),
|
||||
@@ -516,7 +511,7 @@ module Compiler
|
||||
f.write("\#-------------------------------\r\n")
|
||||
GameData::Ribbon.each do |r|
|
||||
f.write(sprintf("%d,%s,%s,%s\r\n",
|
||||
r.id_number,
|
||||
r.icon_position + 1,
|
||||
csvQuote(r.id.to_s),
|
||||
csvQuote(r.real_name),
|
||||
csvQuoteAlways(r.real_description)
|
||||
@@ -569,8 +564,7 @@ module Compiler
|
||||
add_PBS_header_to_file(f)
|
||||
f.write("\#-------------------------------\r\n")
|
||||
GameData::TrainerType.each do |t|
|
||||
f.write(sprintf("%d,%s,%s,%d,%s,%s,%s,%s,%s,%s\r\n",
|
||||
t.id_number,
|
||||
f.write(sprintf("0,%s,%s,%d,%s,%s,%s,%s,%s,%s\r\n",
|
||||
csvQuote(t.id.to_s),
|
||||
csvQuote(t.real_name),
|
||||
t.base_money,
|
||||
|
||||
Reference in New Issue
Block a user