<Mon> suddenly appears! vs ^G

For ^G, throttle the monster creation feedback.  Don't say "suddenly"
and don't exclaim the message, just say "<Mon> appears."  Also, use
Norep() so creating lots of similar monsters at once only gives a few
messages (just one unless varied by "next to you" vs "nearby" vs no
qualifier for farther away).  And for mimics created as objects or
furniture, report the sudden appearance of new object or furniture.
This commit is contained in:
PatR
2022-02-07 15:55:04 -08:00
parent deec94e533
commit 50d8463b71
4 changed files with 37 additions and 17 deletions

View File

@@ -296,6 +296,7 @@ typedef struct sortloot_item Loot;
#define GP_ALLOW_XY 0x080000L /* [actually used by enexto() to decide whether
* to make an extra call to goodpos()] */
#define GP_ALLOW_U 0x100000L /* don't reject hero's location */
#define MM_NOEXCLAM 0x200000L /* more sedate "<mon> appears." mesg for ^G */
/* flags for make_corpse() and mkcorpstat(); 0..7 are recorded in obj->spe */
#define CORPSTAT_NONE 0x00

View File

@@ -1411,13 +1411,30 @@ makemon(register struct permonst *ptr,
if (!g.in_mklev) {
newsym(mtmp->mx, mtmp->my); /* make sure the mon shows up */
if (!(mmflags & MM_NOMSG)
&& ((canseemon(mtmp) && (M_AP_TYPE(mtmp) == M_AP_NOTHING
if (!(mmflags & MM_NOMSG)) {
char mbuf[BUFSZ], *what = 0;
/* MM_NOEXCLAM is used for #wizgenesis (^G) */
boolean exclaim = !(mmflags & MM_NOEXCLAM);
if ((canseemon(mtmp) && (M_AP_TYPE(mtmp) == M_AP_NOTHING
|| M_AP_TYPE(mtmp) == M_AP_MONSTER))
|| sensemon(mtmp)))
pline("%s suddenly appears%s!", Amonnam(mtmp),
distu(x, y) <= 2 ? " next to you"
: (distu(x, y) <= (BOLT_LIM * BOLT_LIM)) ? " close by" : "");
|| sensemon(mtmp)) {
what = Amonnam(mtmp);
if (M_AP_TYPE(mtmp) == M_AP_MONSTER)
exclaim = TRUE;
} else if (canseemon(mtmp)) {
/* mimic masquerading as furniture or object and not sensed */
mhidden_description(mtmp, FALSE, mbuf);
what = upstart(strsubst(mbuf, ", mimicking ", ""));
}
if (what)
Norep("%s%s appears%s%c", what,
exclaim ? " suddenly" : "",
distu(x, y) <= 2 ? " next to you"
: (distu(x, y) <= (BOLT_LIM * BOLT_LIM)) ? " close by"
: "",
exclaim ? '!' : '.');
}
/* TODO: unify with teleport appears msg */
}

View File

@@ -161,10 +161,10 @@ trap_description(char *outbuf, int tnum, int x, int y)
/* describe a hidden monster; used for look_at during extended monster
detection and for probing; also when looking at self */
void
mhidden_description(struct monst *mon,
boolean altmon, /* for probing: if mimicking a monster,
say so */
char *outbuf)
mhidden_description(
struct monst *mon,
boolean altmon, /* for probing: if mimicking a monster, say so */
char *outbuf)
{
struct obj *otmp;
boolean fakeobj, isyou = (mon == &g.youmonst);

View File

@@ -2703,7 +2703,7 @@ do_genocide(int how)
if (!(mons[mndx].geno & G_UNIQ)
&& !(g.mvitals[mndx].mvflags & (G_GENOD | G_EXTINCT)))
for (i = rn1(3, 4); i > 0; i--) {
if (!makemon(ptr, u.ux, u.uy, NO_MINVENT|MM_NOMSG))
if (!makemon(ptr, u.ux, u.uy, NO_MINVENT | MM_NOMSG))
break; /* couldn't make one */
++cnt;
if (g.mvitals[mndx].mvflags & G_EXTINCT)
@@ -2977,10 +2977,12 @@ create_particular_creation(struct _create_particular_data* d)
if (d->genderconf == -1) {
/* no confict exists between explicit gender term and
the specified monster name */
if (d->fem != -1
&& (!whichpm || (!is_male(whichpm) && !is_female(whichpm))))
if (d->fem != -1 && (!whichpm || (!is_male(whichpm)
&& !is_female(whichpm))))
mmflags |= (d->fem == FEMALE) ? MM_FEMALE
: (d->fem == MALE) ? MM_MALE : 0;
/* no surprise; "<mon> appears." rather than "<mon> appears!" */
mmflags |= MM_NOEXCLAM;
} else {
/* conundrum alert: an explicit gender term conflicts with an
explicit gender-tied naming term (i.e. male cavewoman) */
@@ -2989,11 +2991,11 @@ create_particular_creation(struct _create_particular_data* d)
commented out here */
/* d->fem = d->genderconf; */
/* option chosen: let the explicit gender term (male or female)
override the gender-tied naming term, so leave d->fem as-is */
/* option chosen: let the explicit gender term (male or female)
override the gender-tied naming term, so leave d->fem as-is */
mmflags |= (d->fem == FEMALE) ? MM_FEMALE
: (d->fem == MALE) ? MM_MALE : 0;
mmflags |= (d->fem == FEMALE) ? MM_FEMALE
: (d->fem == MALE) ? MM_MALE : 0;
/* another option would be to consider it a faulty specification
and reject the request completely and produce a random monster