Class: PFM::Wild_RoamingInfo
- Defined in:
- scripts/01450 Systems/99991 Wild/00300 Wild_RoamingInfo.rb
Overview
Wild Roaming Pokemon informations
Constant Summary collapse
- RoamingProcs =
The proc takes the Wild_RoamingInfo in parameter and change the informations.
[ proc do |infos| infos.map_id = 1 infos.zone_type = 1 infos.tag = 1 end, proc do |infos| maps = [25, 46, 35, 27] # Maps where the pokemon can spawn if (infos.map_id == $game_map.map_id && infos.spotted) || infos.map_id == -1 infos.map_id = (maps - [infos.map_id]).sample infos.spotted = false end infos.zone_type = 1 infos.tag = 0 end ]
- @@locked =
True if the roaming informations can't be updated
true
Instance Attribute Summary collapse
-
#map_id ⇒ Integer
The ID of the map in which the Roaming Pokemon will appear.
-
#pokemon ⇒ PFM::Pokemon
readonly
The roaming Pokemon.
-
#spotted ⇒ Boolean
The spotted state of the pokemon.
-
#tag ⇒ Integer
The tag in which the Roaming Pokemon will appear.
-
#zone_type ⇒ Integer
The system_tag zone ID in which the Roaming Pokemon will appear.
Class Method Summary collapse
-
.lock
Disallow roaming informations to be updated.
-
.unlock
Allow roaming informations to be updated.
Instance Method Summary collapse
-
#appearing? ⇒ Boolean
Test if the Roaming Pokemon is appearing (to start the battle).
-
#could_appear? ⇒ Boolean
Test if the Roaming Pokemon could appear here.
-
#initialize(pokemon, chance, zone_proc_id) ⇒ Wild_RoamingInfo
constructor
Create a new Wild_RoamingInfo.
-
#pokemon_dead? ⇒ Boolean
Test if the Pokemon is dead (delete from the stack).
-
#update
Call the Roaming Proc to update the Roaming Pokemon zone information.
Constructor Details
#initialize(pokemon, chance, zone_proc_id) ⇒ Wild_RoamingInfo
Create a new Wild_RoamingInfo
36 37 38 39 40 41 42 43 44 45 |
# File 'scripts/01450 Systems/99991 Wild/00300 Wild_RoamingInfo.rb', line 36 def initialize(pokemon, chance, zone_proc_id) @pokemon = pokemon @proc_id = zone_proc_id @map_id = -1 @chance = chance @tag = 0 @zone_type = -1 @spotted = true update end |
Instance Attribute Details
#map_id ⇒ Integer
The ID of the map in which the Roaming Pokemon will appear
13 14 15 |
# File 'scripts/01450 Systems/99991 Wild/00300 Wild_RoamingInfo.rb', line 13 def map_id @map_id end |
#pokemon ⇒ PFM::Pokemon (readonly)
The roaming Pokemon
16 17 18 |
# File 'scripts/01450 Systems/99991 Wild/00300 Wild_RoamingInfo.rb', line 16 def pokemon @pokemon end |
#spotted ⇒ Boolean
The spotted state of the pokemon. True if the player look at the map position or after fighting the roaming pokemon
19 20 21 |
# File 'scripts/01450 Systems/99991 Wild/00300 Wild_RoamingInfo.rb', line 19 def spotted @spotted end |
#tag ⇒ Integer
The tag in which the Roaming Pokemon will appear
7 8 9 |
# File 'scripts/01450 Systems/99991 Wild/00300 Wild_RoamingInfo.rb', line 7 def tag @tag end |
#zone_type ⇒ Integer
The system_tag zone ID in which the Roaming Pokemon will appear
10 11 12 |
# File 'scripts/01450 Systems/99991 Wild/00300 Wild_RoamingInfo.rb', line 10 def zone_type @zone_type end |
Class Method Details
.lock
Disallow roaming informations to be updated
28 29 30 |
# File 'scripts/01450 Systems/99991 Wild/00300 Wild_RoamingInfo.rb', line 28 def self.lock @@locked = true end |
.unlock
Allow roaming informations to be updated
24 25 26 |
# File 'scripts/01450 Systems/99991 Wild/00300 Wild_RoamingInfo.rb', line 24 def self.unlock @@locked = false end |
Instance Method Details
#appearing? ⇒ Boolean
Test if the Roaming Pokemon is appearing (to start the battle)
60 61 62 63 64 65 66 67 68 |
# File 'scripts/01450 Systems/99991 Wild/00300 Wild_RoamingInfo.rb', line 60 def appearing? return false if @pokemon.hp <= 0 if @map_id == $game_map.map_id && @zone_type == $env.get_zone_type(true) && @tag == $game_player.terrain_tag return rand(@chance) == 0 end return false end |
#could_appear? ⇒ Boolean
Test if the Roaming Pokemon could appear here
72 73 74 75 76 |
# File 'scripts/01450 Systems/99991 Wild/00300 Wild_RoamingInfo.rb', line 72 def could_appear? return (@map_id == $game_map.map_id && @zone_type == $env.get_zone_type(true) && @tag == $game_player.terrain_tag) end |
#pokemon_dead? ⇒ Boolean
Test if the Pokemon is dead (delete from the stack)
54 55 56 |
# File 'scripts/01450 Systems/99991 Wild/00300 Wild_RoamingInfo.rb', line 54 def pokemon_dead? @pokemon.dead? end |
#update
Call the Roaming Proc to update the Roaming Pokemon zone information
48 49 50 |
# File 'scripts/01450 Systems/99991 Wild/00300 Wild_RoamingInfo.rb', line 48 def update RoamingProcs[@proc_id]&.call(self) unless @@locked end |