]> granicus.if.org Git - nethack/commitdiff
more green slime
authorPatR <rankin@nethack.org>
Wed, 5 Dec 2018 22:56:03 +0000 (14:56 -0800)
committerPatR <rankin@nethack.org>
Wed, 5 Dec 2018 22:56:03 +0000 (14:56 -0800)
When a hero dies due to turning into green slime, actually polymorph
him into a green slime monster before killing him off.  That way he'll
show as a green 'P' on the map instead of white '@' during final
disclosure.  Also, armor that gets destroyed by polymorphing into that
form will be absent from resulting bones file.

src/cmd.c
src/timeout.c

index 8924923da4f1c853a359634f87f6a0f1c92ba4be..67170cec7cb26ff7922ada93ac91205391fb489a 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -1,4 +1,4 @@
-/* NetHack 3.6 cmd.c   $NHDT-Date: 1543972186 2018/12/05 01:09:46 $  $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.313 $ */
+/* NetHack 3.6 cmd.c   $NHDT-Date: 1544050555 2018/12/05 22:55:55 $  $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.314 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2013. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -2740,7 +2740,12 @@ int final;
     }
     if (Polymorph_control)
         you_have("polymorph control", from_what(POLYMORPH_CONTROL));
-    if (Upolyd && u.umonnum != u.ulycn) {
+    if (Upolyd && u.umonnum != u.ulycn
+        /* if we've died from turning into slime, we're polymorphed
+           right now but don't want to list it as a temporary attribute
+           [we need a more reliable way to detect this situation] */
+        && !(final == ENL_GAMEOVERDEAD
+             && u.umonnum == PM_GREEN_SLIME && !Unchanging)) {
         /* foreign shape (except were-form which is handled below) */
         Sprintf(buf, "polymorphed into %s", an(youmonst.data->mname));
         if (wizard)
index e4347c5b371a06cfa4b2e9f3a2b0ba099acf6117..29b740fccec24ec9e57626cf706828fc2fda49bc 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 timeout.c       $NHDT-Date: 1544003111 2018/12/05 09:45:11 $  $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.87 $ */
+/* NetHack 3.6 timeout.c       $NHDT-Date: 1544050558 2018/12/05 22:55:58 $  $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.88 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2018. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -311,6 +311,13 @@ slime_dialogue()
 {
     register long i = (Slimed & TIMEOUT) / 2L;
 
+    if (i == 1L) {
+        /* display as green slime during "You have become green slime."
+           but don't worry about not being able to see self; if already
+           mimicking something else at the time, implicitly be revealed */
+        youmonst.m_ap_type = M_AP_MONSTER;
+        youmonst.mappearance = PM_GREEN_SLIME;
+    }
     if (((Slimed & TIMEOUT) % 2L) && i >= 0L && i < SIZE(slime_texts)) {
         char buf[BUFSZ];
 
@@ -363,6 +370,8 @@ STATIC_OVL void
 slimed_to_death(kptr)
 struct kinfo *kptr;
 {
+    uchar save_mvflags;
+
     /* redundant: polymon() cures sliming when polying into green slime */
     if (Upolyd && youmonst.data == &mons[PM_GREEN_SLIME]) {
         dealloc_killer(kptr);
@@ -377,8 +386,25 @@ struct kinfo *kptr;
         Strcpy(killer.name, "turned into green slime");
     }
     dealloc_killer(kptr);
-    /* involuntarily break "never changed form" conduct */
-    u.uconduct.polyselfs++;
+
+    /*
+     * Polymorph into a green slime, which might destroy some worn armor
+     * (potentially affecting bones) and dismount from steed.
+     * Can't be Unchanging; wouldn't have turned into slime if we were.
+     * Despite lack of Unchanging, neither done() nor savelife() calls
+     * rehumanize() if hero dies while polymorphed.
+     * polymon() undoes the slime countdown's mimick-green-slime hack
+     * but does not perform polyself()'s light source bookkeeping.
+     * No longer need to manually increment uconduct.polyselfs to reflect
+     * [formerly implicit] change of form; polymon() takes care of that.
+     * Temporarily ungenocide if necessary.
+     */
+    if (emits_light(youmonst.data))
+        del_light_source(LS_MONSTER, monst_to_any(&youmonst));
+    save_mvflags = mvitals[PM_GREEN_SLIME].mvflags;
+    mvitals[PM_GREEN_SLIME].mvflags = save_mvflags & ~G_GENOD;
+    (void) polymon(PM_GREEN_SLIME);
+    mvitals[PM_GREEN_SLIME].mvflags = save_mvflags;
     done(TURNED_SLIME);
 
     /* life-saved; even so, hero still has turned into green slime;
@@ -391,20 +417,6 @@ struct kinfo *kptr;
         done(GENOCIDED);
         /* could be life-saved again (only in explore or wizard mode)
            but green slimes are gone; just stay in current form */
-
-    /* not geno'd; survive as a green slime */
-    } else {
-        /* this part of polyself() isn't in polymon();
-           we assume that green slimes don't emit light */
-        if (emits_light(youmonst.data))
-            del_light_source(LS_MONSTER, monst_to_any(&youmonst));
-        /* undo the 'involuntarily break "never changed form"'
-           increment so that this change isn't counted twice */
-        u.uconduct.polyselfs--;
-        /* can't be Unchanging even if life-saving wasn't due to amulet;
-           hero infected with slime wouldn't have turned into green slime
-           to get here if Unchanging */
-        (void) polymon(PM_GREEN_SLIME);
     }
     return;
 }