Rollable

public protocol Rollable

An object that is rollable. It must have a roll() method that returns a Roll object.

Implemented By

Author

Samasaur

  • 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.

  • The minimum possible result from using the roll() method.

    Since

    0.2.0

    Declaration

    Swift

    var minimumResult: Roll { get }
  • The maximum possible result from using the roll() method.

    Since

    0.2.0

    Declaration

    Swift

    var maximumResult: Roll { get }
  • The average result from using the roll() method.

    Since

    0.15.0

    Declaration

    Swift

    var averageResult: Roll { get }
  • 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

    Declaration

    Swift

    func chance(of range: Range<Roll>) -> Chance

    Parameters

    range

    The range to check.

    Return Value

    The chance of rolling in the given range.

  • Determines the chance of rolling in the given range.

    Since

    0.17.0

    Declaration

    Swift

    func chance(of range: ClosedRange<Roll>) -> Chance

    Parameters

    range

    The range to check.

    Return Value

    The chance of rolling in the given range.

  • Determines the chance of rolling in the given range.

    Since

    0.17.0

    Declaration

    Swift

    func chance(of range: PartialRangeFrom<Roll>) -> Chance

    Parameters

    range

    The range to check.

    Return Value

    The chance of rolling in the given range.

  • Determines the chance of rolling in the given range.

    Since

    0.17.0

    Declaration

    Swift

    func chance(of range: PartialRangeUpTo<Roll>) -> Chance

    Parameters

    range

    The range to check.

    Return Value

    The chance of rolling in the given range.

  • Determines the chance of rolling in the given range.

    Since

    0.17.0

    Declaration

    Swift

    func chance(of range: PartialRangeThrough<Roll>) -> Chance

    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.0

    Declaration

    Swift

    var probabilities: Chances { get }