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

Function trapeffect_slp_gas_trap

src/trap.c:1562–1592  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1560}
1561
1562staticfn int
1563trapeffect_slp_gas_trap(
1564 struct monst *mtmp,
1565 struct trap *trap,
1566 unsigned int trflags UNUSED)
1567{
1568 if (mtmp == &gy.youmonst) {
1569 seetrap(trap);
1570 if (Sleep_resistance || breathless(gy.youmonst.data)) {
1571 You("are enveloped in a cloud of gas!");
1572 monstseesu(M_SEEN_SLEEP);
1573 } else {
1574 pline("A cloud of gas puts you to sleep!");
1575 fall_asleep(-rnd(25), TRUE);
1576 monstunseesu(M_SEEN_SLEEP);
1577 }
1578 (void) steedintrap(trap, (struct obj *) 0);
1579 } else {
1580 boolean in_sight = canseemon(mtmp) || (mtmp == u.usteed);
1581
1582 if (!resists_sleep(mtmp) && !breathless(mtmp->data)
1583 && !helpless(mtmp)) {
1584 if (sleep_monst(mtmp, rnd(25), -1) && in_sight) {
1585 pline_mon(mtmp,
1586 "%s suddenly falls asleep!", Monnam(mtmp));
1587 seetrap(trap);
1588 }
1589 }
1590 }
1591 return Trap_Effect_Finished;
1592}
1593
1594staticfn int
1595trapeffect_rust_trap(

Callers 1

trapeffect_selectorFunction · 0.85

Calls 12

seetrapFunction · 0.85
YouFunction · 0.85
monstseesuFunction · 0.85
fall_asleepFunction · 0.85
rndFunction · 0.85
monstunseesuFunction · 0.85
steedintrapFunction · 0.85
canseemonFunction · 0.85
sleep_monstFunction · 0.85
pline_monFunction · 0.85
MonnamFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected