1 /* NetHack 3.6 worn.c $NHDT-Date: 1496959481 2017/06/08 22:04:41 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.49 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /*-Copyright (c) Robert Patrick Rankin, 2013. */
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-2018 */
9 /* JNetHack may be freely redistributed. See license for details. */
13 STATIC_DCL void FDECL(m_lose_armor, (struct monst *, struct obj *));
14 STATIC_DCL void FDECL(m_dowear_type,
15 (struct monst *, long, BOOLEAN_P, BOOLEAN_P));
16 STATIC_DCL int FDECL(extra_pref, (struct monst *, struct obj *));
21 } worn[] = { { W_ARM, &uarm },
31 { W_SWAPWEP, &uswapwep },
32 { W_QUIVER, &uquiver },
39 /* This only allows for one blocking item per property */
40 #define w_blocks(o, m) \
41 ((o->otyp == MUMMY_WRAPPING && ((m) & W_ARMC)) \
43 : (o->otyp == CORNUTHAUM && ((m) & W_ARMH) && !Role_if(PM_WIZARD)) \
46 /* note: monsters don't have clairvoyance, so your role
47 has no significant effect on their use of w_blocks() */
49 /* Updated to use the extrinsic and blocked fields. */
52 register struct obj *obj;
55 register const struct worn *wp;
56 register struct obj *oobj;
59 if ((mask & (W_ARM | I_SPECIAL)) == (W_ARM | I_SPECIAL)) {
60 /* restoring saved game; no properties are conferred via skin */
62 /* assert( !uarm ); */
65 u.uroleplay.nudist = FALSE;
66 for (wp = worn; wp->w_mask; wp++)
67 if (wp->w_mask & mask) {
69 if (oobj && !(oobj->owornmask & wp->w_mask))
70 impossible("Setworn: mask = %ld.", wp->w_mask);
72 if (u.twoweap && (oobj->owornmask & (W_WEP | W_SWAPWEP)))
74 oobj->owornmask &= ~wp->w_mask;
75 if (wp->w_mask & ~(W_SWAPWEP | W_QUIVER)) {
76 /* leave as "x = x <op> y", here and below, for broken
78 p = objects[oobj->otyp].oc_oprop;
79 u.uprops[p].extrinsic =
80 u.uprops[p].extrinsic & ~wp->w_mask;
81 if ((p = w_blocks(oobj, mask)) != 0)
82 u.uprops[p].blocked &= ~wp->w_mask;
84 set_artifact_intrinsic(oobj, 0, mask);
86 /* in case wearing or removal is in progress or removal
87 is pending (via 'A' command for multiple items) */
88 cancel_doff(oobj, wp->w_mask);
92 obj->owornmask |= wp->w_mask;
93 /* Prevent getting/blocking intrinsics from wielding
94 * potions, through the quiver, etc.
95 * Allow weapon-tools, too.
96 * wp_mask should be same as mask at this point.
98 if (wp->w_mask & ~(W_SWAPWEP | W_QUIVER)) {
99 if (obj->oclass == WEAPON_CLASS || is_weptool(obj)
101 p = objects[obj->otyp].oc_oprop;
102 u.uprops[p].extrinsic =
103 u.uprops[p].extrinsic | wp->w_mask;
104 if ((p = w_blocks(obj, mask)) != 0)
105 u.uprops[p].blocked |= wp->w_mask;
108 set_artifact_intrinsic(obj, 1, mask);
116 /* called e.g. when obj is destroyed */
117 /* Updated to use the extrinsic and blocked fields. */
120 register struct obj *obj;
122 register const struct worn *wp;
127 if (obj == uwep || obj == uswapwep)
129 for (wp = worn; wp->w_mask; wp++)
130 if (obj == *(wp->w_obj)) {
131 /* in case wearing or removal is in progress or removal
132 is pending (via 'A' command for multiple items) */
133 cancel_doff(obj, wp->w_mask);
136 p = objects[obj->otyp].oc_oprop;
137 u.uprops[p].extrinsic = u.uprops[p].extrinsic & ~wp->w_mask;
138 obj->owornmask &= ~wp->w_mask;
140 set_artifact_intrinsic(obj, 0, wp->w_mask);
141 if ((p = w_blocks(obj, wp->w_mask)) != 0)
142 u.uprops[p].blocked &= ~wp->w_mask;
147 /* return a bitmask of the equipment slot(s) a given item might be worn in */
152 int otyp = obj->otyp;
153 /* practically any item can be wielded or quivered; it's up to
154 our caller to handle such things--we assume "normal" usage */
155 long res = 0L; /* default: can't be worn anywhere */
157 switch (obj->oclass) {
159 res = W_AMUL; /* WORN_AMUL */
162 res = W_RINGL | W_RINGR; /* W_RING, BOTH_SIDES */
165 switch (objects[otyp].oc_armcat) {
168 break; /* WORN_ARMOR */
171 break; /* WORN_SHIELD */
174 break; /* WORN_HELMET */
177 break; /* WORN_GLOVES */
180 break; /* WORN_BOOTS */
183 break; /* WORN_CLOAK */
186 break; /* WORN_SHIRT */
190 res = W_WEP | W_SWAPWEP;
191 if (objects[otyp].oc_merge)
195 if (otyp == BLINDFOLD || otyp == TOWEL || otyp == LENSES)
196 res = W_TOOL; /* WORN_BLINDF */
197 else if (is_weptool(obj) || otyp == TIN_OPENER)
198 res = W_WEP | W_SWAPWEP;
199 else if (otyp == SADDLE)
203 if (obj->otyp == MEAT_RING)
204 res = W_RINGL | W_RINGR;
226 if (!mon->invis_blkd) {
228 newsym(mon->mx, mon->my); /* make it disappear */
230 see_wsegs(mon); /* and any tail too */
235 mon_adjust_speed(mon, adjust, obj)
237 int adjust; /* positive => increase speed, negative => decrease */
238 struct obj *obj; /* item to make known if effect can be seen */
241 boolean give_msg = !in_mklev, petrify = FALSE;
242 unsigned int oldspeed = mon->mspeed;
246 mon->permspeed = MFAST;
247 give_msg = FALSE; /* special case monster creation */
250 if (mon->permspeed == MSLOW)
253 mon->permspeed = MFAST;
255 case 0: /* just check for worn speed boots */
258 if (mon->permspeed == MFAST)
261 mon->permspeed = MSLOW;
264 mon->permspeed = MSLOW;
265 give_msg = FALSE; /* (not currently used) */
267 case -3: /* petrification */
268 /* take away intrinsic speed but don't reduce normal speed */
269 if (mon->permspeed == MFAST)
273 case -4: /* green slime */
274 if (mon->permspeed == MFAST)
280 for (otmp = mon->minvent; otmp; otmp = otmp->nobj)
281 if (otmp->owornmask && objects[otmp->otyp].oc_oprop == FAST)
283 if (otmp) /* speed boots */
286 mon->mspeed = mon->permspeed;
288 /* no message if monster is immobile (temp or perm) or unseen */
289 if (give_msg && (mon->mspeed != oldspeed || petrify) && mon->data->mmove
290 && !(mon->mfrozen || mon->msleeping) && canseemon(mon)) {
291 /* fast to slow (skipping intermediate state) or vice versa */
292 const char *howmuch =
294 (mon->mspeed + oldspeed == MFAST + MSLOW) ? "much " : "";
296 (mon->mspeed + oldspeed == MFAST + MSLOW) ? "
\82·
\82²
\82" : "";
299 /* mimic the player's petrification countdown; "slowing down"
300 even if fast movement rate retained via worn speed boots */
303 pline("%s is slowing down.", Monnam(mon));
305 pline("%s
\82Í
\82Ì
\82ë
\82
\82È
\82Á
\82½
\81D", Monnam(mon));
306 } else if (adjust > 0 || mon->mspeed == MFAST)
308 pline("%s is suddenly moving %sfaster.", Monnam(mon), howmuch);
310 pline("%s
\82Ì
\93®
\82«
\82Í
\93Ë
\91R%s
\82·
\82Î
\82â
\82
\82È
\82Á
\82½
\81D", Monnam(mon), howmuch);
313 pline("%s seems to be moving %sslower.", Monnam(mon), howmuch);
315 pline("%s
\82Ì
\93®
\82«
\82Í%s
\82Ì
\82ë
\82
\82È
\82Á
\82½
\82æ
\82¤
\82É
\8c©
\82¦
\82é
\81D", Monnam(mon), howmuch);
317 /* might discover an object if we see the speed change happen */
323 /* armor put on or taken off; might be magical variety */
325 update_mon_intrinsics(mon, obj, on, silently)
328 boolean on, silently;
333 int which = (int) objects[obj->otyp].oc_oprop;
335 unseen = !canseemon(mon);
342 mon->minvis = !mon->invis_blkd;
345 boolean save_in_mklev = in_mklev;
348 mon_adjust_speed(mon, 0, obj);
349 in_mklev = save_in_mklev;
352 /* properties handled elsewhere */
356 /* properties which have no effect for monsters */
361 /* properties which should have an effect but aren't implemented */
365 /* properties which maybe should have an effect but don't */
372 if (which <= 8) { /* 1 thru 8 correspond to MR_xxx mask values */
373 /* FIRE,COLD,SLEEP,DISINT,SHOCK,POISON,ACID,STONE */
374 mask = (uchar) (1 << (which - 1));
375 mon->mintrinsics |= (unsigned short) mask;
382 mon->minvis = mon->perminvis;
385 boolean save_in_mklev = in_mklev;
388 mon_adjust_speed(mon, 0, obj);
389 in_mklev = save_in_mklev;
400 mask = (uchar) (1 << (which - 1));
401 /* If the monster doesn't have this resistance intrinsically,
402 check whether any other worn item confers it. Note that
403 we don't currently check for anything conferred via simply
404 carrying an object. */
405 if (!(mon->data->mresists & mask)) {
406 for (otmp = mon->minvent; otmp; otmp = otmp->nobj)
408 && (int) objects[otmp->otyp].oc_oprop == which)
411 mon->mintrinsics &= ~((unsigned short) mask);
420 /* obj->owornmask has been cleared by this point, so we can't use it.
421 However, since monsters don't wield armor, we don't have to guard
422 against that and can get away with a blanket worn-mask value. */
423 switch (w_blocks(obj, ~0L)) {
425 mon->invis_blkd = on ? 1 : 0;
426 mon->minvis = on ? 0 : mon->perminvis;
432 if (!on && mon == u.usteed && obj->otyp == SADDLE)
433 dismount_steed(DISMOUNT_FELL);
435 /* if couldn't see it but now can, or vice versa, update display */
436 if (!silently && (unseen ^ !canseemon(mon)))
437 newsym(mon->mx, mon->my);
442 register struct monst *mon;
444 register struct obj *obj;
445 int base = mon->data->ac;
446 long mwflags = mon->misc_worn_check;
448 for (obj = mon->minvent; obj; obj = obj->nobj) {
449 if (obj->owornmask & mwflags)
450 base -= ARM_BONUS(obj);
451 /* since ARM_BONUS is positive, subtracting it increases AC */
457 * weapons are handled separately;
458 * rings and eyewear aren't used by monsters
461 /* Wear the best object of each type that the monster has. During creation,
462 * the monster can put everything on at once; otherwise, wearing takes time.
463 * This doesn't affect monster searching for objects--a monster may very well
464 * search for objects it would not want to wear, because we don't want to
465 * check which_armor() each round.
467 * We'll let monsters put on shirts and/or suits under worn cloaks, but
468 * not shirts under worn suits. This is somewhat arbitrary, but it's
469 * too tedious to have them remove and later replace outer garments,
470 * and preventing suits under cloaks makes it a little bit too easy for
471 * players to influence what gets worn. Putting on a shirt underneath
472 * already worn body armor is too obviously buggy...
475 m_dowear(mon, creation)
476 register struct monst *mon;
479 #define RACE_EXCEPTION TRUE
480 /* Note the restrictions here are the same as in dowear in do_wear.c
481 * except for the additional restriction on intelligence. (Players
482 * are always intelligent, even if polymorphed).
484 if (verysmall(mon->data) || nohands(mon->data) || is_animal(mon->data))
486 /* give mummies a chance to wear their wrappings
487 * and let skeletons wear their initial armor */
488 if (mindless(mon->data)
489 && (!creation || (mon->data->mlet != S_MUMMY
490 && mon->data != &mons[PM_SKELETON])))
493 m_dowear_type(mon, W_AMUL, creation, FALSE);
494 /* can't put on shirt if already wearing suit */
495 if (!cantweararm(mon->data) && !(mon->misc_worn_check & W_ARM))
496 m_dowear_type(mon, W_ARMU, creation, FALSE);
497 /* treating small as a special case allows
498 hobbits, gnomes, and kobolds to wear cloaks */
499 if (!cantweararm(mon->data) || mon->data->msize == MZ_SMALL)
500 m_dowear_type(mon, W_ARMC, creation, FALSE);
501 m_dowear_type(mon, W_ARMH, creation, FALSE);
502 if (!MON_WEP(mon) || !bimanual(MON_WEP(mon)))
503 m_dowear_type(mon, W_ARMS, creation, FALSE);
504 m_dowear_type(mon, W_ARMG, creation, FALSE);
505 if (!slithy(mon->data) && mon->data->mlet != S_CENTAUR)
506 m_dowear_type(mon, W_ARMF, creation, FALSE);
507 if (!cantweararm(mon->data))
508 m_dowear_type(mon, W_ARM, creation, FALSE);
510 m_dowear_type(mon, W_ARM, creation, RACE_EXCEPTION);
514 m_dowear_type(mon, flag, creation, racialexception)
518 boolean racialexception;
520 struct obj *old, *best, *obj;
522 int unseen = !canseemon(mon);
527 return; /* probably putting previous item on */
529 /* Get a copy of monster's name before altering its visibility */
530 Strcpy(nambuf, See_invisible ? Monnam(mon) : mon_nam(mon));
532 old = which_armor(mon, flag);
533 if (old && old->cursed)
535 if (old && flag == W_AMUL)
536 return; /* no such thing as better amulets */
539 for (obj = mon->minvent; obj; obj = obj->nobj) {
542 if (obj->oclass != AMULET_CLASS
543 || (obj->otyp != AMULET_OF_LIFE_SAVING
544 && obj->otyp != AMULET_OF_REFLECTION))
547 goto outer_break; /* no such thing as better amulets */
559 /* changing alignment is not implemented for monsters;
560 priests and minions could change alignment but wouldn't
561 want to, so they reject helms of opposite alignment */
562 if (obj->otyp == HELM_OF_OPPOSITE_ALIGNMENT
563 && (mon->ispriest || mon->isminion))
565 /* (flimsy exception matches polyself handling) */
566 if (has_horns(mon->data) && !is_flimsy(obj))
584 if (racialexception && (racial_exception(mon, obj) < 1))
590 /* I'd like to define a VISIBLE_ARM_BONUS which doesn't assume the
591 * monster knows obj->spe, but if I did that, a monster would keep
592 * switching forever between two -2 caps since when it took off one
593 * it would forget spe and once again think the object is better
594 * than what it already has.
596 if (best && (ARM_BONUS(best) + extra_pref(mon, best)
597 >= ARM_BONUS(obj) + extra_pref(mon, obj)))
602 if (!best || best == old)
605 /* same auto-cursing behavior as for hero */
606 autocurse = ((best->otyp == HELM_OF_OPPOSITE_ALIGNMENT
607 || best->otyp == DUNCE_CAP) && !best->cursed);
608 /* if wearing a cloak, account for the time spent removing
609 and re-wearing it when putting on a suit or shirt */
610 if ((flag == W_ARM || flag == W_ARMU) && (mon->misc_worn_check & W_ARMC))
612 /* when upgrading a piece of armor, account for time spent
613 taking off current one */
615 m_delay += objects[old->otyp].oc_delay;
617 if (old) /* do this first to avoid "(being worn)" */
620 if (canseemon(mon)) {
625 Sprintf(buf, " removes %s and", distant_name(old, doname));
627 Sprintf(buf, "%s
\82ð
\82Í
\82¸
\82µ
\82Ä", distant_name(old, doname));
631 pline("%s%s puts on %s.", Monnam(mon), buf,
632 distant_name(best, doname));
634 pline("%s
\82Í%s%s
\82ð
\90g
\82É
\82Â
\82¯
\82½
\81D", Monnam(mon), buf,
635 distant_name(best,doname));
639 pline("%s %s %s %s for a moment.", s_suffix(Monnam(mon)),
640 simpleonames(best), otense(best, "glow"),
643 pline("%s
\82Ì%s
\82Í
\82µ
\82Î
\82ç
\82%s
\8bP
\82¢
\82½
\81D", Monnam(mon),
645 jconj_adj(hcolor(NH_BLACK)));
648 m_delay += objects[best->otyp].oc_delay;
649 mon->mfrozen = m_delay;
654 update_mon_intrinsics(mon, old, FALSE, creation);
655 mon->misc_worn_check |= flag;
656 best->owornmask |= flag;
659 update_mon_intrinsics(mon, best, TRUE, creation);
660 /* if couldn't see it but now can, or vice versa, */
661 if (!creation && (unseen ^ !canseemon(mon))) {
662 if (mon->minvis && !See_invisible) {
664 pline("Suddenly you cannot see %s.", nambuf);
666 pline("
\93Ë
\91R%s
\82ª
\8c©
\82¦
\82È
\82
\82È
\82Á
\82½
\81D", nambuf);
667 makeknown(best->otyp);
668 } /* else if (!mon->minvis) pline("%s suddenly appears!",
672 #undef RACE_EXCEPTION
675 which_armor(mon, flag)
679 if (mon == &youmonst) {
696 impossible("bad flag in which_armor");
700 register struct obj *obj;
702 for (obj = mon->minvent; obj; obj = obj->nobj)
703 if (obj->owornmask & flag)
705 return (struct obj *) 0;
709 /* remove an item of armor and then drop it */
711 m_lose_armor(mon, obj)
715 mon->misc_worn_check &= ~obj->owornmask;
717 update_mon_intrinsics(mon, obj, FALSE, FALSE);
720 obj_extract_self(obj);
721 place_object(obj, mon->mx, mon->my);
722 /* call stackobj() if we ever drop anything that can merge */
723 newsym(mon->mx, mon->my);
726 /* all objects with their bypass bit set should now be reset to normal */
730 struct obj *otmp, *nobj;
733 for (otmp = fobj; otmp; otmp = nobj) {
738 /* bypass will have inhibited any stacking, but since it's
739 * used for polymorph handling, the objects here probably
740 * have been transformed and won't be stacked in the usual
741 * manner afterwards; so don't bother with this.
742 * [Changing the fobj chain mid-traversal would also be risky.]
745 if (objects[otmp->otyp].oc_merge) {
748 (void) get_obj_location(otmp, &ox, &oy, 0);
755 for (otmp = invent; otmp; otmp = otmp->nobj)
757 for (otmp = migrating_objs; otmp; otmp = otmp->nobj)
759 for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
760 if (DEADMONSTER(mtmp))
762 for (otmp = mtmp->minvent; otmp; otmp = otmp->nobj)
765 for (mtmp = migrating_mons; mtmp; mtmp = mtmp->nmon) {
766 for (otmp = mtmp->minvent; otmp; otmp = otmp->nobj)
769 /* billobjs and mydogs chains don't matter here */
770 context.bypasses = FALSE;
778 context.bypasses = TRUE;
781 /* set or clear the bypass bit in a list of objects */
783 bypass_objlist(objchain, on)
784 struct obj *objchain;
785 boolean on; /* TRUE => set, FALSE => clear */
788 context.bypasses = TRUE;
790 objchain->bypass = on ? 1 : 0;
791 objchain = objchain->nobj;
795 /* return the first object without its bypass bit set; set that bit
796 before returning so that successive calls will find further objects */
798 nxt_unbypassed_obj(objchain)
799 struct obj *objchain;
802 if (!objchain->bypass) {
803 bypass_obj(objchain);
806 objchain = objchain->nobj;
812 mon_break_armor(mon, polyspot)
816 register struct obj *otmp;
817 struct permonst *mdat = mon->data;
818 boolean vis = cansee(mon->mx, mon->my);
819 boolean handless_or_tiny = (nohands(mdat) || verysmall(mdat));
820 #if 0 /*JP*//*
\8eg
\82í
\82È
\82¢*/
821 const char *pronoun = mhim(mon), *ppronoun = mhis(mon);
824 if (breakarm(mdat)) {
825 if ((otmp = which_armor(mon, W_ARM)) != 0) {
826 if ((Is_dragon_scales(otmp) && mdat == Dragon_scales_to_pm(otmp))
827 || (Is_dragon_mail(otmp) && mdat == Dragon_mail_to_pm(otmp)))
828 ; /* no message here;
829 "the dragon merges with his scaly armor" is odd
830 and the monster's previous form is already gone */
833 pline("%s breaks out of %s armor!", Monnam(mon), ppronoun);
835 pline("%s
\82Í
\8aZ
\82ð
\82â
\82Ô
\82è
\8fo
\82½
\81I", Monnam(mon));
838 You_hear("a cracking sound.");
840 You_hear("
\83o
\83\8a\83o
\83\8a\82Æ
\82¢
\82¤
\89¹
\82ð
\95·
\82¢
\82½
\81D");
843 if ((otmp = which_armor(mon, W_ARMC)) != 0) {
844 if (otmp->oartifact) {
847 pline("%s %s falls off!", s_suffix(Monnam(mon)),
848 cloak_simple_name(otmp));
850 pline("%s
\82Ì%s
\82Í
\97\8e\82¿
\82½
\81I", Monnam(mon),
851 cloak_simple_name(otmp));
855 m_lose_armor(mon, otmp);
859 pline("%s %s tears apart!", s_suffix(Monnam(mon)),
860 cloak_simple_name(otmp));
862 pline("%s
\82Ì%s
\82Í
\82¸
\82½
\82¸
\82½
\82É
\82È
\82Á
\82½
\81I", Monnam(mon),
863 cloak_simple_name(otmp));
867 You_hear("a ripping sound.");
869 You_hear("
\83r
\83\8a\83b
\82Æ
\82¢
\82¤
\89¹
\82ð
\95·
\82¢
\82½
\81D");
873 if ((otmp = which_armor(mon, W_ARMU)) != 0) {
876 pline("%s shirt rips to shreds!", s_suffix(Monnam(mon)));
878 pline("%s
\82Ì
\83V
\83\83\83c
\82Í
\82¸
\82½
\82¸
\82½
\82É
\82È
\82Á
\82½
\81I", Monnam(mon));
881 You_hear("a ripping sound.");
883 You_hear("
\83r
\83\8a\83b
\82Æ
\82¢
\82¤
\89¹
\82ð
\95·
\82¢
\82½
\81D");
886 } else if (sliparm(mdat)) {
887 if ((otmp = which_armor(mon, W_ARM)) != 0) {
890 pline("%s armor falls around %s!", s_suffix(Monnam(mon)),
893 pline("%s
\82Ì
\8aZ
\82ª
\89ñ
\82è
\82É
\97\8e\82¿
\82½
\81I", Monnam(mon));
899 You_hear("
\83h
\83V
\83\93\82Æ
\82¢
\82¤
\89¹
\82ð
\95·
\82¢
\82½
\81D");
902 m_lose_armor(mon, otmp);
904 if ((otmp = which_armor(mon, W_ARMC)) != 0) {
906 if (is_whirly(mon->data))
908 pline("%s %s falls, unsupported!", s_suffix(Monnam(mon)),
909 cloak_simple_name(otmp));
911 pline("%s
\82Ì%s
\82Í
\8ex
\82¦
\82«
\82ê
\82¸
\82É
\97\8e\82¿
\82½
\81I", Monnam(mon),
912 cloak_simple_name(otmp));
916 pline("%s shrinks out of %s %s!", Monnam(mon), ppronoun,
917 cloak_simple_name(otmp));
919 pline("%s
\82Í%s
\82æ
\82è
\8fk
\82ñ
\82¾
\81I", Monnam(mon),
920 cloak_simple_name(otmp));
925 m_lose_armor(mon, otmp);
927 if ((otmp = which_armor(mon, W_ARMU)) != 0) {
929 if (sliparm(mon->data))
931 pline("%s seeps right through %s shirt!", Monnam(mon),
934 pline("%s
\82Í
\8e©
\95ª
\82Ì
\83V
\83\83\83c
\82É
\82µ
\82Ý
\8d\9e\82ñ
\82¾
\81I", Monnam(mon));
938 pline("%s becomes much too small for %s shirt!",
939 Monnam(mon), ppronoun);
941 pline("%s
\82Í
\8e©
\95ª
\82Ì
\83V
\83\83\83c
\82æ
\82è
\82¸
\82Á
\82Æ
\8f¬
\82³
\82
\82È
\82Á
\82½
\81I",
947 m_lose_armor(mon, otmp);
950 if (handless_or_tiny) {
951 /* [caller needs to handle weapon checks] */
952 if ((otmp = which_armor(mon, W_ARMG)) != 0) {
955 pline("%s drops %s gloves%s!", Monnam(mon), ppronoun,
956 MON_WEP(mon) ? " and weapon" : "");
958 pline("%s
\82Í
\8f¬
\8eè%s
\82ð
\97\8e\82µ
\82½
\81I", Monnam(mon),
959 MON_WEP(mon) ? "
\82Æ
\95\90\8aí" : "");
963 m_lose_armor(mon, otmp);
965 if ((otmp = which_armor(mon, W_ARMS)) != 0) {
968 pline("%s can no longer hold %s shield!", Monnam(mon),
971 pline("%s
\82Í
\82à
\82Í
\82â
\8f\82\82ð
\8e\9d\82Â
\82±
\82Æ
\82ª
\82Å
\82«
\82È
\82¢
\81I", Monnam(mon));
975 You_hear("a clank.");
977 You_hear("
\83J
\83\89\83\93\82Æ
\82¢
\82¤
\89¹
\82ð
\95·
\82¢
\82½
\81D");
980 m_lose_armor(mon, otmp);
983 if (handless_or_tiny || has_horns(mdat)) {
984 if ((otmp = which_armor(mon, W_ARMH)) != 0
985 /* flimsy test for horns matches polyself handling */
986 && (handless_or_tiny || !is_flimsy(otmp))) {
989 pline("%s helmet falls to the %s!", s_suffix(Monnam(mon)),
990 surface(mon->mx, mon->my));
992 pline("%s
\82Ì
\8a\95\82Í%s
\82Ö
\97\8e\82¿
\82½
\81I",
993 Monnam(mon), surface(mon->mx, mon->my));
997 You_hear("a clank.");
999 You_hear("
\83K
\83`
\83\83\83\93\82Æ
\82¢
\82¤
\89¹
\82ð
\95·
\82¢
\82½
\81D");
1002 m_lose_armor(mon, otmp);
1005 if (handless_or_tiny || slithy(mdat) || mdat->mlet == S_CENTAUR) {
1006 if ((otmp = which_armor(mon, W_ARMF)) != 0) {
1008 if (is_whirly(mon->data))
1010 pline("%s boots fall away!", s_suffix(Monnam(mon)));
1012 pline("%s
\82Ì
\8cC
\82Í
\82Ê
\82°
\97\8e\82¿
\82½
\81I", Monnam(mon));
1015 pline("%s boots %s off %s feet!", s_suffix(Monnam(mon)),
1016 verysmall(mdat) ? "slide" : "are pushed", ppronoun);
1018 pline("%s
\82Ì
\8cC
\82Í
\91«
\82©
\82ç%s
\81I", Monnam(mon),
1019 verysmall(mdat) ? "
\8a\8a\82è
\97\8e\82¿
\82½" : "
\89\9f\82µ
\8fo
\82³
\82ê
\82½");
1024 m_lose_armor(mon, otmp);
1027 if (!can_saddle(mon)) {
1028 if ((otmp = which_armor(mon, W_SADDLE)) != 0) {
1031 m_lose_armor(mon, otmp);
1034 pline("%s saddle falls off.", s_suffix(Monnam(mon)));
1036 pline("%s
\82©
\82ç
\88Æ
\82ª
\97\8e\82¿
\82½
\81D", Monnam(mon));
1038 if (mon == u.usteed)
1040 } else if (mon == u.usteed && !can_ride(mon)) {
1043 You("can no longer ride %s.", mon_nam(mon));
1045 You("
\82à
\82¤%s
\82É
\8fæ
\82Á
\82Ä
\82¢
\82ç
\82ê
\82È
\82¢
\81D", mon_nam(mon));
1046 if (touch_petrifies(u.usteed->data) && !Stone_resistance && rnl(3)) {
1050 You("touch %s.", mon_nam(u.usteed));
1052 You("%s
\82É
\90G
\82Á
\82½
\81D", mon_nam(u.usteed));
1054 Sprintf(buf, "falling off %s", an(u.usteed->data->mname));
1056 Sprintf(buf, "%s
\82©
\82ç
\97\8e\82¿
\82Ä", u.usteed->data->mname);
1059 dismount_steed(DISMOUNT_FELL);
1064 /* bias a monster's preferences towards armor that has special benefits. */
1066 extra_pref(mon, obj)
1070 /* currently only does speed boots, but might be expanded if monsters
1071 * get to use more armor abilities
1074 if (obj->otyp == SPEED_BOOTS && mon->permspeed != MFAST)
1081 * Exceptions to things based on race.
1082 * Correctly checks polymorphed player race.
1084 * 0 No exception, normal rules apply.
1085 * 1 If the race/object combination is acceptable.
1086 * -1 If the race/object combination is unacceptable.
1089 racial_exception(mon, obj)
1093 const struct permonst *ptr = raceptr(mon);
1095 /* Acceptable Exceptions: */
1096 /* Allow hobbits to wear elven armor - LoTR */
1097 if (ptr == &mons[PM_HOBBIT] && is_elven_armor(obj))
1099 /* Unacceptable Exceptions: */
1100 /* Checks for object that certain races should never use go here */