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

Function silver_sears

src/weapon.c:435–466  ·  view source on GitHub ↗

give a "silver sears " message; not used for weapon hit, so we only handle rings */

Source from the content-addressed store, hash-verified

433/* give a "silver <item> sears <target>" message;
434 not used for weapon hit, so we only handle rings */
435void
436silver_sears(struct monst *magr UNUSED, struct monst *mdef,
437 long silverhit)
438{
439 char rings[20]; /* plenty of room for "rings" */
440 int ltyp = ((uleft && (silverhit & W_RINGL) != 0L)
441 ? uleft->otyp : STRANGE_OBJECT),
442 rtyp = ((uright && (silverhit & W_RINGR) != 0L)
443 ? uright->otyp : STRANGE_OBJECT);
444 boolean both,
445 l_dknown = (uleft && uleft->dknown),
446 r_dknown = (uright && uright->dknown),
447 l_ag = (objects[ltyp].oc_material == SILVER && l_dknown),
448 r_ag = (objects[rtyp].oc_material == SILVER && r_dknown);
449
450 if ((silverhit & (W_RINGL | W_RINGR)) != 0L) {
451 /* plural if both the same type (so not multi_claw and both rings
452 are non-Null) and either both known or neither known, or both
453 silver (in case there is ever more than one type of silver ring)
454 and both known; singular if multi_claw (where one of ltyp or
455 rtyp will always be STRANGE_OBJECT) even if both rings are known
456 silver [see hmonas(uhitm.c) for explanation of 'multi_claw'] */
457 both = ((ltyp == rtyp && l_dknown == r_dknown) || (l_ag && r_ag));
458 Sprintf(rings, "ring%s", both ? "s" : "");
459 Your("%s%s %s %s!",
460 (l_ag || r_ag) ? "silver "
461 : both ? ""
462 : ((silverhit & W_RINGL) != 0L) ? "left "
463 : "right ",
464 rings, vtense(rings, "sear"), mon_nam(mdef));
465 }
466}
467
468staticfn struct obj *oselect(struct monst *, int);
469#define Oselect(x) \

Callers 1

hmonasFunction · 0.85

Calls 3

YourFunction · 0.85
vtenseFunction · 0.85
mon_namFunction · 0.85

Tested by

no test coverage detected