Module: Battle::Effects::Mechanics::OutOfReach

Included in:
OutOfReachBase
Defined in:
scripts/01600 Alpha 25 Battle Engine/04000 Effects/00001 Mechanics/00100 OutOfReach.rb

Overview

Make the pokemon out of reach

*Requirement*

  • Call initialize_out_of_reach

Instance Method Summary collapse

Instance Method Details

#can_hit_while_out_of_reach?(name) ⇒ Boolean Also known as: oor_can_hit_while_out_of_reach?

Check if the attack can hit the pokemon. Should be called after testing out_of_reach?

Parameters:

  • name (Symbol)

Returns:

  • (Boolean)


27
28
29
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00001 Mechanics/00100 OutOfReach.rb', line 27

def can_hit_while_out_of_reach?(name)
  return @oor_exceptions.include?(name)
end

#initialize_out_of_reach(pokemon, exceptions)

Init the mechanic

Parameters:

  • pokemon (PFM::PokemonBattler)
  • exceptions (Array<Symbol>)

    move that hit the target while out of reach



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

def initialize_out_of_reach(pokemon, exceptions)
  @oor_pokemon = pokemon
  @oor_exceptions = exceptions
end

#on_move_prevention_target(user, target, move) ⇒ Boolean Also known as: oor_on_move_prevention_target

Function called when we try to check if the target evades the move

Parameters:

Returns:

  • (Boolean)

    if the target is evading the move



37
38
39
40
41
42
43
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00001 Mechanics/00100 OutOfReach.rb', line 37

def on_move_prevention_target(user, target, move)
  return false if target != @oor_pokemon

  result = !can_hit_while_out_of_reach?(move.db_symbol)
  move.scene.display_message_and_wait(parse_text_with_pokemon(19, 213, target)) if result
  return result
end

#out_of_reach?Boolean Also known as: oor_out_of_reach?

Tell if the effect make the pokemon out reach

Returns:

  • (Boolean)


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

def out_of_reach?
  return true
end