Class: PFM::Environnement

Inherits:
Object show all
Includes:
GameData::SystemTags
Defined in:
scripts/01200 PFM/00100 Global Systems/01200 Environnement.rb,
scripts/01200 PFM/00100 Global Systems/01201 Weather.rb

Overview

Environment management (Weather, Zone, etc…)

The global Environment object is stored in $env and $pokemon_party.env

Author:

  • Nuri Yuri

Constant Summary collapse

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

Instance Method Summary collapse

Methods included from GameData::SystemTags

gen

Constructor Details

#initializeEnvironnement

Create a new Environnement object

Instance Attribute Details

#last_map_idInteger (readonly)

Last visited map ID

Returns:

#master_zoneInteger (readonly)

Note:

Master zone are used inside Pokemon data

The master zone (zone that show the pannel like city, unlike house of city)

Returns:

#modified_worldmap_positionArray? (readonly)

Return the modified worldmap position or nil

Returns:

  • (Array, nil)

#worldmap_custom_markersArray (readonly)

Custom markers on worldmap

Returns:

  • (Array)

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

Parameters:

  • filename (String)

    the name of the icon in the interface/worldmap/icons directory

  • worldmap_id (Integer)

    the id of the worldmap

  • x (Integer)

    coord x on the worldmap

  • y (Integer)

    coord y on the wolrdmap

  • ox_mode (Symbol, :center) (defaults to: :center)

    :center (the icon will be centered on the tile center), :base

  • oy_mode (Symbol, :center) (defaults to: :center)

    :center (the icon will be centered on the tile center), :base

#apply_weather(id, duration = nil)

Apply a new weather to the current environment

Parameters:

  • id (Integer, Symbol)

    ID of the weather : 0 = None, 1 = Rain, 2 = Sun/Zenith, 3 = Darud Sandstorm, 4 = Hail, 5 = Foggy

  • duration (Integer, nil) (defaults to: nil)

    the total duration of the weather (battle), nil = never stops

#building?Boolean

Is the player inside a building (and not on a systemtag)

Returns:

  • (Boolean)

#can_fish?Boolean

Can the player fish ?

Returns:

  • (Boolean)

#cave?Boolean

Is the player in a cave ?

Returns:

  • (Boolean)

#convert_zone_type(system_tag) ⇒ Integer

Convert a system_tag to a zone_type

Parameters:

  • system_tag (Integer)

    the system tag

Returns:

  • (Integer)

    same as get_zone_type

#current_weatherInteger

Return the current weather id according to the game state (in battle or not)

Returns:

#current_weather_db_symbolSymbol

Return the db_symbol of the current weather

Returns:

  • (Symbol)

#current_zoneInteger Also known as: get_current_zone

Return the current zone in which the player is

Returns:

  • (Integer)

    the zone ID in the database

#current_zone_dataGameData::Zone Also known as: get_current_zone_data

Return the zone data in which the player is

Returns:

#current_zone_nameString

Return the zone name in which the player is (master zone)

Returns:

#day?Boolean

Is it day time ?

Returns:

  • (Boolean)

#decrease_weather_durationBoolean

Decrease the weather duration, set it to normal (none = 0) if the duration is less than 0

Returns:

  • (Boolean)

    true = the weather stopped

#fog?Boolean

Is it foggy ?

Returns:

  • (Boolean)

#get_event_delete_state(event_id, map_id = $game_map.map_id) ⇒ Boolean

Get the delete state of an event

Parameters:

  • event_id (Integer)

    id of the event

  • map_id (Integer) (defaults to: $game_map.map_id)

    id of the map where the event is

Returns:

  • (Boolean)

    if the event is deleted

#get_worldmap(zone = @zone) ⇒ Integer

Get the worldmap from the zone

Parameters:

  • zone (Integer) (defaults to: @zone)

    <default : current zone>

Returns:

#get_zone(x, y, worldmap_id = @worldmap) ⇒ GameData::Map?

Get the zone data in the worldmap

Parameters:

  • x (Integer)

    the x position of the zone in the World Map

  • y (Integer)

    the y position of the zone in the World Map

  • worldmap_id (Integer) (defaults to: @worldmap)

    <default : @worldmap> the worldmap to refer at

