1 /* NetHack 3.6 worn.c $NHDT-Date: 1446887541 2015/11/07 09:12:21 $ $NHDT-Branch: master $:$NHDT-Revision: 1.47 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed. See license for details. */
5 /* JNetHack Copyright */
6 /* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000 */
7 /* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2016 */
8 /* JNetHack may be freely redistributed. See license for details. */
12 STATIC_DCL void FDECL(m_lose_armor, (struct monst *, struct obj *));
13 STATIC_DCL void FDECL(m_dowear_type,
14 (struct monst *, long, BOOLEAN_P, BOOLEAN_P));
15 STATIC_DCL int FDECL(extra_pref, (struct monst *, struct obj *));
20 } worn[] = { { W_ARM, &uarm },
30 { W_SWAPWEP, &uswapwep },
31 { W_QUIVER, &uquiver },
38 /* This only allows for one blocking item per property */
39 #define w_blocks(o, m) \
40 ((o->otyp == MUMMY_WRAPPING && ((m) &W_ARMC)) \
42 : (o->otyp == CORNUTHAUM && ((m) &W_ARMH) && !Role_if(PM_WIZARD)) \
45 /* note: monsters don't have clairvoyance, so your role
46 has no significant effect on their use of w_blocks() */
48 /* Updated to use the extrinsic and blocked fields. */
51 register struct obj *obj;
54 register const struct worn *wp;
55 register struct obj *oobj;
58 if ((mask & (W_ARM | I_SPECIAL)) == (W_ARM | I_SPECIAL)) {
59 /* restoring saved game; no properties are conferred via skin */
61 /* assert( !uarm ); */
64 u.uroleplay.nudist = FALSE;
65 for (wp = worn; wp->w_mask; wp++)
66 if (wp->w_mask & mask) {
68 if (oobj && !(oobj->owornmask & wp->w_mask))
69 impossible("Setworn: mask = %ld.", wp->w_mask);
71 if (u.twoweap && (oobj->owornmask & (W_WEP | W_SWAPWEP)))
73 oobj->owornmask &= ~wp->w_mask;
74 if (wp->w_mask & ~(W_SWAPWEP | W_QUIVER)) {
75 /* leave as "x = x <op> y", here and below, for broken
77 p = objects[oobj->otyp].oc_oprop;
78 u.uprops[p].extrinsic =
79 u.uprops[p].extrinsic & ~wp->w_mask;
80 if ((p = w_blocks(oobj, mask)) != 0)
81 u.uprops[p].blocked &= ~wp->w_mask;
83 set_artifact_intrinsic(oobj, 0, mask);
88 obj->owornmask |= wp->w_mask;
89 /* Prevent getting/blocking intrinsics from wielding
90 * potions, through the quiver, etc.
91 * Allow weapon-tools, too.
92 * wp_mask should be same as mask at this point.
94 if (wp->w_mask & ~(W_SWAPWEP | W_QUIVER)) {
95 if (obj->oclass == WEAPON_CLASS || is_weptool(obj)
97 p = objects[obj->otyp].oc_oprop;
98 u.uprops[p].extrinsic =
99 u.uprops[p].extrinsic | wp->w_mask;
100 if ((p = w_blocks(obj, mask)) != 0)
101 u.uprops[p].blocked |= wp->w_mask;
104 set_artifact_intrinsic(obj, 1, mask);
112 /* called e.g. when obj is destroyed */
113 /* Updated to use the extrinsic and blocked fields. */
116 register struct obj *obj;
118 register const struct worn *wp;
123 if (obj == uwep || obj == uswapwep)
125 for (wp = worn; wp->w_mask; wp++)
126 if (obj == *(wp->w_obj)) {
128 p = objects[obj->otyp].oc_oprop;
129 u.uprops[p].extrinsic = u.uprops[p].extrinsic & ~wp->w_mask;
130 obj->owornmask &= ~wp->w_mask;
132 set_artifact_intrinsic(obj, 0, wp->w_mask);
133 if ((p = w_blocks(obj, wp->w_mask)) != 0)
134 u.uprops[p].blocked &= ~wp->w_mask;
139 /* return a bitmask of the equipment slot(s) a given item might be worn in */
144 int otyp = obj->otyp;
145 /* practically any item can be wielded or quivered; it's up to
146 our caller to handle such things--we assume "normal" usage */
147 long res = 0L; /* default: can't be worn anywhere */
149 switch (obj->oclass) {
151 res = W_AMUL; /* WORN_AMUL */
154 res = W_RINGL | W_RINGR; /* W_RING, BOTH_SIDES */
157 switch (objects[otyp].oc_armcat) {
160 break; /* WORN_ARMOR */
163 break; /* WORN_SHIELD */
166 break; /* WORN_HELMET */
169 break; /* WORN_GLOVES */
172 break; /* WORN_BOOTS */
175 break; /* WORN_CLOAK */
178 break; /* WORN_SHIRT */
182 res = W_WEP | W_SWAPWEP;
183 if (objects[otyp].oc_merge)
187 if (otyp == BLINDFOLD || otyp == TOWEL || otyp == LENSES)
188 res = W_TOOL; /* WORN_BLINDF */
189 else if (is_weptool(obj) || otyp == TIN_OPENER)
190 res = W_WEP | W_SWAPWEP;
191 else if (otyp == SADDLE)
195 if (obj->otyp == MEAT_RING)
196 res = W_RINGL | W_RINGR;
218 if (!mon->invis_blkd) {
220 newsym(mon->mx, mon->my); /* make it disappear */
222 see_wsegs(mon); /* and any tail too */
227 mon_adjust_speed(mon, adjust, obj)
229 int adjust; /* positive => increase speed, negative => decrease */
230 struct obj *obj; /* item to make known if effect can be seen */
233 boolean give_msg = !in_mklev, petrify = FALSE;
234 unsigned int oldspeed = mon->mspeed;
238 mon->permspeed = MFAST;
239 give_msg = FALSE; /* special case monster creation */
242 if (mon->permspeed == MSLOW)
245 mon->permspeed = MFAST;
247 case 0: /* just check for worn speed boots */
250 if (mon->permspeed == MFAST)
253 mon->permspeed = MSLOW;
256 mon->permspeed = MSLOW;
257 give_msg = FALSE; /* (not currently used) */
259 case -3: /* petrification */
260 /* take away intrinsic speed but don't reduce normal speed */
261 if (mon->permspeed == MFAST)
265 case -4: /* green slime */
266 if (mon->permspeed == MFAST)
272 for (otmp = mon->minvent; otmp; otmp = otmp->nobj)
273 if (otmp->owornmask && objects[otmp->otyp].oc_oprop == FAST)
275 if (otmp) /* speed boots */
278 mon->mspeed = mon->permspeed;
280 /* no message if monster is immobile (temp or perm) or unseen */
281 if (give_msg && (mon->mspeed != oldspeed || petrify) && mon->data->mmove
282 && !(mon->mfrozen || mon->msleeping) && canseemon(mon)) {
283 /* fast to slow (skipping intermediate state) or vice versa */
284 const char *howmuch =
286 (mon->mspeed + oldspeed == MFAST + MSLOW) ? "much " : "";
288 (mon->mspeed + oldspeed == MFAST + MSLOW) ? "
\82·
\82²
\82" : "";
291 /* mimic the player's petrification countdown; "slowing down"
292 even if fast movement rate retained via worn speed boots */
295 pline("%s is slowing down.", Monnam(mon));
297 pline("%s
\82Í
\82Ì
\82ë
\82
\82È
\82Á
\82½
\81D", Monnam(mon));
298 } else if (adjust > 0 || mon->mspeed == MFAST)
300 pline("%s is suddenly moving %sfaster.", Monnam(mon), howmuch);
302 pline("%s
\82Ì
\93®
\82«
\82Í
\93Ë
\91R%s
\82·
\82Î
\82â
\82
\82È
\82Á
\82½
\81D", Monnam(mon), howmuch);
305 pline("%s seems to be moving %sslower.", Monnam(mon), howmuch);
307 pline("%s
\82Ì
\93®
\82«
\82Í%s
\82Ì
\82ë
\82
\82È
\82Á
\82½
\82æ
\82¤
\82É
\8c©
\82¦
\82é
\81D", Monnam(mon), howmuch);
309 /* might discover an object if we see the speed change happen */
315 /* armor put on or taken off; might be magical variety */
317 update_mon_intrinsics(mon, obj, on, silently)
320 boolean on, silently;
325 int which = (int) objects[obj->otyp].oc_oprop;
327 unseen = !canseemon(mon);
334 mon->minvis = !mon->invis_blkd;
337 boolean save_in_mklev = in_mklev;
340 mon_adjust_speed(mon, 0, obj);
341 in_mklev = save_in_mklev;
344 /* properties handled elsewhere */
348 /* properties which have no effect for monsters */
353 /* properties which should have an effect but aren't implemented */
357 /* properties which maybe should have an effect but don't */
364 if (which <= 8) { /* 1 thru 8 correspond to MR_xxx mask values */
365 /* FIRE,COLD,SLEEP,DISINT,SHOCK,POISON,ACID,STONE */
366 mask = (uchar) (1 << (which - 1));
367 mon->mintrinsics |= (unsigned short) mask;
374 mon->minvis = mon->perminvis;
377 boolean save_in_mklev = in_mklev;
380 mon_adjust_speed(mon, 0, obj);
381 in_mklev = save_in_mklev;
392 mask = (uchar) (1 << (which - 1));
393 /* If the monster doesn't have this resistance intrinsically,
394 check whether any other worn item confers it. Note that
395 we don't currently check for anything conferred via simply
396 carrying an object. */
397 if (!(mon->data->mresists & mask)) {
398 for (otmp = mon->minvent; otmp; otmp = otmp->nobj)
400 && (int) objects[otmp->otyp].oc_oprop == which)
403 mon->mintrinsics &= ~((unsigned short) mask);
412 /* obj->owornmask has been cleared by this point, so we can't use it.
413 However, since monsters don't wield armor, we don't have to guard
414 against that and can get away with a blanket worn-mask value. */
415 switch (w_blocks(obj, ~0L)) {
417 mon->invis_blkd = on ? 1 : 0;
418 mon->minvis = on ? 0 : mon->perminvis;
424 if (!on && mon == u.usteed && obj->otyp == SADDLE)
425 dismount_steed(DISMOUNT_FELL);
427 /* if couldn't see it but now can, or vice versa, update display */
428 if (!silently && (unseen ^ !canseemon(mon)))
429 newsym(mon->mx, mon->my);
434 register struct monst *mon;
436 register struct obj *obj;
437 int base = mon->data->ac;
438 long mwflags = mon->misc_worn_check;
440 for (obj = mon->minvent; obj; obj = obj->nobj) {
441 if (obj->owornmask & mwflags)
442 base -= ARM_BONUS(obj);
443 /* since ARM_BONUS is positive, subtracting it increases AC */
449 * weapons are handled separately;
450 * rings and eyewear aren't used by monsters
453 /* Wear the best object of each type that the monster has. During creation,
454 * the monster can put everything on at once; otherwise, wearing takes time.
455 * This doesn't affect monster searching for objects--a monster may very well
456 * search for objects it would not want to wear, because we don't want to
457 * check which_armor() each round.
459 * We'll let monsters put on shirts and/or suits under worn cloaks, but
460 * not shirts under worn suits. This is somewhat arbitrary, but it's
461 * too tedious to have them remove and later replace outer garments,
462 * and preventing suits under cloaks makes it a little bit too easy for
463 * players to influence what gets worn. Putting on a shirt underneath
464 * already worn body armor is too obviously buggy...
467 m_dowear(mon, creation)
468 register struct monst *mon;
471 #define RACE_EXCEPTION TRUE
472 /* Note the restrictions here are the same as in dowear in do_wear.c
473 * except for the additional restriction on intelligence. (Players
474 * are always intelligent, even if polymorphed).
476 if (verysmall(mon->data) || nohands(mon->data) || is_animal(mon->data))
478 /* give mummies a chance to wear their wrappings
479 * and let skeletons wear their initial armor */
480 if (mindless(mon->data)
481 && (!creation || (mon->data->mlet != S_MUMMY
482 && mon->data != &mons[PM_SKELETON])))
485 m_dowear_type(mon, W_AMUL, creation, FALSE);
486 /* can't put on shirt if already wearing suit */
487 if (!cantweararm(mon->data) && !(mon->misc_worn_check & W_ARM))
488 m_dowear_type(mon, W_ARMU, creation, FALSE);
489 /* treating small as a special case allows
490 hobbits, gnomes, and kobolds to wear cloaks */
491 if (!cantweararm(mon->data) || mon->data->msize == MZ_SMALL)
492 m_dowear_type(mon, W_ARMC, creation, FALSE);
493 m_dowear_type(mon, W_ARMH, creation, FALSE);
494 if (!MON_WEP(mon) || !bimanual(MON_WEP(mon)))
495 m_dowear_type(mon, W_ARMS, creation, FALSE);
496 m_dowear_type(mon, W_ARMG, creation, FALSE);
497 if (!slithy(mon->data) && mon->data->mlet != S_CENTAUR)
498 m_dowear_type(mon, W_ARMF, creation, FALSE);
499 if (!cantweararm(mon->data))
500 m_dowear_type(mon, W_ARM, creation, FALSE);
502 m_dowear_type(mon, W_ARM, creation, RACE_EXCEPTION);
506 m_dowear_type(mon, flag, creation, racialexception)
510 boolean racialexception;
512 struct obj *old, *best, *obj;
514 int unseen = !canseemon(mon);
519 return; /* probably putting previous item on */
521 /* Get a copy of monster's name before altering its visibility */
522 Strcpy(nambuf, See_invisible ? Monnam(mon) : mon_nam(mon));
524 old = which_armor(mon, flag);
525 if (old && old->cursed)
527 if (old && flag == W_AMUL)
528 return; /* no such thing as better amulets */
531 for (obj = mon->minvent; obj; obj = obj->nobj) {
534 if (obj->oclass != AMULET_CLASS
535 || (obj->otyp != AMULET_OF_LIFE_SAVING
536 && obj->otyp != AMULET_OF_REFLECTION))
539 goto outer_break; /* no such thing as better amulets */
551 /* changing alignment is not implemented for monsters;
552 priests and minions could change alignment but wouldn't
553 want to, so they reject helms of opposite alignment */
554 if (obj->otyp == HELM_OF_OPPOSITE_ALIGNMENT
555 && (mon->ispriest || mon->isminion))
557 /* (flimsy exception matches polyself handling) */
558 if (has_horns(mon->data) && !is_flimsy(obj))
576 if (racialexception && (racial_exception(mon, obj) < 1))
582 /* I'd like to define a VISIBLE_ARM_BONUS which doesn't assume the
583 * monster knows obj->spe, but if I did that, a monster would keep
584 * switching forever between two -2 caps since when it took off one
585 * it would forget spe and once again think the object is better
586 * than what it already has.
588 if (best && (ARM_BONUS(best) + extra_pref(mon, best)
589 >= ARM_BONUS(obj) + extra_pref(mon, obj)))
594 if (!best || best == old)
597 /* same auto-cursing behavior as for hero */
598 autocurse = ((best->otyp == HELM_OF_OPPOSITE_ALIGNMENT
599 || best->otyp == DUNCE_CAP) && !best->cursed);
600 /* if wearing a cloak, account for the time spent removing
601 and re-wearing it when putting on a suit or shirt */
602 if ((flag == W_ARM || flag == W_ARMU) && (mon->misc_worn_check & W_ARMC))
604 /* when upgrading a piece of armor, account for time spent
605 taking off current one */
607 m_delay += objects[old->otyp].oc_delay;
609 if (old) /* do this first to avoid "(being worn)" */
612 if (canseemon(mon)) {
617 Sprintf(buf, " removes %s and", distant_name(old, doname));
619 Sprintf(buf, "%s
\82ð
\82Í
\82¸
\82µ
\82Ä", distant_name(old, doname));
623 pline("%s%s puts on %s.", Monnam(mon), buf,
624 distant_name(best, doname));
626 pline("%s
\82Í%s%s
\82ð
\90g
\82É
\82Â
\82¯
\82½
\81D", Monnam(mon), buf,
627 distant_name(best,doname));
630 pline("%s %s %s %s for a moment.", s_suffix(Monnam(mon)),
631 simpleonames(best), otense(best, "glow"),
634 m_delay += objects[best->otyp].oc_delay;
635 mon->mfrozen = m_delay;
640 update_mon_intrinsics(mon, old, FALSE, creation);
641 mon->misc_worn_check |= flag;
642 best->owornmask |= flag;
645 update_mon_intrinsics(mon, best, TRUE, creation);
646 /* if couldn't see it but now can, or vice versa, */
647 if (!creation && (unseen ^ !canseemon(mon))) {
648 if (mon->minvis && !See_invisible) {
650 pline("Suddenly you cannot see %s.", nambuf);
652 pline("
\93Ë
\91R%s
\82ª
\8c©
\82¦
\82È
\82
\82È
\82Á
\82½
\81D", nambuf);
653 makeknown(best->otyp);
654 } /* else if (!mon->minvis) pline("%s suddenly appears!",
658 #undef RACE_EXCEPTION
661 which_armor(mon, flag)
665 if (mon == &youmonst) {
682 impossible("bad flag in which_armor");
686 register struct obj *obj;
688 for (obj = mon->minvent; obj; obj = obj->nobj)
689 if (obj->owornmask & flag)
691 return (struct obj *) 0;
695 /* remove an item of armor and then drop it */
697 m_lose_armor(mon, obj)
701 mon->misc_worn_check &= ~obj->owornmask;
703 update_mon_intrinsics(mon, obj, FALSE, FALSE);
706 obj_extract_self(obj);
707 place_object(obj, mon->mx, mon->my);
708 /* call stackobj() if we ever drop anything that can merge */
709 newsym(mon->mx, mon->my);
712 /* all objects with their bypass bit set should now be reset to normal */
716 struct obj *otmp, *nobj;
719 for (otmp = fobj; otmp; otmp = nobj) {
724 /* bypass will have inhibited any stacking, but since it's
725 * used for polymorph handling, the objects here probably
726 * have been transformed and won't be stacked in the usual
727 * manner afterwards; so don't bother with this.
728 * [Changing the fobj chain mid-traversal would also be risky.]
731 if (objects[otmp->otyp].oc_merge) {
734 (void) get_obj_location(otmp, &ox, &oy, 0);
741 for (otmp = invent; otmp; otmp = otmp->nobj)
743 for (otmp = migrating_objs; otmp; otmp = otmp->nobj)
745 for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
746 if (DEADMONSTER(mtmp))
748 for (otmp = mtmp->minvent; otmp; otmp = otmp->nobj)
751 for (mtmp = migrating_mons; mtmp; mtmp = mtmp->nmon) {
752 for (otmp = mtmp->minvent; otmp; otmp = otmp->nobj)
755 /* billobjs and mydogs chains don't matter here */
756 context.bypasses = FALSE;
764 context.bypasses = TRUE;
767 /* set or clear the bypass bit in a list of objects */
769 bypass_objlist(objchain, on)
770 struct obj *objchain;
771 boolean on; /* TRUE => set, FALSE => clear */
774 context.bypasses = TRUE;
776 objchain->bypass = on ? 1 : 0;
777 objchain = objchain->nobj;
781 /* return the first object without its bypass bit set; set that bit
782 before returning so that successive calls will find further objects */
784 nxt_unbypassed_obj(objchain)
785 struct obj *objchain;
788 if (!objchain->bypass) {
789 bypass_obj(objchain);
792 objchain = objchain->nobj;
798 mon_break_armor(mon, polyspot)
802 register struct obj *otmp;
803 struct permonst *mdat = mon->data;
804 boolean vis = cansee(mon->mx, mon->my);
805 boolean handless_or_tiny = (nohands(mdat) || verysmall(mdat));
806 #if 0 /*JP*//*
\8eg
\82í
\82È
\82¢*/
807 const char *pronoun = mhim(mon), *ppronoun = mhis(mon);
810 if (breakarm(mdat)) {
811 if ((otmp = which_armor(mon, W_ARM)) != 0) {
812 if ((Is_dragon_scales(otmp) && mdat == Dragon_scales_to_pm(otmp))
813 || (Is_dragon_mail(otmp) && mdat == Dragon_mail_to_pm(otmp)))
814 ; /* no message here;
815 "the dragon merges with his scaly armor" is odd
816 and the monster's previous form is already gone */
819 pline("%s breaks out of %s armor!", Monnam(mon), ppronoun);
821 pline("%s
\82Í
\8aZ
\82ð
\82â
\82Ô
\82è
\8fo
\82½
\81I", Monnam(mon));
824 You_hear("a cracking sound.");
826 You_hear("
\83o
\83\8a\83o
\83\8a\82Æ
\82¢
\82¤
\89¹
\82ð
\95·
\82¢
\82½
\81D");
829 if ((otmp = which_armor(mon, W_ARMC)) != 0) {
830 if (otmp->oartifact) {
833 pline("%s %s falls off!", s_suffix(Monnam(mon)),
834 cloak_simple_name(otmp));
836 pline("%s
\82Ì%s
\82Í
\97\8e\82¿
\82½
\81I", Monnam(mon),
837 cloak_simple_name(otmp));
841 m_lose_armor(mon, otmp);
845 pline("%s %s tears apart!", s_suffix(Monnam(mon)),
846 cloak_simple_name(otmp));
848 pline("%s
\82Ì%s
\82Í
\82¸
\82½
\82¸
\82½
\82É
\82È
\82Á
\82½
\81I", Monnam(mon),
849 cloak_simple_name(otmp));
853 You_hear("a ripping sound.");
855 You_hear("
\83r
\83\8a\83b
\82Æ
\82¢
\82¤
\89¹
\82ð
\95·
\82¢
\82½
\81D");
859 if ((otmp = which_armor(mon, W_ARMU)) != 0) {
862 pline("%s shirt rips to shreds!", s_suffix(Monnam(mon)));
864 pline("%s
\82Ì
\83V
\83\83\83c
\82Í
\82¸
\82½
\82¸
\82½
\82É
\82È
\82Á
\82½
\81I", Monnam(mon));
867 You_hear("a ripping sound.");
869 You_hear("
\83r
\83\8a\83b
\82Æ
\82¢
\82¤
\89¹
\82ð
\95·
\82¢
\82½
\81D");
872 } else if (sliparm(mdat)) {
873 if ((otmp = which_armor(mon, W_ARM)) != 0) {
876 pline("%s armor falls around %s!", s_suffix(Monnam(mon)),
879 pline("%s
\82Ì
\8aZ
\82ª
\89ñ
\82è
\82É
\97\8e\82¿
\82½
\81I", Monnam(mon));
885 You_hear("
\83h
\83V
\83\93\82Æ
\82¢
\82¤
\89¹
\82ð
\95·
\82¢
\82½
\81D");
888 m_lose_armor(mon, otmp);
890 if ((otmp = which_armor(mon, W_ARMC)) != 0) {
892 if (is_whirly(mon->data))
894 pline("%s %s falls, unsupported!", s_suffix(Monnam(mon)),
895 cloak_simple_name(otmp));
897 pline("%s
\82Ì%s
\82Í
\8ex
\82¦
\82«
\82ê
\82¸
\82É
\97\8e\82¿
\82½
\81I", Monnam(mon),
898 cloak_simple_name(otmp));
902 pline("%s shrinks out of %s %s!", Monnam(mon), ppronoun,
903 cloak_simple_name(otmp));
905 pline("%s
\82Í%s
\82æ
\82è
\8fk
\82ñ
\82¾
\81I", Monnam(mon),
906 cloak_simple_name(otmp));
911 m_lose_armor(mon, otmp);
913 if ((otmp = which_armor(mon, W_ARMU)) != 0) {
915 if (sliparm(mon->data))
917 pline("%s seeps right through %s shirt!", Monnam(mon),
920 pline("%s
\82Í
\8e©
\95ª
\82Ì
\83V
\83\83\83c
\82É
\82µ
\82Ý
\8d\9e\82ñ
\82¾
\81I", Monnam(mon));
924 pline("%s becomes much too small for %s shirt!",
925 Monnam(mon), ppronoun);
927 pline("%s
\82Í
\8e©
\95ª
\82Ì
\83V
\83\83\83c
\82æ
\82è
\82¸
\82Á
\82Æ
\8f¬
\82³
\82
\82È
\82Á
\82½
\81I",
933 m_lose_armor(mon, otmp);
936 if (handless_or_tiny) {
937 /* [caller needs to handle weapon checks] */
938 if ((otmp = which_armor(mon, W_ARMG)) != 0) {
941 pline("%s drops %s gloves%s!", Monnam(mon), ppronoun,
942 MON_WEP(mon) ? " and weapon" : "");
944 pline("%s
\82Í
\8f¬
\8eè%s
\82ð
\97\8e\82µ
\82½
\81I", Monnam(mon),
945 MON_WEP(mon) ? "
\82Æ
\95\90\8aí" : "");
949 m_lose_armor(mon, otmp);
951 if ((otmp = which_armor(mon, W_ARMS)) != 0) {
954 pline("%s can no longer hold %s shield!", Monnam(mon),
957 pline("%s
\82Í
\82à
\82Í
\82â
\8f\82\82ð
\8e\9d\82Â
\82±
\82Æ
\82ª
\82Å
\82«
\82È
\82¢
\81I", Monnam(mon));
961 You_hear("a clank.");
963 You_hear("
\83J
\83\89\83\93\82Æ
\82¢
\82¤
\89¹
\82ð
\95·
\82¢
\82½
\81D");
966 m_lose_armor(mon, otmp);
969 if (handless_or_tiny || has_horns(mdat)) {
970 if ((otmp = which_armor(mon, W_ARMH)) != 0
971 /* flimsy test for horns matches polyself handling */
972 && (handless_or_tiny || !is_flimsy(otmp))) {
975 pline("%s helmet falls to the %s!", s_suffix(Monnam(mon)),
976 surface(mon->mx, mon->my));
978 pline("%s
\82Ì
\8a\95\82Í%s
\82Ö
\97\8e\82¿
\82½
\81I",
979 Monnam(mon), surface(mon->mx, mon->my));
983 You_hear("a clank.");
985 You_hear("
\83K
\83`
\83\83\83\93\82Æ
\82¢
\82¤
\89¹
\82ð
\95·
\82¢
\82½
\81D");
988 m_lose_armor(mon, otmp);
991 if (handless_or_tiny || slithy(mdat) || mdat->mlet == S_CENTAUR) {
992 if ((otmp = which_armor(mon, W_ARMF)) != 0) {
994 if (is_whirly(mon->data))
996 pline("%s boots fall away!", s_suffix(Monnam(mon)));
998 pline("%s
\82Ì
\8cC
\82Í
\82Ê
\82°
\97\8e\82¿
\82½
\81I", Monnam(mon));
1001 pline("%s boots %s off %s feet!", s_suffix(Monnam(mon)),
1002 verysmall(mdat) ? "slide" : "are pushed", ppronoun);
1004 pline("%s
\82Ì
\8cC
\82Í
\91«
\82©
\82ç%s
\81I", Monnam(mon),
1005 verysmall(mdat) ? "
\8a\8a\82è
\97\8e\82¿
\82½" : "
\89\9f\82µ
\8fo
\82³
\82ê
\82½");
1010 m_lose_armor(mon, otmp);
1013 if (!can_saddle(mon)) {
1014 if ((otmp = which_armor(mon, W_SADDLE)) != 0) {
1017 m_lose_armor(mon, otmp);
1020 pline("%s saddle falls off.", s_suffix(Monnam(mon)));
1022 pline("%s
\82©
\82ç
\88Æ
\82ª
\97\8e\82¿
\82½
\81D", Monnam(mon));
1024 if (mon == u.usteed)
1026 } else if (mon == u.usteed && !can_ride(mon)) {
1029 You("can no longer ride %s.", mon_nam(mon));
1031 You("
\82à
\82¤%s
\82É
\8fæ
\82Á
\82Ä
\82¢
\82ç
\82ê
\82È
\82¢
\81D", mon_nam(mon));
1032 if (touch_petrifies(u.usteed->data) && !Stone_resistance && rnl(3)) {
1036 You("touch %s.", mon_nam(u.usteed));
1038 You("%s
\82É
\90G
\82Á
\82½
\81D", mon_nam(u.usteed));
1040 Sprintf(buf, "falling off %s", an(u.usteed->data->mname));
1042 Sprintf(buf, "%s
\82©
\82ç
\97\8e\82¿
\82Ä", u.usteed->data->mname);
1045 dismount_steed(DISMOUNT_FELL);
1050 /* bias a monster's preferences towards armor that has special benefits. */
1052 extra_pref(mon, obj)
1056 /* currently only does speed boots, but might be expanded if monsters
1057 * get to use more armor abilities
1060 if (obj->otyp == SPEED_BOOTS && mon->permspeed != MFAST)
1067 * Exceptions to things based on race.
1068 * Correctly checks polymorphed player race.
1070 * 0 No exception, normal rules apply.
1071 * 1 If the race/object combination is acceptable.
1072 * -1 If the race/object combination is unacceptable.
1075 racial_exception(mon, obj)
1079 const struct permonst *ptr = raceptr(mon);
1081 /* Acceptable Exceptions: */
1082 /* Allow hobbits to wear elven armor - LoTR */
1083 if (ptr == &mons[PM_HOBBIT] && is_elven_armor(obj))
1085 /* Unacceptable Exceptions: */
1086 /* Checks for object that certain races should never use go here */