MCPcopy Index your code
hub / github.com/NetHack/NetHack / shield_simple_name

Function shield_simple_name

src/objnam.c:5569–5596  ·  view source on GitHub ↗

simplified shield for messages */

Source from the content-addressed store, hash-verified

5567
5568/* simplified shield for messages */
5569const char *
5570shield_simple_name(struct obj *shield)
5571{
5572 if (shield) {
5573 /* xname() describes unknown (unseen) reflection as smooth */
5574 if (shield->otyp == SHIELD_OF_REFLECTION)
5575 return shield->dknown ? "silver shield" : "smooth shield";
5576 /*
5577 * We might distinguish between wooden vs metallic or
5578 * light vs heavy to give small benefit to spell casters.
5579 * Fighter types probably care more about the former for
5580 * vulnerability to fire or rust.
5581 *
5582 * We could do that both ways: light wooden shield, light
5583 * metallic shield (there aren't any), heavy wooden shield,
5584 * and heavy metallic shield but that's getting away from
5585 * "simple name" which is intended to be shorter as well
5586 * as less detailed than xname().
5587 */
5588#if 0
5589 /* spellcasting uses a division like this */
5590 return (weight(shield) > (int) objects[SMALL_SHIELD].oc_weight)
5591 ? "heavy shield"
5592 : "light shield";
5593#endif
5594 }
5595 return "shield";
5596}
5597
5598/* for completeness */
5599const char *

Callers 5

armoroffFunction · 0.85
disintegrate_armFunction · 0.85
armor_simple_nameFunction · 0.85
item_whatFunction · 0.85
weapon_insightFunction · 0.85

Calls 1

weightFunction · 0.85

Tested by

no test coverage detected