class FifthedSim::Actor

Constants

ASSIGNABLE_ATTRS

Attributes

attacks[R]
base_ac[R]
name[R]
spells[R]

Public Class Methods

define(name, &block) click to toggle source
# File lib/fifthed_sim/actor.rb, line 51
def self.define(name, &block)
  d = DefinitionProxy.new(name, &block)
  return self.new(d.attrs)
end
new(attrs) click to toggle source
# File lib/fifthed_sim/actor.rb, line 60
def initialize(attrs)
  attrs.to_a.keep_if{ |(k, v)| ASSIGNABLE_ATTRS.include?(v) }
    .each { |(k, v)| self.instance_variable_set("@#{k}", v) }
end

Public Instance Methods

ac() click to toggle source

TODO: Implement armor

# File lib/fifthed_sim/actor.rb, line 71
def ac
  base_ac
end
random_attack() click to toggle source
# File lib/fifthed_sim/actor.rb, line 65
def random_attack
  @attacks.keys.sample
end