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

Function trapeffect_vibrating_square

src/trap.c:2724–2764  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2722}
2723
2724staticfn int
2725trapeffect_vibrating_square(
2726 struct monst *mtmp,
2727 struct trap *trap,
2728 unsigned int trflags UNUSED)
2729{
2730 if (mtmp == &gy.youmonst) {
2731 feeltrap(trap);
2732 /* messages handled elsewhere; the trap symbol is merely to mark the
2733 square for future reference */
2734 } else {
2735 boolean in_sight = canseemon(mtmp) || (mtmp == u.usteed);
2736 boolean see_it = cansee(mtmp->mx, mtmp->my);
2737
2738 if (see_it && !Blind) {
2739 seetrap(trap); /* before messages */
2740 if (in_sight) {
2741 char buf[BUFSZ], *p, *monnm = mon_nam(mtmp);
2742
2743 if (nolimbs(mtmp->data) || m_in_air(mtmp)) {
2744 /* just "beneath <mon>" */
2745 Strcpy(buf, monnm);
2746 } else {
2747 Strcpy(buf, s_suffix(monnm));
2748 p = eos(strcat(buf, " "));
2749 Strcpy(p, makeplural(mbodypart(mtmp, FOOT)));
2750 /* avoid "beneath 'rear paws'" or 'rear hooves' */
2751 (void) strsubst(p, "rear ", "");
2752 }
2753 You_see("a strange vibration beneath %s.", buf);
2754 } else {
2755 /* notice something (hearing uses a larger threshold
2756 for 'nearby') */
2757 You_see("the ground vibrate %s.",
2758 (mdistu(mtmp) <= 2 * 2)
2759 ? "nearby" : "in the distance");
2760 }
2761 }
2762 }
2763 return Trap_Effect_Finished;
2764}
2765
2766/*
2767 * for PR#259 - paranoid_confirm:trap

Callers 1

trapeffect_selectorFunction · 0.85

Calls 11

feeltrapFunction · 0.85
canseemonFunction · 0.85
seetrapFunction · 0.85
mon_namFunction · 0.85
m_in_airFunction · 0.85
s_suffixFunction · 0.85
eosFunction · 0.85
makepluralFunction · 0.85
mbodypartFunction · 0.85
strsubstFunction · 0.85
You_seeFunction · 0.85

Tested by

no test coverage detected