]> granicus.if.org Git - nethack/commitdiff
more ring theft
authornethack.rankin <nethack.rankin>
Thu, 10 Feb 2005 05:54:34 +0000 (05:54 +0000)
committernethack.rankin <nethack.rankin>
Thu, 10 Feb 2005 05:54:34 +0000 (05:54 +0000)
     Neither nymphs nor monkeys can steal a ring worn underneath gloves
since they can't see them.  If such rings are randomly targetted, try to
take gloves instead.

     Succubi trying to take worn ring of adornment will attempt to take
off worn gloves first.  (Presumeably they can sense magic rings hidden
beneath gloves better than nymphs can; they're about to try to take all
worn armor off anyway....)  If the glove removal fails, ring theft will
too.  Likewise for incubi, remove gloves before trying to force the hero
to put on ring of adornment.

     At the moment succubi and incubi can't remove gloves which are
blocked by a welded weapon, but they can manipulate rings then if there
aren't any gloves involved.  I don't think that's right.  The latter is
nymph-like and could be attributed to magic, but if that's the case why
aren't they able to remove gloves from under cursed weapons too?

doc/fixes34.4
src/mhitu.c
src/steal.c

index ba9ef3bdc46de423df91ec0d9fb610ea14ac2b96..f1ca003070110f55f6874e9f1ee129cde09f5ef9 100644 (file)
@@ -86,7 +86,10 @@ interrupt current activity during certain stages of petrification or vomiting
 warning about bad food didn't recognize tin of Medusa meat
 eating tainted Medusa corpse caused food poisioning instead of petrification
 avoid potential stale pointer use after magic bag explosion
+nymphs and monkeys can't steal rings worn under gloves
 monkeys can't steal rings worn under cursed weapon
+succubi will remove hero's gloves before taking worn ring; incubi will do
+       so before forcing ring to be put on
 
 
 Platform- and/or Interface-Specific Fixes
index 6b113d28a179b52a13b9083db9c4a9404ce88125..5278fae59ed9a652bf060928c88ed07c49480244 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)mhitu.c    3.5     2004/12/21      */
+/*     SCCS Id: @(#)mhitu.c    3.5     2005/02/09      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -2167,6 +2167,7 @@ register struct monst *mon;
 {
        register struct obj *ring, *nring;
        boolean fem = (mon->data == &mons[PM_SUCCUBUS]); /* otherwise incubus */
+       int tried_gloves = 0;
        char qbuf[QBUFSZ];
 
        if (mon->mcan || mon->mspec_used) {
@@ -2184,11 +2185,18 @@ register struct monst *mon;
 
        if (Blind) pline("It caresses you...");
        else You_feel("very attracted to %s.", mon_nam(mon));
+       /* don't try to take off gloves if cursed weapon blocks them */
+       if (welded(uwep)) tried_gloves = 1;
 
        for(ring = invent; ring; ring = nring) {
            nring = ring->nobj;
            if (ring->otyp != RIN_ADORNMENT) continue;
            if (fem) {
+               if (ring->owornmask && uarmg) {
+                   /* don't take off worn ring if gloves are in the way */
+                   if (!tried_gloves++) mayberem(uarmg, "gloves");
+                   if (uarmg) continue;    /* next ring might not be worn */
+               }
                if (rn2(20) < ACURR(A_CHA)) {
                    Sprintf(qbuf, "\"That %s looks pretty.  May I have it?\"",
                        safe_qbuf("",sizeof("\"That  looks pretty.  May I have it?\""),
@@ -2209,6 +2217,11 @@ register struct monst *mon;
                                && uright->otyp==RIN_ADORNMENT)
                        break;
                if (ring==uleft || ring==uright) continue;
+               if (uarmg) {
+                   /* don't put on ring if gloves are in the way */
+                   if (!tried_gloves++) mayberem(uarmg, "gloves");
+                   if (uarmg) break;   /* no point trying further rings */
+               }
                if (rn2(20) < ACURR(A_CHA)) {
                    Sprintf(qbuf,"\"That %s looks pretty.  Would you wear it for me?\"",
                        safe_qbuf("",
@@ -2260,7 +2273,7 @@ register struct monst *mon;
        if(!uarmc)
                mayberem(uarm, "suit");
        mayberem(uarmf, "boots");
-       if(!uwep || !welded(uwep))
+       if (!tried_gloves)
                mayberem(uarmg, "gloves");
        mayberem(uarms, "shield");
        mayberem(uarmh, helm_simple_name(uarmh));
index c94c9af8baca53ae36beb99bea2a04708888a6bc..361dac8b12d180963b683130b403654474e359d3 100644 (file)
@@ -259,7 +259,7 @@ nothing_to_steal:
        }
 
        monkey_business = is_animal(mtmp->data);
-       if (monkey_business) {
+       if (monkey_business || uarmg) {
            ;   /* skip ring special cases */
        } else if (Adornment & LEFT_RING) {
            otmp = uleft;
@@ -293,15 +293,18 @@ nothing_to_steal:
                impossible("Steal fails!");
                return(0);
        }
+       /* can't steal ring(s) while wearing gloves */
+       if ((otmp == uleft || otmp == uright) && uarmg) otmp = uarmg;
        /* can't steal gloves while wielding - so steal the wielded item. */
-       if (otmp == uarmg && uwep)
-           otmp = uwep;
+       if (otmp == uarmg && uwep) otmp = uwep;
        /* can't steal armor while wearing cloak - so steal the cloak. */
        else if(otmp == uarm && uarmc) otmp = uarmc;
 #ifdef TOURIST
+       /* can't steal shirt while wearing cloak or suit */
        else if(otmp == uarmu && uarmc) otmp = uarmc;
        else if(otmp == uarmu && uarm) otmp = uarm;
 #endif
+
 gotobj:
        if(otmp->o_id == stealoid) return(0);