Implemented GameData::Metadata and GameData::MapMetadata

This commit is contained in:
Maruno17
2020-11-15 18:59:07 +00:00
parent d8476d1fa4
commit 52ffae9e8a
45 changed files with 803 additions and 540 deletions

View File

@@ -0,0 +1,120 @@
module GameData
# A mixin module for data classes which provides common class methods (called
# by GameData::Thing.method) that provide access to data held within.
# Assumes the data class's data is stored in a class constant hash called DATA.
# For data that is known by a symbol or an ID number.
module ClassMethods
# @param other [Symbol, self, String, Integer]
# @return [Boolean] whether the given other is defined as a self
def exists?(other)
return false if other.nil?
validate other => [Symbol, self, String, Integer]
other = other.id if other.is_a?(self)
other = other.to_sym if other.is_a?(String)
return !self::DATA[other].nil?
end
# @param other [Symbol, self, String, Integer]
# @return [self]
def get(other)
validate other => [Symbol, self, String, Integer]
return other if other.is_a?(self)
other = other.to_sym if other.is_a?(String)
# if other.is_a?(Integer)
# p "Please switch to symbols, thanks."
# end
raise "Unknown ID #{other}." unless self::DATA.has_key?(other)
return self::DATA[other]
end
def try_get(other)
return nil if other.nil?
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
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?(Symbol) }
end
def load
const_set(:DATA, load_data("Data/#{self::DATA_FILENAME}"))
end
def save
save_data(self::DATA, "Data/#{self::DATA_FILENAME}")
end
end
# A mixin module for data classes which provides common class methods (called
# by GameData::Thing.method) that provide access to data held within.
# Assumes the data class's data is stored in a class constant hash called DATA.
# For data that is only known by an ID number.
module ClassMethodsIDNumbers
# @param other [self, Integer]
# @return [Boolean] whether the given other is defined as a self
def exists?(other)
return false if other.nil?
validate other => [self, Integer]
other = other.id if other.is_a?(self)
return !self::DATA[other].nil?
end
# @param other [self, Integer]
# @return [self]
def get(other)
validate other => [self, Integer]
return other if other.is_a?(self)
raise "Unknown ID #{other}." unless self::DATA.has_key?(other)
return self::DATA[other]
end
def try_get(other)
return nil if other.nil?
validate other => [self, Integer]
return other if other.is_a?(self)
return (self::DATA.has_key?(other)) ? self::DATA[other] : nil
end
def each
keys = self::DATA.keys.sort
keys.each { |key| yield self::DATA[key] }
end
def load
const_set(:DATA, load_data("Data/#{self::DATA_FILENAME}"))
end
def save
save_data(self::DATA, "Data/#{self::DATA_FILENAME}")
end
end
# A mixin module for data classes which provides common instance methods
# (called by thing.method) that analyse the data of a particular thing which
# the instance represents.
module InstanceMethods
# @param other [Symbol, self.class, String, Integer]
# @return [Boolean] whether other represents the same thing as this thing
def ==(other)
return false if other.nil?
validate other => [Symbol, self.class, String, Integer]
if other.is_a?(Symbol)
return @id == other
elsif other.is_a?(self.class)
return @id == other.id
elsif other.is_a?(String)
return @id_number == other.to_sym
elsif other.is_a?(Integer)
return @id_number == other
end
return false
end
end
end

View File

@@ -0,0 +1,32 @@
module GameData
class Ability
attr_reader :id
attr_reader :id_number
attr_reader :real_name
attr_reader :real_description
DATA = {}
DATA_FILENAME = "abilities.dat"
extend ClassMethods
include InstanceMethods
def initialize(hash)
validate hash => Hash, hash[:id] => Symbol
@id = hash[:id]
@id_number = hash[:id_number] || -1
@real_name = hash[:name] || "Unnamed"
@real_description = hash[:description] || "???"
end
# @return [String] the translated name of this ability
def name
return pbGetMessage(MessageTypes::Abilities, @id_number)
end
# @return [String] the translated description of this ability
def description
return pbGetMessage(MessageTypes::AbilityDescs, @id_number)
end
end
end

View File

@@ -0,0 +1,233 @@
module GameData
class Item
attr_reader :id
attr_reader :id_number
attr_reader :real_name
attr_reader :real_name_plural
attr_reader :pocket
attr_reader :price
attr_reader :real_description
attr_reader :field_use
attr_reader :battle_use
attr_reader :type
attr_reader :move
DATA = {}
DATA_FILENAME = "items.dat"
extend ClassMethods
include InstanceMethods
def initialize(hash)
validate hash => Hash, hash[:id] => Symbol
@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
@price = hash[:price] || 0
@real_description = hash[:description] || "???"
@field_use = hash[:field_use] || 0
@battle_use = hash[:battle_use] || 0
@type = hash[:type] || 0
@move = hash[:move]
end
# @return [String] the translated name of this item
def name
return pbGetMessage(MessageTypes::Items, @id_number)
end
# @return [String] the translated plural version of the name of this item
def name_plural
return pbGetMessage(MessageTypes::ItemPlurals, @id_number)
end
# @return [String] the translated description of this item
def description
return pbGetMessage(MessageTypes::ItemDescriptions, @id_number)
end
def is_TM?; return @field_use == 3; end
def is_HM?; return @field_use == 4; end
def is_machine?; return is_TM? || is_HM?; end
def is_mail?; return @type == 1 || @type == 2; end
def is_icon_mail?; return @type == 2; end
def is_poke_ball?; return @type == 3 || @type == 4; end
def is_snag_ball?; return @type == 3 || (@type == 4 && $PokemonGlobal.snagMachine); end
def is_berry?; return @type == 5; end
def is_key_item?; return @type == 6; end
def is_evolution_stone?; return @type == 7; end
def is_fossil?; return @type == 8; end
def is_apricorn?; return @type == 9; end
def is_gem?; return @type == 10; end
def is_mulch?; return @type == 11; end
def is_mega_stone?; return @type == 12; end # Does NOT include Red Orb/Blue Orb
def is_important?
return true if is_key_item? || is_HM?
return true if is_TM? && INFINITE_TMS
return false
end
def can_hold?; return !is_important?; end
def unlosable?(species, ability)
return false if isConst?(species, PBSpecies, :ARCEUS) && ability != :MULTITYPE
return false if isConst?(species, PBSpecies, :SILVALLY) && ability != :RKSSYSTEM
combos = {
:ARCEUS => [:FISTPLATE, :FIGHTINIUMZ,
:SKYPLATE, :FLYINIUMZ,
:TOXICPLATE, :POISONIUMZ,
:EARTHPLATE, :GROUNDIUMZ,
:STONEPLATE, :ROCKIUMZ,
:INSECTPLATE, :BUGINIUMZ,
:SPOOKYPLATE, :GHOSTIUMZ,
:IRONPLATE, :STEELIUMZ,
:FLAMEPLATE, :FIRIUMZ,
:SPLASHPLATE, :WATERIUMZ,
:MEADOWPLATE, :GRASSIUMZ,
:ZAPPLATE, :ELECTRIUMZ,
:MINDPLATE, :PSYCHIUMZ,
:ICICLEPLATE, :ICIUMZ,
:DRACOPLATE, :DRAGONIUMZ,
:DREADPLATE, :DARKINIUMZ,
:PIXIEPLATE, :FAIRIUMZ],
:SILVALLY => [:FIGHTINGMEMORY,
:FLYINGMEMORY,
:POISONMEMORY,
:GROUNDMEMORY,
:ROCKMEMORY,
:BUGMEMORY,
:GHOSTMEMORY,
:STEELMEMORY,
:FIREMEMORY,
:WATERMEMORY,
:GRASSMEMORY,
:ELECTRICMEMORY,
:PSYCHICMEMORY,
:ICEMEMORY,
:DRAGONMEMORY,
:DARKMEMORY,
:FAIRYMEMORY],
:GIRATINA => [:GRISEOUSORB],
:GENESECT => [:BURNDRIVE, :CHILLDRIVE, :DOUSEDRIVE, :SHOCKDRIVE],
:KYOGRE => [:BLUEORB],
:GROUDON => [:REDORB]
}
combos.each do |comboSpecies, items|
next if !isConst?(species, PBSpecies, comboSpecies)
return items.include?(@id)
end
return false
end
end
end
#===============================================================================
# Deprecated methods
#===============================================================================
def pbGetPocket(item)
Deprecation.warn_method('pbGetPocket', 'v20', 'GameData::Item.get(item).pocket')
return GameData::Item.get(item).pocket
end
def pbGetPrice(item)
Deprecation.warn_method('pbGetPrice', 'v20', 'GameData::Item.get(item).price')
return GameData::Item.get(item).price
end
def pbGetMachine(item)
Deprecation.warn_method('pbGetMachine', 'v20', 'GameData::Item.get(item).move')
return GameData::Item.get(item).move
end
def pbIsTechnicalMachine?(item)
Deprecation.warn_method('pbIsTechnicalMachine?', 'v20', 'GameData::Item.get(item).is_TM?')
return GameData::Item.get(item).is_TM?
end
def pbIsHiddenMachine?(item)
Deprecation.warn_method('pbIsHiddenMachine?', 'v20', 'GameData::Item.get(item).is_HM?')
return GameData::Item.get(item).is_HM?
end
def pbIsMachine?(item)
Deprecation.warn_method('pbIsMachine?', 'v20', 'GameData::Item.get(item).is_machine?')
return GameData::Item.get(item).is_machine?
end
def pbIsMail?(item)
Deprecation.warn_method('pbIsMail?', 'v20', 'GameData::Item.get(item).is_mail?')
return GameData::Item.get(item).is_mail?
end
def pbIsMailWithPokemonIcons?(item)
Deprecation.warn_method('pbIsMailWithPokemonIcons?', 'v20', 'GameData::Item.get(item).is_icon_mail?')
return GameData::Item.get(item).is_icon_mail?
end
def pbIsPokeBall?(item)
Deprecation.warn_method('pbIsPokeBall?', 'v20', 'GameData::Item.get(item).is_poke_ball?')
return GameData::Item.get(item).is_poke_ball?
end
def pbIsSnagBall?(item)
Deprecation.warn_method('pbIsSnagBall?', 'v20', 'GameData::Item.get(item).is_snag_ball?')
return GameData::Item.get(item).is_snag_ball?
end
def pbIsBerry?(item)
Deprecation.warn_method('pbIsBerry?', 'v20', 'GameData::Item.get(item).is_berry?')
return GameData::Item.get(item).is_berry?
end
def pbIsKeyItem?(item)
Deprecation.warn_method('pbIsKeyItem?', 'v20', 'GameData::Item.get(item).is_key_item?')
return GameData::Item.get(item).is_key_item?
end
def pbIsEvolutionStone?(item)
Deprecation.warn_method('pbIsEvolutionStone?', 'v20', 'GameData::Item.get(item).is_evolution_stone?')
return GameData::Item.get(item).is_evolution_stone?
end
def pbIsFossil?(item)
Deprecation.warn_method('pbIsFossil?', 'v20', 'GameData::Item.get(item).is_fossil?')
return GameData::Item.get(item).is_fossil?
end
def pbIsApricorn?(item)
Deprecation.warn_method('pbIsApricorn?', 'v20', 'GameData::Item.get(item).is_apricorn?')
return GameData::Item.get(item).is_apricorn?
end
def pbIsGem?(item)
Deprecation.warn_method('pbIsGem?', 'v20', 'GameData::Item.get(item).is_gem?')
return GameData::Item.get(item).is_gem?
end
def pbIsMulch?(item)
Deprecation.warn_method('pbIsMulch?', 'v20', 'GameData::Item.get(item).is_mulch?')
return GameData::Item.get(item).is_mulch?
end
def pbIsMegaStone?(item)
Deprecation.warn_method('pbIsMegaStone?', 'v20', 'GameData::Item.get(item).is_mega_stone?')
return GameData::Item.get(item).is_mega_stone?
end
def pbIsImportantItem?(item)
Deprecation.warn_method('pbIsImportantItem?', 'v20', 'GameData::Item.get(item).is_important?')
return GameData::Item.get(item).is_important?
end
def pbCanHoldItem?(item)
Deprecation.warn_method('pbCanHoldItem?', 'v20', 'GameData::Item.get(item).can_hold?')
return GameData::Item.get(item).can_hold?
end
def pbIsUnlosableItem?(check_item, species, ability)
Deprecation.warn_method('pbIsUnlosableItem?', 'v20', 'GameData::Item.get(item).unlosable?')
return GameData::Item.get(check_item).unlosable?(species, ability)
end

