MCPcopy Create free account
hub / github.com/NetHack/NetHack / angry_guards

Function angry_guards

src/mon.c:5710–5760  ·  view source on GitHub ↗

anger the Minetown watch */

Source from the content-addressed store, hash-verified

5708
5709/* anger the Minetown watch */
5710boolean
5711angry_guards(boolean silent)
5712{
5713 struct monst *mtmp;
5714 int ct = 0, nct = 0, sct = 0, slct = 0;
5715
5716 for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
5717 if (DEADMONSTER(mtmp))
5718 continue;
5719 if (is_watch(mtmp->data) && mtmp->mpeaceful) {
5720 ct++;
5721 if (canspotmon(mtmp) && mtmp->mcanmove) {
5722 if (m_next2u(mtmp))
5723 nct++;
5724 else
5725 sct++;
5726 }
5727 if (mtmp->msleeping || mtmp->mfrozen) {
5728 slct++;
5729 mtmp->msleeping = mtmp->mfrozen = 0;
5730 }
5731 mtmp->mpeaceful = 0;
5732 }
5733 }
5734 if (ct) {
5735 if (!silent) { /* do we want pline msgs? */
5736 char buf[BUFSZ];
5737
5738 if (slct) { /* sleeping guard(s) */
5739 Sprintf(buf, "guard%s", plur(slct));
5740 pline_The("%s %s up.", buf, vtense(buf, "wake"));
5741 }
5742
5743 if (nct) { /* seen/sensed adjacent guard(s) */
5744 Sprintf(buf, "guard%s", plur(nct));
5745 pline_The("%s %s angry!", buf, vtense(buf, "get"));
5746 } else if (sct) { /* seen/sensed non-adjacent guard(s) */
5747 Sprintf(buf, "guard%s", plur(sct));
5748 pline("%s %s %s approaching!",
5749 (sct == 1) ? "An angry" : "Angry",
5750 buf, vtense(buf, "are"));
5751 } else {
5752 Strcpy(buf, (ct == 1) ? "a guard's" : "guards'");
5753 Soundeffect(se_shrill_whistle, 100);
5754 You_hear("the shrill sound of %s whistle%s.", buf, plur(ct));
5755 }
5756 }
5757 return TRUE;
5758 }
5759 return FALSE;
5760}
5761
5762staticfn void
5763pacify_guard(struct monst *mtmp)

Callers 12

prisoner_speaksFunction · 0.85
hmonFunction · 0.85
watch_digFunction · 0.85
peacefuls_respondFunction · 0.85
watch_on_dutyFunction · 0.85
watchman_thief_arrestFunction · 0.85
watchman_door_damageFunction · 0.85
impact_dropFunction · 0.85
call_kopsFunction · 0.85
stolen_valueFunction · 0.85
dryupFunction · 0.85
dipfountainFunction · 0.85

Calls 4

pline_TheFunction · 0.85
vtenseFunction · 0.85
You_hearFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected