Class: Battle::Logic::SwitchHandler
- Inherits:
-
ChangeHandlerBase
- Object
- ChangeHandlerBase
- Battle::Logic::SwitchHandler
- Includes:
- Hooks
- Defined in:
- docs/5_Battle_04_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
1298 1299 |
# File 'docs/5_Battle_04_Logic.rb', line 1298 def register_pre_switch_event_hook(reason) end |
.register_switch_event_hook(reason) {|handler, who, with| ... }
Register a switch event
1305 1306 |
# File 'docs/5_Battle_04_Logic.rb', line 1305 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?
1282 1283 |
# File 'docs/5_Battle_04_Logic.rb', line 1282 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?
1291 1292 |
# File 'docs/5_Battle_04_Logic.rb', line 1291 def register_switch_prevention_hook(reason) end |
Instance Method Details
#can_switch?(pokemon, skill = nil, reason: :switch) ⇒ Boolean
Test if the switch is possible
1260 1261 |
# File 'docs/5_Battle_04_Logic.rb', line 1260 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
1266 1267 |
# File 'docs/5_Battle_04_Logic.rb', line 1266 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
1272 1273 |
# File 'docs/5_Battle_04_Logic.rb', line 1272 def execute_switch_events(who, with) end |