From 4b3b8b40473e0e948525eb1933925450df553a04 Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Thu, 28 Dec 2006 02:09:54 +0000 Subject: [PATCH] statue trap tweaks Implement '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. --- src/trap.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/trap.c b/src/trap.c index 48253228c..509da79cc 100644 --- a/src/trap.c +++ b/src/trap.c @@ -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);