Skip to content

Commit

Permalink
Addressing issue in dice module where bonus may be equal to the numbe…
Browse files Browse the repository at this point in the history
…r of dice

closes #18
  • Loading branch information
paulofmandown committed Jan 10, 2017
1 parent b66f1df commit 108ee1e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions rotLove/rotLove.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5658,8 +5658,8 @@ function ROT.Dice:__init(dice_notation, minimum, rng)
self.num = tonumber(string.match(dice_notation, '%d+'))
self.faces = tonumber(string.match(dice_notation, '[d](%d+)'))

local double_bonus = string.match(dice_notation, '[^%^+-]([+-]?[+-])%d+')
local bonus = string.match(dice_notation, '[^%^+-][+-]?([+-]%d+)')
local double_bonus = string.match(dice_notation, '[d]%d+([+-]?[+-])%d+')
local bonus = string.match(dice_notation, '[d]%d+[+-]?([+-]%d+)')
self.is_bonus_plural = double_bonus == '++' or double_bonus == '--'
self.bonus = tonumber(bonus) or 0

Expand Down
4 changes: 2 additions & 2 deletions src/dice.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ function Dice:__init(dice_notation, minimum, rng)
self.num = tonumber(string.match(dice_notation, '%d+'))
self.faces = tonumber(string.match(dice_notation, '[d](%d+)'))

local double_bonus = string.match(dice_notation, '[^%^+-]([+-]?[+-])%d+')
local bonus = string.match(dice_notation, '[^%^+-][+-]?([+-]%d+)')
local double_bonus = string.match(dice_notation, '[d]%d+([+-]?[+-])%d+')
local bonus = string.match(dice_notation, '[d]%d+[+-]?([+-]%d+)')
self.is_bonus_plural = double_bonus == '++' or double_bonus == '--'
self.bonus = tonumber(bonus) or 0

Expand Down

0 comments on commit 108ee1e

Please sign in to comment.