Returns:

#get_zone_pos(zone_id, worldmap_id = @worldmap) ⇒ Array(Integer, Integer)

Return the zone coordinate in the worldmap

Parameters:

  • zone_id (Integer)

    id of the zone in the database

  • worldmap_id (Integer) (defaults to: @worldmap)

    <default : @worldmap> the worldmap to refer at

Returns:

#get_zone_type(ice_prio = false) ⇒ Integer

Return the zone type

Parameters:

  • ice_prio (Boolean) (defaults to: false)

    when on snow for background, return ice ID if player is on ice

Returns:

  • (Integer)

    1 = tall grass, 2 = taller grass, 3 = cave, 4 = mount, 5 = sand, 6 = pond, 7 = sea, 8 = underwater, 9 = snow, 10 = ice, 0 = building

#grass?Boolean

Is the player standing in grass ?

Returns:

  • (Boolean)

#hail?Boolean

Does it hail ?

Returns:

  • (Boolean)

#ice?Boolean

Is the player on ice ?

Returns:

  • (Boolean)

#load_zone_information(data, index)

Load the zone information

Parameters:

  • data (GameData::Map)

    the current zone data

  • index (Integer)

    the index of the zone in the stack

#morning?Boolean

Is it morning time ?

Returns:

  • (Boolean)

#mount?Boolean

Is the player on a mount ?

Returns:

  • (Boolean)

#night?Boolean

Is it night time ?

Returns:

  • (Boolean)

#normal?Boolean

Is the weather normal

Returns:

  • (Boolean)

#pond?Boolean

Is the player on a pond/river ?

Returns:

  • (Boolean)

#rain?Boolean

Is it rainning?

Returns:

  • (Boolean)

#remove_worldmap_custom_icon(filename, worldmap_id, x, y)

Remove all custom worldmap icons on the coords

Parameters:

  • filename (String)

    the name of the icon in the interface/worldmap/icons directory

  • worldmap_id (Integer)

    the id of the worldmap

  • x (Integer)

    coord x on the worldmap

  • y (Integer)

    coord y on the wolrdmap

#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 ?

Returns:

  • (Boolean)

#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

Returns:

  • (Boolean)

#sea?Boolean

Is the player on a sea/ocean ?

Returns:

  • (Boolean)

#set_event_delete_state(event_id, map_id = $game_map.map_id, state = true)

Set the delete state of an event

Parameters:

  • event_id (Integer)

    id of the event

  • map_id (Integer) (defaults to: $game_map.map_id)

    id of the map where the event is

  • state (Boolean) (defaults to: true)

    new delete state of the event

#set_worldmap_position(new_x, new_y, new_worldmap_id = nil)

Overwrite the zone worldmap position

Parameters:

  • new_x (Integer)

    the new x coords on the worldmap

  • new_y (Integer)

    the new y coords on the worldmap

  • new_worldmap_id (Integer, nil) (defaults to: nil)

    the new worldmap id

#snow?Boolean

Is the player on snow or ice ?

Returns:

  • (Boolean)

#sunny?Boolean

Is it sunny?

Returns:

  • (Boolean)

#sunset?Boolean

Is it sunset time ?

Returns:

  • (Boolean)

#tall_grass?Boolean

Is the player standing in tall grass ?

Returns:

  • (Boolean)

#under_water?Boolean

Is the player underwater ?

Returns:

  • (Boolean)

#update_zoneInteger, 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

Returns:

  • (Integer, false)

    false = player was in the zone

#very_tall_grass?Boolean

Is the player standing in taller grass ?

Returns:

  • (Boolean)

#visited_worldmap?(worldmap) ⇒ Boolean

Test if the given world map has been visited

Parameters:

Returns:

  • (Boolean)

#visited_zone?(zone) ⇒ Boolean

Check if a zone has been visited

Parameters:

Returns:

  • (Boolean)

#warp_zoneInteger Also known as: get_warp_zone

Return the warp zone ID (where the player will teleport with skills)

Returns:

  • (Integer)

    the ID of the zone in the database

#weather_durationNumeric Also known as: get_weather_duration

Return the current weather duration

Returns:

  • (Numeric)

    can be Float::INFINITY