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

Function kick_monster

src/dokick.c:145–288  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143}
144
145staticfn void
146kick_monster(struct monst *mon, coordxy x, coordxy y)
147{
148 boolean clumsy = FALSE;
149 int i, j;
150
151 /* anger target even if wild miss will occur */
152 setmangry(mon, TRUE);
153
154 if (Levitation && !rn2(3) && verysmall(mon->data)
155 && !is_flyer(mon->data)) {
156 pline("Floating in the air, you miss wildly!");
157 exercise(A_DEX, FALSE);
158 (void) passive(mon, uarmf, FALSE, 1, AT_KICK, FALSE);
159 return;
160 }
161
162 /* reveal hidden target even if kick ends up missing (note: being
163 hidden doesn't affect chance to hit so neither does this reveal) */
164 if (mon->mundetected
165 || (M_AP_TYPE(mon) && M_AP_TYPE(mon) != M_AP_MONSTER)) {
166 if (M_AP_TYPE(mon))
167 seemimic(mon);
168 mon->mundetected = 0;
169 if (!canspotmon(mon))
170 map_invisible(x, y);
171 else
172 newsym(x, y);
173 There("is %s here.",
174 canspotmon(mon) ? a_monnam(mon) : "something hidden");
175 }
176
177 /* Kick attacks by kicking monsters are normal attacks, not special.
178 * This is almost always worthless, since you can either take one turn
179 * and do all your kicks, or else take one turn and attack the monster
180 * normally, getting all your attacks _including_ all your kicks.
181 * If you have >1 kick attack, you get all of them.
182 */
183 if (Upolyd && attacktype(gy.youmonst.data, AT_KICK)) {
184 struct attack *uattk;
185 int sum, kickdieroll, armorpenalty, specialdmg,
186 attknum = 0,
187 tmp = find_roll_to_hit(mon, AT_KICK, (struct obj *) 0, &attknum,
188 &armorpenalty);
189 mon_maybe_unparalyze(mon);
190
191 for (i = 0; i < NATTK; i++) {
192 /* first of two kicks might have provoked counterattack
193 that has incapacitated the hero (ie, floating eye) */
194 if (gm.multi < 0)
195 break;
196
197 uattk = &gy.youmonst.data->mattk[i];
198 /* we only care about kicking attacks here */
199 if (uattk->aatyp != AT_KICK)
200 continue;
201
202 kickdieroll = rnd(20);

Callers 1

dokickFunction · 0.85

Calls 15

setmangryFunction · 0.85
rn2Function · 0.85
exerciseFunction · 0.85
passiveFunction · 0.85
seemimicFunction · 0.85
map_invisibleFunction · 0.85
newsymFunction · 0.85
ThereFunction · 0.85
a_monnamFunction · 0.85
attacktypeFunction · 0.85
find_roll_to_hitFunction · 0.85
mon_maybe_unparalyzeFunction · 0.85

Tested by

no test coverage detected