Class: PFM::Environment
- Includes:
- GameData::SystemTags
- Defined in:
- scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb,
scripts/01450 Systems/00202 Environment/00001 PFM/01201 Weather.rb
Overview
Environment management (Weather, Zone, etc…)
The global Environment object is stored in $env and PFM.game_state.env
Constant Summary collapse
- WEATHER_NAMES =
List of weather symbols
%i[none rain sunny sandstorm hail fog hardsun hardrain wind]
- UNKNOWN_ZONE =
Unkonw location text
'Zone ???'
Constants included from GameData::SystemTags
GameData::SystemTags::AcroBike, GameData::SystemTags::AcroBikeRL, GameData::SystemTags::AcroBikeUD, GameData::SystemTags::BridgeRL, GameData::SystemTags::BridgeUD, GameData::SystemTags::CrackedSoil, GameData::SystemTags::DeepSwamp, GameData::SystemTags::Empty, GameData::SystemTags::HeadButt, GameData::SystemTags::Hole, GameData::SystemTags::JumpD, GameData::SystemTags::JumpL, GameData::SystemTags::JumpR, GameData::SystemTags::JumpU, GameData::SystemTags::MachBike, GameData::SystemTags::RapidsD, GameData::SystemTags::RapidsL, GameData::SystemTags::RapidsR, GameData::SystemTags::RapidsU, GameData::SystemTags::Road, GameData::SystemTags::RocketD, GameData::SystemTags::RocketL, GameData::SystemTags::RocketR, GameData::SystemTags::RocketRD, GameData::SystemTags::RocketRL, GameData::SystemTags::RocketRR, GameData::SystemTags::RocketRU, GameData::SystemTags::RocketU, GameData::SystemTags::SlopesL, GameData::SystemTags::SlopesR, GameData::SystemTags::StairsD, GameData::SystemTags::StairsL, GameData::SystemTags::StairsR, GameData::SystemTags::StairsU, GameData::SystemTags::SwampBorder, GameData::SystemTags::TCave, GameData::SystemTags::TGrass, GameData::SystemTags::TIce, GameData::SystemTags::TMount, GameData::SystemTags::TPond, GameData::SystemTags::TSand, GameData::SystemTags::TSea, GameData::SystemTags::TSnow, GameData::SystemTags::TTallGrass, GameData::SystemTags::TUnderWater, GameData::SystemTags::TWetSand, GameData::SystemTags::WaterFall, GameData::SystemTags::ZTag
Instance Attribute Summary collapse
-
#game_state ⇒ PFM::GameState
Get the game state responsive of the whole game state.
-
#last_map_id ⇒ Integer
readonly
Last visited map ID.
-
#master_zone ⇒ Integer
readonly
The master zone (zone that show the panel like city, unlike house of city).
-
#modified_worldmap_position ⇒ Array?
readonly
Return the modified worldmap position or nil.
-
#worldmap_custom_markers ⇒ Array
readonly
Custom markers on worldmap.
Instance Method Summary collapse
-
#add_worldmap_custom_icon(filename, worldmap_id, x, y, ox_mode = :center, oy_mode = :center)
Add the custom marker to the worldmap.
-
#apply_weather(id, duration = nil)
Apply a new weather to the current environment.
-
#building? ⇒ Boolean
Is the player inside a building (and not on a systemtag).
-
#can_fish? ⇒ Boolean
Can the player fish ?.
-
#cave? ⇒ Boolean
Is the player in a cave ?.
-
#convert_zone_type(system_tag) ⇒ Integer
Convert a system_tag to a zone_type.
-
#current_weather ⇒ Integer
Return the current weather id according to the game state (in battle or not).
-
#current_weather_db_symbol ⇒ Symbol
Return the db_symbol of the current weather.
-
#current_zone ⇒ Integer
(also: #get_current_zone)
Return the current zone in which the player is.
-
#current_zone_data ⇒ Studio::Zone
(also: #get_current_zone_data)
Return the zone data in which the player is.
-
#current_zone_name ⇒ String
Return the zone name in which the player is (master zone).
-
#day? ⇒ Boolean
Is it day time ?.
-
#decrease_weather_duration ⇒ Boolean
Decrease the weather duration, set it to normal (none = 0) if the duration is less than 0.
-
#fog? ⇒ Boolean
Is it foggy ?.
-
#get_event_delete_state(event_id, map_id = @game_state.game_map.map_id) ⇒ Boolean
Get the delete state of an event.
-
#get_worldmap(zone = @zone) ⇒ Integer
Get the worldmap from the zone.
-
#get_zone(x, y, worldmap_id = @worldmap) ⇒ Studio::Zone?
Get the zone data in the worldmap.
-
#get_zone_pos(zone_id, worldmap_id = @worldmap) ⇒ Array(Integer, Integer)
Return the zone coordinate in the worldmap.
-
#get_zone_type(ice_prio = false) ⇒ Integer
Return the zone type.
-
#grass? ⇒ Boolean
Is the player standing in grass ?.
-
#hail? ⇒ Boolean
Does it hail ?.
-
#hardrain? ⇒ Boolean
Is it hardrainning?.
-
#hardsun? ⇒ Boolean
Is it hardsunny?.
-
#ice? ⇒ Boolean
Is the player on ice ?.
-
#initialize(game_state = PFM.game_state) ⇒ Environment
constructor
Create a new Environnement object.
-
#load_zone_information(data, index)
Load the zone information.
-
#morning? ⇒ Boolean
Is it morning time ?.
-
#mount? ⇒ Boolean
Is the player on a mount ?.
-
#night? ⇒ Boolean
Is it night time ?.
-
#normal? ⇒ Boolean
Is the weather normal.
-
#pond? ⇒ Boolean
Is the player on a pond/river ?.
-
#rain? ⇒ Boolean
Is it rainning?.
-
#remove_worldmap_custom_icon(filename, worldmap_id, x, y)
Remove all custom worldmap icons on the coords.
-
#reset_worldmap_position
Reset the modified worldmap position.
-
#reset_zone
Reset the zone informations to get the zone id with update_zone (Panel display).
-
#sand? ⇒ Boolean
Is the player on sand ?.
-
#sandstorm? ⇒ Boolean
Duuuuuuuuuuuuuuuuuuuuuuun Dun dun dun dun dun dun dun dun dun dun dun dundun dun dundundun dun dun dun dun dun dun dundun dundun.
-
#sea? ⇒ Boolean
Is the player on a sea/ocean ?.
-
#set_event_delete_state(event_id, map_id = @game_state.game_map.map_id, state = true)
Set the delete state of an event.
-
#set_worldmap_position(new_x, new_y, new_worldmap_id = nil)
Overwrite the zone worldmap position.
-
#snow? ⇒ Boolean
Is the player on snow or ice ?.
-
#sunny? ⇒ Boolean
Is it sunny?.
-
#sunset? ⇒ Boolean
Is it sunset time ?.
-
#tall_grass? ⇒ Boolean
Is the player standing in tall grass ?.
-
#under_water? ⇒ Boolean
Is the player underwater ?.
-
#update_zone ⇒ Integer, false
Update the zone informations, return the ID of the zone when the player enter in an other zone.
-
#very_tall_grass? ⇒ Boolean
Is the player standing in taller grass ?.
-
#visited_worldmap?(worldmap) ⇒ Boolean
Test if the given world map has been visited.
-
#visited_zone?(zone) ⇒ Boolean
Check if a zone has been visited.
-
#warp_zone ⇒ Integer
(also: #get_warp_zone)
Return the warp zone ID (where the player will teleport with skills).
-
#weather_duration ⇒ Numeric
(also: #get_weather_duration)
Return the current weather duration.
-
#wind? ⇒ Boolean
Is it hardsunny?.
Methods included from GameData::SystemTags
Constructor Details
#initialize(game_state = PFM.game_state) ⇒ Environment
Create a new Environnement object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 29 def initialize(game_state = PFM.game_state) @weather = 0 @battle_weather = 0 @fterrain = 0 @battle_fterrain = 0 @duration = Float::INFINITY @ftduration = Float::INFINITY # Zone where the player currently is @zone = 0 # Zone where the current zone is a child of @master_zone = 0 @warp_zone = 0 @last_map_id = 0 @visited_zone = [] @visited_worldmap = [] @deleted_events = {} # Worldmap where the player currently is @worldmap = 0 @worldmap_custom_markers = [] @game_state = game_state end |
Instance Attribute Details
#game_state ⇒ PFM::GameState
Get the game state responsive of the whole game state
25 26 27 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 25 def game_state @game_state end |
#last_map_id ⇒ Integer (readonly)
Last visited map ID
16 17 18 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 16 def last_map_id @last_map_id end |
#master_zone ⇒ Integer (readonly)
Master zone are used inside Pokemon data
The master zone (zone that show the panel like city, unlike house of city)
13 14 15 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 13 def master_zone @master_zone end |
#modified_worldmap_position ⇒ Array? (readonly)
Return the modified worldmap position or nil
22 23 24 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 22 def modified_worldmap_position @modified_worldmap_position end |
#worldmap_custom_markers ⇒ Array (readonly)
Custom markers on worldmap
19 20 21 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 19 def worldmap_custom_markers @worldmap_custom_markers end |
Instance Method Details
#add_worldmap_custom_icon(filename, worldmap_id, x, y, ox_mode = :center, oy_mode = :center)
Add the custom marker to the worldmap
385 386 387 388 389 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 385 def add_worldmap_custom_icon(filename, worldmap_id, x, y, ox_mode = :center, oy_mode = :center) @worldmap_custom_markers ||= [] @worldmap_custom_markers[worldmap_id] ||= [] @worldmap_custom_markers[worldmap_id].push [filename, x, y, ox_mode, oy_mode] end |
#apply_weather(id, duration = nil)
Apply a new weather to the current environment
8 9 10 11 12 13 14 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01201 Weather.rb', line 8 def apply_weather(id, duration = nil) id = WEATHER_NAMES.index(id) || 0 if id.is_a?(Symbol) @battle_weather = id @weather = id unless @game_state.game_temp.in_battle && !@game_state.game_switches[::Yuki::Sw::MixWeather] @duration = (duration || Float::INFINITY) ajust_weather_switches end |
#building? ⇒ Boolean
Is the player inside a building (and not on a systemtag)
53 54 55 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 53 def building? return (!@game_state.game_switches[Yuki::Sw::Env_CanFly] && @game_state.game_player.system_tag == 0) end |
#can_fish? ⇒ Boolean
Can the player fish ?
353 354 355 356 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 353 def can_fish? tag = @game_state.game_player.front_system_tag return (tag == TPond or tag == TSea) end |
#cave? ⇒ Boolean
Is the player in a cave ?
220 221 222 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 220 def cave? return @game_state.game_player.system_tag == TCave end |
#convert_zone_type(system_tag) ⇒ Integer
Convert a system_tag to a zone_type
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 300 def convert_zone_type(system_tag) case system_tag when TGrass return 1 when TTallGrass return 2 when TCave return 3 when TMount return 4 when TSand return 5 when TPond return 6 when TSea return 7 when TUnderWater return 8 when TSnow return 9 when TIce return 10 else return 0 end end |
#current_weather ⇒ Integer
Return the current weather id according to the game state (in battle or not)
36 37 38 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01201 Weather.rb', line 36 def current_weather return @game_state.game_temp.in_battle ? @battle_weather : @weather end |
#current_weather_db_symbol ⇒ Symbol
Return the db_symbol of the current weather
42 43 44 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01201 Weather.rb', line 42 def current_weather_db_symbol WEATHER_NAMES[current_weather] || :__undef__ end |
#current_zone ⇒ Integer Also known as: get_current_zone
Return the current zone in which the player is
117 118 119 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 117 def current_zone return @zone end |
#current_zone_data ⇒ Studio::Zone Also known as: get_current_zone_data
Return the zone data in which the player is
124 125 126 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 124 def current_zone_data data_zone(@zone) end |
#current_zone_name ⇒ String
Return the zone name in which the player is (master zone)
131 132 133 134 135 136 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 131 def current_zone_name zone = @master_zone return data_zone(zone).name if zone UNKNOWN_ZONE end |
#day? ⇒ Boolean
Is it day time ?
335 336 337 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 335 def day? return @game_state.game_switches[::Yuki::Sw::TJN_DayTime] end |
#decrease_weather_duration ⇒ Boolean
Decrease the weather duration, set it to normal (none = 0) if the duration is less than 0
25 26 27 28 29 30 31 32 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01201 Weather.rb', line 25 def decrease_weather_duration @duration -= 1 if @duration > 0 if @duration <= 0 && @battle_weather != 0 apply_weather(0, 0) return true end return false end |
#fog? ⇒ Boolean
Is it foggy ?
91 92 93 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01201 Weather.rb', line 91 def fog? return current_weather_db_symbol == :fog end |
#get_event_delete_state(event_id, map_id = @game_state.game_map.map_id) ⇒ Boolean
Get the delete state of an event
372 373 374 375 376 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 372 def get_event_delete_state(event_id, map_id = @game_state.game_map.map_id) return false unless (deleted_events = @deleted_events) return false unless deleted_events[map_id] return deleted_events[map_id][event_id] end |
#get_worldmap(zone = @zone) ⇒ Integer
Get the worldmap from the zone
183 184 185 186 187 188 189 190 191 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 183 def get_worldmap(zone = @zone) if @modified_worldmap_position && @modified_worldmap_position[2] return @modified_worldmap_position[2] || 0 elsif zone.is_a?(Studio::Zone) return Studio::Zone.from(zone).worldmaps.first || 0 else return data_zone(zone).worldmaps.first || 0 end end |
#get_zone(x, y, worldmap_id = @worldmap) ⇒ Studio::Zone?
Get the zone data in the worldmap
150 151 152 153 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 150 def get_zone(x, y, worldmap_id = @worldmap) zone_id = data_world_map(worldmap_id).grid.dig(y, x) return zone_id && zone_id >= 0 ? data_zone(zone_id) : nil end |
#get_zone_pos(zone_id, worldmap_id = @worldmap) ⇒ Array(Integer, Integer)
Return the zone coordinate in the worldmap
159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 159 def get_zone_pos(zone_id, worldmap_id = @worldmap) return 0, 0 unless (zone = data_zone(zone_id)) return zone.position.x, zone.position.y if zone.position.x && zone.position.y # Trying to find the current zone world_map = data_world_map(worldmap_id) y = world_map.grid.find_index { |row| row.include?(zone_id) } return 0, 0 unless y x = world_map.grid[y].find_index { |cell| cell == zone_id } || 0 return x, y end |
#get_zone_type(ice_prio = false) ⇒ Integer
Return the zone type
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 271 def get_zone_type(ice_prio = false) if tall_grass? return 1 elsif very_tall_grass? return 2 elsif cave? return 3 elsif mount? return 4 elsif sand? return 5 elsif pond? return 6 elsif sea? return 7 elsif under_water? return 8 elsif snow? return ((ice_prio && ice?) ? 10 : 9) elsif ice? return 10 else return 0 end end |
#grass? ⇒ Boolean
Is the player standing in grass ?
202 203 204 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 202 def grass? return (@game_state.game_switches[Yuki::Sw::Env_CanFly] && @game_state.game_player.system_tag == 0) end |
#hail? ⇒ Boolean
Does it hail ?
85 86 87 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01201 Weather.rb', line 85 def hail? return current_weather_db_symbol == :hail end |
#hardrain? ⇒ Boolean
Is it hardrainning?
54 55 56 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01201 Weather.rb', line 54 def hardrain? return current_weather_db_symbol == :hardrain end |
#hardsun? ⇒ Boolean
Is it hardsunny?
66 67 68 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01201 Weather.rb', line 66 def hardsun? return current_weather_db_symbol == :hardsun end |
#ice? ⇒ Boolean
Is the player on ice ?
257 258 259 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 257 def ice? return @game_state.game_player.system_tag == TIce end |
#load_zone_information(data, index)
Load the zone information
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 83 def load_zone_information(data, index) @zone = index # We store this zone as the zone where to warp if it's possible @warp_zone = index if data.warp.x && data.warp.y # We store this zone as the master zone if there's a panel @master_zone = index if data.panel_id&.>(0) # We memorize the fact we visited this zone @visited_zone << index unless @visited_zone.include?(index) if data.worldmaps.any? # We memorize the fact we visited this worldmap @visited_worldmap << data.worldmaps.first unless @visited_worldmap.include?(data.worldmaps.first) # We store the zone worldmap @worldmap = data.worldmaps.first end # We store the new switch info @game_state.game_switches[Yuki::Sw::Env_CanFly] = (!data.is_warp_disallowed && data.is_fly_allowed) @game_state.game_switches[Yuki::Sw::Env_CanDig] = (!data.is_warp_disallowed && !data.is_fly_allowed) return unless data.forced_weather if data.forced_weather == 0 @game_state.game_screen.weather(0, 0, @game_state.game_switches[Yuki::Sw::Env_CanFly] ? 40 : 0) else @game_state.game_screen.weather(0, 9, 40, psdk_weather: data.forced_weather) end end |
#morning? ⇒ Boolean
Is it morning time ?
341 342 343 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 341 def morning? return @game_state.game_switches[::Yuki::Sw::TJN_MorningTime] end |
#mount? ⇒ Boolean
Is the player on a mount ?
226 227 228 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 226 def mount? return @game_state.game_player.system_tag == TMount end |
#night? ⇒ Boolean
Is it night time ?
329 330 331 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 329 def night? return @game_state.game_switches[::Yuki::Sw::TJN_NightTime] end |
#normal? ⇒ Boolean
Is the weather normal
97 98 99 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01201 Weather.rb', line 97 def normal? return current_weather_db_symbol == :none end |
#pond? ⇒ Boolean
Is the player on a pond/river ?
239 240 241 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 239 def pond? # Etang / Rivière etc... return @game_state.game_player.system_tag == TPond end |
#rain? ⇒ Boolean
Is it rainning?
48 49 50 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01201 Weather.rb', line 48 def rain? return current_weather_db_symbol == :rain end |
#remove_worldmap_custom_icon(filename, worldmap_id, x, y)
Remove all custom worldmap icons on the coords
396 397 398 399 400 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 396 def remove_worldmap_custom_icon(filename, worldmap_id, x, y) return unless @worldmap_custom_markers[worldmap_id] @worldmap_custom_markers[worldmap_id].delete_if { |i| i[0] == filename && i[1] == x && i[2] == y } end |
#reset_worldmap_position
Reset the modified worldmap position
411 412 413 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 411 def reset_worldmap_position @modified_worldmap_position = nil end |
#reset_zone
Reset the zone informations to get the zone id with update_zone (Panel display)
110 111 112 113 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 110 def reset_zone @last_map_id = -1 @zone = -1 end |
#sand? ⇒ Boolean
Is the player on sand ?
232 233 234 235 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 232 def sand? tag = @game_state.game_player.system_tag return (tag == TSand || tag == TWetSand) end |
#sandstorm? ⇒ Boolean
Duuuuuuuuuuuuuuuuuuuuuuun Dun dun dun dun dun dun dun dun dun dun dun dundun dun dundundun dun dun dun dun dun dun dundun dundun
79 80 81 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01201 Weather.rb', line 79 def sandstorm? return current_weather_db_symbol == :sandstorm end |
#sea? ⇒ Boolean
Is the player on a sea/ocean ?
245 246 247 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 245 def sea? return @game_state.game_player.system_tag == TSea end |
#set_event_delete_state(event_id, map_id = @game_state.game_map.map_id, state = true)
Set the delete state of an event
362 363 364 365 366 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 362 def set_event_delete_state(event_id, map_id = @game_state.game_map.map_id, state = true) deleted_events = @deleted_events = {} unless (deleted_events = @deleted_events) deleted_events[map_id] = {} unless deleted_events[map_id] deleted_events[map_id][event_id] = state end |
#set_worldmap_position(new_x, new_y, new_worldmap_id = nil)
Overwrite the zone worldmap position
406 407 408 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 406 def set_worldmap_position(new_x, new_y, new_worldmap_id = nil) @modified_worldmap_position = [new_x, new_y, new_worldmap_id] end |
#snow? ⇒ Boolean
Is the player on snow or ice ?
263 264 265 266 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 263 def snow? tag = @game_state.game_player.system_tag return (tag == TSnow || tag == TIce) # Ice will be the same as snow for skills end |
#sunny? ⇒ Boolean
Is it sunny?
60 61 62 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01201 Weather.rb', line 60 def sunny? return current_weather_db_symbol == :sunny end |
#sunset? ⇒ Boolean
Is it sunset time ?
347 348 349 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 347 def sunset? return @game_state.game_switches[::Yuki::Sw::TJN_SunsetTime] end |
#tall_grass? ⇒ Boolean
Is the player standing in tall grass ?
208 209 210 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 208 def tall_grass? return @game_state.game_player.system_tag == TGrass end |
#under_water? ⇒ Boolean
Is the player underwater ?
251 252 253 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 251 def under_water? return @game_state.game_player.system_tag == TUnderWater end |
#update_zone ⇒ Integer, false
Update the zone informations, return the ID of the zone when the player enter in an other zone
Add the zone to the visited zone Array if the zone has not been visited yet
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 61 def update_zone return false if @last_map_id == @game_state.game_map.map_id @last_map_id = map_id = @game_state.game_map.map_id last_zone = @zone # Searching for the current zone each_data_zone do |data| next unless data if data.maps.include?(map_id) load_zone_information(data, data.id) break end end return false if last_zone == @zone return @zone end |
#very_tall_grass? ⇒ Boolean
Is the player standing in taller grass ?
214 215 216 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 214 def very_tall_grass? return @game_state.game_player.system_tag == TTallGrass end |
#visited_worldmap?(worldmap) ⇒ Boolean
Test if the given world map has been visited
196 197 198 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 196 def visited_worldmap?(worldmap) return @visited_worldmap.include?(worldmap) end |
#visited_zone?(zone) ⇒ Boolean
Check if a zone has been visited
175 176 177 178 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 175 def visited_zone?(zone) zone = zone.id if zone.is_a?(Studio::Zone) return @visited_zone.include?(zone) end |
#warp_zone ⇒ Integer Also known as: get_warp_zone
Return the warp zone ID (where the player will teleport with skills)
140 141 142 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01200 Environnement.rb', line 140 def warp_zone return @warp_zone end |
#weather_duration ⇒ Numeric Also known as: get_weather_duration
Return the current weather duration
18 19 20 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01201 Weather.rb', line 18 def weather_duration return @duration end |
#wind? ⇒ Boolean
Is it hardsunny?
72 73 74 |
# File 'scripts/01450 Systems/00202 Environment/00001 PFM/01201 Weather.rb', line 72 def wind? return current_weather_db_symbol == :wind end |