Limit aggravate to inside or outside of the Wizard's tower

There have been several comments on IRC how the Wizard is a very
light sleeper now; aggravate cast by monsters makes him wake up
and come out of the tower.  So, lets limit aggravate to either
outside or inside of the tower, depending on which side the player is.
This commit is contained in:
Pasi Kallinen
2016-01-16 09:45:08 +02:00
parent cd2f4ac225
commit 04bc048073
3 changed files with 28 additions and 10 deletions

View File

@@ -2677,6 +2677,7 @@ E void NDECL(amulet);
E int FDECL(mon_has_amulet, (struct monst *));
E int FDECL(mon_has_special, (struct monst *));
E int FDECL(tactics, (struct monst *));
E boolean FDECL(has_aggravatables, (struct monst *));
E void NDECL(aggravate);
E void NDECL(clonewiz);
E int NDECL(pick_nasty);

View File

@@ -798,20 +798,11 @@ int spellnum;
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)
if (!has_aggravatables(mtmp))
return rn2(100) ? TRUE : FALSE;
}
} else if (adtyp == AD_CLRC) {

View File

@@ -425,14 +425,40 @@ register struct monst *mtmp;
return 0;
}
/* are there any monsters mon could aggravate? */
boolean
has_aggravatables(mon)
struct monst *mon;
{
struct monst *mtmp;
boolean in_w_tower = In_W_tower(mon->mx, mon->my, &u.uz);
if (in_w_tower != In_W_tower(u.ux, u.uy, &u.uz))
return FALSE;
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if (DEADMONSTER(mtmp))
continue;
if (in_w_tower != In_W_tower(mtmp->mx, mtmp->my, &u.uz))
continue;
if ((mtmp->mstrategy & STRAT_WAITFORU) != 0
|| mtmp->msleeping || !mtmp->mcanmove)
return TRUE;
}
return FALSE;
}
void
aggravate()
{
register struct monst *mtmp;
boolean in_w_tower = In_W_tower(u.ux, u.uy, &u.uz);
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if (DEADMONSTER(mtmp))
continue;
if (in_w_tower != In_W_tower(mtmp->mx, mtmp->my, &u.uz))
continue;
mtmp->mstrategy &= ~(STRAT_WAITFORU | STRAT_APPEARMSG);
mtmp->msleeping = 0;
if (!mtmp->mcanmove && !rn2(5)) {