STATIC_OVL void slime_dialogue() { register long i = (Slimed & TIMEOUT) / 2L; if (((Slimed & TIMEOUT) % 2L) && i >= 0L && i < SIZE(slime_texts)) { const char *str = slime_texts[SIZE(slime_texts) - i - 1L]; if (index(str, '%')) { if (i == 4L) { /* "you are turning green" */ if (!Blind) /* [what if you're already green?] */ pline(str, hcolor(NH_GREEN)); } else pline(str, an(Hallucination ? rndmonnam() : "green slime")); } else pline(str); } if (i == 3L) { /* limbs becoming oozy */ HFast = 0L; /* lose intrinsic speed */ stop_occupation(); if (multi > 0) nomul(0, 0); } exercise(A_DEX, FALSE); }
static void dowatersnakes() /* Fountain of snakes! */ { register int num = rn1(5,2); struct monst *mtmp; if (!(mons[PM_WATER_MOCCASIN].geno & (G_GENOD | G_EXTINCT))) { if (!Blind) pline("An endless stream of %s pours forth!", Hallucination ? makeplural(rndmonnam()) : "snakes"); else You("hear something hissing!"); while(num-- > 0) if((mtmp = makemon(&mons[PM_WATER_MOCCASIN],u.ux,u.uy)) && t_at(mtmp->mx, mtmp->my)) (void) mintrap(mtmp); } else pline("The fountain bubbles furiously for a moment, then calms."); }
/* Bug: if the monster is a priest or shopkeeper, not every one of these * options works, since those are special cases. */ char *x_monnam(const struct monst *mtmp, int article, /* ARTICLE_NONE, ARTICLE_THE, ARTICLE_A: obvious * ARTICLE_YOUR: "your" on pets, "the" on everything * else * If the monster would be referred to as "it" or if the monster has a name * _and_ there is no adjective, "invisible", "saddled", etc., override this * and always use no article. */ const char *adjective, int suppress, /* SUPPRESS_IT, SUPPRESS_INVISIBLE, SUPPRESS_HALLUCINATION, SUPPRESS_SADDLE. * EXACT_NAME: combination of all the above */ boolean called) { static char buf[BUFSZ]; const struct permonst *mdat = mtmp->data; boolean do_hallu, do_invis, do_it, do_saddle; boolean name_at_start, has_adjectives; char *bp; if (program_state.gameover) suppress |= SUPPRESS_HALLUCINATION; if (article == ARTICLE_YOUR && !mtmp->mtame) article = ARTICLE_THE; do_hallu = Hallucination && !(suppress & SUPPRESS_HALLUCINATION); do_invis = mtmp->minvis && !(suppress & SUPPRESS_INVISIBLE); do_it = !canspotmon(mtmp) && article != ARTICLE_YOUR && !program_state.gameover && mtmp != u.usteed && !(u.uswallow && mtmp == u.ustuck) && !(suppress & SUPPRESS_IT); do_saddle = !(suppress & SUPPRESS_SADDLE); buf[0] = 0; /* unseen monsters, etc. Use "it" */ if (do_it) { strcpy(buf, "it"); return buf; } /* priests and minions: don't even use this function */ if (mtmp->ispriest || mtmp->isminion) { struct monst *priestmon = newmonst(mtmp->mxtyp, mtmp->mnamelth); char priestnambuf[BUFSZ]; char *name; long save_prop = EHalluc_resistance; memcpy(priestmon, mtmp, sizeof(struct monst) + mtmp->mxlth + mtmp->mnamelth); /* when true name is wanted, explicitly block Hallucination */ if (!do_hallu) EHalluc_resistance = 1L; if (!do_invis) priestmon->minvis = 0; name = priestname(priestmon, priestnambuf); EHalluc_resistance = save_prop; if (article == ARTICLE_NONE && !strncmp(name, "the ", 4)) name += 4; strcpy(buf, name); free(priestmon); return buf; } /* Shopkeepers: use shopkeeper name. For normal shopkeepers, just * "Asidonhopo"; for unusual ones, "Asidonhopo the invisible * shopkeeper" or "Asidonhopo the blue dragon". If hallucinating, * none of this applies. */ if (mtmp->isshk && !do_hallu) { if (adjective && article == ARTICLE_THE) { /* pathological case: "the angry Asidonhopo the blue dragon" sounds silly */ strcpy(buf, "the "); strcat(strcat(buf, adjective), " "); strcat(buf, shkname(mtmp)); return buf; } strcat(buf, shkname(mtmp)); if (mdat == &mons[PM_SHOPKEEPER] && !do_invis) return buf; strcat(buf, " the "); if (do_invis) strcat(buf, "invisible "); strcat(buf, mdat->mname); return buf; } /* Put the adjectives in the buffer */ if (adjective) strcat(strcat(buf, adjective), " "); if (do_invis) strcat(buf, "invisible "); if (do_saddle && (mtmp->misc_worn_check & W_SADDLE) && !Blind && !Hallucination) strcat(buf, "saddled "); if (buf[0] != 0) has_adjectives = TRUE; else has_adjectives = FALSE; /* Put the actual monster name or type into the buffer now */ /* Be sure to remember whether the buffer starts with a name */ if (do_hallu) { strcat(buf, rndmonnam()); name_at_start = FALSE; } else if (mtmp->mnamelth) { char *name = NAME(mtmp); if (mdat == &mons[PM_GHOST]) { sprintf(eos(buf), "%s ghost", s_suffix(name)); name_at_start = TRUE; } else if (called) { sprintf(eos(buf), "%s called %s", mdat->mname, name); name_at_start = (boolean)type_is_pname(mdat); } else if (is_mplayer(mdat) && (bp = strstri(name, " the ")) != 0) { /* <name> the <adjective> <invisible> <saddled> <rank> */ char pbuf[BUFSZ]; strcpy(pbuf, name); pbuf[bp - name + 5] = '\0'; /* adjectives right after " the " */ if (has_adjectives) strcat(pbuf, buf); strcat(pbuf, bp + 5); /* append the rest of the name */ strcpy(buf, pbuf); article = ARTICLE_NONE; name_at_start = TRUE; } else { strcat(buf, name); name_at_start = TRUE; } } else if (is_mplayer(mdat) && !In_endgame(&u.uz)) { char pbuf[BUFSZ]; strcpy(pbuf, rank_of((int)mtmp->m_lev, monsndx(mdat), (boolean)mtmp->female)); strcat(buf, lcase(pbuf)); name_at_start = FALSE; } else { strcat(buf, mdat->mname); name_at_start = (boolean)type_is_pname(mdat); } if (name_at_start && (article == ARTICLE_YOUR || !has_adjectives)) { if (mdat == &mons[PM_WIZARD_OF_YENDOR]) article = ARTICLE_THE; else article = ARTICLE_NONE; } else if ((mdat->geno & G_UNIQ) && article == ARTICLE_A) { article = ARTICLE_THE; } { char buf2[BUFSZ]; switch(article) { case ARTICLE_YOUR: strcpy(buf2, "your "); strcat(buf2, buf); strcpy(buf, buf2); return buf; case ARTICLE_THE: strcpy(buf2, "the "); strcat(buf2, buf); strcpy(buf, buf2); return buf; case ARTICLE_A: return an(buf); case ARTICLE_NONE: default: return buf; } } }