]> granicus.if.org Git - nethack/commitdiff
B09001 - mhp > mhpmax after life drain
authornethack.rankin <nethack.rankin>
Thu, 22 Aug 2002 01:44:24 +0000 (01:44 +0000)
committernethack.rankin <nethack.rankin>
Thu, 22 Aug 2002 01:44:24 +0000 (01:44 +0000)
     A monster hit by Stormbringer could take less damage to current
HP than it took to max HP if attacker had sufficient penalties, so
end up being healthier than its new maximum.  This only applies to
attacks by the player; attacks by monsters don't include the sorts of
modifiers that can trigger it.

doc/fixes34.1
src/uhitm.c

index bab8ca1edf5bb2c717c2f16dc7c80f98e3378f0c..84a24430f9b233ad911ff53d3aec848715d1ef19 100644 (file)
@@ -219,6 +219,7 @@ If there were a hole outside a shop, you could kick stuff out of the door
        into the hole without the shopkeeper noticing.
 curing hallucination while wielding Grayswandir should print a message
 removing unowned pick-axe from container in shop gave inappropriate message
+don't let monster end up with more current HP than max HP after life drain
 
 
 Platform- and/or Interface-Specific Fixes
index 29d881de153fccf9b6d41bc01417ef8878739da6..5ae9e201b4017aca410873e3f2ca94b94cd6f3f1 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)uhitm.c    3.4     2002/02/17      */
+/*     SCCS Id: @(#)uhitm.c    3.4     2002/08/21      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -932,7 +932,10 @@ int thrown;
        }
 
        mon->mhp -= tmp;
-       if(mon->mhp < 1)
+       /* adjustments might have made tmp become less than what
+          a level draining artifact has already done to max HP */
+       if (mon->mhp > mon->mhpmax) mon->mhp = mon->mhpmax;
+       if (mon->mhp < 1)
                destroyed = TRUE;
        if (mon->mtame && (!mon->mflee || mon->mfleetim) && tmp > 0) {
                abuse_dog(mon);