1 /* NetHack 3.6 steal.c $NHDT-Date: 1554580626 2019/04/06 19:57:06 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.72 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /*-Copyright (c) Robert Patrick Rankin, 2012. */
4 /* NetHack may be freely redistributed. See license for details. */
6 /* JNetHack Copyright */
7 /* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000 */
8 /* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2019 */
9 /* JNetHack may be freely redistributed. See license for details. */
13 STATIC_PTR int NDECL(stealarm);
15 STATIC_DCL const char *FDECL(equipname, (struct obj *));
17 STATIC_OVL const char *
19 register struct obj *otmp;
21 return ((otmp == uarmu)
42 ? cloak_simple_name(otmp)
44 ? helm_simple_name(otmp)
45 : suit_simple_name(otmp));
48 /* proportional subset of gold; return value actually fits in an int */
53 #ifdef LINT /* long conv. ok */
56 int igold = (lmoney >= (long) LARGEST_INT) ? LARGEST_INT : (int) lmoney;
62 igold = rn1(igold - 25 + 1, 25);
64 igold = rn1(igold - 50 + 1, 50);
65 else if (igold < 1000)
66 igold = rn1(igold - 100 + 1, 100);
67 else if (igold < 5000)
68 igold = rn1(igold - 500 + 1, 500);
69 else if (igold < 10000)
70 igold = rn1(igold - 1000 + 1, 1000);
72 igold = rn1(igold - 5000 + 1, 5000);
78 * Find the first (and hopefully only) gold object in a chain.
79 * Used when leprechaun (or you as leprechaun) looks for
80 * someone else's gold. Returns a pointer so the gold may
81 * be seized without further searching.
82 * May search containers too.
83 * Deals in gold only, as leprechauns don't care for lesser coins.
87 register struct obj *chain;
89 while (chain && chain->otyp != GOLD_PIECE)
95 * Steal gold coins only. Leprechauns don't care for lesser coins.
99 register struct monst *mtmp;
101 register struct obj *fgold = g_at(u.ux, u.uy);
102 register struct obj *ygold;
106 const char *whose, *what;
109 /* skip lesser coins on the floor */
110 while (fgold && fgold->otyp != GOLD_PIECE)
111 fgold = fgold->nexthere;
113 /* Do you have real gold? */
114 ygold = findgold(invent);
116 if (fgold && (!ygold || fgold->quan > ygold->quan || !rn2(5))) {
117 obj_extract_self(fgold);
118 add_to_minv(mtmp, fgold);
123 whose = s_suffix(y_monnam(who));
124 what = makeplural(mbodypart(who, FOOT));
128 what = makeplural(body_part(FOOT));
130 /* [ avoid "between your rear regions" :-] */
131 if (slithy(who->data))
133 /* reduce "rear hooves/claws" to "hooves/claws" */
134 if (!strncmp(what, "rear ", 5))
136 pline("%s quickly snatches some gold from %s %s %s!", Monnam(mtmp),
137 (Levitation || Flying) ? "beneath" : "between", whose, what);
138 #else /*JP:
\91«
\82ª
\96³
\82
\82Ä
\82à
\81u
\91«
\8c³
\81v
\82Å
\82æ
\82µ
\82Æ
\82·
\82é*/
139 pline("%s
\82Í
\91f
\91\81\82
\82 \82È
\82½
\82Ì%s
\82©
\82ç
\8bà
\82ð
\82Ð
\82Á
\82½
\82
\82Á
\82½
\81I", Monnam(mtmp),
140 (Levitation || Flying) ? "
\89º" : "
\91«
\8c³");
142 if (!ygold || !rn2(5)) {
143 if (!tele_restrict(mtmp))
144 (void) rloc(mtmp, TRUE);
145 monflee(mtmp, 0, FALSE, FALSE);
148 const int gold_price = objects[GOLD_PIECE].oc_cost;
150 tmp = (somegold(money_cnt(invent)) + gold_price - 1) / gold_price;
151 tmp = min(tmp, ygold->quan);
152 if (tmp < ygold->quan)
153 ygold = splitobj(ygold, tmp);
157 add_to_minv(mtmp, ygold);
159 Your("purse feels lighter.");
161 Your("
\8dà
\95z
\82Í
\8cy
\82
\82È
\82Á
\82½
\81D");
162 if (!tele_restrict(mtmp))
163 (void) rloc(mtmp, TRUE);
164 monflee(mtmp, 0, FALSE, FALSE);
169 /* steal armor after you finish taking it off */
170 unsigned int stealoid; /* object to be stolen */
171 unsigned int stealmid; /* monster doing the stealing */
176 register struct monst *mtmp;
177 register struct obj *otmp;
179 for (otmp = invent; otmp; otmp = otmp->nobj) {
180 if (otmp->o_id == stealoid) {
181 for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
182 if (mtmp->m_id == stealmid) {
183 if (DEADMONSTER(mtmp))
184 impossible("stealarm(): dead monster stealing");
185 if (!dmgtype(mtmp->data, AD_SITM)) /* polymorphed */
188 subfrombill(otmp, shop_keeper(*u.ushops));
191 pline("%s steals %s!", Monnam(mtmp), doname(otmp));
193 pline("%s
\82Í%s
\82ð
\93\90\82ñ
\82¾
\81I", Monnam(mtmp), doname(otmp));
194 (void) mpickobj(mtmp, otmp); /* may free otmp */
195 /* Implies seduction, "you gladly hand over ..."
196 so we don't set mavenge bit here. */
197 monflee(mtmp, 0, FALSE, FALSE);
198 if (!tele_restrict(mtmp))
199 (void) rloc(mtmp, TRUE);
211 /* An object you're wearing has been taken off by a monster (theft or
212 seduction). Also used if a worn item gets transformed (stone to flesh). */
214 remove_worn_item(obj, unchain_ball)
216 boolean unchain_ball; /* whether to unpunish or just unwield */
223 if (obj->owornmask & W_ARMOR) {
225 impossible("Removing embedded scales?");
226 skinback(TRUE); /* uarm = uskin; uskin = 0; */
230 else if (obj == uarmc)
232 else if (obj == uarmf)
234 else if (obj == uarmg)
236 else if (obj == uarmh)
238 else if (obj == uarms)
240 else if (obj == uarmu)
242 /* catchall -- should never happen */
244 setworn((struct obj *) 0, obj->owornmask & W_ARMOR);
245 } else if (obj->owornmask & W_AMUL) {
247 } else if (obj->owornmask & W_RING) {
249 } else if (obj->owornmask & W_TOOL) {
251 } else if (obj->owornmask & W_WEAPON) {
260 if (obj->owornmask & (W_BALL | W_CHAIN)) {
263 } else if (obj->owornmask) {
269 /* Returns 1 when something was stolen (or at least, when N should flee now)
270 * Returns -1 if the monster died in the attempt
271 * Avoid stealing the object stealoid
272 * Nymphs and monkeys won't steal coins
275 steal(mtmp, objnambuf)
280 int tmp, could_petrify, armordelay, olddelay, named = 0, retrycnt = 0;
281 boolean monkey_business, /* true iff an animal is doing the thievery */
286 /* the following is true if successful on first of two attacks. */
287 if (!monnear(mtmp, u.ux, u.uy))
290 /* food being eaten might already be used up but will not have
291 been removed from inventory yet; we don't want to steal that,
292 so this will cause it to be removed now */
294 (void) maybe_finished_meal(FALSE);
296 if (!invent || (inv_cnt(FALSE) == 1 && uskin)) {
298 /* Not even a thousand men in armor can strip a naked man. */
301 pline("Somebody tries to rob you, but finds nothing to steal.");
303 pline("
\92N
\82©
\82ª
\82 \82È
\82½
\82©
\82ç
\93\90\82à
\82¤
\82Æ
\82µ
\82½
\82ª
\81C
\93\90\82Þ
\82à
\82Ì
\82ª
\82È
\82¢
\82±
\82Æ
\82É
\8bC
\82ª
\82Â
\82¢
\82½
\81D");
306 pline("%s tries to rob you, but there is nothing to steal!",
308 pline("%s
\82Í
\82 \82È
\82½
\82©
\82ç
\93\90\82à
\82¤
\82Æ
\82µ
\82½
\82ª
\81C
\93\90\82Þ
\82à
\82Ì
\82ª
\82È
\82¢
\82±
\82Æ
\82É
\8bC
\82ª
\82Â
\82¢
\82½
\81I",
310 return 1; /* let her flee */
313 monkey_business = is_animal(mtmp->data);
314 if (monkey_business || uarmg) {
315 ; /* skip ring special cases */
316 } else if (Adornment & LEFT_RING) {
319 } else if (Adornment & RIGHT_RING) {
326 for (otmp = invent; otmp; otmp = otmp->nobj)
327 if ((!uarm || otmp != uarmc) && otmp != uskin
328 && otmp->oclass != COIN_CLASS)
329 tmp += (otmp->owornmask & (W_ARMOR | W_ACCESSORY)) ? 5 : 1;
331 goto nothing_to_steal;
333 for (otmp = invent; otmp; otmp = otmp->nobj)
334 if ((!uarm || otmp != uarmc) && otmp != uskin
335 && otmp->oclass != COIN_CLASS) {
336 tmp -= (otmp->owornmask & (W_ARMOR | W_ACCESSORY)) ? 5 : 1;
341 impossible("Steal fails!");
344 /* can't steal ring(s) while wearing gloves */
345 if ((otmp == uleft || otmp == uright) && uarmg)
347 /* can't steal gloves while wielding - so steal the wielded item. */
348 if (otmp == uarmg && uwep)
350 /* can't steal armor while wearing cloak - so steal the cloak. */
351 else if (otmp == uarm && uarmc)
353 /* can't steal shirt while wearing cloak or suit */
354 else if (otmp == uarmu && uarmc)
356 else if (otmp == uarmu && uarm)
360 if (otmp->o_id == stealoid)
363 if (otmp->otyp == BOULDER && !throws_rocks(mtmp->data)) {
368 /* animals can't overcome curse stickiness nor unlock chains */
369 if (monkey_business) {
371 /* is the player prevented from voluntarily giving up this item?
372 (ignores loadstones; the !can_carry() check will catch those) */
374 ostuck = TRUE; /* effectively worn; curse is implicit */
375 else if (otmp == uquiver || (otmp == uswapwep && !u.twoweap))
376 ostuck = FALSE; /* not really worn; curse doesn't matter */
378 ostuck = ((otmp->cursed && otmp->owornmask)
379 /* nymphs can steal rings from under
380 cursed weapon but animals can't */
381 || (otmp == uright && welded(uwep))
382 || (otmp == uleft && welded(uwep) && bimanual(uwep)));
384 if (ostuck || can_carry(mtmp, otmp) == 0) {
386 static const char *const how[] = { "steal", "snatch", "grab",
389 pline("%s tries to %s %s%s but gives up.", Monnam(mtmp),
391 (otmp->owornmask & W_ARMOR) ? "your " : "",
392 (otmp->owornmask & W_ARMOR) ? equipname(otmp)
396 pline("%s
\82Í%s
\82ð
\93\90\82à
\82¤
\82Æ
\82µ
\82½
\82ª
\92ú
\82ß
\82½
\81D", Monnam(mtmp),
397 (otmp->owornmask & W_ARMOR) ? equipname(otmp)
400 /* the fewer items you have, the less likely the thief
401 is going to stick around to try again (0) instead of
403 return !rn2(inv_cnt(FALSE) / 5 + 2);
407 if (otmp->otyp == LEASH && otmp->leashmon) {
408 if (monkey_business && otmp->cursed)
413 was_doffing = doffing(otmp);
414 /* stop donning/doffing now so that afternmv won't be clobbered
415 below; stop_occupation doesn't handle donning/doffing */
416 olddelay = stop_donning(otmp);
417 /* you're going to notice the theft... */
420 if (otmp->owornmask & (W_ARMOR | W_ACCESSORY)) {
421 switch (otmp->oclass) {
425 case FOOD_CLASS: /* meat ring */
426 remove_worn_item(otmp, TRUE);
429 armordelay = objects[otmp->otyp].oc_delay;
430 if (olddelay > 0 && olddelay < armordelay)
431 armordelay = olddelay;
432 if (monkey_business) {
433 /* animals usually don't have enough patience
434 to take off items which require extra time */
435 if (armordelay >= 1 && !olddelay && rn2(10))
437 remove_worn_item(otmp, TRUE);
440 int curssv = otmp->cursed;
442 boolean seen = canspotmon(mtmp);
445 /* can't charm you without first waking you */
448 slowly = (armordelay >= 1 || multi < 0);
451 pline("%s charms you. You gladly %s your %s.",
452 !seen ? "She" : Monnam(mtmp),
453 curssv ? "let her take"
454 : !slowly ? "hand over"
455 : was_doffing ? "continue removing"
459 pline("%s
\82Í
\82 \82È
\82½
\82ð
\96£
\97¹
\82µ
\82½
\81D
\82 \82È
\82½
\82Í
\82æ
\82ë
\82±
\82ñ
\82Å%s
\82ð%s
\82½
\81D",
460 !seen ? "
\94Þ
\8f\97" : Monnam(mtmp),
462 curssv ? "
\82Í
\82¸
\82µ
\82Ä
\82à
\82ç
\82Á"
463 : !slowly ? "
\82Í
\82¸
\82µ
\82Ä
\8eè
\93n
\82µ"
464 : was_doffing ? "
\82Í
\82¸
\82µ
\91±
\82¯"
465 : "
\82Í
\82¸
\82µ
\8en
\82ß");
469 pline("%s seduces you and %s off your %s.",
470 !seen ? "She" : Adjmonnam(mtmp, "beautiful"),
472 ? "helps you to take"
473 : !slowly ? "you take"
474 : was_doffing ? "you continue taking"
475 : "you start taking",
478 pline("%s
\82Í
\82 \82È
\82½
\82ð
\97U
\98f
\82µ
\82½
\81D
\82 \82È
\82½
\82Í%s
\82ð%s
\81D",
479 !seen ? "
\94Þ
\8f\97" : Adjmonnam(mtmp, "
\94ü
\82µ
\82¢"),
482 ? "
\82Í
\82¸
\82µ
\82Ä
\82à
\82ç
\82Á"
483 : !slowly ? "
\82Í
\82¸
\82µ"
484 : was_doffing ? "
\82Í
\82¸
\82µ
\91±
\82¯"
485 : "
\82Í
\82¸
\82µ
\8en
\82ß");
488 /* the following is to set multi for later on */
491 multi_reason = "taking off clothes";
493 multi_reason = "
\95\9e\82ð
\92E
\82¢
\82Å
\82¢
\82é
\8e\9e\82É";
495 remove_worn_item(otmp, TRUE);
496 otmp->cursed = curssv;
502 stealoid = otmp->o_id;
503 stealmid = mtmp->m_id;
510 impossible("Tried to steal a strange worn thing. [%d]",
513 } else if (otmp->owornmask)
514 remove_worn_item(otmp, TRUE);
516 /* do this before removing it from inventory */
518 Strcpy(objnambuf, yname(otmp));
519 /* set mavenge bit so knights won't suffer an
520 * alignment penalty during retaliation;
525 subfrombill(otmp, shop_keeper(*u.ushops));
528 pline("%s stole %s.", named ? "She" : Monnam(mtmp), doname(otmp));
530 pline("%s
\82Í%s
\82ð
\93\90\82ñ
\82¾
\81D", named ? "
\94Þ
\8f\97" : Monnam(mtmp), doname(otmp));
532 (otmp->otyp == CORPSE && touch_petrifies(&mons[otmp->corpsenm]));
533 (void) mpickobj(mtmp, otmp); /* may free otmp */
534 if (could_petrify && !(mtmp->misc_worn_check & W_ARMG)) {
535 minstapetrify(mtmp, TRUE);
538 return (multi < 0) ? 0 : 1;
541 /* Returns 1 if otmp is free'd, 0 otherwise. */
544 register struct monst *mtmp;
545 register struct obj *otmp;
548 boolean snuff_otmp = FALSE;
550 /* if monster is acquiring a thrown or kicked object, the throwing
551 or kicking code shouldn't continue to track and place it */
552 if (otmp == thrownobj)
554 else if (otmp == kickedobj)
556 /* don't want hidden light source inside the monster; assumes that
557 engulfers won't have external inventories; whirly monsters cause
558 the light to be extinguished rather than letting it shine thru */
559 if (obj_sheds_light(otmp) && attacktype(mtmp->data, AT_ENGL)) {
560 /* this is probably a burning object that you dropped or threw */
561 if (u.uswallow && mtmp == u.ustuck && !Blind)
563 pline("%s out.", Tobjnam(otmp, "go"));
565 pline("%s
\82Í
\94ò
\82Ñ
\82¾
\82µ
\82½
\81D", xname(otmp));
568 /* for hero owned object on shop floor, mtmp is taking possession
569 and if it's eventually dropped in a shop, shk will claim it */
572 /* Must do carrying effects on object prior to add_to_minv() */
573 carry_obj_effects(otmp);
574 /* add_to_minv() might free otmp [if merged with something else],
575 so we have to call it after doing the object checks */
576 freed_otmp = add_to_minv(mtmp, otmp);
577 /* and we had to defer this until object is in mtmp's inventory */
579 snuff_light_source(mtmp->mx, mtmp->my);
583 /* called for AD_SAMU (the Wizard and quest nemeses) */
589 struct obj *otmp = 0, *obj = 0;
590 int real = 0, fake = 0, n;
592 /* target every quest artifact, not just current role's;
593 if hero has more than one, choose randomly so that player
594 can't use inventory ordering to influence the theft */
595 for (n = 0, obj = invent; obj; obj = obj->nobj)
596 if (any_quest_artifact(obj))
600 for (otmp = invent; otmp; otmp = otmp->nobj)
601 if (any_quest_artifact(otmp) && !--n)
606 /* if we didn't find any quest arifact, find another valuable item */
607 if (u.uhave.amulet) {
608 real = AMULET_OF_YENDOR;
609 fake = FAKE_AMULET_OF_YENDOR;
610 } else if (u.uhave.bell) {
611 real = BELL_OF_OPENING;
613 } else if (u.uhave.book) {
614 real = SPE_BOOK_OF_THE_DEAD;
615 } else if (u.uhave.menorah) {
616 real = CANDELABRUM_OF_INVOCATION;
618 return; /* you have nothing of special interest */
620 /* If we get here, real and fake have been set up. */
621 for (n = 0, obj = invent; obj; obj = obj->nobj)
622 if (obj->otyp == real || (obj->otyp == fake && !mtmp->iswiz))
626 for (otmp = invent; otmp; otmp = otmp->nobj)
627 if ((otmp->otyp == real
628 || (otmp->otyp == fake && !mtmp->iswiz)) && !--n)
633 if (otmp) { /* we have something to snatch */
634 /* take off outer gear if we're targetting [hypothetical]
635 quest artifact suit, shirt, gloves, or rings */
636 if ((otmp == uarm || otmp == uarmu) && uarmc)
637 remove_worn_item(uarmc, FALSE);
638 if (otmp == uarmu && uarm)
639 remove_worn_item(uarm, FALSE);
640 if ((otmp == uarmg || ((otmp == uright || otmp == uleft) && uarmg))
642 /* gloves are about to be unworn; unwield weapon(s) first */
643 if (u.twoweap) /* remove_worn_item(uswapwep) indirectly */
644 remove_worn_item(uswapwep, FALSE); /* clears u.twoweap */
645 remove_worn_item(uwep, FALSE);
647 if ((otmp == uright || otmp == uleft) && uarmg)
648 /* calls Gloves_off() to handle wielded cockatrice corpse */
649 remove_worn_item(uarmg, FALSE);
651 /* finally, steal the target item */
653 remove_worn_item(otmp, TRUE);
655 subfrombill(otmp, shop_keeper(*u.ushops));
657 Strcpy(buf, doname(otmp));
658 (void) mpickobj(mtmp, otmp); /* could merge and free otmp but won't */
660 pline("%s steals %s!", Monnam(mtmp), buf);
662 pline("%s
\82Í%s
\82ð
\93\90\82ñ
\82¾
\81I", Monnam(mtmp), buf);
663 if (can_teleport(mtmp->data) && !tele_restrict(mtmp))
664 (void) rloc(mtmp, TRUE);
668 /* when a mimic gets poked with something, it might take that thing
669 (at present, only implemented for when the hero does the poking) */
671 maybe_absorb_item(mon, obj, ochance, achance)
674 int ochance, achance; /* percent chance for ordinary item, artifact */
676 if (obj == uball || obj == uchain || obj->oclass == ROCK_CLASS
677 || obj_resists(obj, 100 - ochance, 100 - achance)
678 || !touch_artifact(obj, mon))
683 remove_worn_item(obj, TRUE);
685 subfrombill(obj, shop_keeper(*u.ushops));
686 if (cansee(mon->mx, mon->my)) {
687 const char *MonName = Monnam(mon);
689 #if 0 /*JP*//*
\93ú
\96{
\8cê
\82Å
\82Í
\95s
\97v*/
690 /* mon might be invisible; avoid "It pulls ... and absorbs it!" */
691 if (!strcmp(MonName, "It"))
692 MonName = "Something";
695 pline("%s pulls %s away from you and absorbs %s!", MonName,
696 yname(obj), (obj->quan > 1L) ? "them" : "it");
698 pline("%s
\82Í%s
\82ð
\88ø
\82Á
\82Ï
\82è
\8d\9e\82ñ
\82Å
\8bz
\8eû
\82µ
\82½
\81I", MonName,
702 const char *hand_s = body_part(HAND);
705 hand_s = makeplural(hand_s);
707 pline("%s %s pulled from your %s!", upstart(yname(obj)),
708 otense(obj, "are"), hand_s);
710 pline("%s
\82Í
\82 \82È
\82½
\82Ì%s
\82©
\82ç
\88ø
\82Á
\82Ï
\82è
\8d\9e\82Ü
\82ê
\82½
\81I", upstart(yname(obj)),
716 /* not carried; presumably thrown or kicked */
719 pline("%s absorbs %s!", Monnam(mon), yname(obj));
721 pline("%s
\82Í%s
\82ð
\8bz
\8eû
\82µ
\82½
\81I", Monnam(mon), yname(obj));
723 /* add to mon's inventory */
724 (void) mpickobj(mon, obj);
727 /* drop one object taken from a (possibly dead) monster's inventory */
729 mdrop_obj(mon, obj, verbosely)
734 int omx = mon->mx, omy = mon->my;
735 boolean update_mon = FALSE;
737 if (obj->owornmask) {
738 /* perform worn item handling if the monster is still alive */
739 if (!DEADMONSTER(mon)) {
740 mon->misc_worn_check &= ~obj->owornmask;
743 /* don't charge for an owned saddle on dead steed (provided
744 that the hero is within the same shop at the time) */
745 } else if (mon->mtame && (obj->owornmask & W_SADDLE) != 0L
746 && !obj->unpaid && costly_spot(omx, omy)
747 /* being at costly_spot guarantees lev->roomno is not 0 */
748 && index(in_rooms(u.ux, u.uy, SHOPBASE),
749 levl[omx][omy].roomno)) {
752 /* this should be done even if the monster has died */
753 if (obj->owornmask & W_WEP)
754 setmnotwielded(mon, obj);
757 /* obj_no_longer_held(obj); -- done by place_object */
758 if (verbosely && cansee(omx, omy))
760 pline("%s drops %s.", Monnam(mon), distant_name(obj, doname));
762 pline("%s
\82Í%s
\82ð
\92u
\82¢
\82½
\81D", Monnam(mon), distant_name(obj, doname));
764 if (!flooreffects(obj, omx, omy, "fall")) {
766 if (!flooreffects(obj, omx, omy, "
\97\8e\82¿
\82é")) {
767 place_object(obj, omx, omy);
770 /* do this last, after placing obj on floor; removing steed's saddle
771 throws rider, possibly inflicting fatal damage and producing bones */
773 update_mon_intrinsics(mon, obj, FALSE, TRUE);
776 /* some monsters bypass the normal rules for moving between levels or
777 even leaving the game entirely; when that happens, prevent them from
778 taking the Amulet, invocation items, or quest artifact with them */
780 mdrop_special_objs(mon)
783 struct obj *obj, *otmp;
785 for (obj = mon->minvent; obj; obj = otmp) {
787 /* the Amulet, invocation tools, and Rider corpses resist even when
788 artifacts and ordinary objects are given 0% resistance chance;
789 current role's quest artifact is rescued too--quest artifacts
790 for the other roles are not */
791 if (obj_resists(obj, 0, 0) || is_quest_artifact(obj)) {
792 obj_extract_self(obj);
794 mdrop_obj(mon, obj, FALSE);
795 } else { /* migrating monster not on map */
796 if (obj->owornmask) {
797 mon->misc_worn_check &= ~obj->owornmask;
798 if (obj->owornmask & W_WEP)
799 setmnotwielded(mon, obj);
808 /* release the objects the creature is carrying */
810 relobj(mtmp, show, is_pet)
813 boolean is_pet; /* If true, pet should keep wielded/worn items */
816 int omx = mtmp->mx, omy = mtmp->my;
818 /* vault guard's gold goes away rather than be dropped... */
819 if (mtmp->isgd && (otmp = findgold(mtmp->minvent)) != 0) {
820 if (canspotmon(mtmp))
822 pline("%s gold %s.", s_suffix(Monnam(mtmp)),
823 canseemon(mtmp) ? "vanishes" : "seems to vanish");
825 pline("%s
\82Ì
\8bà
\82Í
\8fÁ
\82¦
\82½%s
\81D", Monnam(mtmp),
826 canseemon(mtmp) ? "" : "
\82æ
\82¤
\82¾");
828 obj_extract_self(otmp);
829 obfree(otmp, (struct obj *) 0);
830 } /* isgd && has gold */
832 while ((otmp = (is_pet ? droppables(mtmp) : mtmp->minvent)) != 0) {
833 obj_extract_self(otmp);
834 mdrop_obj(mtmp, otmp, is_pet && flags.verbose);
837 if (show && cansee(omx, omy))