Browse Source

Fix monster damage potentially being off by 63/64th

Monster damage values from melee/missile hits could potentially add or subtract up to 63/64ths of damage over and above a monster's usual damage range

Co-authored-by: Stephen C. Wills <staphen@gmail.com>
pull/3952/head
SoundChaser83 4 years ago committed by Anders Jenbo
parent
commit
b52724a15e
  1. 2
      Source/missiles.cpp
  2. 4
      Source/monster.cpp

2
Source/missiles.cpp

@ -1177,7 +1177,7 @@ bool PlayerMHit(int pnum, Monster *monster, int dist, int mind, int maxd, missil
dam = player._pHitPoints / 3;
} else {
if (!shift) {
dam = (mind << 6) + GenerateRnd((maxd - mind + 1) << 6);
dam = (mind << 6) + GenerateRnd(((maxd - mind) << 6) + 1);
if (monster == nullptr)
if ((player._pIFlags & ISPL_ABSHALFTRAP) != 0)
dam /= 2;

4
Source/monster.cpp

@ -1484,7 +1484,7 @@ void MonsterAttackPlayer(int i, int pnum, int hit, int minDam, int maxDam)
Direction dir = GetDirection(player.position.tile, monster.position.tile);
StartPlrBlock(pnum, dir);
if (pnum == MyPlayerId && player.wReflections > 0) {
int dam = GenerateRnd((maxDam - minDam + 1) << 6) + (minDam << 6);
int dam = GenerateRnd(((maxDam - minDam) << 6) + 1) + (minDam << 6);
dam = std::max(dam + (player._pIGetHit << 6), 64);
CheckReflect(i, pnum, dam);
}
@ -1504,7 +1504,7 @@ void MonsterAttackPlayer(int i, int pnum, int hit, int minDam, int maxDam)
}
}
}
int dam = (minDam << 6) + GenerateRnd((maxDam - minDam + 1) << 6);
int dam = (minDam << 6) + GenerateRnd(((maxDam - minDam) << 6) + 1);
dam = std::max(dam + (player._pIGetHit << 6), 64);
if (pnum == MyPlayerId) {
if (player.wReflections > 0)

Loading…
Cancel
Save