From: PatR Date: Tue, 22 Jun 2021 00:47:51 +0000 (-0700) Subject: more " appears in a cloud of smoke" X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a9134fd8b92c883d4d9162cdafafaa08699892cc;p=nethack more " appears in a cloud of smoke" Now that the appear message isn't limited to summoning by demon, seeing "the Angel of appears in a cloud of smoke" seems strange. Angels weren't covered by the vapor/dust/&c change for elementals. Make angels appear in a flash of light. --- diff --git a/include/extern.h b/include/extern.h index 7f1690393..4c9e3138f 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1,4 +1,4 @@ -/* NetHack 3.7 extern.h $NHDT-Date: 1624322668 2021/06/22 00:44:28 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.984 $ */ +/* NetHack 3.7 extern.h $NHDT-Date: 1624322857 2021/06/22 00:47:37 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.985 $ */ /* Copyright (c) Steve Creps, 1988. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1502,7 +1502,7 @@ extern boolean big_little_match(int, int); extern const char *locomotion(const struct permonst *, const char *); extern const char *stagger(const struct permonst *, const char *); extern const char *on_fire(struct permonst *, struct attack *); -extern const char *msummon_environ(struct permonst *); +extern const char *msummon_environ(struct permonst *, const char **); extern const struct permonst *raceptr(struct monst *); extern boolean olfaction(struct permonst *); unsigned long cvt_adtyp_to_mseenres(uchar); diff --git a/src/minion.c b/src/minion.c index f910fe4e8..907815ced 100644 --- a/src/minion.c +++ b/src/minion.c @@ -1,10 +1,18 @@ -/* NetHack 3.7 minion.c $NHDT-Date: 1624232728 2021/06/20 23:45:28 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.59 $ */ +/* NetHack 3.7 minion.c $NHDT-Date: 1624322864 2021/06/22 00:47:44 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.60 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2008. */ /* NetHack may be freely redistributed. See license for details. */ #include "hack.h" +/* used to pick among the four basic elementals without worrying whether + they've been reordered (difficulty reassessment?) or any new ones have + been introduced (hybrid types added to 'E'-class?) */ +static const int elementals[4] = { + PM_AIR_ELEMENTAL, PM_FIRE_ELEMENTAL, + PM_EARTH_ELEMENTAL, PM_WATER_ELEMENTAL +}; + void newemin(struct monst *mtmp) { @@ -49,10 +57,6 @@ monster_census(boolean spotted) /* seen|sensed vs all */ int msummon(struct monst *mon) { - static const int elementals[4] = { - PM_AIR_ELEMENTAL, PM_FIRE_ELEMENTAL, - PM_EARTH_ELEMENTAL, PM_WATER_ELEMENTAL - }; struct permonst *ptr; int dtype = NON_PM, cnt = 0, result = 0, census; aligntyp atyp; @@ -119,13 +123,13 @@ msummon(struct monst *mon) return 0; /* sanity checks */ - if (cnt > 1 && (mons[dtype].geno & G_UNIQ)) + if (cnt > 1 && (mons[dtype].geno & G_UNIQ) != 0) cnt = 1; /* * If this daemon is unique and being re-summoned (the only way we * could get this far with an extinct dtype), try another. */ - if (g.mvitals[dtype].mvflags & G_GONE) { + if ((g.mvitals[dtype].mvflags & G_GONE) != 0) { dtype = ndemon(atyp); if (dtype == NON_PM) return 0; @@ -147,13 +151,14 @@ msummon(struct monst *mon) or peaceful but different alignment */ EMIN(mtmp)->renegade = (atyp != u.ualign.type) ^ !mtmp->mpeaceful; + /* TODO: set templit at new monster's spot and in one spot + radius around it to match forthcoming "flash of light" + instead of ordinary "cloud of smoke" */ } if (cnt == 1 && canseemon(mtmp)) { - const char *what = msummon_environ(mtmp->data), /* "smoke" */ - *cloud = !strcmpi(what, "sparks") ? "shower" - : !strcmpi(what, "flame") ? "burst" - : "cloud"; + const char *cloud = 0, + *what = msummon_environ(mtmp->data, &cloud); pline("%s appears in a %s of %s!", Amonnam(mtmp), cloud, what); @@ -180,7 +185,7 @@ summon_minion(aligntyp alignment, boolean talk) mnum = lminion(); break; case A_NEUTRAL: - mnum = PM_AIR_ELEMENTAL + rn2(4); + mnum = elementals[rn2(SIZE(elementals))]; break; case A_CHAOTIC: case A_NONE: diff --git a/src/mondata.c b/src/mondata.c index d737123e2..023469908 100644 --- a/src/mondata.c +++ b/src/mondata.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 mondata.c $NHDT-Date: 1624232729 2021/06/20 23:45:29 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.97 $ */ +/* NetHack 3.7 mondata.c $NHDT-Date: 1624322866 2021/06/22 00:47:46 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.98 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1212,11 +1212,13 @@ on_fire(struct permonst *mptr, struct attack *mattk) /* similar to on_fire(); creature is summoned in a cloud of */ const char * -msummon_environ(struct permonst *mptr) +msummon_environ(struct permonst *mptr, const char **cloud) { const char *what; + int mndx = (mptr->mlet != S_ANGEL) ? monsndx(mptr) : PM_ANGEL; - switch (monsndx(mptr)) { + *cloud = "cloud"; /* default is "cloud of " */ + switch (mndx) { case PM_WATER_DEMON: case PM_AIR_ELEMENTAL: case PM_WATER_ELEMENTAL: @@ -1228,6 +1230,7 @@ msummon_environ(struct permonst *mptr) what = "steam"; break; case PM_ENERGY_VORTEX: + *cloud = "shower"; /* "shower of" instead of "cloud of" */ what = "sparks"; break; case PM_EARTH_ELEMENTAL: @@ -1235,8 +1238,13 @@ msummon_environ(struct permonst *mptr) what = "dust"; break; case PM_FIRE_ELEMENTAL: + *cloud = "burst"; /* "burst of" instead of "cloud of" */ what = "flame"; break; + case PM_ANGEL: /* actually any 'A'-class */ + *cloud = "flash"; /* "flash of" instead of "cloud of" */ + what = "light"; + break; default: what = "smoke"; break; @@ -1254,7 +1262,7 @@ msummon_environ(struct permonst *mptr) * We're assuming all insects can smell at a distance too. */ boolean -olfaction(struct permonst* mdat) +olfaction(struct permonst *mdat) { if (is_golem(mdat) || mdat->mlet == S_EYE /* spheres */