Class: Battle::Effects::EffectBase
- Defined in:
- scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb
Overview
Class describing all the effect (“abstract”) and helping the handler to manage effect
Direct Known Subclasses
Ability, Bestow, EchoedVoice, FieldTerrain, Gravity, HappyHour, IonDeluge, Item, MagicRoom, MudSport, PerishSong, PokemonTiedEffectBase, PositionTiedEffectBase, Status, TrickRoom, UpRoar::SleepPrevention, Weather, WonderRoom
Instance Method Summary collapse
-
#base_power_multiplier(user, target, move) ⇒ Float, Integer
Give the move base power mutiplier.
-
#can_attack_hit_out_of_reach?(name) ⇒ Boolean
Check if the attack can hit the pokemon.
-
#chance_of_hit_multiplier(user, target, move) ⇒ Float
Return the chance of hit multiplier.
-
#counter=(counter)
Function that sets the counter.
-
#dead? ⇒ Boolean
Function telling if the effect should be removed from effects handler.
-
#effect_chance_modifier(move) ⇒ Float, Integer
Give the effect chance modifier given to the Pokémon with this effect.
-
#force_next_move? ⇒ Boolean
Tell if the effect forces the next move.
-
#initialize(logic) ⇒ EffectBase
constructor
Create a new effect.
-
#kill
Kill the effect (in order to remove it from the effects handler).
-
#mod1_multiplier(user, target, move) ⇒ Float, Integer
Give the move mod1 mutiplier (before the +2 in the formula).
-
#mod2_multiplier(user, target, move) ⇒ Float, Integer
Give the move mod1 mutiplier (after the critical).
-
#mod3_multiplier(user, target, move) ⇒ Float, Integer
Give the move mod3 mutiplier (after everything).
-
#name ⇒ Symbol
Function giving the name of the effect.
-
#on_damage_prevention(handler, hp, target, launcher, skill) ⇒ :prevent, ...
Function called when a damage_prevention is checked.
-
#on_delete
Function called when the effect has been deleted from the effects handler.
-
#on_end_turn_event(logic, scene, battlers)
Function called at the end of a turn.
-
#on_fterrain_prevention(handler, fterrain_type, last_fterrain) ⇒ :prevent?
Function called when a fterrain_prevention is checked.
-
#on_held_item_use_prevention ⇒ Boolean
Function called when a held item wants to perform its action.
-
#on_move_ability_immunity(user, target, move) ⇒ Boolean
Function called when we try to check if the effect changes the definitive priority of the move.
-
#on_move_disabled_check(user, move) ⇒ Proc?
Function called when we try to check if the user cannot use a move.
-
#on_move_prevention_target(user, target, move) ⇒ Boolean
Function called when we try to check if the target evades the move.
-
#on_move_prevention_user(user, targets, move) ⇒ :prevent?
Function called when we try to use a move as the user (returns :prevent if user fails).
-
#on_move_priority_change(user, priority, move) ⇒ Proc?
Function called when we try to check if the effect changes the definitive priority of the move.
-
#on_move_type_change(user, target, move, type) ⇒ Integer?
Function called when we try to get the definitive type of a move.
-
#on_post_accuracy_check(logic, scene, targets, launcher, skill)
Function called after the accuracy check of a move is done (and the move should land).
-
#on_post_action_event(logic, scene, battlers)
Function called at the end of an action.
-
#on_post_damage(handler, hp, target, launcher, skill)
Function called after damages were applied (post_damage, when target is still alive).
-
#on_post_damage_death(handler, hp, target, launcher, skill)
Function called after damages were applied and when target died (post_damage_death).
-
#on_post_fterrain_change(handler, fterrain_type, last_fterrain)
Function called after the terrain was changed.
-
#on_post_item_change(handler, db_symbol, target, launcher, skill)
Function called when a post_item_change is checked.
-
#on_post_status_change(handler, status, target, launcher, skill)
Function called when a post_status_change is performed.
-
#on_post_weather_change(handler, weather_type, last_weather)
Function called after the weather was changed (on_post_weather_change).
-
#on_pre_item_change(handler, db_symbol, target, launcher, skill) ⇒ :prevent?
Function called when a pre_item_change is checked.
-
#on_single_type_multiplier_overwrite(target, target_type, type, move) ⇒ Float?
Function that computes an overwrite of the type multiplier.
-
#on_stat_change(handler, stat, power, target, launcher, skill) ⇒ Integer?
Function called when a stat_change is about to be applied.
-
#on_stat_change_post(handler, stat, power, target, launcher, skill) ⇒ Integer?
Function called when a stat_change has been applied.
-
#on_stat_decrease_prevention(handler, stat, target, launcher, skill) ⇒ :prevent?
Function called when a stat_decrease_prevention is checked.
-
#on_stat_increase_prevention(handler, stat, target, launcher, skill) ⇒ :prevent?
Function called when a stat_increase_prevention is checked.
-
#on_status_prevention(handler, status, target, launcher, skill) ⇒ :prevent?
Function called when a status_prevention is checked.
-
#on_switch_event(handler, who, with)
Function called when a Pokemon has actually switched with another one.
-
#on_switch_passthrough(handler, pokemon, skill, reason) ⇒ :passthrough?
Function called when testing if pokemon can switch regardless of the prevension.
-
#on_switch_prevention(handler, pokemon, skill, reason) ⇒ :prevent?
Function called when testing if pokemon can switch (when he couldn't passthrough).
-
#on_transform_event(handler, target)
Function called when a Pokemon initialize a transformation.
-
#on_two_turn_shortcut(user, targets, skill) ⇒ Boolean
Function called after a battler proceed its two turn move's first turn.
-
#on_weather_prevention(handler, weather_type, last_weather) ⇒ :prevent?
Function called when a weather_prevention is checked.
-
#out_of_reach? ⇒ Boolean
Tell if the effect make the pokemon out reach.
-
#rapid_spin_affected? ⇒ Boolean
Function that tells if the move is affected by Rapid Spin.
-
#sp_atk_multiplier(user, target, move) ⇒ Float, Integer
Give the move [Spe]atk mutiplier.
-
#sp_def_multiplier(user, target, move) ⇒ Float, Integer
Give the move [Spe]def mutiplier.
-
#spd_modifier ⇒ Float, Integer
Give the speed modifier over given to the Pokemon with this effect.
-
#targetted?(battler) ⇒ Boolean
Tell if the given battler is targetted by the effect.
-
#update_counter
Function that updates the counter of the effect.
Constructor Details
#initialize(logic) ⇒ EffectBase
Create a new effect
7 8 9 10 11 12 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 7 def initialize(logic) @logic = logic # Counter so we can disable the effect # @type [Integer] @counter = Float::INFINITY end |
Instance Method Details
#base_power_multiplier(user, target, move) ⇒ Float, Integer
Give the move base power mutiplier
379 380 381 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 379 def base_power_multiplier(user, target, move) return 1 end |
#can_attack_hit_out_of_reach?(name) ⇒ Boolean
Check if the attack can hit the pokemon. Should be called after testing out_of_reach?
69 70 71 72 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 69 def can_attack_hit_out_of_reach?(name) # (exemple) This is where we test earthquake, fissuer and magnitude for Dig return out_of_reach? end |
#chance_of_hit_multiplier(user, target, move) ⇒ Float
Return the chance of hit multiplier
446 447 448 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 446 def chance_of_hit_multiplier(user, target, move) return 1 end |
#counter=(counter)
Function that sets the counter
16 17 18 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 16 def counter=(counter) @counter = counter.clamp(0, Float::INFINITY) end |
#dead? ⇒ Boolean
Function telling if the effect should be removed from effects handler
27 28 29 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 27 def dead? @counter <= 0 end |
#effect_chance_modifier(move) ⇒ Float, Integer
Give the effect chance modifier given to the Pokémon with this effect
437 438 439 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 437 def effect_chance_modifier(move) return 1 end |
#force_next_move? ⇒ Boolean
Tell if the effect forces the next move
56 57 58 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 56 def force_next_move? return false end |
#kill
Kill the effect (in order to remove it from the effects handler)
38 39 40 41 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 38 def kill @counter = -1 disable_hooks end |
#mod1_multiplier(user, target, move) ⇒ Float, Integer
Give the move mod1 mutiplier (before the +2 in the formula)
406 407 408 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 406 def mod1_multiplier(user, target, move) return 1 end |
#mod2_multiplier(user, target, move) ⇒ Float, Integer
Give the move mod1 mutiplier (after the critical)
415 416 417 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 415 def mod2_multiplier(user, target, move) return 1 end |
#mod3_multiplier(user, target, move) ⇒ Float, Integer
Give the move mod3 mutiplier (after everything)
424 425 426 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 424 def mod3_multiplier(user, target, move) return 1 end |
#name ⇒ Symbol
Function giving the name of the effect
33 34 35 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 33 def name return :base end |
#on_damage_prevention(handler, hp, target, launcher, skill) ⇒ :prevent, ...
Function called when a damage_prevention is checked
191 192 193 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 191 def on_damage_prevention(handler, hp, target, launcher, skill) nil && handler && hp && target && launcher && skill end |
#on_delete
Function called when the effect has been deleted from the effects handler
44 45 46 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 44 def on_delete return nil end |
#on_end_turn_event(logic, scene, battlers)
Function called at the end of a turn
255 256 257 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 255 def on_end_turn_event(logic, scene, battlers) nil && logic && scene && battlers end |
#on_fterrain_prevention(handler, fterrain_type, last_fterrain) ⇒ :prevent?
Function called when a fterrain_prevention is checked
281 282 283 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 281 def on_fterrain_prevention(handler, fterrain_type, last_fterrain) nil && handler && fterrain_type && last_fterrain end |
#on_held_item_use_prevention ⇒ Boolean
Function called when a held item wants to perform its action
83 84 85 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 83 def on_held_item_use_prevention false end |
#on_move_ability_immunity(user, target, move) ⇒ Boolean
Function called when we try to check if the effect changes the definitive priority of the move
353 354 355 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 353 def on_move_ability_immunity(user, target, move) return nil end |
#on_move_disabled_check(user, move) ⇒ Proc?
Function called when we try to check if the user cannot use a move
335 336 337 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 335 def on_move_disabled_check(user, move) return nil end |
#on_move_prevention_target(user, target, move) ⇒ Boolean
Function called when we try to check if the target evades the move
317 318 319 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 317 def on_move_prevention_target(user, target, move) nil && user && target && move end |
#on_move_prevention_user(user, targets, move) ⇒ :prevent?
Function called when we try to use a move as the user (returns :prevent if user fails)
308 309 310 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 308 def on_move_prevention_user(user, targets, move) nil && user && targets && move end |
#on_move_priority_change(user, priority, move) ⇒ Proc?
Function called when we try to check if the effect changes the definitive priority of the move
344 345 346 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 344 def on_move_priority_change(user, priority, move) return nil end |
#on_move_type_change(user, target, move, type) ⇒ Integer?
Function called when we try to get the definitive type of a move
327 328 329 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 327 def on_move_type_change(user, target, move, type) nil && user && target && move && type end |
#on_post_accuracy_check(logic, scene, targets, launcher, skill)
Function called after the accuracy check of a move is done (and the move should land)
299 300 301 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 299 def on_post_accuracy_check(logic, scene, targets, launcher, skill) nil && logic && scene && targets && launcher && skill end |
#on_post_action_event(logic, scene, battlers)
Function called at the end of an action
247 248 249 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 247 def on_post_action_event(logic, scene, battlers) nil && logic && scene && battlers end |
#on_post_damage(handler, hp, target, launcher, skill)
Function called after damages were applied (post_damage, when target is still alive)
201 202 203 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 201 def on_post_damage(handler, hp, target, launcher, skill) nil && handler && hp && target && launcher && skill end |
#on_post_damage_death(handler, hp, target, launcher, skill)
Function called after damages were applied and when target died (post_damage_death)
211 212 213 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 211 def on_post_damage_death(handler, hp, target, launcher, skill) nil && handler && hp && target && launcher && skill end |
#on_post_fterrain_change(handler, fterrain_type, last_fterrain)
Function called after the terrain was changed
289 290 291 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 289 def on_post_fterrain_change(handler, fterrain_type, last_fterrain) nil && handler && fterrain_type && last_fterrain end |
#on_post_item_change(handler, db_symbol, target, launcher, skill)
Function called when a post_item_change is checked
159 160 161 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 159 def on_post_item_change(handler, db_symbol, target, launcher, skill) nil && handler && db_symbol && target && launcher && skill end |
#on_post_status_change(handler, status, target, launcher, skill)
Function called when a post_status_change is performed
180 181 182 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 180 def on_post_status_change(handler, status, target, launcher, skill) nil && handler && status && target && launcher end |
#on_post_weather_change(handler, weather_type, last_weather)
Function called after the weather was changed (on_post_weather_change)
272 273 274 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 272 def on_post_weather_change(handler, weather_type, last_weather) nil && handler && weather_type && last_weather end |
#on_pre_item_change(handler, db_symbol, target, launcher, skill) ⇒ :prevent?
Function called when a pre_item_change is checked
149 150 151 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 149 def on_pre_item_change(handler, db_symbol, target, launcher, skill) nil && handler && db_symbol && target && launcher && skill end |
#on_single_type_multiplier_overwrite(target, target_type, type, move) ⇒ Float?
Function that computes an overwrite of the type multiplier
370 371 372 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 370 def on_single_type_multiplier_overwrite(target, target_type, type, move) nil && target && target_type && type && move end |
#on_stat_change(handler, stat, power, target, launcher, skill) ⇒ Integer?
Function called when a stat_change is about to be applied
126 127 128 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 126 def on_stat_change(handler, stat, power, target, launcher, skill) nil && handler && stat && target && launcher && skill end |
#on_stat_change_post(handler, stat, power, target, launcher, skill) ⇒ Integer?
Function called when a stat_change has been applied
138 139 140 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 138 def on_stat_change_post(handler, stat, power, target, launcher, skill) nil && handler && stat && target && launcher && skill end |
#on_stat_decrease_prevention(handler, stat, target, launcher, skill) ⇒ :prevent?
Function called when a stat_decrease_prevention is checked
114 115 116 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 114 def on_stat_decrease_prevention(handler, stat, target, launcher, skill) nil && 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
103 104 105 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 103 def on_stat_increase_prevention(handler, stat, target, launcher, skill) nil && handler && stat && target && launcher && skill end |
#on_status_prevention(handler, status, target, launcher, skill) ⇒ :prevent?
Function called when a status_prevention is checked
170 171 172 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 170 def on_status_prevention(handler, status, target, launcher, skill) nil && handler && status && target && launcher && skill end |
#on_switch_event(handler, who, with)
Function called when a Pokemon has actually switched with another one
239 240 241 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 239 def on_switch_event(handler, who, with) nil && handler && who && with end |
#on_switch_passthrough(handler, pokemon, skill, reason) ⇒ :passthrough?
Function called when testing if pokemon can switch regardless of the prevension.
221 222 223 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 221 def on_switch_passthrough(handler, pokemon, skill, reason) nil && handler && pokemon && skill end |
#on_switch_prevention(handler, pokemon, skill, reason) ⇒ :prevent?
Function called when testing if pokemon can switch (when he couldn't passthrough)
231 232 233 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 231 def on_switch_prevention(handler, pokemon, skill, reason) nil && handler && pokemon && skill end |
#on_transform_event(handler, target)
Function called when a Pokemon initialize a transformation
360 361 362 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 360 def on_transform_event(handler, target) nil && handler && target end |
#on_two_turn_shortcut(user, targets, skill) ⇒ Boolean
Function called after a battler proceed its two turn move's first turn
92 93 94 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 92 def on_two_turn_shortcut(user, targets, skill) false end |
#on_weather_prevention(handler, weather_type, last_weather) ⇒ :prevent?
Function called when a weather_prevention is checked
264 265 266 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 264 def on_weather_prevention(handler, weather_type, last_weather) nil && handler && weather_type && last_weather end |
#out_of_reach? ⇒ Boolean
Tell if the effect make the pokemon out reach
62 63 64 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 62 def out_of_reach? return false end |
#rapid_spin_affected? ⇒ Boolean
Function that tells if the move is affected by Rapid Spin
50 51 52 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 50 def rapid_spin_affected? return false end |
#sp_atk_multiplier(user, target, move) ⇒ Float, Integer
Give the move [Spe]atk mutiplier
388 389 390 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 388 def sp_atk_multiplier(user, target, move) return 1 end |
#sp_def_multiplier(user, target, move) ⇒ Float, Integer
Give the move [Spe]def mutiplier
397 398 399 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 397 def sp_def_multiplier(user, target, move) return 1 end |
#spd_modifier ⇒ Float, Integer
Give the speed modifier over given to the Pokemon with this effect
430 431 432 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 430 def spd_modifier return 1 end |
#targetted?(battler) ⇒ Boolean
Tell if the given battler is targetted by the effect
77 78 79 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 77 def targetted?(battler) false end |
#update_counter
Function that updates the counter of the effect
21 22 23 |
# File 'scripts/01600 Alpha 25 Battle Engine/04000 Effects/00100 EffectBase.rb', line 21 def update_counter @counter -= 1 end |