Module: Battle::Effects::Mechanics::ForceFlying

Included in:
Battle::Effects::MagnetRise, Telekinesis
Defined in:
scripts/01600 Alpha 25 Battle Engine/04000 Effects/00001 Mechanics/00100 ForceFlying.rb

Overview

Effect mechanics that make the pokemon flies When including this mechanics :

  • overwrite on_proc_message

  • overwrite on_delete_message

  • call Effects::Mechanics::ForceFlying.register_force_flying_hook in the class

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.register_force_flying_hook(reason, name)

Make to pokemon flying in grounded? test

Parameters:

  • reason (String)

    reason of the hook

  • name (Symbol)

    name of the effect



49
50
51
52
53
54
55
56
57
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00001 Mechanics/00100 ForceFlying.rb', line 49

def register_force_flying_hook(reason, name)
  PFM::PokemonBattler.register_force_flying_hook(reason) do |pokemon, scene| 
    next false unless pokemon.effects.has?(name)

    msg = pokemon.effects.get(name).send(:on_proc_message) # Call private method
    scene.display_message_and_wait(msg) if msg
    next true
  end
end

Instance Method Details

#force_flying_initialize(duration)

Create a new Pokemon tied effect

Parameters:

  • duration (Integer)

    duration of the effect (including the current turn)



12
13
14
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00001 Mechanics/00100 ForceFlying.rb', line 12

def force_flying_initialize(duration)
  self.counter = duration
end

#on_delete Also known as: force_flying_on_delete

Function called when the effect has been deleted from the effects handler



17
18
19
20
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00001 Mechanics/00100 ForceFlying.rb', line 17

def on_delete
  msg = on_delete_message
  @logic.scene.display_message_and_wait(msg) if msg
end