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

Function slip_or_trip

src/timeout.c:1221–1341  ·  view source on GitHub ↗

give a fumble message */

Source from the content-addressed store, hash-verified

1219
1220/* give a fumble message */
1221staticfn void
1222slip_or_trip(void)
1223{
1224 struct obj *otmp = vobj_at(u.ux, u.uy), *otmp2, *saddle;
1225 const char *what;
1226 char buf[BUFSZ];
1227 boolean on_foot = !u.usteed;
1228
1229 if (otmp && on_foot && !u.uinwater && is_pool(u.ux, u.uy))
1230 otmp = 0;
1231
1232 if (otmp && on_foot) { /* trip over something in particular */
1233 /*
1234 If there is only one item, it will have just been named
1235 during the move, so refer to it by pronoun; otherwise,
1236 if the top item has been or can be seen, refer to it by
1237 name; if not, look for rocks to trip over; trip over
1238 anonymous "something" if there aren't any rocks.
1239 */
1240 what = (iflags.last_msg == PLNMSG_ONE_ITEM_HERE)
1241 ? ((otmp->quan == 1L) ? "it"
1242 : Hallucination ? "they" : "them")
1243 : (otmp->dknown || !Blind)
1244 ? doname(otmp)
1245 : ((otmp2 = sobj_at(ROCK, u.ux, u.uy)) == 0
1246 ? something
1247 : (otmp2->quan == 1L ? "a rock" : "some rocks"));
1248 if (Hallucination) {
1249 what = strcpy(buf, what);
1250 buf[0] = highc(buf[0]);
1251 pline("Egads! %s bite%s your %s!", what,
1252 (!otmp || otmp->quan == 1L) ? "s" : "", body_part(FOOT));
1253 } else {
1254 You("trip over %s.", what);
1255 }
1256 if (!uarmf && otmp->otyp == CORPSE
1257 && touch_petrifies(&mons[otmp->corpsenm]) && !Stone_resistance) {
1258 Sprintf(svk.killer.name, "tripping over %s corpse",
1259 an(mons[otmp->corpsenm].pmnames[NEUTRAL]));
1260 instapetrify(svk.killer.name);
1261 }
1262 } else if ((HFumbling & FROMOUTSIDE) || (is_ice(u.ux, u.uy) && !rn2(3))) {
1263 /* is fumbling from ice alone? */
1264 boolean ice_only = !(EFumbling || (HFumbling & ~FROMOUTSIDE));
1265
1266 pline("%s %s %s the ice.",
1267 u.usteed ? upstart(x_monnam(u.usteed, ARTICLE_THE, (char *) 0,
1268 SUPPRESS_SADDLE, FALSE))
1269 : "You",
1270 /* "steed": arbitrary value that will use third person verb
1271 regardless of what u.usteed might be named, as opposed to
1272 "you" (second person, which won't have final 's' added) */
1273 vtense(u.usteed ? "steed" : "you", rn2(2) ? "slip" : "slide"),
1274 /* sometimes slipping due to ice occurs during turn that hero
1275 has just moved off the ice; phrase things differently then */
1276 is_ice(u.ux, u.uy) ? "on" : "off");
1277 /* fumbling outside of ice while mounted always causes the hero to
1278 fall from the saddle (unless it is cursed), so to avoid a

Callers 1

nh_timeoutFunction · 0.85

Calls 15

is_poolFunction · 0.85
donameFunction · 0.85
sobj_atFunction · 0.85
highcFunction · 0.85
body_partFunction · 0.85
YouFunction · 0.85
anFunction · 0.85
instapetrifyFunction · 0.85
is_iceFunction · 0.85
rn2Function · 0.85
upstartFunction · 0.85
vtenseFunction · 0.85

Tested by

no test coverage detected