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

Function weapon_insight

src/insight.c:1269–1465  ·  view source on GitHub ↗

extracted from status_enlightenment() to reduce clutter there */

Source from the content-addressed store, hash-verified

1267
1268/* extracted from status_enlightenment() to reduce clutter there */
1269staticfn void
1270weapon_insight(int final)
1271{
1272 char buf[BUFSZ];
1273 int wtype;
1274
1275 /* report being weaponless; distinguish whether gloves are worn
1276 [perhaps mention silver ring(s) when not wearing gloves?] */
1277 if (!uwep) {
1278 you_are(empty_handed(), "");
1279
1280 /* two-weaponing implies hands and
1281 a weapon or wep-tool (not other odd stuff) in each hand */
1282 } else if (u.twoweap) {
1283 you_are("wielding two weapons at once", "");
1284
1285 /* report most weapons by their skill class (so a katana will be
1286 described as a long sword, for instance; mattock, hook, and aklys
1287 are exceptions), or wielded non-weapon item by its object class */
1288 } else {
1289 const char *what = weapon_descr(uwep);
1290
1291 /* [what about other silver items?] */
1292 if (uwep->otyp == SHIELD_OF_REFLECTION)
1293 what = shield_simple_name(uwep); /* silver|smooth shield */
1294 else if (is_wet_towel(uwep))
1295 what = /* (uwep->spe < 3) ? "moist towel" : */ "wet towel";
1296
1297 if (!strcmpi(what, "armor") || !strcmpi(what, "food")
1298 || !strcmpi(what, "venom"))
1299 Sprintf(buf, "wielding some %s", what);
1300 else
1301 /* [maybe include known blessed?] */
1302 Sprintf(buf, "wielding %s",
1303 (uwep->quan == 1L) ? an(what) : makeplural(what));
1304 you_are(buf, "");
1305 }
1306
1307 /*
1308 * Skill with current weapon. Might help players who've never
1309 * noticed #enhance or decided that it was pointless.
1310 */
1311 if ((wtype = weapon_type(uwep)) != P_NONE && (!uwep || !is_ammo(uwep))) {
1312 char sklvlbuf[20];
1313 int sklvl = P_SKILL(wtype);
1314 boolean hav = (sklvl != P_UNSKILLED && sklvl != P_SKILLED);
1315
1316 if (sklvl == P_ISRESTRICTED)
1317 Strcpy(sklvlbuf, "no");
1318 else
1319 (void) lcase(skill_level_name(wtype, sklvlbuf));
1320 /* "you have no/basic/expert/master/grand-master skill with <skill>"
1321 or "you are unskilled/skilled in <skill>" */
1322 Sprintf(buf, "%s %s %s", sklvlbuf,
1323 hav ? "skill with" : "in", skill_name(wtype));
1324
1325 if (!u.twoweap) {
1326 if (can_advance(wtype, FALSE))

Callers 1

status_enlightenmentFunction · 0.85

Calls 12

empty_handedFunction · 0.85
weapon_descrFunction · 0.85
shield_simple_nameFunction · 0.85
anFunction · 0.85
makepluralFunction · 0.85
weapon_typeFunction · 0.85
lcaseFunction · 0.85
skill_level_nameFunction · 0.85
skill_nameFunction · 0.85
can_advanceFunction · 0.85
eosFunction · 0.85
you_haveFunction · 0.85

Tested by

no test coverage detected