Class: Battle::Actions::Flee
- Defined in:
- scripts/01600 Alpha 25 Battle Engine/03000 Actions/00006 Flee.rb
Overview
Class describing the Flee action
Instance Attribute Summary collapse
-
#target ⇒ PFM::PokemonBattler
readonly
Get the pokemon trying to flee.
Instance Method Summary collapse
-
#<=>(other) ⇒ Integer
Compare this action with another.
-
#execute(from_scene = false)
Execute the action.
-
#initialize(scene, target) ⇒ Flee
constructor
Create a new flee action.
Methods inherited from Base
Constructor Details
#initialize(scene, target) ⇒ Flee
Create a new flee action
11 12 13 14 |
# File 'scripts/01600 Alpha 25 Battle Engine/03000 Actions/00006 Flee.rb', line 11 def initialize(scene, target) super(scene) @target = target end |
Instance Attribute Details
#target ⇒ PFM::PokemonBattler (readonly)
Get the pokemon trying to flee
7 8 9 |
# File 'scripts/01600 Alpha 25 Battle Engine/03000 Actions/00006 Flee.rb', line 7 def target @target end |
Instance Method Details
#<=>(other) ⇒ Integer
Compare this action with another
19 20 21 22 23 |
# File 'scripts/01600 Alpha 25 Battle Engine/03000 Actions/00006 Flee.rb', line 19 def <=>(other) return 1 if other.is_a?(Attack) && Attack.from(other).move.relative_priority > 0 return -1 end |
#execute(from_scene = false)
Execute the action
27 28 29 30 31 32 33 34 35 |
# File 'scripts/01600 Alpha 25 Battle Engine/03000 Actions/00006 Flee.rb', line 27 def execute(from_scene = false) if from_scene execute_from_scene elsif @scene.logic.switch_handler.can_switch?(@target) @scene.(parse_text_with_pokemon(19, 767, @target)) @scene.logic.battle_result = 1 @scene.next_update = :battle_end end end |