long what = context.takeoff.what; /* if nonzero, occupation is implied */
boolean result = FALSE;
+ /* 'W' and 'T' set afternmv, 'A' sets context.takeoff.what */
if (otmp == uarm)
result = (afternmv == Armor_on || afternmv == Armor_off ||
what == WORN_ARMOR);
return result;
}
+/* check whether the target object is currently being taken off,
+ so that stop_donning() and steal() can vary messages */
+boolean
+doffing(otmp)
+struct obj *otmp;
+{
+ long what = context.takeoff.what;
+ boolean result = FALSE;
+
+ /* 'T' (also 'W') sets afternmv, 'A' sets context.takeoff.what */
+ if (otmp == uarm)
+ result = (afternmv == Armor_off || what == WORN_ARMOR);
+#ifdef TOURIST
+ else if (otmp == uarmu)
+ result = (afternmv == Shirt_off || what == WORN_SHIRT);
+#endif
+ else if (otmp == uarmc)
+ result = (afternmv == Cloak_off || what == WORN_CLOAK);
+ else if (otmp == uarmf)
+ result = (afternmv == Boots_off || what == WORN_BOOTS);
+ else if (otmp == uarmh)
+ result = (afternmv == Helmet_off || what == WORN_HELMET);
+ else if (otmp == uarmg)
+ result = (afternmv == Gloves_off || what == WORN_GLOVES);
+ else if (otmp == uarms)
+ result = (afternmv == Shield_off || what == WORN_SHIELD);
+
+ return result;
+}
+
void
cancel_don()
{
char buf[BUFSZ];
struct obj *otmp;
boolean putting_on;
- int result;
+ int result = 0;
for (otmp = invent; otmp; otmp = otmp->nobj)
if ((otmp->owornmask & W_ARMOR) && donning(otmp)) break;
/* at most one item will pass donning() test at any given time */
if (!otmp) return 0;
- result = -multi; /* remember this before calling unmul() */
- /* donning() returns True when doffing too */
- putting_on = !(context.takeoff.mask & otmp->owornmask);
+ /* donning() returns True when doffing too; doffing() is more specific */
+ putting_on = !doffing(otmp);
/* cancel_don() looks at afternmv; it also serves as cancel_doff() */
cancel_don();
/* don't want <armor>_on() or <armor>_off() being called
by unmul() since the on or off action isn't completing */
afternmv = 0;
- if (putting_on || otmp != stolenobj)
+ if (putting_on || otmp != stolenobj) {
Sprintf(buf, "You stop %s %s.",
putting_on ? "putting on" : "taking off",
thesimpleoname(otmp));
- else
- buf[0] = '\0'; /* silently stop doffing stolenobj */
+ } else {
+ buf[0] = '\0'; /* silently stop doffing stolenobj */
+ result = -multi; /* remember this before calling unmul() */
+ }
unmul(buf);
/* while putting on, item becomes worn immediately but side-effects are
deferred until the delay expires; when interrupted, make it unworn
{
struct obj *otmp;
int tmp, could_petrify, armordelay, olddelay, named = 0, retrycnt = 0;
- boolean monkey_business; /* true iff an animal is doing the thievery */
+ boolean monkey_business, /* true iff an animal is doing the thievery */
+ was_doffing;
if (objnambuf) *objnambuf = '\0';
/* the following is true if successful on first of two attacks. */
o_unleash(otmp);
}
+ was_doffing = doffing(otmp);
/* stop donning/doffing now so that afternmv won't be clobbered
below; stop_occupation doesn't handle donning/doffing */
olddelay = stop_donning(otmp);
pline("%s charms you. You gladly %s your %s.",
!seen ? "She" : Monnam(mtmp),
curssv ? "let her take" :
- slowly ? "start removing" : "hand over",
+ !slowly ? "hand over" :
+ was_doffing ? "continue removing" :
+ "start removing",
equipname(otmp));
else
pline("%s seduces you and %s off your %s.",
!seen ? "She" : Adjmonnam(mtmp, "beautiful"),
curssv ? "helps you to take" :
- slowly ? "you start taking" : "you take",
+ !slowly ? "you take" :
+ was_doffing ? "you continue taking" :
+ "you start taking",
equipname(otmp));
named++;
/* the following is to set multi for later on */