break_armor(void)
{
register struct obj *otmp;
+ struct permonst *uptr = g.youmonst.data;
- if (breakarm(g.youmonst.data)) {
+ if (breakarm(uptr)) {
if ((otmp = uarm) != 0) {
if (donning(otmp))
cancel_don();
(void) Armor_gone();
useup(otmp);
}
- if ((otmp = uarmc) != 0) {
+ if ((otmp = uarmc) != 0
+ /* mummy wrapping adapts to small and very big sizes */
+ && (otmp->otyp != MUMMY_WRAPPING || !WrappingAllowed(uptr))) {
if (otmp->oartifact) {
Your("%s falls off!", cloak_simple_name(otmp));
(void) Cloak_off();
Your("shirt rips to shreds!");
useup(uarmu);
}
- } else if (sliparm(g.youmonst.data)) {
- if ((otmp = uarm) != 0 && racial_exception(&g.youmonst, otmp) < 1) {
+ } else if (sliparm(uptr)) {
+ if ((otmp = uarm) != 0 && racial_exception(uptr, otmp) < 1) {
if (donning(otmp))
cancel_don();
Your("armor falls around you!");
(void) Armor_gone();
dropp(otmp);
}
- if ((otmp = uarmc) != 0) {
- if (is_whirly(g.youmonst.data))
+ if ((otmp = uarmc) != 0
+ /* mummy wrapping adapts to small and very big sizes */
+ && (otmp->otyp != MUMMY_WRAPPING || !WrappingAllowed(uptr))) {
+ if (is_whirly(uptr))
Your("%s falls, unsupported!", cloak_simple_name(otmp));
else
You("shrink out of your %s!", cloak_simple_name(otmp));
dropp(otmp);
}
if ((otmp = uarmu) != 0) {
- if (is_whirly(g.youmonst.data))
+ if (is_whirly(uptr))
You("seep right through your shirt!");
else
You("become much too small for your shirt!");
dropp(otmp);
}
}
- if (has_horns(g.youmonst.data)) {
+ if (has_horns(uptr)) {
if ((otmp = uarmh) != 0) {
if (is_flimsy(otmp) && !donning(otmp)) {
char hornbuf[BUFSZ];
/* Future possibilities: This could damage/destroy helmet */
- Sprintf(hornbuf, "horn%s", plur(num_horns(g.youmonst.data)));
+ Sprintf(hornbuf, "horn%s", plur(num_horns(uptr)));
Your("%s %s through %s.", hornbuf, vtense(hornbuf, "pierce"),
yname(otmp));
} else {
}
}
}
- if (nohands(g.youmonst.data) || verysmall(g.youmonst.data)) {
+ if (nohands(uptr) || verysmall(uptr)) {
if ((otmp = uarmg) != 0) {
if (donning(otmp))
cancel_don();
dropp(otmp);
}
}
- if (nohands(g.youmonst.data) || verysmall(g.youmonst.data)
- || slithy(g.youmonst.data) || g.youmonst.data->mlet == S_CENTAUR) {
+ if (nohands(uptr) || verysmall(uptr)
+ || slithy(uptr) || uptr->mlet == S_CENTAUR) {
if ((otmp = uarmf) != 0) {
if (donning(otmp))
cancel_don();
- if (is_whirly(g.youmonst.data))
+ if (is_whirly(uptr))
Your("boots fall away!");
else
Your("boots %s off your feet!",
- verysmall(g.youmonst.data) ? "slide" : "are pushed");
+ verysmall(uptr) ? "slide" : "are pushed");
(void) Boots_off();
dropp(otmp);
}
it/them on (should also come off if head is too tiny or too huge,
but putting accessories on doesn't reject those cases [yet?]);
amulet stays worn */
- if ((otmp = ublindf) != 0 && !has_head(g.youmonst.data)) {
+ if ((otmp = ublindf) != 0 && !has_head(uptr)) {
int l;
const char *eyewear = simpleonames(otmp); /* blindfold|towel|lenses */
}
void
-mon_adjust_speed(struct monst *mon,
- int adjust, /* positive => increase speed, negative =>
- decrease */
- struct obj *obj) /* item to make known if effect can be seen */
+mon_adjust_speed(
+ struct monst *mon,
+ int adjust, /* positive => increase speed, negative => decrease */
+ struct obj *obj) /* item to make known if effect can be seen */
{
struct obj *otmp;
boolean give_msg = !g.in_mklev, petrify = FALSE;
void
m_dowear(struct monst *mon, boolean creation)
{
+ boolean can_wear_armor;
+
#define RACE_EXCEPTION TRUE
/* Note the restrictions here are the same as in dowear in do_wear.c
* except for the additional restriction on intelligence. (Players
return;
m_dowear_type(mon, W_AMUL, creation, FALSE);
+ can_wear_armor = !cantweararm(mon->data); /* for suit, cloak, shirt */
/* can't put on shirt if already wearing suit */
- if (!cantweararm(mon->data) && !(mon->misc_worn_check & W_ARM))
+ if (can_wear_armor && !(mon->misc_worn_check & W_ARM))
m_dowear_type(mon, W_ARMU, creation, FALSE);
- /* treating small as a special case allows
- hobbits, gnomes, and kobolds to wear cloaks */
- if (!cantweararm(mon->data) || mon->data->msize == MZ_SMALL)
+ /* WrappingAllowed() makes any size between small and huge eligible;
+ treating small as a special case allows hobbits, gnomes, and
+ kobolds to wear all cloaks; large and huge allows giants and such
+ to wear mummy wrappings but not other cloaks */
+ if (can_wear_armor || WrappingAllowed(mon->data))
m_dowear_type(mon, W_ARMC, creation, FALSE);
m_dowear_type(mon, W_ARMH, creation, FALSE);
if (!MON_WEP(mon) || !bimanual(MON_WEP(mon)))
m_dowear_type(mon, W_ARMG, creation, FALSE);
if (!slithy(mon->data) && mon->data->mlet != S_CENTAUR)
m_dowear_type(mon, W_ARMF, creation, FALSE);
- if (!cantweararm(mon->data))
+ if (can_wear_armor)
m_dowear_type(mon, W_ARM, creation, FALSE);
else
m_dowear_type(mon, W_ARM, creation, RACE_EXCEPTION);
}
static void
-m_dowear_type(struct monst *mon, long flag, boolean creation,
- boolean racialexception)
+m_dowear_type(
+ struct monst *mon,
+ long flag, /* wornmask value */
+ boolean creation,
+ boolean racialexception) /* small monsters that are allowed for player
+ * races (gnomes) can wear suits */
{
struct obj *old, *best, *obj;
long oldmask = 0L;
case W_ARMC:
if (!is_cloak(obj))
continue;
+ /* mummy wrapping is only cloak allowed when bigger than human */
+ if (mon->data->msize > MZ_HUMAN && obj->otyp != MUMMY_WRAPPING)
+ continue;
+ /* avoid mummy wrapping if it will allow hero to see mon (unless
+ this is a new mummy; an invisible one is feasible via ^G) */
+ if (mon->minvis && w_blocks(obj, W_ARMC) == INVIS
+ && !See_invisible && !creation)
+ continue;
break;
case W_ARMH:
if (!is_helmet(obj))
if (mon->minvis && !See_invisible) {
pline("Suddenly you cannot see %s.", nambuf);
makeknown(best->otyp);
- } /* else if (!mon->minvis)
- * pline("%s suddenly appears!", Amonnam(mon)); */
+ /* } else if (!mon->minvis) {
+ * pline("%s suddenly appears!", Amonnam(mon)); */
+ }
}
}
#undef RACE_EXCEPTION
You_hear("a cracking sound.");
m_useup(mon, otmp);
}
- if ((otmp = which_armor(mon, W_ARMC)) != 0) {
+ if ((otmp = which_armor(mon, W_ARMC)) != 0
+ /* mummy wrapping adapts to small and very big sizes */
+ && (otmp->otyp != MUMMY_WRAPPING || !WrappingAllowed(mdat))) {
if (otmp->oartifact) {
if (vis)
pline("%s %s falls off!", s_suffix(Monnam(mon)),
bypass_obj(otmp);
m_lose_armor(mon, otmp);
}
- if ((otmp = which_armor(mon, W_ARMC)) != 0) {
+ if ((otmp = which_armor(mon, W_ARMC)) != 0
+ /* mummy wrapping adapts to small and very big sizes */
+ && (otmp->otyp != MUMMY_WRAPPING || !WrappingAllowed(mdat))) {
if (vis) {
if (is_whirly(mon->data))
pline("%s %s falls, unsupported!", s_suffix(Monnam(mon)),