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).
This commit is contained in:
PatR
2021-07-24 11:30:52 -07:00
parent 120a8c0173
commit 2e43f83db0
2 changed files with 32 additions and 17 deletions

View File

@@ -880,13 +880,13 @@ bot_via_windowport(void)
#endif #endif
} }
} }
condtests[bl_blind].test = (Blind); condtests[bl_blind].test = (Blind) ? TRUE : FALSE;
condtests[bl_conf].test = (Confusion) ? TRUE : FALSE; condtests[bl_conf].test = (Confusion) ? TRUE : FALSE;
condtests[bl_deaf].test = (Deaf); condtests[bl_deaf].test = (Deaf) ? TRUE : FALSE;
condtests[bl_fly].test = (Flying); condtests[bl_fly].test = (Flying) ? TRUE : FALSE;
condtests[bl_glowhands].test = (u.umconf); condtests[bl_glowhands].test = (u.umconf) ? TRUE : FALSE;
condtests[bl_hallu].test = (Hallucination); condtests[bl_hallu].test = (Hallucination) ? TRUE : FALSE;
condtests[bl_lev].test = (Levitation); condtests[bl_lev].test = (Levitation) ? TRUE : FALSE;
condtests[bl_ride].test = (u.usteed) ? TRUE : FALSE; condtests[bl_ride].test = (u.usteed) ? TRUE : FALSE;
condtests[bl_slime].test = (Slimed) ? TRUE : FALSE; condtests[bl_slime].test = (Slimed) ? TRUE : FALSE;
condtests[bl_stone].test = (Stoned) ? 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_bareh) = (!uarmg && !uwep);
test_if_enabled(bl_icy) = (levl[u.ux][u.uy].typ == ICE); test_if_enabled(bl_icy) = (levl[u.ux][u.uy].typ == ICE);
test_if_enabled(bl_slippery) = (Glib) ? TRUE : FALSE; 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) { if (g.multi < 0) {
cond_cache_prepA(); cond_cache_prepA();

View File

@@ -183,7 +183,8 @@ trap_predicament(char *outbuf, int final, boolean wizxtra)
confers the target property; item must have been seen and its type confers the target property; item must have been seen and its type
discovered but it doesn't necessarily have to be fully identified */ discovered but it doesn't necessarily have to be fully identified */
static boolean 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; register struct obj *o;
long mask = W_ARMOR | W_AMUL | W_RING | W_TOOL; 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)); you_are("warned of undead", from_what(WARN_UNDEAD));
if (Searching) if (Searching)
you_have("automatic searching", from_what(SEARCHING)); you_have("automatic searching", from_what(SEARCHING));
if (Clairvoyant) if (Clairvoyant) {
you_are("clairvoyant", from_what(CLAIRVOYANT)); you_are("clairvoyant", from_what(CLAIRVOYANT));
else if ((HClairvoyant || EClairvoyant) && BClairvoyant) { } else if ((HClairvoyant || EClairvoyant) && BClairvoyant) {
Strcpy(buf, from_what(-CLAIRVOYANT)); Strcpy(buf, from_what(-CLAIRVOYANT));
if (!strncmp(buf, " because of ", 12)) (void) strsubst(buf, " because of ", " if not for ");
/* overwrite substring */
memcpy(buf, " if not for ", 12);
enl_msg(You_, "could be", "could have been", " clairvoyant", buf); enl_msg(You_, "could be", "could have been", " clairvoyant", buf);
} }
if (Infravision) if (Infravision)
you_have("infravision", from_what(INFRAVISION)); you_have("infravision", from_what(INFRAVISION));
if (Detect_monsters) if (Detect_monsters) {
you_are("sensing the presence of monsters", ""); Strcpy(buf, "sensing the presence of monsters");
if (u.umconf) if (wizard) {
you_are("going to confuse monsters", ""); 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 ***/ /*** Appearance and behavior ***/
if (Adornment) { if (Adornment) {