]> granicus.if.org Git - nethack/commitdiff
explode() while engulfed (trunk only)
authornethack.rankin <nethack.rankin>
Mon, 30 Apr 2007 04:56:37 +0000 (04:56 +0000)
committernethack.rankin <nethack.rankin>
Mon, 30 Apr 2007 04:56:37 +0000 (04:56 +0000)
     For an explosion caused by the player while the hero is engulfed,
skip adjacent monsters.  Also, don't give "you hear a blast" when an
unseen explosion is caused by a scroll of fire (explosion is always unseen
when hero is engulfed, regardless of explosion's cause).  [Offhand I'm
not sure whether something other than the player can trigger an explosion
while the hero is engulfed.]  Lastly, round up instead of down when a
monster takes half damage, so that non-zero can't be reduced to zero.

doc/fixes35.0
src/explode.c

index 0e2a1b5ffbbedf738d3be9d9cde0492561b37431..47de1fbfd390a09e57fd85a82ce0c732f5aa5e15 100644 (file)
@@ -223,6 +223,7 @@ rogue's backstab bonus doesn't apply for throwing attacks
 hiding monsters who are unhidden when hero leaves a level can hide upon return
 touching a pile of objects while blind affects hero even when the pile is
        big enough to give "there are many objects here" and not list them
+explosion while engulfed only affects engulfer and hero, not adjacent monsters
 
 
 Platform- and/or Interface-Specific Fixes
index bac28bfbbaae965a289469cabffaddd4e3b36294..e409cbebd4254e2ce7afa2e7060c14a122e80cbe 100644 (file)
@@ -45,7 +45,7 @@ int expltype;
        int explmask[3][3];
                /* 0=normal explosion, 1=do shieldeff, 2=do nothing */
        boolean shopdamage = FALSE, generic = FALSE, physical_dmg = FALSE,
-               do_hallu = FALSE;
+               do_hallu = FALSE, inside_engulfer;
        char hallu_buf[BUFSZ];
        short exploding_wand_typ = 0;
 
@@ -72,6 +72,9 @@ int expltype;
            mdef = m_at(x, y);
            expltype = -expltype;
        }
+       /* if hero is engulfed and caused the explosion, only hero and
+          engulfer will be affected */
+       inside_engulfer = (u.uswallow && type >= 0);
 
        if (olet == MON_EXPLODE) {
            str = killer.name;
@@ -243,7 +246,7 @@ int expltype;
                str = "explosion";
                generic = TRUE;
            }
-           if (!Deaf) You_hear("a blast.");
+           if (!Deaf && olet != SCROLL_CLASS) You_hear("a blast.");
        }
 
     if (dam)
@@ -251,10 +254,12 @@ int expltype;
                if (explmask[i][j] == 2) continue;
                if (i+x-1 == u.ux && j+y-1 == u.uy)
                        uhurt = (explmask[i][j] == 1) ? 1 : 2;
+               /* for inside_engulfer, only <u.ux,u.uy> is affected */
+               else if (inside_engulfer) continue;
                idamres = idamnonres = 0;
-               if (type >= 0)
+               if (type >= 0 && !u.uswallow)
                    (void)zap_over_floor((xchar)(i+x-1), (xchar)(j+y-1),
-                               type, &shopdamage, exploding_wand_typ);
+                               type, &shopdamage, exploding_wand_typ);
 
                mtmp = m_at(i+x-1, j+y-1);
 #ifdef STEED
@@ -318,9 +323,10 @@ int expltype;
                        int mdam = dam;
 
                        if (resist(mtmp, olet, 0, FALSE)) {
-                           if (cansee(i+x-1,j+y-1))
+                           /* inside_engulfer: <i+x-1,j+y-1> == <u.ux,u.uy> */
+                           if (cansee(i+x-1,j+y-1) || inside_engulfer)
                                pline("%s resists the %s!", Monnam(mtmp), str);
-                           mdam = dam/2;
+                           mdam = (dam + 1) / 2;
                        }
                        if (mtmp == u.ustuck)
                                mdam *= 2;
@@ -420,6 +426,7 @@ int expltype;
        /* explosions are noisy */
        i = dam * dam;
        if (i < 50) i = 50;     /* in case random damage is very small */
+       if (inside_engulfer) i = (i + 3) / 4;
        wake_nearto(x, y, i);
 }