Class: SavageWorlds::SWDie
- Inherits:
-
DiceBag::Roll
- Object
- DiceBag::Roll
- SavageWorlds::SWDie
- Defined in:
- lib/dicebag/systems/savage_worlds.rb
Overview
Models a single Savage World die, with attributes for max and half values.
Since all Savage Worlds Trait (Attributes + Skills) dice can explode, that option is included automatically.
Instance Attribute Summary collapse
-
#half ⇒ Object
readonly
Returns the value of attribute half.
-
#maximum ⇒ Object
readonly
Returns the value of attribute maximum.
Attributes inherited from DiceBag::Roll
Instance Method Summary collapse
-
#initialize(sides, mod = 0) ⇒ SWDie
constructor
A new instance of SWDie.
Methods inherited from DiceBag::Roll
#average, #minimum, #notes, #notes_to_s, #result, #roll
Methods included from RollString
Constructor Details
#initialize(sides, mod = 0) ⇒ SWDie
Returns a new instance of SWDie.
13 14 15 16 17 18 19 20 |
# File 'lib/dicebag/systems/savage_worlds.rb', line 13 def initialize(sides, mod = 0) @maximum = sides @half = (sides / 2) + (mod / 2) dstr = mod.zero? ? "1d#{sides}e" : "1d#{sides}e #{mod}" super(dstr) end |
Instance Attribute Details
#half ⇒ Object (readonly)
Returns the value of attribute half.
11 12 13 |
# File 'lib/dicebag/systems/savage_worlds.rb', line 11 def half @half end |
#maximum ⇒ Object (readonly)
Returns the value of attribute maximum.
10 11 12 |
# File 'lib/dicebag/systems/savage_worlds.rb', line 10 def maximum @maximum end |