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

Function kickdmg

src/dokick.c:33–123  ·  view source on GitHub ↗

kicking damage when not poly'd into a form with a kick attack */

Source from the content-addressed store, hash-verified

31
32/* kicking damage when not poly'd into a form with a kick attack */
33staticfn void
34kickdmg(struct monst *mon, boolean clumsy)
35{
36 int mdx, mdy;
37 int dmg = (ACURRSTR + ACURR(A_DEX) + ACURR(A_CON)) / 15;
38 int specialdmg, kick_skill = P_NONE;
39 boolean trapkilled = FALSE;
40
41 if (uarmf && uarmf->otyp == KICKING_BOOTS)
42 dmg += 5;
43
44 /* excessive wt affects dex, so it affects dmg */
45 if (clumsy)
46 dmg /= 2;
47
48 /* kicking a dragon or an elephant will not harm it */
49 if (thick_skinned(mon->data))
50 dmg = 0;
51
52 /* attacking a shade is normally useless */
53 if (mon->data == &mons[PM_SHADE])
54 dmg = 0;
55
56 specialdmg = special_dmgval(&gy.youmonst, mon, W_ARMF, (long *) 0);
57
58 if (mon->data == &mons[PM_SHADE] && !specialdmg) {
59 pline_The("%s.", kick_passes_thru);
60 /* doesn't exercise skill or abuse alignment or frighten pet,
61 and shades have no passive counterattack */
62 return;
63 }
64
65 if (M_AP_TYPE(mon))
66 seemimic(mon);
67
68 check_caitiff(mon);
69
70 /* squeeze some guilt feelings... */
71 if (mon->mtame) {
72 abuse_dog(mon);
73 if (mon->mtame)
74 monflee(mon, (dmg ? rnd(dmg) : 1), FALSE, FALSE);
75 else
76 mon->mflee = 0;
77 }
78
79 if (dmg > 0) {
80 /* convert potential damage to actual damage */
81 dmg = rnd(dmg);
82 if (martial()) {
83 if (dmg > 1)
84 kick_skill = P_MARTIAL_ARTS;
85 dmg += rn2(ACURR(A_DEX) / 2 + 1);
86 }
87 /* a good kick exercises your dex */
88 exercise(A_DEX, TRUE);
89 }
90 dmg += specialdmg; /* for blessed (or hypothetically, silver) boots */

Callers 1

kick_monsterFunction · 0.85

Calls 15

special_dmgvalFunction · 0.85
pline_TheFunction · 0.85
seemimicFunction · 0.85
check_caitiffFunction · 0.85
abuse_dogFunction · 0.85
monfleeFunction · 0.85
rndFunction · 0.85
rn2Function · 0.85
exerciseFunction · 0.85
goodposFunction · 0.85
MonnamFunction · 0.85
m_in_out_regionFunction · 0.85

Tested by

no test coverage detected