is_lminion should only match lawful minions

When Angels were introduced, they were always lawful.  Somewhere along the
line, non-lawful angels were added, but is_lminion and uses of it was never
updated to address this change.  Among other things, this resulted in
non-lawful angels delivering messages via #chat that are only appropriate
for lawful angels.  That is addressed simply by changing the definition of
is_lminion, which must take a struct monst, not a permonst, to return valid
results.  Also, non-lawful angels should summon appropriate monsters, not
lawful minions.
This commit is contained in:
cohrs
2002-10-24 04:13:56 +00:00
parent 71480033c6
commit ff8512b36b
8 changed files with 55 additions and 16 deletions
+38 -6
View File
@@ -7,12 +7,25 @@
#include "epri.h"
void
msummon(ptr) /* ptr summons a monster */
register struct permonst *ptr;
msummon(mon) /* mon summons a monster */
struct monst *mon;
{
register struct permonst *ptr;
register int dtype = NON_PM, cnt = 0;
aligntyp atyp = (ptr->maligntyp==A_NONE) ? A_NONE : sgn(ptr->maligntyp);
aligntyp atyp;
struct monst *mtmp;
if (mon) {
ptr = mon->data;
atyp = (ptr->maligntyp==A_NONE) ? A_NONE : sgn(ptr->maligntyp);
if (mon->ispriest || mon->data == &mons[PM_ALIGNED_PRIEST]
|| mon->data == &mons[PM_ANGEL])
atyp = EPRI(mon)->shralign;
} else {
ptr = &mons[PM_WIZARD_OF_YENDOR];
atyp = (ptr->maligntyp==A_NONE) ? A_NONE : sgn(ptr->maligntyp);
}
if (is_dprince(ptr) || (ptr == &mons[PM_WIZARD_OF_YENDOR])) {
dtype = (!rn2(20)) ? dprince(atyp) :
(!rn2(4)) ? dlord(atyp) : ndemon(atyp);
@@ -25,10 +38,26 @@ register struct permonst *ptr;
dtype = (!rn2(20)) ? dlord(atyp) :
(!rn2(6)) ? ndemon(atyp) : monsndx(ptr);
cnt = 1;
} else if (is_lminion(ptr)) {
} else if (is_lminion(mon)) {
dtype = (is_lord(ptr) && !rn2(20)) ? llord() :
(is_lord(ptr) || !rn2(6)) ? lminion() : monsndx(ptr);
cnt = (!rn2(4) && !is_lord(&mons[dtype])) ? 2 : 1;
} else if (ptr == &mons[PM_ANGEL]) {
/* non-lawful angels can also summon */
if (!rn2(6)) {
switch (atyp) { /* see summon_minion */
case A_NEUTRAL:
dtype = PM_AIR_ELEMENTAL + rn2(4);
break;
case A_CHAOTIC:
case A_NONE:
dtype = ndemon(atyp);
break;
}
} else {
dtype = PM_ANGEL;
}
cnt = (!rn2(4) && !is_lord(&mons[dtype])) ? 2 : 1;
}
if (dtype == NON_PM) return;
@@ -45,10 +74,13 @@ register struct permonst *ptr;
}
while (cnt > 0) {
(void)makemon(&mons[dtype], u.ux, u.uy, NO_MM_FLAGS);
mtmp = makemon(&mons[dtype], u.ux, u.uy, NO_MM_FLAGS);
if (mtmp && (dtype == PM_ANGEL)) {
/* alignment should match the summoner */
EPRI(mtmp)->shralign = atyp;
}
cnt--;
}
return;
}
void