Skip to content

Commit 270b3f3

Browse files
committed
Spell-check and rename dquantity to dropAmount
1 parent 9d6446b commit 270b3f3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ezdice.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88
class EZDice {
99
// Magic dice & modifier matching regex
10-
private const REGEX_DICE = '/(?<operator>[\+-]?)\s*(?:(?:(?<number>\d+)*[dD](?<type>(?:\d+|[%fF]))(?:-(?<drop>[LlHh])(?<dquantity>\d+)?)?)|(?<mod>[0-9]\d*))/';
10+
private const REGEX_DICE = '/(?<operator>[\+-]?)\s*(?:(?:(?<number>\d+)*[dD](?<type>(?:\d+|[%fF]))(?:-(?<drop>[LlHh])(?<dropAmount>\d+)?)?)|(?<mod>[0-9]\d*))/';
1111
private const REGEX_DICE_SINGLE = '/(?<number>\d+)*[dD](?<type>(?:[1-9]\d*|[%fF]))/';
1212

1313
// Stores information on last roll
@@ -209,7 +209,7 @@ private function countAndValidateDiceGroups(string $diceStr): int|false
209209

210210
private function processGroup(array $group): void
211211
{
212-
// Scaler makes the output postive or negative
212+
// Scaler makes the output positive or negative
213213
$isNegative = ($group['operator'] == '-');
214214
$scaler = ($isNegative ? -1 : 1);
215215

@@ -261,7 +261,7 @@ private function processGroup(array $group): void
261261
} else { // Dropping high, so sort ascending
262262
sort($results, SORT_NUMERIC);
263263
}
264-
$dropQuantity = min($group['dquantity'] ?? 1, $number);
264+
$dropQuantity = min($group['dropAmount'] ?? 1, $number);
265265
for ($i=0; $i < $dropQuantity; $i++) {
266266
$droppedResult = array_pop($results);
267267
$this->addState($type, $droppedResult, $isNegative, true);
@@ -287,7 +287,7 @@ private function resetResultValues(): void
287287
}
288288

289289
/**
290-
* Generates the psudo-random number for dice rolls.
290+
* Generates the pseudo-random number for dice rolls.
291291
*
292292
* @param int $max the highest number on the dice. Roll is 1 - $max (inclusive).
293293
*

0 commit comments

Comments
 (0)