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

Function trapeffect_magic_trap

src/trap.c:2292–2320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2290}
2291
2292staticfn int
2293trapeffect_magic_trap(
2294 struct monst *mtmp,
2295 struct trap *trap,
2296 unsigned int trflags)
2297{
2298 if (mtmp == &gy.youmonst) {
2299 seetrap(trap);
2300 if (!rn2(30)) {
2301 deltrap(trap);
2302 newsym(u.ux, u.uy); /* update position */
2303 You("are caught in a magical explosion!");
2304 losehp(rnd(10), "magical explosion", KILLED_BY_AN);
2305 Your("body absorbs some of the magical energy!");
2306 u.uen = (u.uenmax += 2);
2307 if (u.uenmax > u.uenpeak)
2308 u.uenpeak = u.uenmax;
2309 return Trap_Effect_Finished;
2310 } else {
2311 domagictrap();
2312 }
2313 (void) steedintrap(trap, (struct obj *) 0);
2314 } else {
2315 /* A magic trap. Monsters usually immune. */
2316 if (!rn2(21))
2317 return trapeffect_fire_trap(mtmp, trap, trflags);
2318 }
2319 return Trap_Effect_Finished;
2320}
2321
2322staticfn int
2323trapeffect_anti_magic(

Callers 1

trapeffect_selectorFunction · 0.85

Calls 11

seetrapFunction · 0.85
rn2Function · 0.85
deltrapFunction · 0.85
newsymFunction · 0.85
YouFunction · 0.85
losehpFunction · 0.85
rndFunction · 0.85
YourFunction · 0.85
domagictrapFunction · 0.85
steedintrapFunction · 0.85
trapeffect_fire_trapFunction · 0.85

Tested by

no test coverage detected