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

Function mkot_trap_warn

src/artifact.c:2752–2770  ·  view source on GitHub ↗

sense adjacent traps if wielding MKoT without wearing gloves */

Source from the content-addressed store, hash-verified

2750
2751/* sense adjacent traps if wielding MKoT without wearing gloves */
2752void
2753mkot_trap_warn(void)
2754{
2755 static const char *const heat[7] = {
2756 "cool", "slightly warm", "warm", "very warm",
2757 "hot", "very hot", "like fire"
2758 };
2759
2760 if (!uarmg && u_wield_art(ART_MASTER_KEY_OF_THIEVERY)) {
2761 int idx, ntraps = count_surround_traps(u.ux, u.uy);
2762
2763 if (ntraps != gm.mkot_trap_warn_count) {
2764 idx = min(ntraps, SIZE(heat) - 1);
2765 pline_The("Key feels %s%c", heat[idx], (ntraps > 3) ? '!' : '.');
2766 }
2767 gm.mkot_trap_warn_count = ntraps;
2768 } else
2769 gm.mkot_trap_warn_count = 0;
2770}
2771
2772/* Master Key is magic key if its bless/curse state meets our criteria:
2773 not cursed for rogues or blessed for non-rogues */

Callers 1

allmain.cFile · 0.85

Calls 2

count_surround_trapsFunction · 0.85
pline_TheFunction · 0.85

Tested by

no test coverage detected