really hit target monster; returns TRUE if it still lives */
| 584 | |
| 585 | /* really hit target monster; returns TRUE if it still lives */ |
| 586 | staticfn boolean |
| 587 | known_hitum( |
| 588 | struct monst *mon, /* target */ |
| 589 | struct obj *weapon, /* uwep or uswapwep */ |
| 590 | int *mhit, /* *mhit is 1 or 0; hit (1) gets changed to miss (0) |
| 591 | * for decapitation attack against headless target */ |
| 592 | int rollneeded, /* rollneeded and armorpenalty are used for monks +*/ |
| 593 | int armorpenalty, /*+ wearing suits so miss message can vary for missed |
| 594 | * because of penalty vs would have missed anyway */ |
| 595 | struct attack *uattk, |
| 596 | int dieroll) |
| 597 | { |
| 598 | boolean malive = TRUE, |
| 599 | /* hmon() might destroy weapon; remember aspect for cutworm */ |
| 600 | slice_or_chop = (weapon && (is_blade(weapon) || is_axe(weapon))); |
| 601 | |
| 602 | if (go.override_confirmation) { |
| 603 | /* this may need to be generalized if weapons other than |
| 604 | Stormbringer acquire similar anti-social behavior... */ |
| 605 | if (flags.verbose) |
| 606 | Your("bloodthirsty blade attacks!"); |
| 607 | } |
| 608 | |
| 609 | if (!*mhit) { |
| 610 | missum(mon, uattk, (rollneeded + armorpenalty > dieroll)); |
| 611 | } else { |
| 612 | int oldhp = mon->mhp; |
| 613 | long oldweaphit = u.uconduct.weaphit; |
| 614 | |
| 615 | /* KMH, conduct */ |
| 616 | if (weapon && (weapon->oclass == WEAPON_CLASS || is_weptool(weapon))) |
| 617 | u.uconduct.weaphit++; |
| 618 | |
| 619 | /* we hit the monster; be careful: it might die or |
| 620 | be knocked into a different location */ |
| 621 | gn.notonhead = (mon->mx != gb.bhitpos.x || mon->my != gb.bhitpos.y); |
| 622 | malive = hmon(mon, weapon, HMON_MELEE, dieroll); |
| 623 | if (malive) { |
| 624 | /* monster still alive */ |
| 625 | if (!rn2(25) && mon->mhp < mon->mhpmax / 2 |
| 626 | && !engulfing_u(mon)) { |
| 627 | /* maybe should regurgitate if swallowed? */ |
| 628 | monflee(mon, !rn2(3) ? rnd(100) : 0, FALSE, TRUE); |
| 629 | |
| 630 | if (u.ustuck == mon && !u.uswallow |
| 631 | && !sticks(gy.youmonst.data)) |
| 632 | set_ustuck((struct monst *) 0); |
| 633 | } |
| 634 | /* Vorpal Blade hit converted to miss */ |
| 635 | /* could be headless monster or worm tail */ |
| 636 | if (mon->mhp == oldhp) { |
| 637 | *mhit = 0; |
| 638 | /* a miss does not break conduct */ |
| 639 | u.uconduct.weaphit = oldweaphit; |
| 640 | } |
| 641 | if (mon->wormno && *mhit) |
| 642 | cutworm(mon, gb.bhitpos.x, gb.bhitpos.y, slice_or_chop); |
| 643 | } |