]> granicus.if.org Git - nethack/commitdiff
more "<mon> appears in a cloud of smoke"
authorPatR <rankin@nethack.org>
Tue, 22 Jun 2021 00:47:51 +0000 (17:47 -0700)
committerPatR <rankin@nethack.org>
Tue, 22 Jun 2021 00:47:51 +0000 (17:47 -0700)
Now that the appear message isn't limited to summoning by demon,
seeing "the Angel of <foo> 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.

include/extern.h
src/minion.c
src/mondata.c

index 7f1690393e784b7758bccb1fd87f56fc3abc9839..4c9e3138f4d25d419bc181b4e388c210dc700578 100644 (file)
@@ -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);
index f910fe4e8e23223dc54c3947090c06b3eee7ed13..907815ced5bf2f7d45dcc5c2a0fc4d336b4bc05c 100644 (file)
@@ -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:
index d737123e2c1a38f61da0aead2cbce95b6db447ae..0234699082e0e85f298407b181224863789e96bd 100644 (file)
@@ -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 <something> */
 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 <something>" */
+    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 permonstmdat)
+olfaction(struct permonst *mdat)
 {
     if (is_golem(mdat)
         || mdat->mlet == S_EYE /* spheres  */