Class: StarWarsDice
- Inherits:
-
ParaDice::Bag
- Object
- ParaDice::Bag
- StarWarsDice
- Defined in:
- lib/star_wars_dice.rb
Overview
Note:
no claim is made for the name StarWarsDice
A class for representing the game dice from Star Wars: Edge of the Empire,
Star Wars: Age of Rebellion, Star Wars: Force and Destiny. Mostly here as
an example of how to create a custom dice bag.
Constant Summary collapse
- DATA_FILE_NAME =
yaml file containing dice definitions
'data/star_wars_dice.yml'- OPPOSING =
opposite facing to be used by the reader CancelOpposing
[ ['blank', 'blank'], ['success', 'failure'], ['advantage', 'threat'] ]
- DEFAULT_READERS =
The normal reader order for StarWarsDice. First split the face names using
'_', then cancel opposing faces, finally return as a hash [ ParaDice::Results::SplitFaces.new('_'), ParaDice::Results::CancelOpposing.new(OPPOSING), ParaDice::Results::Hash ]
Instance Attribute Summary collapse
Attributes inherited from ParaDice::Bag
Class Method Summary collapse
-
.get ⇒ Object
load and return a bag of StarWarsDice.
Methods inherited from ParaDice::Bag
Instance Attribute Details
#default_readers ⇒ Array<#resolve>
34 |
# File 'lib/star_wars_dice.rb', line 34 attribute :default_readers, Array, default: ->(*a) { DEFAULT_READERS } |
#dice ⇒ Hash<String,StringDie>
|
|
# File 'lib/star_wars_dice.rb', line 31
|
Class Method Details
.get ⇒ Object
load and return a bag of StarWarsDice
37 38 39 40 |
# File 'lib/star_wars_dice.rb', line 37 def self.get hash = YAML.load_file(DATA_FILE_NAME) self.new(name: 'Star Wars Dice', dice: hash) end |