Class: Battle::Logic::DamageHandler
- Inherits:
-
ChangeHandlerBase
- Object
- ChangeHandlerBase
- Battle::Logic::DamageHandler
- Includes:
- Hooks
- Defined in:
- docs/5_Battle_04_Logic.rb
Overview
Handler responsive of defining how damage should be dealt (if possible)
Instance Attribute Summary
Attributes inherited from ChangeHandlerBase
#logic, #pre_checked_effects, #scene
Class Method Summary collapse
-
.register_damage_prevention_hook(reason) {|handler, hp, target, launcher, skill| ... }
Function that registers a damage_prevention hook.
-
.register_post_damage_death_hook(reason) {|handler, hp, target, launcher, skill| ... }
Function that registers a post_damage_death hook (when target is KO).
-
.register_post_damage_hook(reason) {|handler, hp, target, launcher, skill| ... }
Function that registers a post_damage hook (when target is still alive).
Instance Method Summary collapse
-
#damage_appliable(hp, target, launcher = nil, skill = nil) ⇒ Integer, false
Function telling if a damage can be applied and how much.
-
#damage_change(hp, target, launcher = nil, skill = nil, &messages)
Function that actually deal the damage.
-
#damage_change_with_process(hp, target, launcher = nil, skill = nil, &messages)
Function that test if the damage can be dealt and deal the damage if so.
-
#drain(hp_factor, target, launcher, skill = nil, hp_overwrite: nil, drain_factor: 1, &messages)
Function that drains a certain quantity of HP from the target and give it to the user.
-
#drain_with_process(hp_factor, target, launcher, skill = nil, hp_overwrite: nil, drain_factor: 1, &messages)
Function that test if the drain damages can be dealt and perform the drain if so.
-
#heal(target, hp, test_heal_block: true, animation_id: nil) {|hp| ... } ⇒ Boolean
Function that proceed the heal of a Pokemon.
Methods included from Hooks
#exec_hooks, #force_return, included, register, remove, remove_without_name
Methods inherited from ChangeHandlerBase
#initialize, #prevent_change, #process_prevention_reason, #reset_prevention_reason
Constructor Details
This class inherits a constructor from Battle::Logic::ChangeHandlerBase
Class Method Details
.register_damage_prevention_hook(reason) {|handler, hp, target, launcher, skill| ... }
Function that registers a damage_prevention hook
1161 1162 |
# File 'docs/5_Battle_04_Logic.rb', line 1161 def register_damage_prevention_hook(reason) end |
.register_post_damage_death_hook(reason) {|handler, hp, target, launcher, skill| ... }
Function that registers a post_damage_death hook (when target is KO)
1179 1180 |
# File 'docs/5_Battle_04_Logic.rb', line 1179 def register_post_damage_death_hook(reason) end |
.register_post_damage_hook(reason) {|handler, hp, target, launcher, skill| ... }
Function that registers a post_damage hook (when target is still alive)
1170 1171 |
# File 'docs/5_Battle_04_Logic.rb', line 1170 def register_post_damage_hook(reason) end |
Instance Method Details
#damage_appliable(hp, target, launcher = nil, skill = nil) ⇒ Integer, false
Thing that prevents the damage from being applied should be defined using :damage_prevention Hook.
Function telling if a damage can be applied and how much
1103 1104 |
# File 'docs/5_Battle_04_Logic.rb', line 1103 def damage_appliable(hp, target, launcher = nil, skill = nil) end |
#damage_change(hp, target, launcher = nil, skill = nil, &messages)
Function that actually deal the damage
1111 1112 |
# File 'docs/5_Battle_04_Logic.rb', line 1111 def damage_change(hp, target, launcher = nil, skill = nil, &) end |
#damage_change_with_process(hp, target, launcher = nil, skill = nil, &messages)
Function that test if the damage can be dealt and deal the damage if so
1119 1120 |
# File 'docs/5_Battle_04_Logic.rb', line 1119 def damage_change_with_process(hp, target, launcher = nil, skill = nil, &) end |
#drain(hp_factor, target, launcher, skill = nil, hp_overwrite: nil, drain_factor: 1, &messages)
Function that drains a certain quantity of HP from the target and give it to the user
1140 1141 |
# File 'docs/5_Battle_04_Logic.rb', line 1140 def drain(hp_factor, target, launcher, skill = nil, hp_overwrite: nil, drain_factor: 1, &) end |
#drain_with_process(hp_factor, target, launcher, skill = nil, hp_overwrite: nil, drain_factor: 1, &messages)
Function that test if the drain damages can be dealt and perform the drain if so
1150 1151 |
# File 'docs/5_Battle_04_Logic.rb', line 1150 def drain_with_process(hp_factor, target, launcher, skill = nil, hp_overwrite: nil, drain_factor: 1, &) end |
#heal(target, hp, test_heal_block: true, animation_id: nil) {|hp| ... } ⇒ Boolean
this method yields a block in order to show the message after the animation
this shows the default message if no block has been given
Function that proceed the heal of a Pokemon
1130 1131 |
# File 'docs/5_Battle_04_Logic.rb', line 1130 def heal(target, hp, test_heal_block: true, animation_id: nil) end |