Class: Battle::Logic::SwitchHandler
- Inherits:
-
ChangeHandlerBase
- Object
- ChangeHandlerBase
- Battle::Logic::SwitchHandler
- Includes:
- Hooks
- Defined in:
- docs/01600_Alpha_25_Battle_Engine_00200_Battle_Logic.rb
Overview
Handler responsive of processing switch events that happens during switch
Instance Attribute Summary
Attributes inherited from ChangeHandlerBase
#logic, #pre_checked_effects, #scene
Class Method Summary collapse
-
.register_pre_switch_event_hook(reason) {|handler, who, with| ... }
Register a pre switch event.
-
.register_switch_event_hook(reason) {|handler, who, with| ... }
Register a switch event.
-
.register_switch_passthrough_hook(reason) {|handler, pokemon, skill, reason| ... }
Register a switch passthrough.
-
.register_switch_prevention_hook(reason) {|handler, pokemon, skill, reason| ... }
Register a switch prevention hook.
Instance Method Summary collapse
-
#can_switch?(pokemon, skill = nil, reason: :switch) ⇒ Boolean
Test if the switch is possible.
-
#execute_pre_switch_events(who, with)
Execute the events before the pokemon switch out.
-
#execute_switch_events(who, with)
Perform the switch between two 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_pre_switch_event_hook(reason) {|handler, who, with| ... }
Register a pre switch event
1271 1272 |
# File 'docs/01600_Alpha_25_Battle_Engine_00200_Battle_Logic.rb', line 1271 def register_pre_switch_event_hook(reason) end |
.register_switch_event_hook(reason) {|handler, who, with| ... }
Register a switch event
1278 1279 |
# File 'docs/01600_Alpha_25_Battle_Engine_00200_Battle_Logic.rb', line 1278 def register_switch_event_hook(reason) end |
.register_switch_passthrough_hook(reason) {|handler, pokemon, skill, reason| ... }
Register a switch passthrough. If the block returns :passthrough, it will say that Pokemon can switch in can_switch?
1255 1256 |
# File 'docs/01600_Alpha_25_Battle_Engine_00200_Battle_Logic.rb', line 1255 def register_switch_passthrough_hook(reason) end |
.register_switch_prevention_hook(reason) {|handler, pokemon, skill, reason| ... }
Register a switch prevention hook. If the block returns :prevent, it will say that Pokemon cannot switch in can_switch?
1264 1265 |
# File 'docs/01600_Alpha_25_Battle_Engine_00200_Battle_Logic.rb', line 1264 def register_switch_prevention_hook(reason) end |
Instance Method Details
#can_switch?(pokemon, skill = nil, reason: :switch) ⇒ Boolean
Test if the switch is possible
1233 1234 |
# File 'docs/01600_Alpha_25_Battle_Engine_00200_Battle_Logic.rb', line 1233 def can_switch?(pokemon, skill = nil, reason: :switch) end |
#execute_pre_switch_events(who, with)
In the event we’re starting the battle who & with should be identic, this help to process effect like Intimidate
Execute the events before the pokemon switch out
1239 1240 |
# File 'docs/01600_Alpha_25_Battle_Engine_00200_Battle_Logic.rb', line 1239 def execute_pre_switch_events(who, with) end |
#execute_switch_events(who, with)
In the event we’re starting the battle who & with should be identic, this help to process effect like Intimidate
Perform the switch between two Pokemon
1245 1246 |
# File 'docs/01600_Alpha_25_Battle_Engine_00200_Battle_Logic.rb', line 1245 def execute_switch_events(who, with) end |