Mario Domgörgen
and 2 contributors
Coverage Status

NAME

Games::Dice::Roll20 - Simulate dice rolls with Roll20's syntax

SYNOPSIS

  my $dice = Games::Dice::Roll20->new();
  say $dice->roll('3d20+5');
  say $dice->roll('d6*10+d6');
  say $dice->roll('10d6rk4>5');

DESCRIPTION

Games::Dice::Roll20 simulates dice rolls by using a syntax familiar to players of role playing games. In contrast to many similar projects it does not only support simple constructs like 2d6+4 but aims to simulate complex dice mechanics like exploding, re-rolling and keeping and dropping high or low dice. It should be a almost complete implementation of the dice specification by Roll20. The supported features and deviations from this specifications are listed in our own specification.

METHODS

roll

  my $result = $dice->roll('3d20+5');

Parse the provided dice expression and returns the results as integer. Returns undef if the expression can't be parsed.

COPYRIGHT AND LICENSE

Copyright 2015 Mario Domgoergen <mario@domgoergen.com>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.