Added classes GameData::Environment and GameData::BattleTerrain

This commit is contained in:
Maruno17
2021-02-21 18:37:26 +00:00
parent c16311326c
commit 63e640c79b
23 changed files with 368 additions and 258 deletions

View File

@@ -45,7 +45,7 @@ module GameData
"TrainerVictoryME" => [17, "s"],
"WildCaptureME" => [18, "s"],
"MapSize" => [19, "us"],
"Environment" => [20, "e", :PBEnvironment]
"Environment" => [20, "e", :Environment]
}
extend ClassMethodsIDNumbers
@@ -53,26 +53,26 @@ module GameData
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", EnumProperty2.new(PBEnvironment), _INTL("The default battle environment for battles on this map.")]
["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", GameDataProperty.new(:Environment), _INTL("The default battle environment for battles on this map.")]
]
end

View File

@@ -0,0 +1,129 @@
module GameData
class Environment
attr_reader :id
attr_reader :real_name
attr_reader :battle_base
DATA = {}
extend ClassMethodsSymbols
include InstanceMethods
def self.load; end
def self.save; end
def initialize(hash)
@id = hash[:id]
@real_name = hash[:name] || "Unnamed"
@battle_base = hash[:battle_base]
end
# @return [String] the translated name of this environment
def name
return _INTL(@real_name)
end
end
end
GameData::Environment.register({
:id => :None,
:name => _INTL("None")
})
GameData::Environment.register({
:id => :Grass,
:name => _INTL("Grass"),
:battle_base => "grass"
})
GameData::Environment.register({
:id => :TallGrass,
:name => _INTL("Tall grass"),
:battle_base => "grass"
})
GameData::Environment.register({
:id => :MovingWater,
:name => _INTL("Moving water"),
:battle_base => "water"
})
GameData::Environment.register({
:id => :StillWater,
:name => _INTL("Still water"),
:battle_base => "water"
})
GameData::Environment.register({
:id => :Puddle,
:name => _INTL("Puddle"),
:battle_basec => "puddle"
})
GameData::Environment.register({
:id => :Underwater,
:name => _INTL("Underwater")
})
GameData::Environment.register({
:id => :Cave,
:name => _INTL("Cave")
})
GameData::Environment.register({
:id => :Rock,
:name => _INTL("Rock")
})
GameData::Environment.register({
:id => :Sand,
:name => _INTL("Sand"),
:battle_base => "sand"
})
GameData::Environment.register({
:id => :Forest,
:name => _INTL("Forest")
})
GameData::Environment.register({
:id => :ForestGrass,
:name => _INTL("Forest grass"),
:battle_base => "grass"
})
GameData::Environment.register({
:id => :Snow,
:name => _INTL("Snow")
})
GameData::Environment.register({
:id => :Ice,
:name => _INTL("Ice"),
:battle_base => "ice"
})
GameData::Environment.register({
:id => :Volcano,
:name => _INTL("Volcano")
})
GameData::Environment.register({
:id => :Graveyard,
:name => _INTL("Graveyard")
})
GameData::Environment.register({
:id => :Sky,
:name => _INTL("Sky")
})
GameData::Environment.register({
:id => :Space,
:name => _INTL("Space")
})
GameData::Environment.register({
:id => :UltraSpace,
:name => _INTL("Ultra Space")
})

View File

@@ -1,30 +0,0 @@
begin
module PBEnvironment
None = 0
Grass = 1
TallGrass = 2
MovingWater = 3
StillWater = 4
Puddle = 5
Underwater = 6
Cave = 7
Rock = 8
Sand = 9
Forest = 10
ForestGrass = 11
Snow = 12
Ice = 13
Volcano = 14
Graveyard = 15
Sky = 16
Space = 17
UltraSpace = 18
def self.maxValue; return 18; end
end
rescue Exception
if $!.is_a?(SystemExit) || "#{$!.class}"=="Reset"
raise $!
end
end

View File

@@ -0,0 +1,56 @@
# These are in-battle terrain effects caused by moves like Electric Terrain.
module GameData
class BattleTerrain
attr_reader :id
attr_reader :real_name
attr_reader :animation
DATA = {}
extend ClassMethodsSymbols
include InstanceMethods
def self.load; end
def self.save; end
def initialize(hash)
@id = hash[:id]
@real_name = hash[:name] || "Unnamed"
@animation = hash[:animation]
end
# @return [String] the translated name of this battle terrain
def name
return _INTL(@real_name)
end
end
end
GameData::BattleTerrain.register({
:id => :None,
:name => _INTL("None")
})
GameData::BattleTerrain.register({
:id => :Electric,
:name => _INTL("Electric"),
:animation => "ElectricTerrain"
})
GameData::BattleTerrain.register({
:id => :Grassy,
:name => _INTL("Grassy"),
:animation => "GrassyTerrain"
})
GameData::BattleTerrain.register({
:id => :Misty,
:name => _INTL("Misty"),
:animation => "MistyTerrain"
})
GameData::BattleTerrain.register({
:id => :Psychic,
:name => _INTL("Psychic"),
:animation => "PsychicTerrain"
})

View File

@@ -1,25 +0,0 @@
# These are in-battle terrain effects caused by moves like Electric Terrain.
begin
module PBBattleTerrains
None = 0
Electric = 1
Grassy = 2
Misty = 3
Psychic = 4
def self.animationName(terrain)
case terrain
when Electric then return "ElectricTerrain"
when Grassy then return "GrassyTerrain"
when Misty then return "MistyTerrain"
when Psychic then return "PsychicTerrain"
end
return nil
end
end
rescue Exception
if $!.is_a?(SystemExit) || "#{$!.class}"=="Reset"
raise $!
end
end