]> granicus.if.org Git - nethack/commitdiff
When attacking a peaceful monster, make other peaceful monsters react.
authorPasi Kallinen <paxed@alt.org>
Sat, 11 Jun 2016 17:27:55 +0000 (20:27 +0300)
committerPasi Kallinen <paxed@alt.org>
Sat, 11 Jun 2016 17:27:55 +0000 (20:27 +0300)
src/mon.c

index 059903a7bde7a823630e64caba324f3f9f5cb19f..3094425eb12f01003452d853cb1afdb7bccb5e18 100644 (file)
--- a/src/mon.c
+++ b/src/mon.c
@@ -2611,6 +2611,52 @@ struct monst *mtmp;
                                    : makeplural(q_guardian->mname),
                       got_mad == 1 ? "s" : "");
     }
+
+    /* make other peaceful monsters react */
+    if (!context.mon_moving) {
+        struct monst *mon;
+        int got_mad = 0;
+
+        for (mon = fmon; mon; mon = mon->nmon)
+            if (!DEADMONSTER(mon) && !mindless(mon->data) && mon->mpeaceful
+                && couldsee(mon->mx, mon->my) && !mon->msleeping
+                && mon->mcansee && m_canseeu(mon)) {
+                boolean exclaimed = FALSE;
+
+                if (humanoid(mon->data) || mon->isshk || mon->ispriest) {
+                    if (is_watch(mon->data)) {
+                        verbalize("Halt!  You're under arrest!");
+                        (void) angry_guards(!!Deaf);
+                    } else {
+                        const char *exclam[] = {
+                            "Gasp!", "Uh-oh.", "Oh my!", "What?", "Why?"
+                        };
+                        if (!rn2(5)) {
+                            verbalize("%s", exclam[mon->m_id % SIZE(exclam)]);
+                            exclaimed = TRUE;
+                        }
+                        if (!mon->isshk && !mon->ispriest && (mon->data->mlevel < rn2(10))) {
+                            monflee(mon, rn2(50)+25, TRUE, !exclaimed);
+                            exclaimed = TRUE;
+                        }
+                        if (!mon->isshk && !mon->ispriest) {
+                            mon->mpeaceful = 0;
+                            adjalign(-1);
+                            if (!exclaimed)
+                                pline("%s gets angry!", Monnam(mon));
+                        }
+                    }
+                } else if ((mtmp->data == mon->data) && !rn2(3)) {
+                    if (!rn2(4)) {
+                        growl(mon);
+                        exclaimed = TRUE;
+                    }
+                    if (rn2(6))
+                        monflee(mon, rn2(25)+15, TRUE, !exclaimed);
+                }
+            }
+    }
+
 }
 
 /* wake up a monster, usually making it angry in the process */