Skip to content

Commit

Permalink
Reverted change from b78ab8e, which reduces randomness in the result …
Browse files Browse the repository at this point in the history
…of the Dice plugin's roll command
elazar committed Aug 14, 2011
1 parent 4937aea commit c140200
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Phergie/Plugin/Dice.php
Original file line number Diff line number Diff line change
@@ -59,11 +59,12 @@ public function onCommandRoll($message)
)) {
list (, $num, $die, $mod, $rest) = $matches;
$roll = 0;
if ($die) {
$roll = $num + mt_rand(0, $num * ($die - 1));
for ($i = 0; $i < $num; $i++) {
$roll += mt_rand(1, $die);
}
$roll = min($roll, $num * $die);
if (!empty($mod)) {
$roll += intval(preg_replace('/\s+/', '', $mod));
$roll += (int) preg_replace('/\s+/', '', $mod);
}

$this->doPrivmsg(

0 comments on commit c140200

Please sign in to comment.