MCPcopy Index your code
hub / github.com/NetHack/NetHack / trapeffect_rolling_boulder_trap

Function trapeffect_rolling_boulder_trap

src/trap.c:2660–2707  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2658#undef MINE_TRIGGER_WT
2659
2660staticfn int
2661trapeffect_rolling_boulder_trap(
2662 struct monst *mtmp,
2663 struct trap *trap,
2664 unsigned int trflags UNUSED)
2665{
2666 if (mtmp == &gy.youmonst) {
2667 int style = ROLL | (trap->tseen ? LAUNCH_KNOWN : 0);
2668
2669 feeltrap(trap);
2670 pline("%sYou trigger a rolling boulder trap!",
2671 !Deaf ? "Click! " : "");
2672 if (!launch_obj(BOULDER, trap->launch.x, trap->launch.y,
2673 trap->launch2.x, trap->launch2.y, style)) {
2674 /* if this is a known trap, the player may have known there wasn't
2675 a lined up boulder, so use a shorter message to avoid --More--
2676 spam */
2677 if (style & LAUNCH_KNOWN)
2678 pline("No boulder was released.");
2679 else
2680 pline("Fortunately for you, no boulder was released.");
2681 }
2682 } else {
2683 if (!m_in_air(mtmp)) {
2684 boolean in_sight = (mtmp == u.usteed
2685 || (cansee(mtmp->mx, mtmp->my)
2686 && canspotmon(mtmp)));
2687 int style = ROLL | (in_sight ? 0 : LAUNCH_UNSEEN);
2688 boolean trapkilled = FALSE;
2689
2690 newsym(mtmp->mx, mtmp->my);
2691 if (in_sight)
2692 pline_mon(mtmp, "%s%s triggers %s.",
2693 !Deaf ? "Click! " : "", Monnam(mtmp),
2694 trap->tseen ? "a rolling boulder trap" : something);
2695 if (launch_obj(BOULDER, trap->launch.x, trap->launch.y,
2696 trap->launch2.x, trap->launch2.y, style)) {
2697 if (in_sight)
2698 trap->tseen = TRUE;
2699 if (DEADMONSTER(mtmp))
2700 trapkilled = TRUE;
2701 }
2702 return trapkilled ? Trap_Killed_Mon : mtmp->mtrapped
2703 ? Trap_Caught_Mon : Trap_Effect_Finished;
2704 }
2705 }
2706 return Trap_Effect_Finished;
2707}
2708
2709staticfn int
2710trapeffect_magic_portal(

Callers 1

trapeffect_selectorFunction · 0.85

Calls 7

feeltrapFunction · 0.85
launch_objFunction · 0.85
m_in_airFunction · 0.85
newsymFunction · 0.85
pline_monFunction · 0.85
MonnamFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected