Help a monster out of a bear trap or web, or if no monster is present, disarm a bear trap or destroy a web. Helge Hafting */
| 5550 | /* Help a monster out of a bear trap or web, or if no monster is |
| 5551 | present, disarm a bear trap or destroy a web. Helge Hafting */ |
| 5552 | staticfn int |
| 5553 | disarm_holdingtrap(struct trap *ttmp) |
| 5554 | { |
| 5555 | struct monst *mtmp; |
| 5556 | const char *which = the_your[ttmp->madeby_u]; |
| 5557 | int fails = try_disarm(ttmp, FALSE); |
| 5558 | |
| 5559 | if (fails < 2) |
| 5560 | return fails; |
| 5561 | |
| 5562 | /* ok, disarm it. */ |
| 5563 | |
| 5564 | /* untrap the monster, if any. |
| 5565 | There's no need for a cockatrice test, only the trap is touched */ |
| 5566 | if ((mtmp = m_at(ttmp->tx, ttmp->ty)) != 0) { |
| 5567 | mtmp->mtrapped = 0; |
| 5568 | You("extract %s from %s %s.", mon_nam(mtmp), |
| 5569 | which, (ttmp->ttyp == BEAR_TRAP) ? "bear trap" : "web"); |
| 5570 | reward_untrap(ttmp, mtmp); |
| 5571 | } else if (ttmp->ttyp == BEAR_TRAP) { |
| 5572 | You("disarm %s bear trap.", which); |
| 5573 | cnv_trap_obj(BEARTRAP, 1, ttmp, FALSE); |
| 5574 | } else if (ttmp->ttyp == WEB) { |
| 5575 | struct obj *wep = (uwep && is_blade(uwep)) ? uwep |
| 5576 | : (uswapwep && u.twoweap && is_blade(uswapwep)) |
| 5577 | ? uswapwep : NULL; |
| 5578 | |
| 5579 | if (wep && wep->oartifact |
| 5580 | && (u_wield_art(ART_STING) || attacks(AD_FIRE, wep))) |
| 5581 | pline("%s %s through %s web!", bare_artifactname(uwep), |
| 5582 | u_wield_art(ART_STING) ? "cuts" : "burns", which); |
| 5583 | else if (wep) |
| 5584 | You("cut through %s web.", which); |
| 5585 | else |
| 5586 | You("succeed in removing %s web.", which); |
| 5587 | deltrap(ttmp); |
| 5588 | } |
| 5589 | newsym(u.ux + u.dx, u.uy + u.dy); |
| 5590 | return 1; |
| 5591 | } |
| 5592 | |
| 5593 | staticfn int |
| 5594 | disarm_landmine(struct trap *ttmp) /* Helge Hafting */ |
no test coverage detected