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

Function call_kops

src/shk.c:509–564  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

507}
508
509staticfn void
510call_kops(struct monst *shkp, boolean nearshop)
511{
512 /* Keystone Kops srt@ucla */
513 boolean nokops;
514
515 if (!shkp)
516 return;
517
518 Soundeffect(se_alarm, 80);
519 if (!Deaf)
520 pline("An alarm sounds!");
521
522 nokops = ((svm.mvitals[PM_KEYSTONE_KOP].mvflags & G_GONE)
523 && (svm.mvitals[PM_KOP_SERGEANT].mvflags & G_GONE)
524 && (svm.mvitals[PM_KOP_LIEUTENANT].mvflags & G_GONE)
525 && (svm.mvitals[PM_KOP_KAPTAIN].mvflags & G_GONE));
526
527 if (!angry_guards(!!Deaf) && nokops) {
528 if (flags.verbose && !Deaf)
529 pline("But no one seems to respond to it.");
530 return;
531 }
532
533 if (nokops)
534 return;
535
536 {
537 coord mm;
538 coordxy sx = 0, sy = 0;
539
540 choose_stairs(&sx, &sy, TRUE);
541
542 if (nearshop) {
543 /* Create swarm around you, if you merely "stepped out" */
544 if (flags.verbose)
545 pline_The("Keystone Kops appear!");
546 mm.x = u.ux;
547 mm.y = u.uy;
548 makekops(&mm);
549 return;
550 }
551 if (flags.verbose)
552 pline_The("Keystone Kops are after you!");
553 /* Create swarm near down staircase (hinders return to level) */
554 if (isok(sx, sy)) {
555 mm.x = sx;
556 mm.y = sy;
557 makekops(&mm);
558 }
559 /* Create swarm near shopkeeper (hinders return to shop) */
560 mm.x = shkp->mx;
561 mm.y = shkp->my;
562 makekops(&mm);
563 }
564}
565
566/* x,y is strictly inside shop */

Callers 2

u_left_shopFunction · 0.85
remote_burglaryFunction · 0.85

Calls 6

angry_guardsFunction · 0.85
choose_stairsFunction · 0.85
pline_TheFunction · 0.85
makekopsFunction · 0.85
isokFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected