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=, #dead?, #dfe_modifier, #dfs_modifier, #effect_chance_modifier, #force_next_move?, #force_next_turn_action?, #ignore_target_redirection?, #kill, #mod1_multiplier, #mod2_multiplier, #mod3_multiplier, #on_end_turn_event, #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_damage, #on_post_damage_death, #on_post_fterrain_change, #on_post_item_change, #on_post_status_change, #on_post_weather_change, #on_pre_accuracy_check, #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_prevention, #out_of_reach?, #preparing_attack?, #rapid_spin_affected?, #sp_atk_multiplier, #sp_def_multiplier, #spd_modifier, #specific_proceed_internal, #target_redirection, #targetted?, #update_counter

Constructor Details

#initialize(logic, pokemon) ⇒ Substitute

Create a new Pokemon tied effect

Parameters:



2104
2105
# File 'docs/5_Battle_06_Effects_02_Move_Effects.rb', line 2104

def initialize(logic, pokemon)
end

Instance Attribute Details

#hpInteger

Get the substitute hp

Returns:

  • (Integer)


2096
2097
2098
# File 'docs/5_Battle_06_Effects_02_Move_Effects.rb', line 2096

def hp
  @hp
end

#max_hp (readonly)

Get the substitute max hp



2098
2099
2100
# File 'docs/5_Battle_06_Effects_02_Move_Effects.rb', line 2098

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



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

def direct_sprite_change(method_name)
end

#nameSymbol

Get the name of the effect

Returns:

  • (Symbol)


2144
2145
# File 'docs/5_Battle_06_Effects_02_Move_Effects.rb', line 2144

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



2131
2132
# File 'docs/5_Battle_06_Effects_02_Move_Effects.rb', line 2131

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

#on_delete

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



2147
2148
# File 'docs/5_Battle_06_Effects_02_Move_Effects.rb', line 2147

def on_delete
end

#on_post_action_event(logic, scene, battlers)

Function called at the end of an action

Parameters:



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

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



2122
2123
# File 'docs/5_Battle_06_Effects_02_Move_Effects.rb', line 2122

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



2113
2114
# File 'docs/5_Battle_06_Effects_02_Move_Effects.rb', line 2113

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



2140
2141
# File 'docs/5_Battle_06_Effects_02_Move_Effects.rb', line 2140

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:



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

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



2163
2164
# File 'docs/5_Battle_06_Effects_02_Move_Effects.rb', line 2163

def play_substitute_animation(reason = :from)
end

#reset_user_sprite

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



2170
2171
# File 'docs/5_Battle_06_Effects_02_Move_Effects.rb', line 2170

def reset_user_sprite
end