View Source Rollex.Dice.Operations (Rollex v0.7.1)
Support for operations that can be applied to dice rolls including:
- odd only (
o
) - even oly (
e
) - keep high (
kh#, k#
) - keep low (
kl#
) - drop high (
dh#
) - drop low (
dl#
) - less than (
<#
,<[#, #, #..]
,<[#..#]
) - greater than (
>#
,>[#, #, #..]
,>[#..#]
) - equal to (
=#
,=[#, #, #..]
,=[#..#]
)
Link to this section Summary
Link to this section Types
Specs
operable_token() :: %{ :operation => operation(), :sides => non_neg_integer(), required(atom()) => any() }
Specs
operation() :: operation_type() | {operation_type(), params :: term()}
Specs
operation_type() :: :drop_bottom | :drop_top | :greater_than | :less_than | :match | :match_list | nil | :take_bottom | :take_even | :take_odd | :take_top
Link to this section Functions
Specs
apply(token :: operable_token(), rolls :: [integer()]) :: {valid :: [integer()], rejected :: [integer()]}
Applies an operation returned by parse/1
to a list of numbers representing dice rolls
Specs
parse(definition :: String.t()) :: {operation(), num_chars_consumed :: non_neg_integer()} | {:error, reason :: String.t()}
Parse operations from a provided string