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

Function glibr

src/do_wear.c:2527–2627  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2525}
2526
2527void
2528glibr(void)
2529{
2530 struct obj *otmp;
2531 int xfl = 0;
2532 boolean leftfall, rightfall, wastwoweap = FALSE;
2533 const char *otherwep = 0, *thiswep, *which, *hand;
2534
2535 leftfall = (uleft && !uleft->cursed
2536 && (!uwep || !(welded(uwep) && ULEFTY)
2537 || !bimanual(uwep)));
2538 rightfall = (uright && !uright->cursed
2539 && (!uwep || !(welded(uwep) && URIGHTY)
2540 || !bimanual(uwep)));
2541/*
2542 leftfall = (uleft && !uleft->cursed
2543 && (!uwep || !welded(uwep) || !bimanual(uwep)));
2544 rightfall = (uright && !uright->cursed && (!welded(uwep)));
2545*/
2546
2547 if (!uarmg && (leftfall || rightfall) && !nolimbs(gy.youmonst.data)) {
2548 /* changed so cursed rings don't fall off, GAN 10/30/86 */
2549 Your("%s off your %s.",
2550 (leftfall && rightfall) ? "rings slip" : "ring slips",
2551 (leftfall && rightfall) ? fingers_or_gloves(FALSE)
2552 : body_part(FINGER));
2553 xfl++;
2554 if (leftfall) {
2555 otmp = uleft;
2556 Ring_off(uleft);
2557 dropx(otmp);
2558 cmdq_clear(CQ_CANNED);
2559 }
2560 if (rightfall) {
2561 otmp = uright;
2562 Ring_off(uright);
2563 dropx(otmp);
2564 cmdq_clear(CQ_CANNED);
2565 }
2566 }
2567
2568 otmp = uswapwep;
2569 if (u.twoweap && otmp) {
2570 /* secondary weapon doesn't need nearly as much handling as
2571 primary; when in two-weapon mode, we know it's one-handed
2572 with something else in the other hand and also that it's
2573 a weapon or weptool rather than something unusual, plus
2574 we don't need to compare its type with the primary */
2575 otherwep = is_sword(otmp) ? c_sword : weapon_descr(otmp);
2576 if (otmp->quan > 1L)
2577 otherwep = makeplural(otherwep);
2578 hand = body_part(HAND);
2579 which = URIGHTY ? "left " : "right "; /* text for the off hand */
2580 Your("%s %s%s from your %s%s.", otherwep, xfl ? "also " : "",
2581 otense(otmp, "slip"), which, hand);
2582 xfl++;
2583 wastwoweap = TRUE;
2584 setuswapwep((struct obj *) 0); /* clears u.twoweap */

Callers 1

allmain.cFile · 0.85

Calls 15

weldedFunction · 0.85
YourFunction · 0.85
fingers_or_glovesFunction · 0.85
body_partFunction · 0.85
Ring_offFunction · 0.85
dropxFunction · 0.85
cmdq_clearFunction · 0.85
weapon_descrFunction · 0.85
makepluralFunction · 0.85
otenseFunction · 0.85
setuswapwepFunction · 0.85
canletgoFunction · 0.85

Tested by

no test coverage detected