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

Function trapeffect_poly_trap

src/trap.c:2452–2525  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2450}
2451
2452staticfn int
2453trapeffect_poly_trap(
2454 struct monst *mtmp,
2455 struct trap *trap,
2456 unsigned int trflags)
2457{
2458 if (mtmp == &gy.youmonst) {
2459 boolean viasitting = (trflags & VIASITTING) != 0;
2460 int steed_article = ARTICLE_THE;
2461 char verbbuf[BUFSZ];
2462
2463 /* suppress article in various steed messages when using its
2464 name (which won't occur when hallucinating) */
2465 if (u.usteed && has_mgivenname(u.usteed) && !Hallucination)
2466 steed_article = ARTICLE_NONE;
2467
2468 seetrap(trap);
2469 if (viasitting)
2470 Strcpy(verbbuf, "trigger"); /* follows "You sit down." */
2471 else if (u.usteed)
2472 Sprintf(verbbuf, "lead %s onto",
2473 x_monnam(u.usteed, steed_article, (char *) 0,
2474 SUPPRESS_SADDLE, FALSE));
2475 else
2476 Sprintf(verbbuf, "%s onto", u_locomotion("step"));
2477 You("%s a polymorph trap!", verbbuf);
2478 if (wearing_iron_shoes(mtmp)) {
2479 deltrap(trap);
2480 pline("%s warps strangely.", Yname2(uarmf));
2481 poly_obj(
2482 uarmf, uarmf->otyp == IRON_SHOES ? KICKING_BOOTS : IRON_SHOES);
2483 update_inventory();
2484 if (uarmf)
2485 prinv(NULL, uarmf, 0);
2486 } else if (Antimagic || Unchanging) {
2487 shieldeff(u.ux, u.uy);
2488 You_feel("momentarily different.");
2489 /* Trap did nothing; don't remove it --KAA */
2490 } else {
2491 (void) steedintrap(trap, (struct obj *) 0);
2492 deltrap(trap); /* delete trap before polymorph */
2493 newsym(u.ux, u.uy); /* get rid of trap symbol */
2494 You_feel("a change coming over you.");
2495 polyself(POLY_NOFLAGS);
2496 }
2497 } else {
2498 boolean in_sight = canseemon(mtmp) || (mtmp == u.usteed);
2499
2500 if (wearing_iron_shoes(mtmp)) {
2501 /* remove and readd the shoes to forcibly unwear them */
2502 struct obj *shoes = which_armor(mtmp, W_ARMF);
2503 extract_from_minvent(mtmp, shoes, TRUE, TRUE);
2504 if (mpickobj(mtmp, shoes)) {
2505 impossible("re-equipping iron shoes destroyed them?");
2506 return Trap_Effect_Finished;
2507 }
2508 shoes = poly_obj(
2509 shoes, shoes->otyp == IRON_SHOES ? KICKING_BOOTS : IRON_SHOES);

Callers 1

trapeffect_selectorFunction · 0.85

Calls 15

seetrapFunction · 0.85
u_locomotionFunction · 0.85
YouFunction · 0.85
wearing_iron_shoesFunction · 0.85
deltrapFunction · 0.85
Yname2Function · 0.85
poly_objFunction · 0.85
update_inventoryFunction · 0.85
prinvFunction · 0.85
shieldeffFunction · 0.85
You_feelFunction · 0.85
steedintrapFunction · 0.85

Tested by

no test coverage detected