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