Class: Battle::Effects::Substitute

Inherits:
PokemonTiedEffectBase show all
Defined in:
docs/5_Battle_06_Effects_02_Move_Effects.rb

Overview

Implement the Substitute effect

Constant Summary collapse

CANT_IGNORE_SUBSTITUTE =

Returns:

  • (Array<Symbol>)
%i[transform sky_drop]

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from PokemonTiedEffectBase

#on_baton_pass_switch

Methods inherited from EffectBase

#apply_common_effects_with_fling, #atk_modifier, #ats_modifier, #base_power_multiplier, #can_attack_hit_out_of_reach?, #chance_of_hit_multiplier, #counter=, #critical_count_modifier, #dead?, #dfe_modifier, #dfs_modifier, #effect_chance_modifier, #force_critical_hit?, #force_next_move?, #force_next_turn_action?, #ignore_target_redirection?, #kill, #mod1_multiplier, #mod2_multiplier, #mod3_multiplier, #on_ability_change_prevention, #on_drain_prevention, #on_end_turn_event, #on_flee_passthrough, #on_flee_prevention, #on_fterrain_prevention, #on_held_item_use_prevention, #on_move_ability_immunity, #on_move_disabled_check, #on_move_failure, #on_move_prevention_target, #on_move_prevention_user, #on_move_priority_change, #on_move_type_change, #on_post_ability_change, #on_post_accuracy_check, #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_ability_change, #on_pre_accuracy_check, #on_pre_drain, #on_pre_item_change, #on_single_type_multiplier_overwrite, #on_stat_change, #on_stat_change_post, #on_switch_passthrough, #on_switch_prevention, #on_transform_event, #on_two_turn_shortcut, #on_weather_effects_disabled_change, #on_weather_prevention, #out_of_reach?, #preparing_attack?, #prevent_critical_hit?, #rapid_spin_affected?, #sp_atk_multiplier, #sp_def_multiplier, #spd_modifier, #specific_proceed_internal, #target_redirection, #targetted?, #triggered?, #update_counter

Constructor Details

#initialize(logic, pokemon) ⇒ Substitute

Create a new Pokemon tied effect

Parameters:



2159
2160
# File 'docs/5_Battle_06_Effects_02_Move_Effects.rb', line 2159

def initialize(logic, pokemon)
end

Instance Attribute Details

#hp ⇒ Integer

Get the substitute hp

Returns:

  • (Integer)


2151
2152
2153
# File 'docs/5_Battle_06_Effects_02_Move_Effects.rb', line 2151

def hp
  @hp
end

#max_hp (readonly)

Get the substitute max hp



2153
2154
2155
# File 'docs/5_Battle_06_Effects_02_Move_Effects.rb', line 2153

def max_hp
  @max_hp
end

Instance Method Details

#direct_sprite_change(method_name)

Applies the sprite change directly

Parameters:

  • method_name (Symbol) —

    :switch_from_substitute_animation, :switch_to_substitute_animation



2222
2223
# File 'docs/5_Battle_06_Effects_02_Move_Effects.rb', line 2222

def direct_sprite_change(method_name)
end

#name ⇒ Symbol

Get the name of the effect

Returns:

  • (Symbol)


2199
2200
# File 'docs/5_Battle_06_Effects_02_Move_Effects.rb', line 2199

def name
end

#on_damage_prevention(handler, hp, target, launcher, skill) ⇒ :prevent, ...

Function called when a damage_prevention is checked

Parameters:

Returns:

  • (:prevent, Integer, nil) —

    :prevent if the damage cannot be applied, Integer if the hp variable should be updated



2186
2187
# File 'docs/5_Battle_06_Effects_02_Move_Effects.rb', line 2186

def on_damage_prevention(handler, hp, target, launcher, skill)
end

#on_delete

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



2202
2203
# File 'docs/5_Battle_06_Effects_02_Move_Effects.rb', line 2202

def on_delete
end

#on_post_action_event(logic, scene, battlers)

Function called at the end of an action

Parameters:



2208
2209
# File 'docs/5_Battle_06_Effects_02_Move_Effects.rb', line 2208

def on_post_action_event(logic, scene, battlers)
end

#on_stat_decrease_prevention(handler, stat, target, launcher, skill) ⇒ :prevent?

Function called when a stat_decrease_prevention is checked

Parameters:

Returns:

  • (:prevent, nil) —

    :prevent if the stat decrease cannot apply



2177
2178
# File 'docs/5_Battle_06_Effects_02_Move_Effects.rb', line 2177

def on_stat_decrease_prevention(handler, stat, target, launcher, skill)
end

#on_stat_increase_prevention(handler, stat, target, launcher, skill) ⇒ :prevent?

Function called when a stat_increase_prevention is checked

Parameters:

Returns:

  • (:prevent, nil) —

    :prevent if the stat increase cannot apply



2168
2169
# File 'docs/5_Battle_06_Effects_02_Move_Effects.rb', line 2168

def on_stat_increase_prevention(handler, stat, target, launcher, skill)
end

#on_status_prevention(handler, status, target, launcher, skill) ⇒ :prevent?

Function called when a status_prevention is checked

Parameters:

Returns:

  • (:prevent, nil) —

    :prevent if the status cannot be applied



2195
2196
# File 'docs/5_Battle_06_Effects_02_Move_Effects.rb', line 2195

def on_status_prevention(handler, status, target, launcher, skill)
end

#on_switch_event(handler, who, with)

Function called when a Pokemon has actually switched with another one

Parameters:



2214
2215
# File 'docs/5_Battle_06_Effects_02_Move_Effects.rb', line 2214

def on_switch_event(handler, who, with)
end

#play_substitute_animation(reason = :from)

Play the right Substitute animation depending on the given reason

Parameters:

  • reason (Symbol) (defaults to: :from) —

    :to => from sprite to substitute, :from => from substitute to sprite



2218
2219
# File 'docs/5_Battle_06_Effects_02_Move_Effects.rb', line 2218

def play_substitute_animation(reason = :from)
end

#reset_user_sprite

Force the reset of the user's sprite to its original sprite



2225
2226
# File 'docs/5_Battle_06_Effects_02_Move_Effects.rb', line 2225

def reset_user_sprite
end