]> granicus.if.org Git - nethack/commitdiff
fix #Q431 - water elemental caught in beartrap (trunk only)
authornethack.rankin <nethack.rankin>
Tue, 3 Apr 2007 05:11:44 +0000 (05:11 +0000)
committernethack.rankin <nethack.rankin>
Tue, 3 Apr 2007 05:11:44 +0000 (05:11 +0000)
     Reported two months ago by <email deleted>,
having a water elemental become trapped in a bear trap seems pretty
strange.  Fixed by marking water elementals as M1_UNSOLID (like air and
fire elementals), which has a side-effect of making them immune to webs
as well.  Tweaked some unused digging code which checks unsolid(), added
unsolid() to the types allowed to bar through iron bars, and brought the
check for whether a monster is willing to enter a bear trap location up
to date.  That code also needed an update to reflect the change made to
anti-magic traps last year.  Lastly, there was another report which
suggested that being hit by a bear trap should dish out some damage
(along with a suggestion that wand of opening should work to escape such
traps, which has already been done).  This makes bear trap do 2d4 damage
(on entry, not when trying to pull out after becoming stuck).

doc/fixes35.0
src/dig.c
src/mon.c
src/mondata.c
src/monst.c
src/trap.c

index 1c136f1f6bdf31ad0f51a26a046d09f7d09d3404..0437b707dc14b9aefc65a18ecf4b0d8ef1962fb1 100644 (file)
@@ -210,6 +210,8 @@ unicorn horn produced by revived monster will polymorph as if non-magic
 stone-to-flesh on any golem statue or golem figurine creates flesh golem
 stone-to-flesh which activates shop-owned figurine entails shop charges
 make giants be less likely to be randomly generated in Sokoban
+bear traps dish out some damage on initial entrapment
+bear traps and webs are harmless to water elementals
 
 
 Platform- and/or Interface-Specific Fixes
