Class: BCDice::DiceTable::SaiFicSkillTable::Category
- Inherits:
-
Object
- Object
- BCDice::DiceTable::SaiFicSkillTable::Category
- Defined in:
- lib/bcdice/dice_table/sai_fic_skill_table/category.rb
Instance Attribute Summary collapse
-
#dice ⇒ Object
readonly
Returns the value of attribute dice.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#skills ⇒ Object
readonly
Returns the value of attribute skills.
Instance Method Summary collapse
-
#initialize(name, skills, dice, s_format) ⇒ Category
constructor
A new instance of Category.
- #roll(randomizer) ⇒ Object
- #to_s ⇒ Object
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
#dice ⇒ Object (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 |
#name ⇒ Object (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 |
#skills ⇒ Object (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_s ⇒ Object
17 18 19 |
# File 'lib/bcdice/dice_table/sai_fic_skill_table/category.rb', line 17 def to_s @name end |