Class: GothamDice
- Inherits:
-
ParaDice::Bag
- Object
- ParaDice::Bag
- GothamDice
- Defined in:
- lib/gotham_dice.rb
Overview
Another example of creating a custom set of dice
Constant Summary collapse
- DATA_FILE_NAME =
path to yml file
'data/gotham_dice.yml'
- OPPOSING =
which faces are considered opposing, and thus cancel out in CancelOpposing
readers
[ ['blank', 'blank'], ['pow', 'antipow'], ['clue', 'anticlue'], ['move', 'antimove'], ]
- DEFAULT_READERS =
The Readers to use in order, in this case, use ‘_’ to split face names
(allowing single faces with multiple results), then cancel all of the opposing results, then present the results as a frequency hash
[ ParaDice::Results::SplitFaces.new('_'), ParaDice::Results::CancelOpposing.new(OPPOSING), ParaDice::Results::Hash ]
Instance Attribute Summary collapse
-
#default_readers ⇒ Array<#resolve>
, defaults to DEFAULT_READERS.
-
#dice ⇒ Hash<String,Paradise::StringDie]
Hash<String,Paradise::StringDie].
Attributes inherited from ParaDice::Bag
Class Method Summary collapse
-
.get(rng = nil) ⇒ GothamDice
simple way to get a bag of dice with optional rng.
Methods inherited from ParaDice::Bag
Instance Attribute Details
#default_readers ⇒ Array<#resolve>
Returns , defaults to DEFAULT_READERS.
36 |
# File 'lib/gotham_dice.rb', line 36 attribute :default_readers, Array, default: ->(*a) { DEFAULT_READERS } |
#dice ⇒ Hash<String,Paradise::StringDie]
Returns Hash<String,Paradise::StringDie].
|
# File 'lib/gotham_dice.rb', line 32
|
Class Method Details
.get(rng = nil) ⇒ GothamDice
simple way to get a bag of dice with optional rng
40 41 42 43 |
# File 'lib/gotham_dice.rb', line 40 def self.get(rng = nil) hash = YAML.load_file(DATA_FILE_NAME) self.new(name: 'Gotham Dice', dice: hash, rng: rng) end |