From 2c7ed27c16f3a480d8e4e5ff3efa7b28255562e9 Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Thu, 15 Dec 2005 07:07:25 +0000 Subject: [PATCH] gold theft while mounted (trunk only) From a bug report, "The leprechuan quickly snatches some gold from between your feet!" doesn't make much sense when you're riding. Fix started out simple, but "between" isn't right if you're above the floor, and "rear hooves" for horse or "rear claws" for dragon didn't sound right for steed (or poly'd hero), so it got a little more complex. Complicated even more due to requiring two copies; ick. A minor side-effect of this change is that somewhat naughty sounding "The leprechaun quickly snatches some gold from between your rear regions!" won't occur anymore. :-} --- doc/fixes35.0 | 1 + src/steal.c | 60 ++++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 49 insertions(+), 12 deletions(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index e9a97e822..5f9a2168c 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -104,6 +104,7 @@ being petrified by swallowing a cockatrice violates foodless conduct devouring Medusa whole is fatal eating pet won't continue eating after becoming paralyzed or falling asleep randomize shopkeeper names when hallucinating +fix wording for "leprechaun steals gold from between your feet" when mounted Platform- and/or Interface-Specific Fixes diff --git a/src/steal.c b/src/steal.c index 772cb04d2..a2baa7039 100644 --- a/src/steal.c +++ b/src/steal.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)steal.c 3.5 2005/10/14 */ +/* SCCS Id: @(#)steal.c 3.5 2005/12/14 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -43,13 +43,31 @@ register struct monst *mtmp; { register struct obj *gold = g_at(u.ux, u.uy); register long tmp; + struct monst *who; + const char *whose, *what; - if (gold && ( !u.ugold || gold->quan > u.ugold || !rn2(5))) { + if (gold && (!u.ugold || gold->quan > u.ugold || !rn2(5))) { mtmp->mgold += gold->quan; delobj(gold); newsym(u.ux, u.uy); - pline("%s quickly snatches some gold from between your %s!", - Monnam(mtmp), makeplural(body_part(FOOT))); +#ifdef STEED + if (u.usteed) + who = u.usteed, + whose = s_suffix(y_monnam(who)), + what = makeplural(mbodypart(who, FOOT)); + else +#endif + who = &youmonst, + whose = "your", + what = makeplural(body_part(FOOT)); + /* [ avoid "between your rear regions" :-] */ + if (slithy(who->data)) what = "coils"; + /* reduce "rear hooves/claws" to "hooves/claws" */ + if (!strncmp(what, "rear ", 5)) what += 5; + pline("%s quickly snatches some gold from %s %s %s!", + Monnam(mtmp), + (Levitation || Flying) ? "beneath" : "between", + whose, what); if(!u.ugold || !rn2(5)) { if (!tele_restrict(mtmp)) (void) rloc(mtmp, FALSE); /* do not set mtmp->mavenge here; gold on the floor is fair game */ @@ -106,19 +124,37 @@ register struct monst *mtmp; register struct obj *fgold = g_at(u.ux, u.uy); register struct obj *ygold; register long tmp; + struct monst *who; + const char *whose, *what; - /* skip lesser coins on the floor */ - while (fgold && fgold->otyp != GOLD_PIECE) fgold = fgold->nexthere; + /* skip lesser coins on the floor */ + while (fgold && fgold->otyp != GOLD_PIECE) fgold = fgold->nexthere; - /* Do you have real gold? */ - ygold = findgold(invent); + /* Do you have real gold? */ + ygold = findgold(invent); - if (fgold && ( !ygold || fgold->quan > ygold->quan || !rn2(5))) { - obj_extract_self(fgold); + if (fgold && (!ygold || fgold->quan > ygold->quan || !rn2(5))) { + obj_extract_self(fgold); add_to_minv(mtmp, fgold); newsym(u.ux, u.uy); - pline("%s quickly snatches some gold from between your %s!", - Monnam(mtmp), makeplural(body_part(FOOT))); +#ifdef STEED + if (u.usteed) + who = u.usteed, + whose = s_suffix(y_monnam(who)), + what = makeplural(mbodypart(who, FOOT)); + else +#endif + who = &youmonst, + whose = "your", + what = makeplural(body_part(FOOT)); + /* [ avoid "between your rear regions" :-] */ + if (slithy(who->data)) what = "coils"; + /* reduce "rear hooves/claws" to "hooves/claws" */ + if (!strncmp(what, "rear ", 5)) what += 5; + pline("%s quickly snatches some gold from %s %s %s!", + Monnam(mtmp), + (Levitation || Flying) ? "beneath" : "between", + whose, what); if(!ygold || !rn2(5)) { if (!tele_restrict(mtmp)) (void) rloc(mtmp, FALSE); monflee(mtmp, 0, FALSE, FALSE); -- 2.50.1