Class: PFM::Wild_Battle

Inherits:
Object show all
Defined in:
docs/4_Systems_999_Wild.rb

Overview

The wild battle management

The main object is stored in $wild_battle and PFM.game_state.wild_battle

Constant Summary collapse

WEAK_POKEMON_ABILITY =

List of ability that force strong Pokemon to battle (Intimidation / Regard vif)

%i[intimidate keen_eye]
FISHING_BATTLES =

List of special wild battle that are actually fishing

%i[normal super mega]
FISHING_TOOLS =

List of Rod

%i[old_rod good_rod super_rod]
MAX_POKEMON_LEVEL_ABILITY =

List of ability giving the max level of the pokemon we can encounter

%i[hustle pressure vital_spirit]
TOOL_MAPPING =

Mapping allowing to get the correct tool based on the input

{normal: :old_rod, super: :good_rod, mega: :super_rod, rock: :rock_smash, headbutt: :headbutt}
FishIncRate =

Ability that increase the rate of any fishing rod # Glue / Ventouse

%i[sticky_hold suction_cups]
CHANGE_POKEMON_CHANCE =

Hash describing which method to seek to change the Pokemon chances depending on the player’s leading Pokemon’s talent

{keen_eye: :rate_intimidate_keen_eye, intimidate: :rate_intimidate_keen_eye, cute_charm: :rate_cute_charm, magnet_pull: :rate_magnet_pull, compound_eyes: :rate_compound_eyes, super_luck: :rate_compound_eyes, static: :rate_static, lightning_rod: :rate_static, flash_fire: :rate_flash_fire, synchronize: :rate_synchronize, storm_drain: :rate_storm_drain, harvest: :rate_harvest}
ENCOUNTER_FREQ_INCREASE =

List of abilities increasing the frequency of encounter

{}
ENCOUNTER_FREQ_DECREASE =

List of abilities decreasing the frequency of encounter

{}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(game_state) ⇒ Wild_Battle

Create a new Wild_Battle manager

Parameters:

  • game_state (PFM::GameState)

    variable responsive of containing the whole game state for easier access



30
31
# File 'docs/4_Systems_999_Wild.rb', line 30

def initialize(game_state)
end

Instance Attribute Details

#encounters_historyArray<Hash> (readonly)

Get the history of the encounters wild Pokémon

Returns:

  • (Array<Hash>)


27
28
29
# File 'docs/4_Systems_999_Wild.rb', line 27

def encounters_history
  @encounters_history
end

#game_statePFM::GameState

Get the game state responsive of the whole game state

Returns:



24
25
26
# File 'docs/4_Systems_999_Wild.rb', line 24

def game_state
  @game_state
end

#groupsArray<Studio::Group> (readonly)

List of Remaining creature groups

Returns:



21
22
23
# File 'docs/4_Systems_999_Wild.rb', line 21

def groups
  @groups
end

#roaming_pokemonsArray<PFM::Wild_RoamingInfo> (readonly)

List of Roaming Pokemon

Returns:



18
19
20
# File 'docs/4_Systems_999_Wild.rb', line 18

def roaming_pokemons
  @roaming_pokemons
end

Class Method Details

.register_frequency_decrease_ability(ability_db_symbol, &block)

Register an ability that decrease the encounter frequency

Parameters:

  • ability_db_symbol (Symbol, Array<Symbol>)

    db_symbol of the ability that decrease the encounter frequency

  • block (Proc, nil)

    Additional condition needed to validate the ability effect



286
287
# File 'docs/4_Systems_999_Wild.rb', line 286

def register_frequency_decrease_ability(ability_db_symbol, &block)
end

.register_frequency_increase_ability(ability_db_symbol, &block)

Register an ability that increase the encounter frequency

Parameters:

  • ability_db_symbol (Symbol, Array<Symbol>)

    db_symbol of the ability that increase the encounter frequency

  • block (Proc, nil)

    Additional condition needed to validate the ability effect



