]> granicus.if.org Git - nethack/commitdiff
"<foo> appears in cloud of smoke."
authorPatR <rankin@nethack.org>
Sun, 20 Jun 2021 23:45:42 +0000 (16:45 -0700)
committerPatR <rankin@nethack.org>
Sun, 20 Jun 2021 23:45:42 +0000 (16:45 -0700)
Have water demons appear in a cloud of vapor rather than a cloud of
smoke.  This adds a few other alternatives but they'll never happen.
Elementals could only be summoned by Angels but Angels never call
msummon() as far as I can tell.  Vortices aren't summoned at all
but the smoke/vapor/&c routine has provisions for them.

The cloud of smoke message used to be given only when the summoner
is a demon.  Now it will be given if the last--or only--summoned
creature can be seen to arrive, no matter whether summoned by a
demon, a non-demon (which I think isn't possible), or post-Wizard
harassment.

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

index 92ce774e8285e677e4137a12aba580e3c8bcd6e7..b51c60cda13a6afc85edafc2f15a42442dd211c6 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.7 extern.h        $NHDT-Date: 1620923916 2021/05/13 16:38:36 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.971 $ */
+/* NetHack 3.7 extern.h        $NHDT-Date: 1624232719 2021/06/20 23:45:19 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.983 $ */
 /* Copyright (c) Steve Creps, 1988.                              */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -1502,6 +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 struct permonst *raceptr(struct monst *);
 extern boolean olfaction(struct permonst *);
 unsigned long cvt_adtyp_to_mseenres(uchar);
index faf30590cbb5b5307fa35bcf0755c9092c12ee8a..f910fe4e8e23223dc54c3947090c06b3eee7ed13 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.7 minion.c        $NHDT-Date: 1596498180 2020/08/03 23:43:00 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.55 $ */
+/* NetHack 3.7 minion.c        $NHDT-Date: 1624232728 2021/06/20 23:45:28 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.59 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2008. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -49,6 +49,10 @@ 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;
@@ -64,10 +68,9 @@ msummon(struct monst *mon)
         }
 
         atyp = mon->ispriest ? EPRI(mon)->shralign
-                             : mon->isminion ? EMIN(mon)->min_align
-                                             : (ptr->maligntyp == A_NONE)
-                                                   ? A_NONE
-                                                   : sgn(ptr->maligntyp);
+               : mon->isminion ? EMIN(mon)->min_align
+                 : (ptr->maligntyp == A_NONE) ? A_NONE
+                   : sgn(ptr->maligntyp);
     } else {
         ptr = &mons[PM_WIZARD_OF_YENDOR];
         atyp = (ptr->maligntyp == A_NONE) ? A_NONE : sgn(ptr->maligntyp);
@@ -98,7 +101,7 @@ msummon(struct monst *mon)
         if (!rn2(6)) {
             switch (atyp) { /* see summon_minion */
             case A_NEUTRAL:
-                dtype = PM_AIR_ELEMENTAL + rn2(4);
+                dtype = elementals[rn2(SIZE(elementals))];
                 break;
             case A_CHAOTIC:
             case A_NONE:
@@ -145,8 +148,16 @@ msummon(struct monst *mon)
                 EMIN(mtmp)->renegade =
                     (atyp != u.ualign.type) ^ !mtmp->mpeaceful;
             }
-            if (is_demon(ptr) && canseemon(mtmp))
-                pline("%s appears in a cloud of smoke!", Amonnam(mtmp));
+
+            if (cnt == 1 && canseemon(mtmp)) {
+                const char *what = msummon_environ(mtmp->data), /* "smoke" */
+                           *cloud = !strcmpi(what, "sparks") ? "shower"
+                                    : !strcmpi(what, "flame") ? "burst"
+                                      : "cloud";
+
+                pline("%s appears in a %s of %s!", Amonnam(mtmp),
+                      cloud, what);
+            }
         }
         cnt--;
     }
index 07f79bc6a535503dd526f83ec279e83bdf573dfd..d737123e2c1a38f61da0aead2cbce95b6db447ae 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.7 mondata.c       $NHDT-Date: 1623489867 2021/06/12 09:24:27 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.95 $ */
+/* NetHack 3.7 mondata.c       $NHDT-Date: 1624232729 2021/06/20 23:45:29 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.97 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2011. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -1174,7 +1174,7 @@ stagger(const struct permonst* ptr, const char* def)
 
 /* return phrase describing the effect of fire attack on a type of monster */
 const char *
-on_fire(struct permonst* mptr, struct attack* mattk)
+on_fire(struct permonst *mptr, struct attack *mattk)
 {
     const char *what;
 
@@ -1210,6 +1210,40 @@ on_fire(struct permonst* mptr, struct attack* mattk)
     return what;
 }
 
+/* similar to on_fire(); creature is summoned in a cloud of <something> */
+const char *
+msummon_environ(struct permonst *mptr)
+{
+    const char *what;
+
+    switch (monsndx(mptr)) {
+    case PM_WATER_DEMON:
+    case PM_AIR_ELEMENTAL:
+    case PM_WATER_ELEMENTAL:
+    case PM_FOG_CLOUD:
+    case PM_ICE_VORTEX:
+        what = "vapor";
+        break;
+    case PM_STEAM_VORTEX:
+        what = "steam";
+        break;
+    case PM_ENERGY_VORTEX:
+        what = "sparks";
+        break;
+    case PM_EARTH_ELEMENTAL:
+    case PM_DUST_VORTEX:
+        what = "dust";
+        break;
+    case PM_FIRE_ELEMENTAL:
+        what = "flame";
+        break;
+    default:
+        what = "smoke";
+        break;
+    }
+    return what;
+}
+
 /*
  * Returns:
  *      True if monster is presumed to have a sense of smell.