Awakened2069/spells.rb
2019-07-04 09:23:39 -04:00

17 lines
608 B
Ruby

class Spell
def self.spells
spells = []
# TESTS
duplicate_spells = spells.group_by(&:name).select {| k, v| v.length > 1 }
raise "Duplicate spells (on name) detected: #{duplicate_spells.collect{ |k,v| k}.to_list}" if duplicate_spells.length > 0
unpunctuated_spells = spells.select { |spell| spell.rules_text.unpunctuated? || spell.reaches.collect{|reach| reach[1]}.any?(&:unpunctuated?) || spell.adds.any? { |add| add[:effect].unpunctuated? } }
raise "The following spells lack punctuation: #{unpunctuated_spells.collect(&:name).to_list}" if unpunctuated_spells.length > 0
spells
end
end