is_innate(propidx)
int propidx;
{
+ if (propidx == BLINDED && !haseyes(youmonst.data)) return 1;
return innately(&u.uprops[propidx].intrinsic);
}
char *
from_what(propidx)
-int propidx;
+int propidx; /* special cases can have negative values */
{
- static char buf[BUFSZ];
+ static char buf[BUFSZ];
- buf[0] = '\0';
- /*
- * Restrict the source of the attributes just to debug mode for now
- */
+ buf[0] = '\0';
+ /*
+ * Restrict the source of the attributes just to debug mode for now
+ */
#ifdef WIZARD
- if (wizard) {
+ if (wizard) {
+ static NEARDATA const char because_of[] = " because of %s";
+
+ if (propidx >= 0) {
struct obj *obj = (struct obj *)0;
int innate = is_innate(propidx);
else if (innate == 1)
Strcpy(buf, " innately");
else if (wizard && (obj = what_gives(&u.uprops[propidx].extrinsic)))
- Sprintf(buf, " because of %s",
+ Sprintf(buf, because_of,
(obj->oartifact) ? bare_artifactname(obj) : yname(obj));
+ else if (propidx == BLINDED && Blindfolded_only)
+ Sprintf(buf, because_of, yname(ublindf));
+
+ } else { /* negative property index */
+ /* if more blocking capabilities get implemented we'll need to
+ replace this with what_blocks() comparable to what_gives() */
+ switch (-propidx) {
+ case BLINDED:
+ if (ublindf && ublindf->oartifact == ART_EYES_OF_THE_OVERWORLD)
+ Sprintf(buf, because_of, bare_artifactname(ublindf));
+ break;
+ case INVIS:
+ if (u.uprops[INVIS].blocked & W_ARMC)
+ Sprintf(buf, because_of, yname(uarmc)); /* mummy wrapping */
+ break;
+ case CLAIRVOYANT:
+ if (wizard && (u.uprops[CLAIRVOYANT].blocked & W_ARMH))
+ Sprintf(buf, because_of, yname(uarmh)); /* cornuthaum */
+ break;
+ }
}
+
+ } /*wizard*/
#endif
- return buf;
+ return buf;
}
void
if (Hallucination) you_are("hallucinating","");
if (Stunned) you_are("stunned","");
if (Confusion) you_are("confused","");
- if (Blinded) you_are("blinded",from_what(BLINDED));
+ if (Blind) you_are("blind",from_what(BLINDED));
if (Deaf) you_are("deaf",from_what(DEAF));
if (Sick) {
if (u.usick_type & SICK_VOMITABLE)
if (Hate_silver) you_are("harmed by silver","");
/*** Vision and senses ***/
- if (See_invisible) enl_msg(You_, "see", "saw", " invisible",
- from_what(SEE_INVIS));
+ if (!Blind && (Blinded || !haseyes(youmonst.data)))
+ you_can("see", from_what(-BLINDED)); /* Eyes of the Overworld */
+ if (See_invisible) {
+ if (!Blind)
+ enl_msg(You_, "see", "saw", " invisible", from_what(SEE_INVIS));
+ else
+ enl_msg(You_, "will see", "would have seen",
+ " invisible when not blind", from_what(SEE_INVIS));
+ }
if (Blind_telepat) you_are("telepathic",from_what(TELEPAT));
if (Warning) you_are("warned", from_what(WARNING));
if (Warn_of_mon && context.warntype.obj) {
}
if (Warn_of_mon && context.warntype.polyd) {
Sprintf(buf, "aware of the presence of %s",
- ((context.warntype.polyd &
- (M2_HUMAN|M2_ELF))==(M2_HUMAN|M2_ELF)) ? "humans and elves" :
+ ((context.warntype.polyd & (M2_HUMAN|M2_ELF))
+ == (M2_HUMAN|M2_ELF)) ? "humans and elves" :
(context.warntype.polyd & M2_HUMAN) ? "humans" :
(context.warntype.polyd & M2_ELF) ? "elves" :
(context.warntype.polyd & M2_ORC) ? "orcs" :
if (Undead_warning) you_are("warned of undead",from_what(WARN_UNDEAD));
if (Searching) you_have("automatic searching",from_what(SEARCHING));
if (Clairvoyant) you_are("clairvoyant",from_what(CLAIRVOYANT));
+ else if ((HClairvoyant || EClairvoyant) && BClairvoyant) {
+ Strcpy(buf, from_what(-CLAIRVOYANT));
+ if (!strncmp(buf, " because of ", 12))
+ /* overwrite substring; strncpy doesn't add terminator */
+ (void) strncpy(buf, " if not for ", 12);
+ 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", "");
+ you_are("sensing the presence of monsters", "");
if (u.umconf) you_are("going to confuse monsters","");
/*** Appearance and behavior ***/
/* ordinarily "visible" is redundant; this is a special case for
the situation when invisibility would be an expected attribute */
else if ((HInvis || EInvis || pm_invisible(youmonst.data)) && BInvis)
- you_are("visible","");
+ you_are("visible", from_what(-INVIS));
if (Displaced) you_are("displaced",from_what(DISPLACED));
if (Stealth) you_are("stealthy",from_what(STEALTH));
if (Aggravate_monster)