]> granicus.if.org Git - nethack/commitdiff
monster aggravation spell
authornethack.rankin <nethack.rankin>
Sun, 20 Mar 2005 05:05:06 +0000 (05:05 +0000)
committernethack.rankin <nethack.rankin>
Sun, 20 Mar 2005 05:05:06 +0000 (05:05 +0000)
     When testing drawbridge stuff recently I ended up with an unseen
monster who evidently cast the aggravation spell repeatedly, yielding a
steady stream of "you feel that monsters are aware of your presence"
messages.  This patch makes monsters tend to avoid repeating that spell
once everyone on the level has already been woken up.  It also extends
the spell effect so that it will wake monsters like quest nemesis and the
Wizard who ordinarily wait until you get close before they become active.

doc/fixes34.4
src/mcastu.c
src/wizard.c

index ddae48557634dd22c919e58dd8bb50a852c2eed4..7421315d63d5c5a5b2348a5dc25dc0194b024964 100644 (file)
@@ -99,6 +99,8 @@ land mine explosion will destroy a drawbridge at same location
 avoid some more buffer overflows in query buffers containing object names
 avoid giving extra information about things that break out of sight
 avoid giving away wand type for near misses while blind
+avoid excessive repetition of "monsters are aware of your presence"
+monster's aggravation spell now affects meditating monsters
 
 
 Platform- and/or Interface-Specific Fixes
index e65006e5ed5cdfdc3c5a434e27de69efab2eb3a9..c5079059c5346a38a54fbc4dbf492afcf3212cd8 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)mcastu.c   3.5     2003/01/08      */
+/*     SCCS Id: @(#)mcastu.c   3.5     2005/03/19      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -731,6 +731,21 @@ int spellnum;
        if ((!mtmp->iswiz || context.no_of_wizards > 1)
                                                && spellnum == MGC_CLONE_WIZ)
            return TRUE;
+       /* aggravation (global wakeup) when everyone is already active */
+       if (spellnum == MGC_AGGRAVATION) {
+           struct monst *nxtmon;
+
+           for (nxtmon = fmon; nxtmon; nxtmon = nxtmon->nmon) {
+               if (DEADMONSTER(nxtmon)) continue;
+               if ((nxtmon->mstrategy & STRAT_WAITFORU) != 0 ||
+                       nxtmon->msleeping || !nxtmon->mcanmove) break;
+           }
+           /* if nothing needs to be awakened then this spell is useless
+              but caster might not realize that [chance to pick it then
+              must be very small otherwise caller's many retry attempts
+              will eventually end up picking it too often] */
+           if (!nxtmon) return rn2(100) ? TRUE : FALSE;
+       }
     } else if (adtyp == AD_CLRC) {
        /* summon insects/sticks to snakes won't be cast by peaceful monsters */
        if (mtmp->mpeaceful && spellnum == CLC_INSECTS)
index 4c160c8cbda66aeefd08aee3c8388c8ee0cc96d6..8017a767c8b1af668a15441616d02f5786ecc28a 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)wizard.c   3.5     2004/12/20      */
+/*     SCCS Id: @(#)wizard.c   3.5     2005/03/19      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -371,14 +371,15 @@ aggravate()
 {
        register struct monst *mtmp;
 
-       for(mtmp = fmon; mtmp; mtmp = mtmp->nmon)
-           if (!DEADMONSTER(mtmp)) {
-               mtmp->msleeping = 0;
-               if(!mtmp->mcanmove && !rn2(5)) {
-                       mtmp->mfrozen = 0;
-                       mtmp->mcanmove = 1;
-               }
+       for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
+           if (DEADMONSTER(mtmp)) continue;
+           mtmp->mstrategy &= ~STRAT_WAITFORU;
+           mtmp->msleeping = 0;
+           if (!mtmp->mcanmove && !rn2(5)) {
+               mtmp->mfrozen = 0;
+               mtmp->mcanmove = 1;
            }
+       }
 }
 
 void