From: PatR Date: Sat, 24 Jul 2021 18:30:52 +0000 (-0700) Subject: wizard mode enlightenment tweaks + Glow status fix X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2e43f83db051ef57f2f9dbca89d3e153872153c7;p=nethack wizard mode enlightenment tweaks + Glow status fix For extended monster detection, show the number of turns remaining during enlightenment (wizard mode only). The value is also available via #timeout but various enlightenment entries already do something like this. For confuse monster, show the number of hits left for glowing hands (again, wizard mode only). And for the latter, the 3.7 conditional status condition set up was storing u.umconf, an unsigned int, into contests[bl_glowhands].test, a boolean, so would yield the wrong value if glowing hands managed to become high enough to be a multiple of 256 (assumes 8-bit char for boolean). --- diff --git a/src/botl.c b/src/botl.c index 365eda211..d6a1ebf0c 100644 --- a/src/botl.c +++ b/src/botl.c @@ -880,13 +880,13 @@ bot_via_windowport(void) #endif } } - condtests[bl_blind].test = (Blind); + condtests[bl_blind].test = (Blind) ? TRUE : FALSE; condtests[bl_conf].test = (Confusion) ? TRUE : FALSE; - condtests[bl_deaf].test = (Deaf); - condtests[bl_fly].test = (Flying); - condtests[bl_glowhands].test = (u.umconf); - condtests[bl_hallu].test = (Hallucination); - condtests[bl_lev].test = (Levitation); + condtests[bl_deaf].test = (Deaf) ? TRUE : FALSE; + condtests[bl_fly].test = (Flying) ? TRUE : FALSE; + condtests[bl_glowhands].test = (u.umconf) ? TRUE : FALSE; + condtests[bl_hallu].test = (Hallucination) ? TRUE : FALSE; + condtests[bl_lev].test = (Levitation) ? TRUE : FALSE; condtests[bl_ride].test = (u.usteed) ? TRUE : FALSE; condtests[bl_slime].test = (Slimed) ? TRUE : FALSE; condtests[bl_stone].test = (Stoned) ? TRUE : FALSE; @@ -897,7 +897,7 @@ bot_via_windowport(void) test_if_enabled(bl_bareh) = (!uarmg && !uwep); test_if_enabled(bl_icy) = (levl[u.ux][u.uy].typ == ICE); test_if_enabled(bl_slippery) = (Glib) ? TRUE : FALSE; - test_if_enabled(bl_woundedl) = (Wounded_legs); + test_if_enabled(bl_woundedl) = (Wounded_legs) ? TRUE : FALSE; if (g.multi < 0) { cond_cache_prepA(); diff --git a/src/insight.c b/src/insight.c index c57496c77..6133919d2 100644 --- a/src/insight.c +++ b/src/insight.c @@ -183,7 +183,8 @@ trap_predicament(char *outbuf, int final, boolean wizxtra) confers the target property; item must have been seen and its type discovered but it doesn't necessarily have to be fully identified */ static boolean -cause_known(int propindx) /* index of a property which can be conveyed by worn item */ +cause_known( + int propindx) /* index of a property which can be conveyed by worn item */ { register struct obj *o; long mask = W_ARMOR | W_AMUL | W_RING | W_TOOL; @@ -1379,21 +1380,35 @@ attributes_enlightenment(int unused_mode UNUSED, int final) you_are("warned of undead", from_what(WARN_UNDEAD)); if (Searching) you_have("automatic searching", from_what(SEARCHING)); - if (Clairvoyant) + if (Clairvoyant) { you_are("clairvoyant", from_what(CLAIRVOYANT)); - else if ((HClairvoyant || EClairvoyant) && BClairvoyant) { + } else if ((HClairvoyant || EClairvoyant) && BClairvoyant) { Strcpy(buf, from_what(-CLAIRVOYANT)); - if (!strncmp(buf, " because of ", 12)) - /* overwrite substring */ - memcpy(buf, " if not for ", 12); + (void) strsubst(buf, " because of ", " if not for "); enl_msg(You_, "could be", "could have been", " clairvoyant", buf); } if (Infravision) you_have("infravision", from_what(INFRAVISION)); - if (Detect_monsters) - you_are("sensing the presence of monsters", ""); - if (u.umconf) - you_are("going to confuse monsters", ""); + if (Detect_monsters) { + Strcpy(buf, "sensing the presence of monsters"); + if (wizard) { + long detectmon_timeout = (HDetect_monsters & TIMEOUT); + + if (detectmon_timeout) + Sprintf(eos(buf), " (%ld)", detectmon_timeout); + } + you_are(buf, ""); + } + if (u.umconf) { /* 'u.umconf' is a counter rather than a timeout */ + Strcpy(buf, " monsters when hitting them"); + if (wizard && !final) { + if (u.umconf == 1) + Strcat(buf, " (next hit only)"); + else /* u.umconf > 1 */ + Sprintf(eos(buf), " (next %u hits)", u.umconf); + } + enl_msg(You_, "will confuse", "would have confused", buf, ""); + } /*** Appearance and behavior ***/ if (Adornment) {