statue trap tweaks

Implement <Someone>'s suggestion/request that co-aligned unicorn not be
used for statue traps, so that the hero won't get hit with a big luck
penalty for killing such a unicorn when the trap releases one which is
hostile.  I think that set_malign() probably ought to override that, but
this just changes the monster type selection for the trap's statue.

     Also, noticed in adjoining code:  avoid counting the template monster
used to generate inventory for the statue towards extinction.  It gets
immediately discarded, and later statue activation counts the resulting
monster then.
This commit is contained in:
nethack.rankin
2006-12-28 02:09:54 +00:00
parent f93b3837d8
commit 4b3b8b4047

View File

@@ -274,10 +274,16 @@ register int x, y, typ;
case STATUE_TRAP: /* create a "living" statue */
{ struct monst *mtmp;
struct obj *otmp, *statue;
struct permonst *mptr;
int trycount = 10;
do { /* avoid ultimately hostile co-aligned unicorn */
mptr = &mons[rndmonnum()];
} while (--trycount > 0 && is_unicorn(mptr) &&
sgn(u.ualign.type) == sgn(mptr->maligntyp));
statue = mkcorpstat(STATUE, (struct monst *)0,
&mons[rndmonnum()], x, y, CORPSTAT_NONE);
mtmp = makemon(&mons[statue->corpsenm], 0, 0, NO_MM_FLAGS);
mptr, x, y, CORPSTAT_NONE);
mtmp = makemon(&mons[statue->corpsenm], 0, 0, MM_NOCOUNTBIRTH);
if (!mtmp) break; /* should never happen */
while(mtmp->minvent) {
otmp = mtmp->minvent;
@@ -627,8 +633,7 @@ boolean shatter;
shatter ? ANIMATE_SHATTER : ANIMATE_NORMAL, &fail_reason);
if (mtmp || fail_reason != AS_MON_IS_UNIQUE) break;
while ((otmp = otmp->nexthere) != 0)
if (otmp->otyp == STATUE) break;
otmp = nxtobj(otmp, STATUE, TRUE);
}
if (Blind) feel_location(x, y);