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

Function trapeffect_sqky_board

src/trap.c:1402–1476  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1400}
1401
1402staticfn int
1403trapeffect_sqky_board(
1404 struct monst *mtmp,
1405 struct trap *trap,
1406 unsigned trflags)
1407{
1408 enum sound_effect_entries tsnds[] = {
1409 se_squeak_C, se_squeak_D_flat, se_squeak_D,
1410 se_squeak_E_flat, se_squeak_E, se_squeak_F,
1411 se_squeak_F_sharp, se_squeak_G, se_squeak_G_sharp,
1412 se_squeak_A, se_squeak_B_flat, se_squeak_B,
1413 };
1414 boolean forcetrap = ((trflags & FORCETRAP) != 0
1415 || (trflags & FAILEDUNTRAP) != 0
1416 || (Flying && (trflags & VIASITTING) != 0));
1417
1418 if (mtmp == &gy.youmonst) {
1419 if ((Levitation || Flying) && !forcetrap) {
1420 if (!Blind) {
1421 seetrap(trap);
1422 if (Hallucination)
1423 You("notice a crease in the linoleum.");
1424 else
1425 You("notice a loose board below you.");
1426 }
1427 } else {
1428 seetrap(trap);
1429 if (IndexOk(trap->tnote, tsnds)) {
1430 Soundeffect(tsnds[trap->tnote], 50);
1431 }
1432 pline("A board beneath you %s%s%s.",
1433 Deaf ? "vibrates" : "squeaks ",
1434 Deaf ? "" : trapnote(trap, FALSE),
1435 Deaf ? "" : " loudly");
1436 wake_nearby(FALSE);
1437 }
1438 } else {
1439 boolean in_sight = canseemon(mtmp) || (mtmp == u.usteed);
1440
1441 if (m_in_air(mtmp))
1442 return Trap_Effect_Finished;
1443 /* stepped on a squeaky board */
1444 if (in_sight) {
1445 if (!Deaf) {
1446 if (IndexOk(trap->tnote, tsnds)) {
1447 Soundeffect(tsnds[trap->tnote], 50);
1448 }
1449 pline_mon(mtmp,
1450 "A board beneath %s squeaks %s loudly.",
1451 mon_nam(mtmp), trapnote(trap, FALSE));
1452 seetrap(trap);
1453 } else if (!mindless(mtmp->data)) {
1454 pline_mon(mtmp,
1455 "%s stops momentarily and appears to cringe.",
1456 Monnam(mtmp));
1457 }
1458 } else {
1459 /* same near/far threshold as mzapmsg() */

Callers 1

trapeffect_selectorFunction · 0.85

Calls 12

seetrapFunction · 0.85
YouFunction · 0.85
trapnoteFunction · 0.85
wake_nearbyFunction · 0.85
canseemonFunction · 0.85
m_in_airFunction · 0.85
pline_monFunction · 0.85
mon_namFunction · 0.85
MonnamFunction · 0.85
You_hearFunction · 0.85
wake_neartoFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected