pline("Snatching %s is a fatal mistake.", kbuf);
instapetrify(kbuf);
}
- if (!touch_artifact(otmp, &youmonst))
- dropy(otmp);
- else
- otmp = hold_another_object(otmp, "You drop %s!",
+ otmp = hold_another_object(otmp, "You drop %s!",
doname(otmp), (const char *)0);
break;
default:
#endif /* OVL1 */
#ifdef OVLB
-/* Add an item to the inventory unless we're fumbling, and give a message.
+/* Add an item to the inventory unless we're fumbling or it refuses to be
+ * held (via touch_artifact), and give a message.
* If there aren't any free inventory slots, we'll drop it instead.
* If both success and failure messages are NULL, then we're just doing the
- * fumbling/slot-limit checking for a silent grab.
+ * fumbling/slot-limit checking for a silent grab. In any case,
+ * touch_artifact will print its own messages if they are warranted.
*/
struct obj *
hold_another_object(obj, drop_fmt, drop_arg, hold_msg)
char buf[BUFSZ];
if (!Blind) obj->dknown = 1; /* maximize mergibility */
+ if (obj->oartifact) {
+ /* place_object may change these */
+ boolean crysknife = (obj->otyp == CRYSKNIFE);
+ int oerode = obj->oerodeproof;
+
+ /* in case touching this object turns out to be fatal */
+ place_object(obj, u.ux, u.uy);
+
+ if (!touch_artifact(obj, &youmonst)) {
+ obj_extract_self(obj); /* remove it from the floor */
+ dropy(obj); /* now put it back again :-) */
+ return obj;
+ }
+ obj_extract_self(obj);
+ if (crysknife) {
+ obj->otyp = CRYSKNIFE;
+ obj->oerodeproof = oerode;
+ }
+ }
if (Fumbling) {
if (drop_fmt) pline(drop_fmt, drop_arg);
dropy(obj);
} else {
long oquan = obj->quan;
int prev_encumbr = near_capacity(); /* before addinv() */
+
/* encumbrance only matters if it would now become worse
than max( current_value, stressed ) */
if (prev_encumbr < MOD_ENCUMBER) prev_encumbr = MOD_ENCUMBER;
pline("%s finishes taking off %s suit.",
Monnam(mdef), mhis(mdef));
}
- if (!touch_artifact(otmp, &youmonst)) {
- dropy(otmp);
- continue;
- }
/* give the object to the character */
otmp = hold_another_object(otmp, "You steal %s.",
doname(otmp), "You steal: ");
+ if (otmp->where != OBJ_INVENT) continue;
if (otmp->otyp == CORPSE &&
touch_petrifies(&mons[otmp->corpsenm]) && !uarmg) {
char kbuf[BUFSZ];
u.uconduct.wishes++;
if (otmp != &zeroobj) {
- /* place_object looses these */
- boolean crysknife = (otmp->otyp == CRYSKNIFE);
- int oerode = otmp->oerodeproof;
-
- /* in case touching this object turns out to be fatal */
- place_object(otmp, u.ux, u.uy);
-
- if (otmp->oartifact && !touch_artifact(otmp,&youmonst)) {
- obj_extract_self(otmp); /* remove it from the floor */
- dropy(otmp); /* now put it back again :-) */
- } else {
- obj_extract_self(otmp);
- if (crysknife) {
- otmp->otyp = CRYSKNIFE;
- otmp->oerodeproof = oerode;
- }
- /* The(aobjnam()) is safe since otmp is unidentified -dlc */
- (void) hold_another_object(otmp, u.uswallow ?
+ /* The(aobjnam()) is safe since otmp is unidentified -dlc */
+ (void) hold_another_object(otmp, u.uswallow ?
"Oops! %s out of your reach!" :
(Is_airlevel(&u.uz) ||
Is_waterlevel(&u.uz) ||
Is_airlevel(&u.uz) || u.uinwater ?
"slip" : "drop")),
(const char *)0);
- }
u.ublesscnt += rn1(100,50); /* the gods take notice */
}
}