From ac79fedf6040acee5fd95c2b7e19bffa0304b63b Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 4 Jun 2019 09:16:00 -0700 Subject: [PATCH] fix github issue #196 - green slime feedback Fixes #196 If you didn't die from turning into green slime but then died because green slimes had been genocided, the message given assumed that you had just seen "OK, you don't die" from answering No to "Really die?". Its wording didn't make sense if the reason you didn't die was an amulet of life-saving. Give a different message for that case. Also, if you survive turning into slime (via either method) and either green slimes are still around or you answer No to "Really die?" when they've been genocided, give a message after "You survived that attempt on your life" pointing out that you have done so in green slime form. Useful since prior to 3.6.2 you would have reverted to original form-- despite the Slimed countdown saying you had turned into green slime. --- doc/fixes36.3 | 7 ++++++- include/flag.h | 5 +++-- src/end.c | 3 ++- src/hack.c | 12 ++++++++++-- src/polyself.c | 6 ++++-- src/potion.c | 11 +++++++++-- src/timeout.c | 17 ++++++++++++++--- 7 files changed, 48 insertions(+), 13 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 7aef2fdf8..cc5ebceb7 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.33 $ $NHDT-Date: 1559601004 2019/06/03 22:30:04 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.34 $ $NHDT-Date: 1559664948 2019/06/04 16:15:48 $ This fixes36.3 file is here to capture information about updates in the 3.6.x lineage following the release of 3.6.2 in May 2019. Please note, however, @@ -38,6 +38,10 @@ on the Plane of Air, make clouds disrupt line of sight along the edges have '&' (whatdoes) command describe movement keystrokes instead of reporting them as unknown or showing their number_pad action when that is Off some improvement to the handling of endgame levels filling up with monsters +if you survive turning into green slime due to life-saving (surviving as a + green slime) then die again due to green slimes having been genocided, + the feedback was strange because it assumed that the prior message + came from answering No to "Really die?" in explore or wizard mode Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository @@ -60,6 +64,7 @@ curses: if message window is only one line, cancelling some prompts with ESC left the prompts visible on the message line instead of erasing them curses: support EDIT_GETLIN (but like with tty, it's disabled by default) to pre-load an earlier response as the default answer for some prompts + (however, it's skipped if the 'popup_dialog' option is On) curses: when display windows get reconfigured (after setting align_status, align_message, statuslines, windowborders or due to external resize), the message window was being refreshed with the oldest available N diff --git a/include/flag.h b/include/flag.h index b5e1bcfda..56352dded 100644 --- a/include/flag.h +++ b/include/flag.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 flag.h $NHDT-Date: 1554155745 2019/04/01 21:55:45 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.150 $ */ +/* NetHack 3.6 flag.h $NHDT-Date: 1559664948 2019/06/04 16:15:48 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.151 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -484,7 +484,8 @@ enum plnmsg_types { PLNMSG_TOWER_OF_FLAME, /* scroll of fire */ PLNMSG_CAUGHT_IN_EXPLOSION, /* explode() feedback */ PLNMSG_OBJ_GLOWS, /* "the glows " */ - PLNMSG_OBJNAM_ONLY /* xname/doname only, for #tip */ + PLNMSG_OBJNAM_ONLY, /* xname/doname only, for #tip */ + PLNMSG_OK_DONT_DIE /* overriding death in explore/wizard mode */ }; /* runmode options */ diff --git a/src/end.c b/src/end.c index 67ae532f1..e9b9d88ab 100644 --- a/src/end.c +++ b/src/end.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 end.c $NHDT-Date: 1558921075 2019/05/27 01:37:55 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.174 $ */ +/* NetHack 3.6 end.c $NHDT-Date: 1559664950 2019/06/04 16:15:50 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.175 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1177,6 +1177,7 @@ int how; if (!survive && (wizard || discover) && how <= GENOCIDED && !paranoid_query(ParanoidDie, "Die?")) { pline("OK, so you don't %s.", (how == CHOKING) ? "choke" : "die"); + iflags.last_msg = PLNMSG_OK_DONT_DIE; savelife(how); survive = TRUE; } diff --git a/src/hack.c b/src/hack.c index 7c80a8c1e..74a13af98 100644 --- a/src/hack.c +++ b/src/hack.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 hack.c $NHDT-Date: 1559313320 2019/05/31 14:35:20 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.212 $ */ +/* NetHack 3.6 hack.c $NHDT-Date: 1559664951 2019/06/04 16:15:51 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.213 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2901,8 +2901,16 @@ const char *msg_override; nomovemsg = msg_override; else if (!nomovemsg) nomovemsg = You_can_move_again; - if (*nomovemsg) + if (*nomovemsg) { pline("%s", nomovemsg); + /* follow "you survived that attempt on your life" with a message + about current form if it's not the default; primarily for + life-saving while turning into green slime but is also a reminder + if life-saved while poly'd and Unchanging (explore or wizard mode + declining to die since can't be both Unchanging and Lifesaved) */ + if (Upolyd && !strncmpi(nomovemsg, "You survived that ", 18)) + You("are %s", an(mons[u.umonnum].mname)); /* (ignore Hallu) */ + } nomovemsg = 0; u.usleep = 0; multi_reason = NULL; diff --git a/src/polyself.c b/src/polyself.c index a8e434206..3f33c8e9b 100644 --- a/src/polyself.c +++ b/src/polyself.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 polyself.c $NHDT-Date: 1556497911 2019/04/29 00:31:51 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.132 $ */ +/* NetHack 3.6 polyself.c $NHDT-Date: 1559664952 2019/06/04 16:15:52 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.133 $ */ /* Copyright (C) 1987, 1988, 1989 by Ken Arromdee */ /* NetHack may be freely redistributed. See license for details. */ @@ -163,7 +163,7 @@ polyman(fmt, arg) const char *fmt, *arg; { boolean sticky = (sticks(youmonst.data) && u.ustuck && !u.uswallow), - was_mimicking = (U_AP_TYPE == M_AP_OBJECT); + was_mimicking = (U_AP_TYPE != M_AP_NOTHING); boolean was_blind = !!Blind; if (Upolyd) { @@ -186,6 +186,7 @@ const char *fmt, *arg; if (multi < 0) unmul(""); youmonst.m_ap_type = M_AP_NOTHING; + youmonst.mappearance = 0; } newsym(u.ux, u.uy); @@ -633,6 +634,7 @@ int mntmp; if (mons[mntmp].mlet != S_MIMIC) { /* as in polyman() */ youmonst.m_ap_type = M_AP_NOTHING; + youmonst.mappearance = 0; } if (is_male(&mons[mntmp])) { if (flags.female) diff --git a/src/potion.c b/src/potion.c index 7d8afd0ba..a07fcd0d8 100644 --- a/src/potion.c +++ b/src/potion.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 potion.c $NHDT-Date: 1549074254 2019/02/02 02:24:14 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.160 $ */ +/* NetHack 3.6 potion.c $NHDT-Date: 1559664951 2019/06/04 16:15:51 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.161 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -185,8 +185,15 @@ const char *msg; if (msg) pline("%s", msg); } - if (!Slimed) + if (!Slimed) { dealloc_killer(find_delayed_killer(SLIMED)); + /* fake appearance is set late in turn-to-slime countdown */ + if (youmonst.m_ap_type == M_AP_MONSTER + && youmonst.mappearance == PM_GREEN_SLIME) { + youmonst.m_ap_type = M_AP_NOTHING; + youmonst.mappearance = 0; + } + } } /* start or stop petrification */ diff --git a/src/timeout.c b/src/timeout.c index a4408de5c..54a2943c3 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 timeout.c $NHDT-Date: 1545182148 2018/12/19 01:15:48 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.89 $ */ +/* NetHack 3.6 timeout.c $NHDT-Date: 1559664953 2019/06/04 16:15:53 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.90 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2018. */ /* NetHack may be freely redistributed. See license for details. */ @@ -403,6 +403,7 @@ struct kinfo *kptr; 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; + /* become a green slime; also resets youmonst.m_ap_type+.mappearance */ (void) polymon(PM_GREEN_SLIME); mvitals[PM_GREEN_SLIME].mvflags = save_mvflags; done(TURNED_SLIME); @@ -410,10 +411,20 @@ struct kinfo *kptr; /* life-saved; even so, hero still has turned into green slime; player may have genocided green slimes after being infected */ if ((mvitals[PM_GREEN_SLIME].mvflags & G_GENOD) != 0) { + char slimebuf[BUFSZ]; + killer.format = KILLED_BY; Strcpy(killer.name, "slimicide"); - /* immediately follows "OK, so you don't die." */ - pline("Yes, you do. Green slime has been genocided..."); + /* vary the message depending upon whether life-save was due to + amulet or due to declining to die in explore or wizard mode */ + Strcpy(slimebuf, "green slime has been genocided..."); + if (iflags.last_msg == PLNMSG_OK_DONT_DIE) + /* follows "OK, so you don't die." and arg is second sentence */ + pline("Yes, you do. %s", upstart(slimebuf)); + else + /* follows "The medallion crumbles to dust." */ + pline("Unfortunately, %s", slimebuf); + /* die again; no possibility of amulet this time */ done(GENOCIDED); /* could be life-saved again (only in explore or wizard mode) but green slimes are gone; just stay in current form */