Games-Dice-Roll20

 view release on metacpan or  search on metacpan

lib/Games/Dice/Roll20/Spec.pod  view on Meta::CPAN


=pod

=head1 Roll20 Dice Specification

=head2 Order of Operations

While the Roll20 dice engine does support basic math and functions such as
floor() and ceil(), it is first and foremost a dice engine, and so it has its
own order of operations. This means that putting parentheses inside of your
dice formula will not always affect the outcome of the roll (for example, you
can't force a variable to be interpreted before a macro). Here is the general
order of operations:

The roll is executed: first, dice are rolled for any dice (e.g. "2d6" is
rolled; including any special dice such as dropped or exploding), then the
result of that roll is substituted into the formula. Next, floor() and ceil()
functions are executed. Finally, the entire remaining formula is evaluated,
including observing proper math order of operations (parentheses first, then
multiplication/division, then addition/subtraction).

=head2 Types Of Dice

Roll20 supports more than just your standard polyhedrons when rolling dice,
below are the available die types you can use in your games.

=head3 Basic Roll I<NdX>

lib/Games/Dice/Roll20/Spec.pod  view on Meta::CPAN


=item Keep, Drop, Success, Failure, Sorting

These are applied after all of the dice have "settled" and all of the
result values are known.

=back

=head1 Rounding Rolls and Math Functions

You may want to use rounding in your roll formulas to emulate mechanics such as
"half a level, rounded down to the nearest level." Roll20 provides several
functions to accomplish this:

=over 4

=item *

I<floor()> which will always round the number down (e.g. 5.7 becomes 5)

=item *

lib/Games/Dice/Roll20/Spec.pod  view on Meta::CPAN


I<round()> which will always round to the nearest whole number (e.g. 4.4
becomes 4 and 4.5 becomes 5).

=item *

I<abs()> will calculate the absolute value of the roll

=back

You can use these functions almost anywhere in your roll formulas (around a
single math expression, groups of math expressions, or even the entire roll).

=head2 Grouped Rolls

B<This section is not yet implemented>

Mutliple rolls can be perfomed within a group via curly braces using a comma to
seperate the sub-roll expressions I<{3d6+3d4+5, 2d8+4}>. Grouped Rolls have
their own set of Group Modifiers which perform actions across the whole group.



( run in 0.477 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )