class Spell ARCANA = [:death, :fate, :forces, :life, :matter, :mind, :prime, :space, :spirit, :time] RANKS = ["Initiate", "Apprentice", "Disciple", "Adept", "Master"] ARCANA.each do |arcanum| attr_accessor arcanum end attr_accessor :name, :practice, :primary_factor, :withstand, :suggested_rote_skills, :reaches, :adds, :rules_text, :cost attr_accessor :authors def initialize( death: 0, fate: 0, forces: 0, life: 0, matter: 0, mind: 0, prime: 0, space: 0, spirit: 0, time: 0, name:, practice:, primary_factor:, withstand: nil, suggested_rote_skills:, reaches: [], rules_text:, authors:, adds: [], cost: nil) @death = death @fate = fate @forces = forces @life = life @matter = matter @mind = mind @prime = prime @space = space @spirit = spirit @time = time @name = name @practice = practice @primary_factor = primary_factor @withstand = withstand @suggested_rote_skills = suggested_rote_skills @reaches = reaches @rules_text = rules_text @authors = authors @adds = adds @cost = cost end def primary_arcanum ARCANA.max { |arcanum1, arcanum2| self.send(arcanum1) <=> self.send(arcanum2) } end def full_title "#{name} (#{arcana_with_dots.join(', ')})" end def arcana ARCANA.select { |arcanum| self.send(arcanum) > 0} end def arcana_with_dots arcana.collect { |arcanum| arcanum_with_dots(arcanum) } end def arcanum_with_dots(arcanum) [arcanum, self.send(arcanum)].to_arcanum_with_dots end end