OSRIC::Util::d exports correctly
This commit is contained in:
parent
30c4f4929d
commit
8f59c28565
@ -72,7 +72,7 @@ sub generate_stats
|
||||
# * Class specific boosts.
|
||||
# * Perhaps an alternate system where players can choose what number
|
||||
# to allocate to what stat.
|
||||
$self->{stats}->{$stat} = (d(6) + d(6) + d(6));
|
||||
$self->{stats}->{$stat} = d(6, 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,19 @@
|
||||
package OSRIC::Util;
|
||||
use Exporter qw/import/;
|
||||
our @EXPORT = qw/d/;
|
||||
|
||||
# Rolls a dice of the specified number:
|
||||
sub d
|
||||
{
|
||||
my $n = shift;
|
||||
return int(rand($n));
|
||||
# The range of the dice:
|
||||
my $range = shift;
|
||||
|
||||
# Optional: The number of dice thrown.
|
||||
my $n = shift // 1;
|
||||
|
||||
my $i = 0;
|
||||
$i += int(rand($range));
|
||||
return $i;
|
||||
}
|
||||
|
||||
1;
|
||||
|
Loading…
Reference in New Issue
Block a user