priest/minion bits (trunk only)

Cleanup up a couple of priest and minion allocation/conversion bits.
Also, restrict minion naming so that "guardian <foo>" is only applied when
<foo> is an Angel.  (That restores old behavior from before a change I made
last October; it prevents the guardian Angel from being recognized while
hallucinating.  It probably affects slash'em too, where they have tame
minions besides the astral level's guardian Angel.)
This commit is contained in:
nethack.rankin
2006-01-12 06:24:23 +00:00
parent 3b127d31d9
commit b98f6a6ccb
3 changed files with 21 additions and 18 deletions
+5 -2
View File
@@ -1101,8 +1101,11 @@ register int mmflags;
} }
/* it's possible to create an ordinary monster of some special /* it's possible to create an ordinary monster of some special
types; make sure their extended data is initialized to types; make sure their extended data is initialized to
something sensible (caller can override these settings) */ something sensible if caller hasn't specified MM_EPRI|MM_EMIN
if (mndx == PM_ALIGNED_PRIEST || (mndx == PM_ANGEL && !rn2(3))) { (when they're specified, caller intends to handle this itself) */
if ((mndx == PM_ALIGNED_PRIEST || mndx == PM_HIGH_PRIEST) ?
!(mmflags && (MM_EPRI|MM_EMIN)) :
(mndx == PM_ANGEL && !(mmflags && MM_EMIN) && !rn2(3))) {
struct emin *eminp; struct emin *eminp;
newemin(mtmp); newemin(mtmp);
eminp = EMIN(mtmp); eminp = EMIN(mtmp);
+1 -2
View File
@@ -138,12 +138,11 @@ boolean talk;
if (mnum == NON_PM) { if (mnum == NON_PM) {
mon = 0; mon = 0;
} else if (mnum == PM_ANGEL) { } else if (mnum == PM_ANGEL) {
mon = makemon(&mons[mnum], u.ux, u.uy, MM_EPRI|MM_EMIN); mon = makemon(&mons[mnum], u.ux, u.uy, MM_EMIN);
if (mon) { if (mon) {
mon->isminion = 1; mon->isminion = 1;
EMIN(mon)->min_align = alignment; EMIN(mon)->min_align = alignment;
EMIN(mon)->renegade = FALSE; EMIN(mon)->renegade = FALSE;
EPRI(mon)->shralign = alignment;
} }
} else if (mnum != PM_SHOPKEEPER && mnum != PM_GUARD && } else if (mnum != PM_SHOPKEEPER && mnum != PM_GUARD &&
mnum != PM_ALIGNED_PRIEST && mnum != PM_HIGH_PRIEST) { mnum != PM_ALIGNED_PRIEST && mnum != PM_HIGH_PRIEST) {
+15 -14
View File
@@ -295,7 +295,7 @@ char *pname; /* caller-supplied output buffer */
what = "priest"; what = "priest";
} }
} else { } else {
if (mon->mtame) if (mon->mtame && !strcmpi(what, "Angel"))
Strcat(pname, "guardian "); Strcat(pname, "guardian ");
} }
@@ -561,10 +561,10 @@ boolean peaceful;
register struct monst *roamer; register struct monst *roamer;
register boolean coaligned = (u.ualign.type == alignment); register boolean coaligned = (u.ualign.type == alignment);
/* Angel's have the emin extension; aligned priests have the epri #if 0 /* this was due to permonst's pxlth field which is now gone */
extension, we access it as if it were emin */
if (ptr != &mons[PM_ALIGNED_PRIEST] && ptr != &mons[PM_ANGEL]) if (ptr != &mons[PM_ALIGNED_PRIEST] && ptr != &mons[PM_ANGEL])
return((struct monst *)0); return((struct monst *)0);
#endif
if (MON_AT(x, y)) (void) rloc(m_at(x, y), FALSE); /* insurance */ if (MON_AT(x, y)) (void) rloc(m_at(x, y), FALSE); /* insurance */
@@ -690,6 +690,8 @@ angry_priest()
struct rm *lev; struct rm *lev;
if ((priest = findpriest(temple_occupied(u.urooms))) != 0) { if ((priest = findpriest(temple_occupied(u.urooms))) != 0) {
struct epri *eprip = EPRI(priest);
wakeup(priest); wakeup(priest);
/* /*
* If the altar has been destroyed or converted, let the * If the altar has been destroyed or converted, let the
@@ -698,20 +700,19 @@ angry_priest()
* a fresh corpse nearby, the priest ought to have an * a fresh corpse nearby, the priest ought to have an
* opportunity to try converting it back; maybe someday...) * opportunity to try converting it back; maybe someday...)
*/ */
lev = &levl[EPRI(priest)->shrpos.x][EPRI(priest)->shrpos.y]; lev = &levl[eprip->shrpos.x][eprip->shrpos.y];
if (!IS_ALTAR(lev->typ) || if (!IS_ALTAR(lev->typ) ||
((aligntyp)Amask2align(lev->altarmask & AM_MASK) != ((aligntyp)Amask2align(lev->altarmask & AM_MASK) !=
EPRI(priest)->shralign)) { eprip->shralign)) {
if (EPRI(priest)) { if (!EMIN(priest)) newemin(priest);
if (!EMIN(priest)) newemin(priest); priest->ispriest = 0; /* now a roaming minion */
priest->ispriest = 0; /* roamer */ priest->isminion = 1;
/* but still aligned */ EMIN(priest)->min_align = eprip->shralign;
priest->isminion = 1;
EMIN(priest)->min_align = EPRI(priest)->shralign;
}
/* this used to overload EPRI's shroom field, which was then clobbered
* but not since adding the separate mextra structure */
EMIN(priest)->renegade = FALSE; EMIN(priest)->renegade = FALSE;
/* discard priest's memory of his former shrine;
if we ever implement the re-conversion mentioned
above, this will need to be removed */
free_epri(priest);
} }
} }
} }