View File

@@ -0,0 +1,36 @@
module GameData
class BerryPlant
attr_reader :id
attr_reader :id_number
attr_reader :hours_per_stage
attr_reader :drying_per_hour
attr_reader :minimum_yield
attr_reader :maximum_yield
DATA = {}
DATA_FILENAME = "berry_plants.dat"
NUMBER_OF_REPLANTS = 9
extend ClassMethods
include InstanceMethods
def initialize(hash)
validate hash => Hash, hash[:id] => Symbol
@id = hash[:id]
@id_number = hash[:id_number] || -1
@hours_per_stage = hash[:hours_per_stage] || 3
@drying_per_hour = hash[:drying_per_hour] || 15
@minimum_yield = hash[:minimum_yield] || 2
@maximum_yield = hash[:maximum_yield] || 5
end
end
end
#===============================================================================
# Deprecated methods
#===============================================================================
def pbGetBerryPlantData(item)
Deprecation.warn_method('pbGetBerryPlantData', 'v20', 'GameData::BerryPlant.get(item)')
return GameData::BerryPlant.get(item)
end

View File

@@ -0,0 +1,229 @@
module GameData
class Metadata
attr_reader :id
attr_reader :home
attr_reader :wild_battle_BGM
attr_reader :trainer_battle_BGM
attr_reader :wild_victory_ME
attr_reader :trainer_victory_ME
attr_reader :wild_capture_ME
attr_reader :surf_BGM
attr_reader :bicycle_BGM
attr_reader :player_A
attr_reader :player_B
attr_reader :player_C
attr_reader :player_D
attr_reader :player_E
attr_reader :player_F
attr_reader :player_G
attr_reader :player_H
DATA = {}
DATA_FILENAME = "metadata.dat"
SCHEMA = {
"Home" => [1, "vuuu"],
"WildBattleBGM" => [2, "s"],
"TrainerBattleBGM" => [3, "s"],
"WildVictoryME" => [4, "s"],
"TrainerVictoryME" => [5, "s"],
"WildCaptureME" => [6, "s"],
"SurfBGM" => [7, "s"],
"BicycleBGM" => [8, "s"],
"PlayerA" => [9, "esssssss", :PBTrainers],
"PlayerB" => [10, "esssssss", :PBTrainers],
"PlayerC" => [11, "esssssss", :PBTrainers],
"PlayerD" => [12, "esssssss", :PBTrainers],
"PlayerE" => [13, "esssssss", :PBTrainers],
"PlayerF" => [14, "esssssss", :PBTrainers],
"PlayerG" => [15, "esssssss", :PBTrainers],
"PlayerH" => [16, "esssssss", :PBTrainers]
}
extend ClassMethodsIDNumbers
include InstanceMethods
def self.editor_properties
return [
["Home", MapCoordsFacingProperty, _INTL("Map ID and X and Y coordinates of where the player goes if no Pokémon Center was entered after a loss.")],
["WildBattleBGM", BGMProperty, _INTL("Default BGM for wild Pokémon battles.")],
["TrainerBattleBGM", BGMProperty, _INTL("Default BGM for Trainer battles.")],
["WildVictoryME", MEProperty, _INTL("Default ME played after winning a wild Pokémon battle.")],
["TrainerVictoryME", MEProperty, _INTL("Default ME played after winning a Trainer battle.")],
["WildCaptureME", MEProperty, _INTL("Default ME played after catching a Pokémon.")],
["SurfBGM", BGMProperty, _INTL("BGM played while surfing.")],
["BicycleBGM", BGMProperty, _INTL("BGM played while on a bicycle.")],
["PlayerA", PlayerProperty, _INTL("Specifies player A.")],
["PlayerB", PlayerProperty, _INTL("Specifies player B.")],
["PlayerC", PlayerProperty, _INTL("Specifies player C.")],
["PlayerD", PlayerProperty, _INTL("Specifies player D.")],
["PlayerE", PlayerProperty, _INTL("Specifies player E.")],
["PlayerF", PlayerProperty, _INTL("Specifies player F.")],
["PlayerG", PlayerProperty, _INTL("Specifies player G.")],
["PlayerH", PlayerProperty, _INTL("Specifies player H.")]
]
end
def self.get
return DATA[0]
end
def self.get_player(id)
case id
when 0 then return self.get.player_A
when 1 then return self.get.player_B
when 2 then return self.get.player_C
when 3 then return self.get.player_D
when 4 then return self.get.player_E
when 5 then return self.get.player_F
when 6 then return self.get.player_G
when 7 then return self.get.player_H
end
return nil
end
def initialize(hash)
validate hash => Hash, hash[:id] => Integer
@id = hash[:id]
@home = hash[:home]
@wild_battle_BGM = hash[:wild_battle_BGM]
@trainer_battle_BGM = hash[:trainer_battle_BGM]
@wild_victory_ME = hash[:wild_victory_ME]
@trainer_victory_ME = hash[:trainer_victory_ME]
@wild_capture_ME = hash[:wild_capture_ME]
@surf_BGM = hash[:surf_BGM]
@bicycle_BGM = hash[:bicycle_BGM]
@player_A = hash[:player_A]
@player_B = hash[:player_B]
@player_C = hash[:player_C]
@player_D = hash[:player_D]
@player_E = hash[:player_E]
@player_F = hash[:player_F]
@player_G = hash[:player_G]
@player_H = hash[:player_H]
end
def property_from_string(str)
case str
when "Home" then return @home
when "WildBattleBGM" then return @wild_battle_BGM
when "TrainerBattleBGM" then return @trainer_battle_BGM
when "WildVictoryME" then return @wild_victory_ME
when "TrainerVictoryME" then return @trainer_victory_ME
when "WildCaptureME" then return @wild_capture_ME
when "SurfBGM" then return @surf_BGM
when "BicycleBGM" then return @bicycle_BGM
when "PlayerA" then return @player_A
when "PlayerB" then return @player_B
when "PlayerC" then return @player_C
when "PlayerD" then return @player_D
when "PlayerE" then return @player_E
when "PlayerF" then return @player_F
when "PlayerG" then return @player_G
when "PlayerH" then return @player_H
end
return nil
end
end
end
#===============================================================================
# Deprecated methods
#===============================================================================
def pbLoadMetadata
Deprecation.warn_method('pbLoadMetadata', 'v20', 'GameData::Metadata.get or GameData::MapMetadata.get(map_id)')
return nil
end
def pbGetMetadata(map_id, metadata_type)
if map_id == 0 # Global metadata
Deprecation.warn_method('pbGetMetadata', 'v20', 'GameData::Metadata.get.something')
ret = GameData::Metadata.get
case metadata_type
when Metadata::HOME then return ret.home
when Metadata::WILD_BATTLE_BGM then return ret.wild_battle_BGM
when Metadata::TRAINER_BATTLE_BGM then return ret.trainer_battle_BGM
when Metadata::WILD_VICTORY_ME then return ret.wild_victory_ME
when Metadata::TRAINER_VICTORY_ME then return ret.trainer_victory_ME
when Metadata::WILD_CAPTURE_ME then return ret.wild_capture_ME
when Metadata::SURF_BGM then return ret.surf_BGM
when Metadata::BICYCLE_BGM then return ret.bicycle_BGM
when Metadata::PLAYER_A then return ret.player_A
when Metadata::PLAYER_B then return ret.player_B
when Metadata::PLAYER_C then return ret.player_C
when Metadata::PLAYER_D then return ret.player_D
when Metadata::PLAYER_E then return ret.player_E
when Metadata::PLAYER_F then return ret.player_F
when Metadata::PLAYER_G then return ret.player_G
when Metadata::PLAYER_H then return ret.player_H
end
else # Map metadata
Deprecation.warn_method('pbGetMetadata', 'v20', 'GameData::MapMetadata.get(map_id).something')
ret = GameData::MapMetadata.get(map_id)
case metadata_type
when MapMetadata::OUTDOOR then return ret.outdoor_map
when MapMetadata::SHOW_AREA then return ret.announce_location
when MapMetadata::BICYCLE then return ret.can_bicycle
when MapMetadata::BICYCLE_ALWAYS then return ret.always_bicycle
when MapMetadata::HEALING_SPOT then return ret.teleport_destination
when MapMetadata::WEATHER then return ret.weather
when MapMetadata::MAP_POSITION then return ret.town_map_position
when MapMetadata::DIVE_MAP then return ret.dive_map_id
when MapMetadata::DARK_MAP then return ret.dark_map
when MapMetadata::SAFARI_MAP then return ret.safari_map
when MapMetadata::SNAP_EDGES then return ret.snap_edges
when MapMetadata::DUNGEON then return ret.random_dungeon
when MapMetadata::BATTLE_BACK then return ret.battle_background
when MapMetadata::WILD_BATTLE_BGM then return ret.wild_battle_BGM
when MapMetadata::TRAINER_BATTLE_BGM then return ret.trainer_battle_BGM
when MapMetadata::WILD_VICTORY_ME then return ret.wild_victory_ME
when MapMetadata::TRAINER_VICTORY_ME then return ret.trainer_victory_ME
when MapMetadata::WILD_CAPTURE_ME then return ret.wild_capture_ME
when MapMetadata::MAP_SIZE then return ret.town_map_size
when MapMetadata::ENVIRONMENT then return ret.battle_environment
end
end
return nil
end
module Metadata
HOME = 1
WILD_BATTLE_BGM = 2
TRAINER_BATTLE_BGM = 3
WILD_VICTORY_ME = 4
TRAINER_VICTORY_ME = 5
WILD_CAPTURE_ME = 6
SURF_BGM = 7
BICYCLE_BGM = 8
PLAYER_A = 9
PLAYER_B = 10
PLAYER_C = 11
PLAYER_D = 12
PLAYER_E = 13
PLAYER_F = 14
PLAYER_G = 15
PLAYER_H = 16
end
module MapMetadata
OUTDOOR = 1
SHOW_AREA = 2
BICYCLE = 3
BICYCLE_ALWAYS = 4
HEALING_SPOT = 5
WEATHER = 6
MAP_POSITION = 7
DIVE_MAP = 8
DARK_MAP = 9
SAFARI_MAP = 10
SNAP_EDGES = 11
DUNGEON = 12
BATTLE_BACK = 13
WILD_BATTLE_BGM = 14
TRAINER_BATTLE_BGM = 15
WILD_VICTORY_ME = 16
TRAINER_VICTORY_ME = 17
WILD_CAPTURE_ME = 18
MAP_SIZE = 19
ENVIRONMENT = 20
end

