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

Function u_catch_thrown_obj

src/mthrowu.c:532–550  ·  view source on GitHub ↗

hero may catch thrown obj. it is added to inventory, if possible */

Source from the content-addressed store, hash-verified

530
531/* hero may catch thrown obj. it is added to inventory, if possible */
532staticfn boolean
533u_catch_thrown_obj(struct obj *otmp)
534{
535 int catch_chance = 100 - ACURR(A_DEX)
536 - ((Role_if(PM_MONK) || Role_if(PM_ROGUE)) ? 20 : 0);
537
538 if (!Blind && !Confusion && !Stunned && !Fumbling
539 && otmp->oclass != VENOM_CLASS
540 && !nohands(gy.youmonst.data) && freehand()
541 && calc_capacity(otmp->owt) <= SLT_ENCUMBER && !rn2(catch_chance)) {
542 char buf[BUFSZ];
543
544 Snprintf(buf, BUFSZ, "You catch the %s!", simpleonames(otmp));
545 (void) hold_another_object(otmp, "You catch, but drop, the %s.",
546 simpleonames(otmp), buf);
547 return TRUE;
548 }
549 return FALSE;
550}
551
552#define MT_FLIGHTCHECK(pre,forcehit) \
553 (/* missile hits edge of screen */ \

Callers 1

mthrowu.cFile · 0.85

Calls 5

freehandFunction · 0.85
calc_capacityFunction · 0.85
rn2Function · 0.85
simpleonamesFunction · 0.85
hold_another_objectFunction · 0.85

Tested by

no test coverage detected