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

Function update_mon_extrinsics

src/worn.c:578–712  ·  view source on GitHub ↗

armor put on or taken off; might be magical variety */

Source from the content-addressed store, hash-verified

576
577/* armor put on or taken off; might be magical variety */
578void
579update_mon_extrinsics(
580 struct monst *mon,
581 struct obj *obj, /* armor being worn or taken off */
582 boolean on,
583 boolean silently)
584{
585 int unseen;
586 uchar mask;
587 struct obj *otmp;
588 int which = (int) objects[obj->otyp].oc_oprop,
589 altwhich = altprop(obj);
590
591 unseen = !canseemon(mon);
592 if (!which && !altwhich)
593 goto maybe_blocks;
594
595 again:
596 if (on) {
597 switch (which) {
598 case INVIS:
599 mon->minvis = !mon->invis_blkd;
600 break;
601 case FAST: {
602 boolean save_in_mklev = gi.in_mklev;
603 if (silently)
604 gi.in_mklev = TRUE;
605 mon_adjust_speed(mon, 0, obj);
606 gi.in_mklev = save_in_mklev;
607 break;
608 }
609 /* properties handled elsewhere */
610 case ANTIMAGIC:
611 case REFLECTING:
612 case PROTECTION:
613 break;
614 /* properties which have no effect for monsters */
615 case CLAIRVOYANT:
616 case STEALTH:
617 case TELEPAT:
618 break;
619 /* properties which should have an effect but aren't implemented */
620 case LEVITATION:
621 case FLYING:
622 case WWALKING:
623 break;
624 /* properties which maybe should have an effect but don't */
625 case DISPLACED:
626 case FUMBLING:
627 case JUMPING:
628 break;
629 default:
630 mon->mextrinsics |= (unsigned short) res_to_mr(which);
631 break;
632 }
633 } else { /* off */
634 switch (which) {
635 case INVIS:

Callers 5

mdrop_objFunction · 0.85
put_saddle_on_monFunction · 0.85
m_dowear_typeFunction · 0.85
extract_from_minventFunction · 0.85
trapeffect_poly_trapFunction · 0.85

Calls 4

canseemonFunction · 0.85
mon_adjust_speedFunction · 0.85
dismount_steedFunction · 0.85
newsymFunction · 0.85

Tested by

no test coverage detected