]> granicus.if.org Git - nethack/commitdiff
fix #H6489 - explosion double damage to ustuck
authorPatR <rankin@nethack.org>
Fri, 24 Nov 2017 00:37:20 +0000 (16:37 -0800)
committerPatR <rankin@nethack.org>
Fri, 24 Nov 2017 00:37:20 +0000 (16:37 -0800)
Report asked why u.ustuck takes double explosion damage, and concocting
a reason uncovered several inconsistencies.  Grabber takes double damage
for reaching into hero's spot, but only when that spot is within the
explosion's radius and only if hero isn't engulfed.  Poly'd hero takes
double damage if holding a monster which is hit by the explosion.

There are still multiple bugs here:  if the hero is grabbing a monster
which gets killed by the explosion, the fact that one was held is
forgotten by the time damage is inflicted upon the hero.  Just a messy
detail that I opted not to get bogged down in.  But much messier is
that grabber might be outside the explosion radius reaching into that
to hold grabbee, in which case no damage is inflicted.  Handling that
for out-of-range monster holding exploded hero shouldn't be very tough,
but handling it for out-of-range hero holding exploded monster could be
hard.  Anyway, it's more headache than I intend to tackle.

doc/fixes36.1
src/explode.c

index af1de2a6c516e655d3d7560abaa9222a04e29433..4039409166bde3804bbc614123192a2b51d642fd 100644 (file)
@@ -473,6 +473,11 @@ make Vlad slightly tougher
 reduce the amount of gold laying on the floor
 locked chests and large boxes contain more stuff
 make shopkeepers bill hero for burying merchandise
+monster holding hero takes double damage from an explosion for reaching into
+       adjacent spot, but it was being inflicted even when hero was swallowed
+       or beyond the explosion radius
+poly'd hero holding monster now takes double damage (if monster is within
+       explosion radious) instead of inflicting that upon the monster
 
 
 Fixes to Post-3.6.0 Problems that Were Exposed Via git Repository
index cc6477c4a9631a4530324948a463228000aa5c18..8720c48a4b0e4b232c65a974dfa609d8e9bd9636 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 explode.c       $NHDT-Date: 1503355817 2017/08/21 22:50:17 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.50 $ */
+/* NetHack 3.6 explode.c       $NHDT-Date: 1511483825 2017/11/24 00:37:05 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.53 $ */
 /*      Copyright (C) 1990 by Ken Arromdee */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -401,8 +401,18 @@ int expltype;
                             pline("%s resists the %s!", Monnam(mtmp), str);
                         mdam = (dam + 1) / 2;
                     }
-                    if (mtmp == u.ustuck)
+                    /* if grabber is reaching into hero's spot and
+                       hero's spot is within explosion radius, grabber
+                       gets hit by double damage */
+                    if (mtmp == u.ustuck && !u.uswallow
+                        && !(Upolyd && sticks(youmonst.data))
+                        && distu(x, y) <= 2)
                         mdam *= 2;
+                    /* being resistant to opposite type of damage makes
+                       target more vulnerable to current type of damage
+                       (being resistant to current type has already cut
+                       damage in half, so this effectively restores it
+                       to full for targets who resist both types) */
                     if (resists_cold(mtmp) && adtyp == AD_FIRE)
                         mdam *= 2;
                     else if (resists_fire(mtmp) && adtyp == AD_COLD)
@@ -468,6 +478,13 @@ int expltype;
 
         ugolemeffects((int) adtyp, damu);
         if (uhurt == 2) {
+            /* if poly'd hero is grabbing another victim, do double damage */
+            /* [FIXME: if u.ustuck was killed above, we'll miss it here.]  */
+            if (u.ustuck && !u.uswallow && (Upolyd && sticks(youmonst.data))
+                && dist2((int) u.ustuck->mx, (int) u.ustuck->my, x, y) <= 2)
+                damu *= 2;
+            /* [FIXME too: hero ought to get same fire-resistant vs cold
+             *  and cold-resistant vs fire double damage as monsters.] */
             if (Upolyd)
                 u.mh -= damu;
             else