-/* NetHack 3.6 minion.c $NHDT-Date: 1432512773 2015/05/25 00:12:53 $ $NHDT-Branch: master $:$NHDT-Revision: 1.33 $ */
+/* NetHack 3.6 minion.c $NHDT-Date: 1544998886 2018/12/16 22:21:26 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.40 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2008. */
/* NetHack may be freely redistributed. See license for details. */
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));
}
cnt--;
}
#endif
if (!tele_restrict(mtmp))
(void) rloc(mtmp, TRUE);
- return (1);
+ return 1;
}
cash = money_cnt(invent);
demand =
}
}
mongone(mtmp);
- return (1);
+ return 1;
}
long
}
(void) money2mon(mtmp, offer);
context.botl = 1;
- return (offer);
+ return offer;
}
int
pm = rn1(PM_DEMOGORGON + 1 - PM_ORCUS, PM_ORCUS);
if (!(mvitals[pm].mvflags & G_GONE)
&& (atyp == A_NONE || sgn(mons[pm].maligntyp) == sgn(atyp)))
- return (pm);
+ return pm;
}
- return (dlord(atyp)); /* approximate */
+ return dlord(atyp); /* approximate */
}
int
pm = rn1(PM_YEENOGHU + 1 - PM_JUIBLEX, PM_JUIBLEX);
if (!(mvitals[pm].mvflags & G_GONE)
&& (atyp == A_NONE || sgn(mons[pm].maligntyp) == sgn(atyp)))
- return (pm);
+ return pm;
}
- return (ndemon(atyp)); /* approximate */
+ return ndemon(atyp); /* approximate */
}
/* create lawful (good) lord */
llord()
{
if (!(mvitals[PM_ARCHON].mvflags & G_GONE))
- return (PM_ARCHON);
+ return PM_ARCHON;
- return (lminion()); /* approximate */
+ return lminion(); /* approximate */
}
int
for (tryct = 0; tryct < 20; tryct++) {
ptr = mkclass(S_ANGEL, 0);
if (ptr && !is_lord(ptr))
- return (monsndx(ptr));
+ return monsndx(ptr);
}
return NON_PM;
int
ndemon(atyp)
-aligntyp atyp;
+aligntyp atyp; /* A_NONE is used for 'any alignment' */
{
- int tryct;
struct permonst *ptr;
- for (tryct = 0; tryct < 20; tryct++) {
- ptr = mkclass(S_DEMON, 0);
- if (ptr && is_ndemon(ptr)
- && (atyp == A_NONE || sgn(ptr->maligntyp) == sgn(atyp)))
- return (monsndx(ptr));
- }
-
- return NON_PM;
+ /*
+ * 3.6.2: [fix #H2204, 22-Dec-2010, eight years later...]
+ * pick a correctly aligned demon in one try. This used to
+ * use mkclass() to choose a random demon type and keep trying
+ * (up to 20 times) until it got one with the desired alignment.
+ * mkclass_aligned() skips wrongly aligned potential candidates.
+ * [The only neutral demons are djinni and mail daemon and
+ * mkclass() won't pick them, but call it anyway in case either
+ * aspect of that changes someday.]
+ */
+#if 0
+ if (atyp == A_NEUTRAL)
+ return NON_PM;
+#endif
+ ptr = mkclass_aligned(S_DEMON, 0, atyp);
+ return (ptr && is_ndemon(ptr)) ? monsndx(ptr) : NON_PM;
}
/* guardian angel has been affected by conflict so is abandoning hero */