Fix dmonsfree pending when hero was hit with drain-life artifact
When a monster hit hero with an artifact with drain-life attack (Stormbringer or The Staff of Aesculapius), and hero lost a level and hero had more max hp in the lower xp level, the math made the attacker lose hp. This could put the monster hp in the negative, causing "dmonsfree: 1 removed doesn't match 0 pending"
This commit is contained in:
+1
-1
@@ -1589,7 +1589,7 @@ artifact_hit(struct monst *magr, struct monst *mdef, struct obj *otmp,
|
|||||||
}
|
}
|
||||||
losexp("life drainage");
|
losexp("life drainage");
|
||||||
if (magr && magr->mhp < magr->mhpmax) {
|
if (magr && magr->mhp < magr->mhpmax) {
|
||||||
magr->mhp += (oldhpmax - u.uhpmax + 1) / 2;
|
magr->mhp += (abs(oldhpmax - u.uhpmax) + 1) / 2;
|
||||||
if (magr->mhp > magr->mhpmax)
|
if (magr->mhp > magr->mhpmax)
|
||||||
magr->mhp = magr->mhpmax;
|
magr->mhp = magr->mhpmax;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user