Class: Battle::Logic::FleeHandler

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

Overview

Handler responsive of processing flee attempt

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_flee_block_hook(reason) {|handler| ... }

Function that registers a flee_block hook

Parameters:

  • reason (String)

    reason of the flee_block registration

Yield Parameters:

Yield Returns:

  • (:prevent, nil)

    :prevent if the stat increase cannot apply

[View source]

1509
1510
# File 'docs/5_Battle_04_Logic.rb', line 1509

def register_flee_block_hook(reason)
end

.register_flee_passthrough_hook(reason) {|handler, pokemon| ... }

Function that registers a flee_passthrough hook

Parameters:

  • reason (String)

    reason of the flee_passthrough registration

Yield Parameters:

Yield Returns:

  • (:prevent, nil)

    :prevent if the stat increase cannot apply

[View source]

1516
1517
# File 'docs/5_Battle_04_Logic.rb', line 1516

def register_flee_passthrough_hook(reason)
end

Instance Method Details

#attempt(index) ⇒ Symbol

Note:

flee_block hooks are called to test if the flee is blocked for other reason than switch blocked

Try to flee

Parameters:

  • index (Integer)

    index of the Pokemon on the trainer bank

Returns:

  • (Symbol)

    if success :success, if failure :failure, if blocked (trainer battle) :blocked

[View source]

1495
1496
# File 'docs/5_Battle_04_Logic.rb', line 1495

def attempt(index)
end