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

Function level_distance

src/detect.c:1141–1185  ·  view source on GitHub ↗

way back in 3.0plN and/or 2.x, you could use a crystal ball to find out where the wizard was relative to your current location; that was when the Wizard guarded the Amulet and was located on a random maze level, and you were expected to level teleport deep into Hell and hunt for him while working your way up; this isn't of much use anymore */

Source from the content-addressed store, hash-verified

1139 were expected to level teleport deep into Hell and hunt for him while
1140 working your way up; this isn't of much use anymore */
1141const char *
1142level_distance(d_level *where)
1143{
1144 schar ll = depth(&u.uz) - depth(where);
1145 boolean indun = (u.uz.dnum == where->dnum);
1146 const char *res = ""; /* always replaced by some other non-Null value */
1147
1148 if (ll < 0) {
1149 if (ll < (-8 - rn2(3)))
1150 if (!indun)
1151 res = "far away";
1152 else
1153 res = "far below";
1154 else if (ll < -1)
1155 if (!indun)
1156 res = "away below you";
1157 else
1158 res = "below you";
1159 else if (!indun)
1160 res = "in the distance";
1161 else
1162 res = "just below";
1163 } else if (ll > 0) {
1164 if (ll > (8 + rn2(3)))
1165 if (!indun)
1166 res = "far away";
1167 else
1168 res = "far above";
1169 else if (ll > 1)
1170 if (!indun)
1171 res = "away above you";
1172 else
1173 res = "above you";
1174 else if (!indun)
1175 res = "in the distance";
1176 else
1177 res = "just above";
1178 } else { /* l1 == 0 */
1179 if (!indun)
1180 res = "in the distance";
1181 else
1182 res = "near you";
1183 }
1184 return res;
1185}
1186
1187 /*
1188 * This could be made a lot more useful. Especially now that

Callers 1

use_crystal_ballFunction · 0.85

Calls 2

depthFunction · 0.85
rn2Function · 0.85

Tested by

no test coverage detected