Return the string name of the trap type passed in, unless the player is hallucinating, in which case return a random or hallucinatory trap name. */
| 7097 | /* Return the string name of the trap type passed in, unless the player is |
| 7098 | hallucinating, in which case return a random or hallucinatory trap name. */ |
| 7099 | const char * |
| 7100 | trapname( |
| 7101 | int ttyp, |
| 7102 | boolean override) /* if True, ignore Hallucination */ |
| 7103 | { |
| 7104 | static const char *const halu_trapnames[] = { |
| 7105 | /* riffs on actual nethack traps */ |
| 7106 | "bottomless pit", "polymorphism trap", "devil teleporter", |
| 7107 | "falling boulder trap", "anti-anti-magic field", "weeping gas trap", |
| 7108 | "queasy board", "electrified web", "owlbear trap", "sand mine", |
| 7109 | "vacillating triangle", |
| 7110 | /* some traps found in nethack variants */ |
| 7111 | "death trap", "disintegration trap", "ice trap", "monochrome trap", |
| 7112 | /* plausible real-life traps */ |
| 7113 | "axeblade trap", "pool of boiling oil", "pool of quicksand", |
| 7114 | "field of caltrops", "buzzsaw trap", "spiked floor", "revolving wall", |
| 7115 | "uneven floor", "finger trap", "jack-in-a-box", "yellow snow", |
| 7116 | "booby trap", "rat trap", "poisoned nail", "snare", "whirlpool", |
| 7117 | "trip wire", "roach motel (tm)", |
| 7118 | /* sci-fi */ |
| 7119 | "negative space", "tensor field", "singularity", "imperial fleet", |
| 7120 | "black hole", "thermal detonator", "event horizon", |
| 7121 | "entoptic phenomenon", |
| 7122 | /* miscellaneous suggestions */ |
| 7123 | "sweet-smelling gas vent", "phone booth", "exploding runes", |
| 7124 | "never-ending elevator", "slime pit", "warp zone", "illusory floor", |
| 7125 | "pile of poo", "honey trap", "tourist trap", |
| 7126 | "banana peel", "garden rake", "whoopie cushion", "box and stick trap", |
| 7127 | "fly trap", "legal trap", "pit of snakes", "pollywog trap", |
| 7128 | "slippery slope", "thirst trap", "suntrap", |
| 7129 | }; |
| 7130 | static char roletrap[33]; /* [17 + 5 + 1] should suffice */ |
| 7131 | |
| 7132 | if (Hallucination && !override) { |
| 7133 | int total_names = TRAPNUM + SIZE(halu_trapnames), |
| 7134 | nameidx = rn2_on_display_rng(total_names + 1); |
| 7135 | |
| 7136 | if (nameidx == total_names) { |
| 7137 | boolean fem = Upolyd ? u.mfemale : flags.female; |
| 7138 | |
| 7139 | /* inspired by "tourist trap" */ |
| 7140 | copynchars(roletrap, |
| 7141 | rn2(3) ? ((fem && gu.urole.name.f) ? gu.urole.name.f |
| 7142 | : gu.urole.name.m) |
| 7143 | : rank_of(u.ulevel, Role_switch, fem), |
| 7144 | (int) (sizeof roletrap - sizeof " trap")); |
| 7145 | Strcat(roletrap, " trap"); |
| 7146 | return lcase(roletrap); |
| 7147 | } else if (nameidx >= TRAPNUM) { |
| 7148 | nameidx -= TRAPNUM; |
| 7149 | return halu_trapnames[nameidx]; |
| 7150 | } /* else use an actual trap type */ |
| 7151 | if (nameidx != NO_TRAP) |
| 7152 | ttyp = nameidx; |
| 7153 | } |
| 7154 | return defsyms[trap_to_defsym(ttyp)].explanation; |
| 7155 | } |
| 7156 |
no test coverage detected