]> granicus.if.org Git - nethack/commitdiff
killing pets by displacing them into traps
authornethack.rankin <nethack.rankin>
Tue, 17 Aug 2004 01:29:47 +0000 (01:29 +0000)
committernethack.rankin <nethack.rankin>
Tue, 17 Aug 2004 01:29:47 +0000 (01:29 +0000)
     A user pointed out that you lose pacifism conduct if you kill your
pet by displacing it into a trap but you don't gain any experience in
the process.  Make this consistent with killing monsters in other ways:
if you get blamed for it then you should also get credit for it.

     Probably minliquid() and mintrap() should take another argument so
they can call killed() instead of mondead() when necessary, but I didn't
go to that much effort....

doc/fixes34.4
src/hack.c

index f03f1312214bf61ca47f7aa8e4c7a1d58ade0878..f503f22c1aefbe591135b525d9a77179816a55ab 100644 (file)
@@ -48,6 +48,7 @@ fractured boulders or statues produced inconsistent object settings on the
        resulting rocks
 really fix rolling boulder bug C340-18, the previous "fix" reversed the test
 monster throwing greased weapon has same chance for slip/misfire as player
+killing a pet by displacing it into a trap now yields experience
 
 
 Platform- and/or Interface-Specific Fixes
index bc504494a14839e8da33c7e80c23b07857b28275..4ce1db40e82870ef745a80641d6bc5a87adee7b4 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)hack.c     3.4     2004/01/03      */
+/*     SCCS Id: @(#)hack.c     3.4     2004/08/16      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -1392,19 +1392,33 @@ domove()
                    adjalign(-3);
                    break;
                case 2:
-                   /* it may have drowned or died.  that's no way to
-                    * treat a pet!  your god gets angry.
+                   /* drowned or died...
+                    * you killed your pet by direct action, so get experience
+                    * and possibly penalties;
+                    * we want the level gain message, if it happens, to occur
+                    * before the guilt message below
+                    */
+                 {
+                   /* minliquid() and mintrap() call mondead() rather than
+                      killed() so we duplicate some of the latter here */
+                   int tmp, mndx;
+
+                   u.uconduct.killer++;
+                   mndx = monsndx(mtmp->data);
+                   tmp = experience(mtmp, (int)mvitals[mndx].died + 1);
+                   more_experienced(tmp, 0);
+                   newexplevel();      /* will decide if you go up */
+                 }
+                   /* That's no way to treat a pet!  Your god gets angry.
+                    *
+                    * [This has always been pretty iffy.  Why does your
+                    * patron deity care at all, let alone enough to get mad?]
                     */
                    if (rn2(4)) {
                        You_feel("guilty about losing your pet like this.");
                        u.ugangr++;
                        adjalign(-15);
                    }
-
-                   /* you killed your pet by direct action.
-                    * minliquid and mintrap don't know to do this
-                    */
-                   u.uconduct.killer++;
                    break;
                default:
                    pline("that's strange, unknown mintrap result!");