Class: Battle::Logic::FTerrainChangeHandler

Inherits:
ChangeHandlerBase show all
Includes:
Hooks
Defined in:
docs/5_Battle_04_Logic.rb

Overview

Handler responsive of answering properly terrain changes requests

Constant Summary collapse

FTERRAIN_SYM_TO_MSG =

Weather thingies copiepasted, I don’t think this is really useful right now

{none: {electric_terrain: 227, grassy_terrain: 223, misty_terrain: 225, psychic_terrain: 347}, electric_terrain: 226, grassy_terrain: 222, misty_terrain: 224, psychic_terrain: 346}

Instance Attribute Summary

Attributes inherited from ChangeHandlerBase

#logic, #pre_checked_effects, #scene

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Hooks

#exec_hooks, #force_return, included, register, remove, remove_without_name

Methods inherited from ChangeHandlerBase

#initialize, #prevent_change, #process_prevention_reason, #reset_prevention_reason

Constructor Details

This class inherits a constructor from Battle::Logic::ChangeHandlerBase

Class Method Details

.register_fterrain_prevention_hook(reason) {|handler, fterrain_type, last_fterrain| ... }

Function that registers a fterrain_prevetion hook

Parameters:

  • reason (String)

    reason of the fterrain_prevetion registration

Yield Parameters:

  • handler (FTerrainChangeHandler)
  • fterrain_type (Symbol)

    :none, :electric_terrain, :grassy_terrain, :misty_terrain, :psychic_terrain

  • last_fterrain (Symbol)

    :none, :electric_terrain, :grassy_terrain, :misty_terrain, :psychic_terrain

Yield Returns:

  • (:prevent, nil)

    :prevent if the status cannot be applied



2046
2047
# File 'docs/5_Battle_04_Logic.rb', line 2046

def register_fterrain_prevention_hook(reason)
end

.register_post_fterrain_change_hook(reason) {|handler, fterrain_type, last_fterrain| ... }

Function that registers a post_fterrain_handler hook

Parameters:

  • reason (String)

    reason of the post_fterrain_handler registration

Yield Parameters:

  • handler (FTerrainChangeHandler)
  • fterrain_type (Symbol)

    :none, :electric_terrain, :grassy_terrain, :misty_terrain, :psychic_terrain

  • last_fterrain (Symbol)

    :none, :electric_terrain, :grassy_terrain, :misty_terrain, :psychic_terrain



2053
2054
# File 'docs/5_Battle_04_Logic.rb', line 2053

def register_post_fterrain_change_hook(reason)
end

Instance Method Details

#fterrain_appliable?(fterrain_type) ⇒ Boolean

Function telling if a terrain can be applyied

Parameters:

  • fterrain_type (Symbol)

    :none, :electric_terrain, :grassy_terrain, :misty_terrain, :psychic_terrain

Returns:

  • (Boolean)


2021
2022
# File 'docs/5_Battle_04_Logic.rb', line 2021

def fterrain_appliable?(fterrain_type)
end

#fterrain_change(fterrain_type, turn_count = 5)

Function that actually change the terrain

Parameters:

  • fterrain_type (Symbol)

    :none, :electric_terrain, :grassy_terrain, :misty_terrain, :psychic_terrain

  • nb_turn (Integer)

    INFINITY if last_fterrain == :none, turn_count else



2026
2027
# File 'docs/5_Battle_04_Logic.rb', line 2026

def fterrain_change(fterrain_type, turn_count = 5)
end

#fterrain_change_with_process(fterrain_type, turn_count = 5)

Function that test if the change is possible and perform the change if so

Parameters:

  • fterrain_type (Symbol)

    :none, :electric_terrain, :grassy_terrain, :misty_terrain, :psychic_terrain

  • nb_turn (Integer)

    INFINITY if last_fterrain == :none, turn_count else



2031
2032
# File 'docs/5_Battle_04_Logic.rb', line 2031

def fterrain_change_with_process(fterrain_type, turn_count = 5)
end