Class: Battle::Effects::Bind

Inherits:
PokemonTiedEffectBase show all
Defined in:
scripts/01600 Alpha 25 Battle Engine/04000 Effects/00500 Move Effects/01000 Bind.rb

Overview

Class that describe the bind effect

Constant Summary collapse

MESSAGE_INFO =

Hash giving the message info based on the db_symbol of the move

{
  bind: [806, true],
  wrap: [813, true],
  fire_spin: [830, false],
  clamp: [820, true],
  whirlpool: [827, false],
  sand_tomb: [836, false],
  magma_storm: [833, false],
  infestation: [1234, false]
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from PokemonTiedEffectBase

#on_baton_pass_switch

Methods inherited from EffectBase

#base_power_multiplier, #can_attack_hit_out_of_reach?, #chance_of_hit_multiplier, #counter=, #effect_chance_modifier, #force_next_move?, #kill, #mod1_multiplier, #mod2_multiplier, #mod3_multiplier, #on_damage_prevention, #on_fterrain_prevention, #on_held_item_use_prevention, #on_move_ability_immunity, #on_move_disabled_check, #on_move_prevention_target, #on_move_prevention_user, #on_move_priority_change, #on_move_type_change, #on_post_accuracy_check, #on_post_action_event, #on_post_damage, #on_post_damage_death, #on_post_fterrain_change, #on_post_item_change, #on_post_status_change, #on_post_weather_change, #on_pre_item_change, #on_single_type_multiplier_overwrite, #on_stat_change, #on_stat_change_post, #on_stat_decrease_prevention, #on_stat_increase_prevention, #on_status_prevention, #on_switch_passthrough, #on_transform_event, #on_two_turn_shortcut, #on_weather_prevention, #out_of_reach?, #sp_atk_multiplier, #sp_def_multiplier, #spd_modifier, #targetted?, #update_counter

Constructor Details

#initialize(logic, pokemon, origin, turn_count, move) ⇒ Bind

Create a new Pokemon tied effect

Parameters:



26
27
28
29
30
31
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00500 Move Effects/01000 Bind.rb', line 26

def initialize(logic, pokemon, origin, turn_count, move)
  super(logic, pokemon)
  @origin = origin
  @move = move
  self.counter = turn_count
end

Instance Attribute Details

#originPFM::PokemonBattler (readonly)

The Pokemon that launched the attack

Returns:



18
19
20
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00500 Move Effects/01000 Bind.rb', line 18

def origin
  @origin
end

Instance Method Details

#dead?Boolean

Tell if the effect is dead

Returns:

  • (Boolean)


69
70
71
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00500 Move Effects/01000 Bind.rb', line 69

def dead?
  super || !@origin.position
end

#nameSymbol

Get the name of the effect

Returns:

  • (Symbol)


81
82
83
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00500 Move Effects/01000 Bind.rb', line 81

def name
  return :bind
end

#on_delete

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



86
87
88
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00500 Move Effects/01000 Bind.rb', line 86

def on_delete
  @logic.scene.display_message_and_wait(parse_text_with_pokemon(19, 375, @pokemon, PFM::Text::MOVE[1] => @move.name))
end

#on_end_turn_event(logic, scene, battlers)

Function called at the end of a turn

Parameters:



37
38
39
40
41
42
43
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00500 Move Effects/01000 Bind.rb', line 37

def on_end_turn_event(logic, scene, battlers)
  return kill if @origin.dead?
  return if @pokemon.dead?

  scene.display_message(message)
  logic.damage_handler.damage_change((@pokemon.max_hp / hp_factor).clamp(1, Float::INFINITY), @pokemon)
end

#on_switch_event(_handler, who, _with)

Function called when a Pokemon has actually switched with another one

Parameters:



63
64
65
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00500 Move Effects/01000 Bind.rb', line 63

def on_switch_event(_handler, who, _with)
  kill if who == @origin
end

#on_switch_prevention(handler, pokemon, skill, reason) ⇒ :prevent?

Function called when testing if pokemon can switch (when he couldn't passthrough)

Parameters:

Returns:

  • (:prevent, nil)

    if :prevent, can_switch? will return false



51
52
53
54
55
56
57
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00500 Move Effects/01000 Bind.rb', line 51

def on_switch_prevention(handler, pokemon, skill, reason)
  return if pokemon != @pokemon

  return handler.prevent_change do
    handler.scene.display_message_and_wait(message)
  end
end

#rapid_spin_affected?Boolean

Function that tells if the move is affected by Rapid Spin

Returns:

  • (Boolean)


75
76
77
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00500 Move Effects/01000 Bind.rb', line 75

def rapid_spin_affected?
  return true
end