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

Function trap_predicament

src/insight.c:232–261  ·  view source on GitHub ↗

describe u.utraptype; used by status_enlightenment() and self_lookat() */

Source from the content-addressed store, hash-verified

230
231/* describe u.utraptype; used by status_enlightenment() and self_lookat() */
232char *
233trap_predicament(char *outbuf, int final, boolean wizxtra)
234{
235 struct trap *t;
236
237 /* caller has verified u.utrap */
238 *outbuf = '\0';
239 switch (u.utraptype) {
240 case TT_BURIEDBALL:
241 Strcpy(outbuf, "tethered to something buried");
242 break;
243 case TT_LAVA:
244 Sprintf(outbuf, "sinking into %s", final ? "lava" : hliquid("lava"));
245 break;
246 case TT_INFLOOR:
247 Sprintf(outbuf, "stuck in %s", the(surface(u.ux, u.uy)));
248 break;
249 default: /* TT_BEARTRAP, TT_PIT, or TT_WEB */
250 Strcpy(outbuf, "trapped");
251 if ((t = t_at(u.ux, u.uy)) != 0) /* should never be null */
252 Sprintf(eos(outbuf), " in %s", an(trapname(t->ttyp, FALSE)));
253 break;
254 }
255 if (wizxtra) { /* give extra information for wizard mode enlightenment */
256 /* curly braces: u.utrap is an escape attempt counter rather than a
257 turn timer so use different ornamentation than usual parentheses */
258 Sprintf(eos(outbuf), " {%u}", u.utrap);
259 }
260 return outbuf;
261}
262
263/* check whether hero is wearing something that player definitely knows
264 confers the target property; item must have been seen and its type

Callers 2

self_lookatFunction · 0.85
status_enlightenmentFunction · 0.85

Calls 7

hliquidFunction · 0.85
theFunction · 0.85
surfaceFunction · 0.85
t_atFunction · 0.85
eosFunction · 0.85
anFunction · 0.85
trapnameFunction · 0.85

Tested by

no test coverage detected