View File

@@ -0,0 +1,130 @@
module GameData
class MapMetadata
attr_reader :id
attr_reader :outdoor_map
attr_reader :announce_location
attr_reader :can_bicycle
attr_reader :always_bicycle
attr_reader :teleport_destination
attr_reader :weather
attr_reader :town_map_position
attr_reader :dive_map_id
attr_reader :dark_map
attr_reader :safari_map
attr_reader :snap_edges
attr_reader :random_dungeon
attr_reader :battle_background
attr_reader :wild_battle_BGM
attr_reader :trainer_battle_BGM
attr_reader :wild_victory_ME
attr_reader :trainer_victory_ME
attr_reader :wild_capture_ME
attr_reader :town_map_size
attr_reader :battle_environment
DATA = {}
DATA_FILENAME = "map_metadata.dat"
SCHEMA = {
"Outdoor" => [1, "b"],
"ShowArea" => [2, "b"],
"Bicycle" => [3, "b"],
"BicycleAlways" => [4, "b"],
"HealingSpot" => [5, "vuu"],
"Weather" => [6, "eu", :PBFieldWeather],
"MapPosition" => [7, "uuu"],
"DiveMap" => [8, "v"],
"DarkMap" => [9, "b"],
"SafariMap" => [10, "b"],
"SnapEdges" => [11, "b"],
"Dungeon" => [12, "b"],
"BattleBack" => [13, "s"],
"WildBattleBGM" => [14, "s"],
"TrainerBattleBGM" => [15, "s"],
"WildVictoryME" => [16, "s"],
"TrainerVictoryME" => [17, "s"],
"WildCaptureME" => [18, "s"],
"MapSize" => [19, "us"],
"Environment" => [20, "e", :PBEnvironment]
}
extend ClassMethodsIDNumbers
include InstanceMethods
def self.editor_properties
return [
["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.")],
["Bicycle", BooleanProperty, _INTL("If true, the bicycle can be used on this map.")],
["BicycleAlways", BooleanProperty, _INTL("If true, the bicycle will be mounted automatically on this map and cannot be dismounted.")],
["HealingSpot", MapCoordsProperty, _INTL("Map ID of this Pokémon Center's town, and X and Y coordinates of its entrance within that town.")],
["Weather", WeatherEffectProperty, _INTL("Weather conditions in effect for this map.")],
["MapPosition", RegionMapCoordsProperty, _INTL("Identifies the point on the regional map for this map.")],
["DiveMap", MapProperty, _INTL("Specifies the underwater layer of this map. Use only if this map has deep water.")],
["DarkMap", BooleanProperty, _INTL("If true, this map is dark and a circle of light appears around the player. Flash can be used to expand the circle.")],
["SafariMap", BooleanProperty, _INTL("If true, this map is part of the Safari Zone (both indoor and outdoor). Not to be used in the reception desk.")],
["SnapEdges", BooleanProperty, _INTL("If true, when the player goes near this map's edge, the game doesn't center the player as usual.")],
["Dungeon", BooleanProperty, _INTL("If true, this map has a randomly generated layout. See the wiki for more information.")],
["BattleBack", StringProperty, _INTL("PNG files named 'XXX_bg', 'XXX_base0', 'XXX_base1', 'XXX_message' in Battlebacks folder, where XXX is this property's value.")],
["WildBattleBGM", BGMProperty, _INTL("Default BGM for wild Pokémon battles on this map.")],
["TrainerBattleBGM", BGMProperty, _INTL("Default BGM for trainer battles on this map.")],
["WildVictoryME", MEProperty, _INTL("Default ME played after winning a wild Pokémon battle on this map.")],
["TrainerVictoryME", MEProperty, _INTL("Default ME played after winning a Trainer battle on this map.")],
["WildCaptureME", MEProperty, _INTL("Default ME played after catching a wild Pokémon on this map.")],
["MapSize", MapSizeProperty, _INTL("The width of the map in Town Map squares, and a string indicating which squares are part of this map.")],
["Environment", EnvironmentProperty, _INTL("The default battle environment for battles on this map.")]
]
end
def initialize(hash)
validate hash => Hash, hash[:id] => Integer
@id = hash[:id]
@outdoor_map = hash[:outdoor_map]
@announce_location = hash[:announce_location]
@can_bicycle = hash[:can_bicycle]
@always_bicycle = hash[:always_bicycle]
@teleport_destination = hash[:teleport_destination]
@weather = hash[:weather]
@town_map_position = hash[:town_map_position]
@dive_map_id = hash[:dive_map_id]
@dark_map = hash[:dark_map]
@safari_map = hash[:safari_map]
@snap_edges = hash[:snap_edges]
@random_dungeon = hash[:random_dungeon]
@battle_background = hash[:battle_background]
@wild_battle_BGM = hash[:wild_battle_BGM]
@trainer_battle_BGM = hash[:trainer_battle_BGM]
@wild_victory_ME = hash[:wild_victory_ME]
@trainer_victory_ME = hash[:trainer_victory_ME]
@wild_capture_ME = hash[:wild_capture_ME]
@town_map_size = hash[:town_map_size]
@battle_environment = hash[:battle_environment]
end
def property_from_string(str)
case str
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 "WildVictoryME" then return @wild_victory_ME
when "TrainerVictoryME" then return @trainer_victory_ME
when "WildCaptureME" then return @wild_capture_ME
when "MapSize" then return @town_map_size
when "Environment" then return @battle_environment
end
return nil
end
end
end