Class: Storyteller::Pool

Inherits:
DiceBag::Roll show all
Defined in:
lib/dicebag/systems/storyteller.rb

Overview

This is a models a pool of Storyteller dice.

Instance Attribute Summary

Attributes inherited from DiceBag::Roll

#dstr, #tree

Instance Method Summary collapse

Methods inherited from DiceBag::Roll

#average, #maximum, #minimum, #notes, #notes_to_s, #result

Methods included from RollString

#inspect

Constructor Details

#initialize(number = 1, success = 8) ⇒ Pool

Returns a new instance of Pool.



9
10
11
12
13
14
15
# File 'lib/dicebag/systems/storyteller.rb', line 9

def initialize(number = 1, success = 8)
  @number  = number
  @success = success
  @result  = nil

  super("#{number}d10e t#{success}")
end

Instance Method Details

#rollObject



17
18
19
# File 'lib/dicebag/systems/storyteller.rb', line 17

def roll
  @result = super
end

#successesObject



21
22
23
24
25
# File 'lib/dicebag/systems/storyteller.rb', line 21

def successes
  roll unless @result

  @result.total
end

#tallyObject



27
28
29
30
31
# File 'lib/dicebag/systems/storyteller.rb', line 27

def tally
  roll unless @result

  @result.sections[0].tally
end

#to_sObject



33
34
35
# File 'lib/dicebag/systems/storyteller.rb', line 33

def to_s
  "#{@number}d10/#{@success}"
end