281
282
# File 'docs/4_Systems_999_Wild.rb', line 281

def register_frequency_increase_ability(ability_db_symbol, &block)
end

Instance Method Details

#add_roaming_pokemon(chance, proc_id, pokemon_hash) ⇒ PFM::Pokemon

Add a roaming Pokemon

Parameters:

  • chance (Integer)

    the chance divider to see the Pokemon

  • proc_id (Integer)

    ID of the Wild_RoamingInfo::RoamingProcs

  • pokemon_hash (Hash, PFM::Pokemon)

    hash to generate the mon (cf. PFM::Pokemon#generate_from_hash), or the Pokemon

Returns:



103
104
# File 'docs/4_Systems_999_Wild.rb', line 103

def add_roaming_pokemon(chance, proc_id, pokemon_hash)
end

#any_fish?(rod = :normal, start = false) ⇒ Boolean?

Test if there’s any fish battle available and start it if asked.

Parameters:

  • rod (Symbol) (defaults to: :normal)

    the kind of rod used to fish : :norma, :super, :mega

  • start (Boolean) (defaults to: false)

    if the battle should be started

Returns:

  • (Boolean, nil)

    if there’s a battle available



46
47
# File 'docs/4_Systems_999_Wild.rb', line 46

def any_fish?(rod = :normal, start = false)
end

#any_hidden_pokemon?(rod = :rock, start = false) ⇒ Boolean?

Test if there’s any hidden battle available and start it if asked.

Parameters:

  • rod (Symbol) (defaults to: :rock)

    the kind of rod used to fish : :rock, :headbutt

  • start (Boolean) (defaults to: false)

    if the battle should be started

Returns:

  • (Boolean, nil)

    if there’s a battle available



52
53
# File 'docs/4_Systems_999_Wild.rb', line 52

def any_hidden_pokemon?(rod = :rock, start = false)
end

#available?Boolean

Is a wild battle available ?

Returns:

  • (Boolean)


40
41
# File 'docs/4_Systems_999_Wild.rb', line 40

def available?
end

#begin_save

Method that prevent non wanted data save of the Wild_Battle object



130
131
# File 'docs/4_Systems_999_Wild.rb', line 130

def begin_save
end

#check_fishing_chances(type) ⇒ Boolean

Check if a Pokemon can be fished there with a specific fishing rod type

Parameters:

  • type (Symbol)

    :mega, :super, :normal

Returns:

  • (Boolean)


114
115
# File 'docs/4_Systems_999_Wild.rb', line 114

def check_fishing_chances(type)
end

#compute_fishing_chainInteger

Compute the fishing chain

Returns:

  • (Integer)

    The total fishing chain (max 20)



127
128
# File 'docs/4_Systems_999_Wild.rb', line 127

def compute_fishing_chain
end

#detected_group_encounter_indexesArray<Integer>

Get the index of the groups that might trigger a battle due to encounter steps depleted

Returns:

  • (Array<Integer>)


267
268
# File 'docs/4_Systems_999_Wild.rb', line 267

def detected_group_encounter_indexes
end

#each_roaming_pokemon

yield a block on every available roaming Pokemon



117
118
# File 'docs/4_Systems_999_Wild.rb', line 117

def each_roaming_pokemon
end

#end_save

Method that end the save state of the Wild_Battle object



133
134
# File 'docs/4_Systems_999_Wild.rb', line 133

def end_save
end

#group_encounter_detected?Boolean

Detect if a group has encounter

Returns:

  • (Boolean)


263
264
# File 'docs/4_Systems_999_Wild.rb', line 263

def group_encounter_detected?
end

#init_battle(id, level, *args) #init_battle(id, level, *args)

Note:

Does not start the battle

Init a wild battle

Overloads:

  • #init_battle(id, level, *args)

    Parameters:

  • #init_battle(id, level, *args)

    Parameters:

    • id (Integer)

      id of the Pokemon in the database

    • level (Integer)

      level of the first Pokemon

    • args (Array<Integer, Integer>)

      array of id, level of the other Pokemon in the wild battle.



77
78
# File 'docs/4_Systems_999_Wild.rb', line 77

def init_battle(id, level = 70, *others)
end

#load_groups

Load the groups of Wild Pokemon (map change/ time change)



36
37
# File 'docs/4_Systems_999_Wild.rb', line 36

def load_groups
end

#make_encounter_count(only_less_than_one = false)

Make the encounter count for each groups

Parameters:

  • only_less_than_one (Boolean) (defaults to: false)

    if the function should only update the group encounter count that are less or equal than 1



256
257
# File 'docs/4_Systems_999_Wild.rb', line 256

def make_encounter_count(only_less_than_one = false)
end

#on_map_viewed

Tell the roaming pokemon that the playe has look at their position



120
121
# File 'docs/4_Systems_999_Wild.rb', line 120

def on_map_viewed
end

#remove_roaming_pokemon(pokemon)

Remove a roaming Pokemon from the roaming Pokemon array

Parameters:

  • pokemon (PFM::Pokemon)

    the Pokemon that should be removed



107
108
# File 'docs/4_Systems_999_Wild.rb', line 107

def remove_roaming_pokemon(pokemon)
end

#reset

Reset the wild battle



33
34
# File 'docs/4_Systems_999_Wild.rb', line 33

def reset
end

#reset_encounters_history

Reset the history of the encounters wild Pokémon



123
124
# File 'docs/4_Systems_999_Wild.rb', line 123

def reset_encounters_history
end

#roaming?(pokemon) ⇒ Boolean Also known as: is_roaming?

Test if a Pokemon is a roaming Pokemon (Usefull in battle)

Parameters:

Returns:

  • (Boolean)


95
96
# File 'docs/4_Systems_999_Wild.rb', line 95

def roaming?(pokemon)
end

#set(zone_type, tag, delta_level, vs_type, *data)

Define a group of remaining wild battle

Parameters:

  • zone_type (Integer)

    type of the zone, see $env.get_zone_type to know the id

  • tag (Integer)

    terrain_tag on which the player should be to start a battle with wild Pokemon of this group

  • delta_level (Integer)

    the disparity of the Pokemon levels

  • vs_type (Integer)

    the vs_type the Wild Battle are

  • data (Array<Integer, Integer, Integer>, Array<Integer, Hash, Integer>)

    Array of id, level/informations, chance to see (Pokemon informations)



90
91
# File 'docs/4_Systems_999_Wild.rb', line 90

def set(zone_type, tag, delta_level, vs_type, *data)
end

#setup(battle_id = 1) ⇒ Battle::Logic::BattleInfo?

Set the Battle::Info with the right information

Parameters:

  • battle_id (Integer) (defaults to: 1)

    ID of the events to load for battle scenario

Returns:



82
83
# File 'docs/4_Systems_999_Wild.rb', line 82

def setup(battle_id = 1)
end

#start_battle(id, level, *args) #start_battle(id, level, *args)

Start a wild battle

Overloads:

  • #start_battle(id, level, *args)

    Parameters:

    • id (PFM::Pokemon)

      First Pokemon in the wild battle.

    • level (Object)

      ignored

    • args (Array<PFM::Pokemon>)

      other pokemon in the wild battle.

    • battle_id (Integer)

      ID of the events to load for battle scenario

  • #start_battle(id, level, *args)

    Parameters:

    • id (Integer)

      id of the Pokemon in the database

    • level (Integer)

      level of the first Pokemon

    • args (Array<Integer, Integer>)

      array of id, level of the other Pokemon in the wild battle.

    • battle_id (Integer)

      ID of the events to load for battle scenario



65
66
# File 'docs/4_Systems_999_Wild.rb', line 65

def start_battle(id, level = 70, *others, battle_id: 1)
end

#update_encounter_count

Update encounter count for each groups



259
260
# File 'docs/4_Systems_999_Wild.rb', line 259

def update_encounter_count
end