From f6c08d9f8026275f3a52301a54e75b846c9b8b6e Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Sun, 20 Mar 2005 05:05:06 +0000 Subject: [PATCH] monster aggravation spell 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 | 2 ++ src/mcastu.c | 17 ++++++++++++++++- src/wizard.c | 17 +++++++++-------- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/doc/fixes34.4 b/doc/fixes34.4 index ddae48557..7421315d6 100644 --- a/doc/fixes34.4 +++ b/doc/fixes34.4 @@ -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 diff --git a/src/mcastu.c b/src/mcastu.c index e65006e5e..c5079059c 100644 --- a/src/mcastu.c +++ b/src/mcastu.c @@ -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) diff --git a/src/wizard.c b/src/wizard.c index 4c160c8cb..8017a767c 100644 --- a/src/wizard.c +++ b/src/wizard.c @@ -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 -- 2.40.0