can't hold an unsolid target (ghosts, lights, vortices, most elementals) or a long worm tail */
| 594 | /* can't hold an unsolid target (ghosts, lights, vortices, most elementals) |
| 595 | or a long worm tail */ |
| 596 | boolean |
| 597 | failed_grab( |
| 598 | struct monst *magr, |
| 599 | struct monst *mdef, |
| 600 | struct attack *mattk) |
| 601 | { |
| 602 | if ((unsolid(mdef->data) || gn.notonhead) |
| 603 | /* hug attack: most holders (owlbear, python, pit fiend, &c); |
| 604 | wrap damage: eel grabbing, trapper/lurker-above engulfing; |
| 605 | stick-to damage: mimic, lichen; |
| 606 | digestion damage: purple worm swallowing */ |
| 607 | && (mattk->aatyp == AT_HUGS || mattk->adtyp == AD_WRAP |
| 608 | || mattk->adtyp == AD_STCK || mattk->adtyp == AD_DGST)) { |
| 609 | if ((gv.vis && canspotmon(mdef)) /* mon-vs-mon */ |
| 610 | || magr == &gy.youmonst || mdef == &gy.youmonst) { |
| 611 | char magrnam[BUFSZ], mdefnam[BUFSZ]; |
| 612 | boolean tailmiss = gn.notonhead; |
| 613 | const char *verb = (mattk->adtyp == AD_DGST) ? "gulp" |
| 614 | : (mattk->adtyp == AD_STCK) ? "adhere" |
| 615 | : "grab"; |
| 616 | |
| 617 | /* beware of "Foo's grab passes through Bar's ghost"; |
| 618 | mon_nam(x_monnam) calls s_suffix() for named ghosts and |
| 619 | s_suffix() uses a single static buffer; make copies of both |
| 620 | names to overcome that [note: comment predates 'tailmiss'] */ |
| 621 | Strcpy(magrnam, (magr == &gy.youmonst) ? "Your" |
| 622 | : s_suffix(Monnam(magr))); |
| 623 | if (!tailmiss) { |
| 624 | Strcpy(mdefnam, (mdef == &gy.youmonst) ? "you" |
| 625 | : mon_nam(mdef)); |
| 626 | } else { |
| 627 | /* hero poly'd into long worm can't grow tail |
| 628 | so no 'youmonst' handling is needed here */ |
| 629 | Sprintf(mdefnam, "%s tail", s_suffix(some_mon_nam(mdef))); |
| 630 | } |
| 631 | /* unsolid grab misses are actually somewhat iffy--how come |
| 632 | ordinary attacks don't also pass right through? */ |
| 633 | pline("%.99s %s attempt %s %.99s!", magrnam, verb, |
| 634 | !tailmiss ? "passes right through" : "fails to hold", |
| 635 | mdefnam); |
| 636 | } |
| 637 | return TRUE; |
| 638 | } |
| 639 | return FALSE; |
| 640 | } |
| 641 | |
| 642 | /* Returns the result of mdamagem(). */ |
| 643 | staticfn int |