index 17a161ef91d2c28836275b14d33548d817d1b6c9..6ade4303136b1b3168a334fa651474fc043eb72d 100644 (file)
--- a/src/dig.c
+++ b/src/dig.c
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)dig.c      3.5     2006/07/08      */
+/*     SCCS Id: @(#)dig.c      3.5     2007/04/02      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -1937,7 +1937,9 @@ escape_tomb()
                boolean good;
 
                if(amorphous(youmonst.data) || Passes_walls ||
-                  noncorporeal(youmonst.data) || unsolid(youmonst.data) ||
+                  noncorporeal(youmonst.data) ||
+                  (unsolid(youmonst.data) &&
+                       youmonst.data != &mons[PM_WATER_ELEMENTAL]) ||
                   (tunnels(youmonst.data) && !needspick(youmonst.data))) {
 
                    You("%s up through the %s.",
index 3737f3221e74f3d28635909f53b37d9f53602ea9..69ae08f01fce8d2018ad61ca210801c6b3b4f14c 100644 (file)
--- a/src/mon.c
+++ b/src/mon.c
@@ -1192,12 +1192,15 @@ impossible("A monster looked at a very strange trap of type %d.", ttmp->ttyp);
                                    !resists_sleep(mon))
                                && (ttmp->ttyp != BEAR_TRAP ||
                                    (mdat->msize > MZ_SMALL &&
-                                    !amorphous(mdat) && !is_flyer(mdat)))
+                                    !amorphous(mdat) && !is_flyer(mdat) &&
+                                    !is_whirly(mdat) && !unsolid(mdat)))
                                && (ttmp->ttyp != FIRE_TRAP ||
                                    !resists_fire(mon))
                                && (ttmp->ttyp != SQKY_BOARD || !is_flyer(mdat))
                                && (ttmp->ttyp != WEB || (!amorphous(mdat) &&
                                    !webmaker(mdat)))
+                               && (ttmp->ttyp != ANTI_MAGIC ||
+                                   !resists_magm(mon))
                        ) {
                            if (!(flag & ALLOW_TRAPS)) {
                                if (mon->mtrapseen & (1L << (ttmp->ttyp - 1)))
index 4e67fb096173d1816875045d651a80c58a709940..86981c51997bac9314f36c0e215d6074804cab63 100644 (file)
@@ -283,7 +283,7 @@ passes_bars(mptr)
 struct permonst *mptr;
 {
     return (boolean) (passes_walls(mptr) || amorphous(mptr) ||
-                     is_whirly(mptr) || verysmall(mptr) ||
+                     unsolid(mptr) || is_whirly(mptr) || verysmall(mptr) ||
                      (slithy(mptr) && !bigmonst(mptr)));
 }
 
index af7305661b0caa099d39f5a5522aafb501c5c075..0e7bef1fe99d8e2e5367422e4a324b93b9da9d89 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)monst.c    3.5     2006/02/13      */
+/*     SCCS Id: @(#)monst.c    3.5     2007/04/02      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -1389,7 +1389,8 @@ NEARDATA struct permonst mons[] = {
        A(ATTK(AT_CLAW, AD_PHYS, 5, 6),
          NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK, NO_ATTK),
        SIZ(2500, 0, MS_SILENT, MZ_HUGE), MR_POISON|MR_STONE, 0,
-       M1_NOEYES|M1_NOLIMBS|M1_NOHEAD|M1_MINDLESS|M1_AMPHIBIOUS|M1_SWIM,
+       M1_NOEYES|M1_NOLIMBS|M1_NOHEAD|M1_MINDLESS|M1_UNSOLID|
+         M1_AMPHIBIOUS|M1_SWIM,
        M2_STRONG|M2_NEUTER, 0, CLR_BLUE),
 /*
  * Fungi
index aa81fd7a8789cc2051869280898d5eba875baa5b..667eff55f07ba90a997fcfb98a1b9b513d8375a1 100644 (file)
@@ -852,6 +852,9 @@ unsigned trflags;
                break;
 
            case BEAR_TRAP:
+           {
+               int dmg = d(2, 4);
+
                if ((Levitation || Flying) && !forcetrap) break;
                feeltrap(trap);
                if(amorphous(youmonst.data) || is_whirly(youmonst.data) ||
@@ -876,6 +879,8 @@ unsigned trflags;
                    pline("%s bear trap closes on %s %s!",
                        A_Your[trap->madeby_u], s_suffix(mon_nam(u.usteed)),
                        mbodypart(u.usteed, FOOT));
+                   if (thitm(0, u.usteed, (struct obj *)0, dmg, FALSE))
+                       u.utrap = 0;    /* steed died, hero not trapped */
                } else
 #endif
                {
@@ -883,9 +888,11 @@ unsigned trflags;
                            A_Your[trap->madeby_u], body_part(FOOT));
                    if(u.umonnum == PM_OWLBEAR || u.umonnum == PM_BUGBEAR)
                        You("howl in anger!");
+                   losehp(Maybe_Half_Phys(dmg), "bear trap", KILLED_BY_AN);
                }
                exercise(A_DEX, FALSE);
                break;
+           }
 
            case SLP_GAS_TRAP:
                seetrap(trap);
@@ -2055,6 +2062,9 @@ register struct monst *mtmp;
                                seetrap(trap);
                            }
                        }
+                       if (mtmp->mtrapped)
+                           trapkilled = thitm(0, mtmp, (struct obj *)0,
+                                              d(2, 4), FALSE);
                        break;
 
                case SLP_GAS_TRAP:
@@ -2365,8 +2375,9 @@ glovecheck:                   target = which_armor(mtmp, W_ARMG);
                case ANTI_MAGIC:
                        /* similar to hero's case, more or less */
                        if (!resists_magm(mtmp)) {      /* lose spell energy */
-                           if (attacktype(mptr, AT_MAGC) ||
-                                   attacktype(mptr, AT_BREA)) {
+                           if (!mtmp->mcan &&
+                                   (attacktype(mptr, AT_MAGC) ||
+                                    attacktype(mptr, AT_BREA))) {
                                mtmp->mspec_used += d(2, 2);
                                if (in_sight) {
                                    seetrap(trap);