Class: BCDice::DiceTable::SaiFicSkillTable::Category

Inherits:
Object
  • Object
show all
Defined in:
lib/bcdice/dice_table/sai_fic_skill_table/category.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, skills, dice, s_format) ⇒ Category

Returns a new instance of Category.



7
8
9
10
11
# File 'lib/bcdice/dice_table/sai_fic_skill_table/category.rb', line 7

def initialize(name, skills, dice, s_format)
  @name = name
  @skills = skills.map.with_index(2) { |s, index| SaiFicSkillTable::Skill.new(name, s, dice, index, s_format) }
  @dice = dice
end

Instance Attribute Details

#diceObject (readonly)

Returns the value of attribute dice.



21
22
23
# File 'lib/bcdice/dice_table/sai_fic_skill_table/category.rb', line 21

def dice
  @dice
end

#nameObject (readonly)

Returns the value of attribute name.



21
22
23
# File 'lib/bcdice/dice_table/sai_fic_skill_table/category.rb', line 21

def name
  @name
end

#skillsObject (readonly)

Returns the value of attribute skills.



21
22
23
# File 'lib/bcdice/dice_table/sai_fic_skill_table/category.rb', line 21

def skills
  @skills
end

Instance Method Details

#roll(randomizer) ⇒ Object



13
14
15
# File 'lib/bcdice/dice_table/sai_fic_skill_table/category.rb', line 13

def roll(randomizer)
  skills[randomizer.roll_sum(2, 6) - 2]
end

#to_sObject



17
18
19
# File 'lib/bcdice/dice_table/sai_fic_skill_table/category.rb', line 17

def to_s
  @name
end