Rollables
-
A representation of a single die.
It can be rolled using the
roll()
method, which will give aRoll
result.A
See moreDie
object cannot change. Use the addition operators and theDice
class to represent more complex dice expressions.Declaration
Swift
public struct Die
extension Die: Rollable
extension Die: Equatable
extension Die: Comparable
extension Die: Hashable
extension Die: Describable
-
A collection of
Die
objects and/or a modifier that can be rolled using theroll()
method.The properties of
See moreDice
objects are immutable; use the addition operators to combine them with otherDie
objects or modifiers. You can use compound assignment operators if you want, so long as you declare theDice
object as avar
instead of alet
constant. -
A representation of a weighted die; i.e. a die whose sides do not necessarily have the same chance of being rolled.
The chances of specific rolls are passed using a
Chances
object. It is recommended to create the object separately, because it is easier to manipulate theChance
s that way.Since
0.16.0Declaration
Swift
public struct WeightedDie
extension WeightedDie: Rollable
extension WeightedDie: Equatable
extension WeightedDie: Hashable
extension WeightedDie: Describable