Class: Battle::Actions::PreAttack

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

Overview

Class describing the Pre Attacks Action

Instance Method Summary collapse

Methods inherited from Base

#valid?

Constructor Details

#initialize(scene, attack_actions) ⇒ PreAttack

Create a new attack action

Parameters:



7
8
9
10
# File 'scripts/01600 Alpha 25 Battle Engine/03000 Actions/00002 PreAttack.rb', line 7

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

Instance Method Details

#<=>(other) ⇒ Integer

Compare this action with another

Parameters:

  • other (Base)

    other action

Returns:



15
16
17
18
19
# File 'scripts/01600 Alpha 25 Battle Engine/03000 Actions/00002 PreAttack.rb', line 15

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

  return -1
end

#execute

Execute the action



22
23
24
# File 'scripts/01600 Alpha 25 Battle Engine/03000 Actions/00002 PreAttack.rb', line 22

def execute
  @attack_actions.each { |action| action.move.proceed_pre_attack(action.launcher) }
end