aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/lol.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/kyra/lol.cpp')
-rw-r--r--engines/kyra/lol.cpp13
1 files changed, 3 insertions, 10 deletions
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index f2617dc8b4..d2c8be9556 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -1877,15 +1877,8 @@ int LoLEngine::rollDice(int times, int pips) {
return 0;
int res = 0;
- int d = 0;
-
- do {
- int val = (((int)_rnd.getRandomNumber(0x7fff) * pips) / 0x8000) + 1;
- if (val > pips)
- val -= pips;
- res += val;
- d++;
- } while (d < times);
+ while (times--)
+ res += _rnd.getRandomNumberRng(1, pips);
return res;
}
@@ -1901,7 +1894,7 @@ int LoLEngine::castSpell(int charNum, int spellType, int spellLevel) {
_activeSpell.spell = spellType;
_activeSpell.p = &_spellProperties[spellType];
- _activeSpell.level = spellLevel < 0 ? -spellLevel : spellLevel;
+ _activeSpell.level = ABS(spellLevel);
if ((_spellProperties[spellType].flags & 0x100) && testWallFlag(calcNewBlockPosition(_currentBlock, _currentDirection), _currentDirection, 1)) {
_txt->printMessage(2, getLangString(0x4257));