MCPcopy Create free account
hub / github.com/NetHack/NetHack / hitmsg

Function hitmsg

src/mhitu.c:28–81  ·  view source on GitHub ↗

monster hits hero (most callers have been moved to uthim.c) */

Source from the content-addressed store, hash-verified

26
27/* monster hits hero (most callers have been moved to uthim.c) */
28void
29hitmsg(struct monst *mtmp, struct attack *mattk)
30{
31 int compat;
32 const char *verb = 0, *again, *punct = "!";
33 char *Monst_name = Monnam(mtmp);
34
35 /* Note: if opposite gender, "seductively";
36 if same gender, "engagingly" for nymph, normal msg for others. */
37 if ((compat = could_seduce(mtmp, &gy.youmonst, mattk)) != 0
38 && !mtmp->mcan && !mtmp->mspec_used) {
39 pline_mon(mtmp, "%s %s you %s.", Monst_name,
40 !Blind ? "smiles at" : !Deaf ? "talks to" : "touches",
41 (compat == 2) ? "engagingly" : "seductively");
42 } else {
43 switch (mattk->aatyp) {
44 case AT_BITE:
45 verb = "bites";
46 break;
47 case AT_KICK:
48 if (thick_skinned(gy.youmonst.data))
49 punct = ".";
50 verb = "kicks";
51 break;
52 case AT_STNG:
53 verb = "stings";
54 break;
55 case AT_BUTT:
56 verb = "butts";
57 break;
58 case AT_TUCH:
59 verb = "touches you";
60 break;
61 case AT_TENT:
62 verb = "tentacles suck your brain";
63 Monst_name = s_suffix(Monst_name);
64 break;
65 case AT_EXPL:
66 case AT_BOOM:
67 verb = "explodes";
68 break;
69 default:
70 verb = "hits";
71 }
72 /* if a monster hits more than once with similar attack, say so */
73 again = (mtmp->m_id == gh.hitmsg_mid
74 && gh.hitmsg_prev != NULL
75 && mattk == gh.hitmsg_prev + 1
76 && mattk->aatyp == gh.hitmsg_prev->aatyp) ? " again" : "";
77 pline_mon(mtmp, "%s %s%s%s", Monst_name, verb, again, punct);
78 }
79 gh.hitmsg_mid = mtmp->m_id;
80 gh.hitmsg_prev = mattk;
81}
82
83/* monster missed you */
84staticfn void

Callers 15

mhitm_ad_rustFunction · 0.85
mhitm_ad_corrFunction · 0.85
mhitm_ad_dcayFunction · 0.85
mhitm_ad_drenFunction · 0.85
mhitm_ad_drliFunction · 0.85
mhitm_ad_fireFunction · 0.85
mhitm_ad_coldFunction · 0.85
mhitm_ad_elecFunction · 0.85
mhitm_ad_acidFunction · 0.85
mhitm_ad_sgldFunction · 0.85
mhitm_ad_tlptFunction · 0.85
mhitm_ad_cursFunction · 0.85

Calls 4

MonnamFunction · 0.85
could_seduceFunction · 0.85
pline_monFunction · 0.85
s_suffixFunction · 0.85

Tested by

no test coverage detected