class Core::Game::Combat::Behaviour

For enemies

Public Class Methods

new(hash) click to toggle source
# File lib/game/combat/battle.rb, line 41
def initialize(hash)
  @actions = {}
  hash.each { |k, v|
    i = 0
    v.each { |action|
      if !@actions[k]
        @actions.store(k, {})
      end
      @actions[k].store(i, action)
      i += 1
    }
  }
end

Public Instance Methods

execute(sym) click to toggle source
# File lib/game/combat/battle.rb, line 55
def execute(sym)
  ary = @actions[sym].values.flatten(1)
  ary.each { |str|
    params = str.split(" ")
    self.send(params.shift, params)
  }
end

Private Instance Methods

attack(target) click to toggle source
# File lib/game/combat/battle.rb, line 75
def attack(target)
  target = target.first
  puts("STUB: Behaviour.attack(#{target})")
end
drop(items) click to toggle source
# File lib/game/combat/battle.rb, line 69
def drop(items)
  items.each { |item|
    puts("STUB: Behaviour.drop(#{item})")
  }
end
vanish(*args) click to toggle source
# File lib/game/combat/battle.rb, line 65
def vanish(*args)
  puts("STUB: Behaviour.vanish")
end