From: nethack.rankin Date: Sun, 5 Feb 2012 04:26:48 +0000 (+0000) Subject: theft vs donning, round 2 (trunk only) X-Git-Tag: MOVE2GIT~58 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a2f15cfd612e4973c3af5b0cd5bce6f0c060fcdc;p=nethack theft vs donning, round 2 (trunk only) The message "you stop taking off " when interrupted by a nymph's or monkey's theft attack would only be given if you were using 'A' to take off the armor. If you used 'T', you'd get "you stop putting on " instead. The fix for that also makes it easy to vary the nymph message " you to start taking off" to be "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 _on() or _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 diff --git a/src/mhitu.c b/src/mhitu.c index 1f379388b..1d650f23d 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -2263,7 +2263,7 @@ register struct monst *mon; else You_feel("very attracted to %s.", mon_nam(mon)); /* if in the process of putting armor on or taking armor off, interrupt that activity now */ - stop_donning((struct obj *)0); + (void) stop_donning((struct obj *)0); /* don't try to take off gloves if cursed weapon blocks them */ if (welded(uwep)) tried_gloves = 1; diff --git a/src/steal.c b/src/steal.c index 6016e41a9..21712a3f2 100644 --- a/src/steal.c +++ b/src/steal.c @@ -272,7 +272,8 @@ char *objnambuf; { 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. */ @@ -391,6 +392,7 @@ gotobj: 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); @@ -429,13 +431,17 @@ gotobj: 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 */