class FifthedSim::Spell

Spells model save-or-take-damage stuff. At some point in the future I hope to modify them so they work as other stu

Attributes

save_dc[R]
save_type[R]

Public Class Methods

define(name, &block) click to toggle source
# File lib/fifthed_sim/spell.rb, line 40
def self.define(name, &block)
  h = DefinitionProxy.new(name, &block).attrs
  self.new(h)
end
new(hash) click to toggle source
# File lib/fifthed_sim/spell.rb, line 45
def initialize(hash)
  @name = hash[:name]
  @damage = hash[:damage]
  @save_damage = hash[:save_damage]
  @save_type = hash[:save_type]
  @save_dc = hash[:save_dc]
end

Public Instance Methods

against(other) click to toggle source
# File lib/fifthed_sim/spell.rb, line 56
def against(other)
  other.saving_throw(@save_type).test_then do |res|
    if res >= @save_dc
      @save_damage.to(other)
    else
      @damage.to(other)
    end
  end
end
raw_damage() click to toggle source
# File lib/fifthed_sim/spell.rb, line 66
def raw_damage
  @damage.raw
end
raw_save_damage() click to toggle source
# File lib/fifthed_sim/spell.rb, line 70
def raw_save_damage
  @save_damage.raw
end