Returns the same values as mdamagem(). */
| 733 | |
| 734 | /* Returns the same values as mdamagem(). */ |
| 735 | staticfn int |
| 736 | gazemm(struct monst *magr, struct monst *mdef, struct attack *mattk) |
| 737 | { |
| 738 | char buf[BUFSZ]; |
| 739 | /* an Archon's gaze affects target even if Archon itself is blinded */ |
| 740 | boolean archon = (magr->data == &mons[PM_ARCHON] |
| 741 | && mattk->adtyp == AD_BLND), |
| 742 | altmesg = (archon && !magr->mcansee); |
| 743 | |
| 744 | /* bring target out of hiding even if hero doesn't see it happen (this |
| 745 | is already done in pre_mm_attack() and shouldn't be needed here) */ |
| 746 | if (mdef->data->mlet == S_MIMIC && M_AP_TYPE(mdef) != M_AP_NOTHING) |
| 747 | seemimic(mdef); |
| 748 | mdef->mundetected = 0; |
| 749 | |
| 750 | if (gv.vis) { |
| 751 | Sprintf(buf, "%s gazes %s", |
| 752 | altmesg ? Adjmonnam(magr, "blinded") : Monnam(magr), |
| 753 | altmesg ? "toward" : "at"); |
| 754 | pline("%s %s...", buf, |
| 755 | canspotmon(mdef) ? mon_nam(mdef) : "something"); |
| 756 | } |
| 757 | |
| 758 | if (magr->mcan || !mdef->mcansee |
| 759 | || (archon ? resists_blnd(mdef) : !magr->mcansee) |
| 760 | || (magr->minvis && !perceives(mdef->data)) || mdef->msleeping) { |
| 761 | if (gv.vis && canspotmon(mdef)) |
| 762 | pline("but nothing happens."); |
| 763 | return M_ATTK_MISS; |
| 764 | } |
| 765 | /* call mon_reflects 2x, first test, then, if visible, print message */ |
| 766 | if (magr->data == &mons[PM_MEDUSA] && mon_reflects(mdef, (char *) 0)) { |
| 767 | if (canseemon(mdef)) |
| 768 | (void) mon_reflects(mdef, "The gaze is reflected away by %s %s."); |
| 769 | if (mdef->mcansee) { |
| 770 | if (mon_reflects(magr, (char *) 0)) { |
| 771 | if (canseemon(magr)) |
| 772 | (void) mon_reflects(magr, |
| 773 | "The gaze is reflected away by %s %s."); |
| 774 | return M_ATTK_MISS; |
| 775 | } |
| 776 | if (mdef->minvis && !perceives(magr->data)) { |
| 777 | if (canseemon(magr)) { |
| 778 | pline( |
| 779 | "%s doesn't seem to notice that %s gaze was reflected.", |
| 780 | Monnam(magr), mhis(magr)); |
| 781 | } |
| 782 | return M_ATTK_MISS; |
| 783 | } |
| 784 | if (canseemon(magr)) |
| 785 | pline_mon(magr, "%s is turned to stone!", Monnam(magr)); |
| 786 | monstone(magr); |
| 787 | if (!DEADMONSTER(magr)) |
| 788 | return M_ATTK_MISS; |
| 789 | return M_ATTK_AGR_DIED; |
| 790 | } |
| 791 | } else if (archon) { |
| 792 | mhitm_ad_blnd(magr, mattk, mdef, (struct mhitm_data *) 0); |
no test coverage detected