-/* 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. */
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);
-/* 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)
{
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;
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;
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);
mnum = lminion();
break;
case A_NEUTRAL:
- mnum = PM_AIR_ELEMENTAL + rn2(4);
+ mnum = elementals[rn2(SIZE(elementals))];
break;
case A_CHAOTIC:
case A_NONE:
-/* 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. */
/* 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:
what = "steam";
break;
case PM_ENERGY_VORTEX:
+ *cloud = "shower"; /* "shower of" instead of "cloud of" */
what = "sparks";
break;
case PM_EARTH_ELEMENTAL:
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;
* 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 */