Differentiate between monster anger from attacks and from other causes

setmangry() and wakeup() were being used for multiple purposes. Add an
extra parameter to track which. This fixes several minor bugs (e.g.
whether monsters with no eyes were angered by (useless) gaze attacks
against them previously depended on the state of a UI option, and
the Minetown guards would be annoyed if you used a cursed scroll of
tame monster on a shopkeeper). It's also a prerequisite for the
Elbereth changes I'm working on.
This commit is contained in:
Alex Smith
2016-10-17 18:15:57 +01:00
parent 5c12362a98
commit ee5b488514
17 changed files with 55 additions and 45 deletions

View File

@@ -608,7 +608,8 @@ int x, y;
if ((mon = m_at(x, y)) != 0) {
You("bump into %s.", a_monnam(mon));
wakeup(mon);
wakeup(mon, FALSE);
setmangry(mon, FALSE);
wake_nearto(x,y, 10);
return FALSE;
}
@@ -1346,7 +1347,7 @@ boolean maybe_wakeup;
else
miss(missile, mon);
if (maybe_wakeup && !rn2(3))
wakeup(mon);
wakeup(mon, TRUE);
return;
}
@@ -1448,7 +1449,8 @@ register struct obj *obj; /* thrownobj or kickedobj or uwep */
at leader... (kicked artifact is ok too; HMON_APPLIED could
occur if quest artifact polearm or grapnel ever gets added) */
if (hmode != HMON_APPLIED && quest_arti_hits_leader(obj, mon)) {
/* not wakeup(), which angers non-tame monsters */
/* AIS: changes to wakeup() means that it's now less inappropriate here
than it used to be, but the manual version works just as well */
mon->msleeping = 0;
mon->mstrategy &= ~STRAT_WAITMASK;
@@ -1562,7 +1564,7 @@ register struct obj *obj; /* thrownobj or kickedobj or uwep */
} else {
tmiss(obj, mon, TRUE);
if (hmode == HMON_APPLIED)
wakeup(mon);
wakeup(mon, TRUE);
}
} else if (otyp == HEAVY_IRON_BALL) {
@@ -1610,7 +1612,7 @@ register struct obj *obj; /* thrownobj or kickedobj or uwep */
}
} else if (guaranteed_hit) {
/* this assumes that guaranteed_hit is due to swallowing */
wakeup(mon);
wakeup(mon, TRUE);
if (obj->otyp == CORPSE && touch_petrifies(&mons[obj->corpsenm])) {
if (is_animal(u.ustuck->data)) {
minstapetrify(u.ustuck, TRUE);