From 4a4fc8f4fa5300146f168393ea466cd0cce41696 Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Thu, 10 Feb 2005 05:54:34 +0000 Subject: [PATCH] more ring theft 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 | 3 +++ src/mhitu.c | 17 +++++++++++++++-- src/steal.c | 9 ++++++--- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/doc/fixes34.4 b/doc/fixes34.4 index ba9ef3bdc..f1ca00307 100644 --- a/doc/fixes34.4 +++ b/doc/fixes34.4 @@ -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 diff --git a/src/mhitu.c b/src/mhitu.c index 6b113d28a..5278fae59 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -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)); diff --git a/src/steal.c b/src/steal.c index c94c9af8b..361dac8b1 100644 --- a/src/steal.c +++ b/src/steal.c @@ -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); -- 2.40.0