Class: Battle::Actions::HighPriorityItem

Inherits:
Base show all
Defined in:
scripts/01600 Alpha 25 Battle Engine/03000 Actions/00007 HighPriorityItem.rb

Overview

Class describing the activation message of item granting priority

Instance Method Summary collapse

Methods inherited from Base

#valid?

Constructor Details

#initialize(scene, holder) ⇒ HighPriorityItem

Create a new high priority item action

Parameters:



8
9
10
11
# File 'scripts/01600 Alpha 25 Battle Engine/03000 Actions/00007 HighPriorityItem.rb', line 8

def initialize(scene, holder)
  super(scene)
  @holder = holder
end

Instance Method Details

#<=>(other) ⇒ Integer

Compare this action with another

Parameters:

  • other (Base)

    other action

Returns:



16
17
18
19
20
# File 'scripts/01600 Alpha 25 Battle Engine/03000 Actions/00007 HighPriorityItem.rb', line 16

def <=>(other)
  return -1 if other.is_a?(Flee)

  return 1
end

#execute

Execute the action



23
24
25
26
27
# File 'scripts/01600 Alpha 25 Battle Engine/03000 Actions/00007 HighPriorityItem.rb', line 23

def execute
  item_name = @holder.item_name
  @holder.send(:consume_berry, @holder) if @holder.item_effect.is_a?(Effects::Item::Berry)
  @scene.display_message_and_wait(parse_text_with_pokemon(19, 1031, @holder, PFM::Text::ITEM2[1] => item_name))
end