Rollable
public protocol Rollable
An object that is rollable. It must have a roll()
method that returns a Roll
object.
Implemented By
-
Rolls this object and returns the result.
Declaration
Swift
func roll() -> Roll
Return Value
The result of the roll.
-
roll(times:
Default implementation_: ) Rolls this object the given number of times and returns the given result type.
Since
0.5.0
Default Implementation
Rolls this object the given number of times and returns the given result type.
Since
0.5.0
Declaration
Swift
func roll(times: Int, _ returnType: MultipleRollResult) -> Roll
Parameters
times
The number of times to roll.
returnType
The type of result to return.
Return Value
The type of result performed with the given number of rolls.
-
Determines whether or not this object can reach the target Roll, compared by the given comparison.
Since
0.15.0
Declaration
Swift
func canReach(_ target: Roll, _ comparisonType: RollComparison) -> Bool
Parameters
target
The target to check reachibility for.
comparisonType
The method of checking reachibility.
Return Value
Whether or not this object can reach the target using the given method of comparison.
-
chance(of:
Default implementation_: ) Determines the chance of rolling the target
Roll
, compared by the given comparison.Since
0.17.0
Default Implementation
Determines the chance of rolling the target
Roll
, compared by the given comparison.Since
0.17.0
Declaration
Swift
func chance(of target: Roll, _ comparisonType: RollComparison) -> Chance
Parameters
target
The target to check the chance for.
comparisonType
The method of comparison of which the chance of occurring is being returned.
Return Value
The chance of rolling the target using the given method of comparison.
-
chance(of:
Default implementation) Determines the chance of rolling in the given range.
Since
0.17.0
Default Implementation
Determines the chance of rolling in the given range.
Since
0.17.0
Parameters
range
The range to check.
Return Value
The chance of rolling in the given range.
-
The probabilities of all possible rolls.
Since
0.17.0Declaration
Swift
var probabilities: Chances { get }