Home | History | Annotate | Download | only in hack

Lines Matching refs:obj

78 static int drop(struct obj *);
79 static void dropy(struct obj *);
88 drop(struct obj *obj)
90 if (!obj)
92 if (obj->olet == '$') { /* pseudo object */
93 long amount = OGOLD(obj);
104 free(obj);
107 if (obj->owornmask & (W_ARMOR | W_RING)) {
111 if (obj == uwep) {
116 setuwep((struct obj *) 0);
118 pline("You dropped %s.", doname(obj));
119 dropx(obj);
125 dropx(struct obj *obj)
127 freeinv(obj);
128 dropy(obj);
132 dropy(struct obj *obj)
134 if (obj->otyp == CRYSKNIFE)
135 obj->otyp = WORM_TOOTH;
136 obj->ox = u.ux;
137 obj->oy = u.uy;
138 obj->nobj = fobj;
139 fobj = obj;
142 subfrombill(obj);
143 stackobj(obj);
333 struct obj *obj;
337 obj = getobj("#)", "throw"); /* it is also possible to throw food */
339 if (!obj || !getdir(1)) /* ask "in what direction?" */
341 if (obj->owornmask & (W_ARMOR | W_RING)) {
347 if (obj == uwep) {
348 if (obj->cursed) {
352 if (obj->quan > 1)
353 setuwep(splitobj(obj, 1));
355 setuwep((struct obj *) 0);
356 } else if (obj->quan > 1)
357 (void) splitobj(obj, 1);
358 freeinv(obj);
366 Doname(obj)); /* note: obj->quan == 1 */
367 if (obj->olet == POTION_SYM)
368 potionhit(&youmonst, obj);
372 losehp(uarmh ? 1 : rnd((int) (obj->owt)), "falling object");
373 dropy(obj);
376 pline("%s hits the floor.", Doname(obj));
377 if (obj->otyp == EXPENSIVE_CAMERA) {
379 obfree(obj, Null(obj));
380 } else if (obj->otyp == EGG) {
382 obfree(obj, Null(obj));
383 } else if (obj->olet == POTION_SYM) {
385 potionbreathe(obj);
386 obfree(obj, Null(obj));
388 dropy(obj);
392 } else if (obj->otyp == BOOMERANG) {
395 (void) addinv(obj);
399 if (obj->otyp == PICK_AXE && shkcatch(obj))
402 mon = bhit(u.dx, u.dy, (obj->otyp == ICE_BOX) ? 1 :
403 (!Punished || obj != uball) ? 8 : !u.ustuck ? 5 : 1,
404 obj->olet,
405 (void (*)(struct monst *, struct obj *)) 0,
406 (int (*)(struct obj *, struct obj *)) 0, obj);
412 if (obj->olet == WEAPON_SYM) {
414 if (obj->otyp < ROCK) {
416 uwep->otyp != obj->otyp + (BOW - ARROW))
421 } else if (obj->otyp == BOOMERANG)
423 tmp += obj->spe;
425 if (hmon(mon, obj, 1) == TRUE) {
428 cutworm(mon, bhitpos.x, bhitpos.y, obj->otyp);
433 if (obj->otyp < BOOMERANG && rn2(3)) {
435 obfree(obj, (struct obj *) 0);
439 miss(objects[obj->otyp].oc_name, mon);
440 } else if (obj->otyp == HEAVY_IRON_BALL) {
442 if (!Punished || obj != uball)
447 if (hmon(mon, obj, 1) == FALSE)
451 } else if (obj->olet == POTION_SYM && u.ulevel > rn2(15)) {
452 potionhit(mon, obj);
459 if (obj->olet == FOOD_SYM && mon->data->mlet == 'd')
460 if (tamedog(mon, obj))
462 if (obj->olet == GEM_SYM && mon->data->mlet == 'u' &&
464 if (obj->dknown && objects[obj->otyp].oc_name_known) {
465 if (objects[obj->otyp].g_val > 0) {
479 mpickobj(mon, obj);
487 if (obj->otyp == CRYSKNIFE)
488 obj->otyp = WORM_TOOTH;
489 obj->ox = bhitpos.x;
490 obj->oy = bhitpos.y;
491 obj->nobj = fobj;
492 fobj = obj;
494 /* subfrombill(obj); */
495 stackobj(obj);
496 if (Punished && obj == uball &&
527 /* split obj so that it gets size num */
529 struct obj *
530 splitobj(struct obj *obj, int num)
532 struct obj *otmp;
534 *otmp = *obj; /* copies whole structure */
537 obj->quan = num;
538 obj->owt = weight(obj);
540 otmp->owt = weight(otmp); /* -= obj->owt ? */
541 obj->nobj = otmp;
542 if (obj->unpaid)
543 splitbill(obj, otmp);