From 709748234d444f2c6dd9bc27f9c98657f08ca5cb Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Fri, 20 Sep 2002 05:05:46 +0000 Subject: [PATCH] fix B12003 - kicking a box embedded in a wall Move a block of kicking code so that freeing items stuck inside solid work takes precedence over breaking open containers. Now the box has a chance to fall out like other types of objects (and if it fails that chance, there's just the normal message about not coming loose--no attempt to actually kick open the box will occur). --- doc/fixes34.1 | 1 + src/dokick.c | 62 ++++++++++++++++++++++++++------------------------- 2 files changed, 33 insertions(+), 30 deletions(-) diff --git a/doc/fixes34.1 b/doc/fixes34.1 index 840f402c3..90b768ff7 100644 --- a/doc/fixes34.1 +++ b/doc/fixes34.1 @@ -248,6 +248,7 @@ starved pet raised from dead shouldn't immediately starve again skilled spell of detected treasure wasn't acting like blessed potion of object detection (from Roderick Schertler) fix end of game attribute disclosure for levitation negated by sink +kicking a box embedded in a wall will knock it free rather than bust it open Platform- and/or Interface-Specific Fixes diff --git a/src/dokick.c b/src/dokick.c index da277b541..51305e83d 100644 --- a/src/dokick.c +++ b/src/dokick.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)dokick.c 3.4 2002/07/25 */ +/* SCCS Id: @(#)dokick.c 3.4 2002/09/18 */ /* Copyright (c) Izchak Miller, Mike Stephenson, Steve Linhart, 1989. */ /* NetHack may be freely redistributed. See license for details. */ @@ -406,6 +406,37 @@ xchar x, y; costly_spot(x, y)); insider = (*u.ushops && inside_shop(u.ux, u.uy) && *in_rooms(x, y, SHOPBASE) == *u.ushops); + isgold = (kickobj->oclass == COIN_CLASS); + + if (IS_ROCK(levl[x][y].typ) || closed_door(x, y)) { + if ((!martial() && rn2(20) > ACURR(A_DEX)) || + IS_ROCK(levl[u.ux][u.uy].typ) || closed_door(u.ux, u.uy)) { + if (Blind) + pline("It doesn't come loose."); + else + pline("%s %sn't come loose.", + The(distant_name(kickobj, xname)), + otense(kickobj, "do")); + return (!rn2(3) || martial()); + } + if (Blind) + pline("It comes loose."); + else + pline("%s %s loose.", + The(distant_name(kickobj, xname)), + otense(kickobj, "come")); + obj_extract_self(kickobj); + newsym(x, y); + if (costly && (!costly_spot(u.ux, u.uy) || + !index(u.urooms, *in_rooms(x, y, SHOPBASE)))) + addtobill(kickobj, FALSE, FALSE, FALSE); + if (!flooreffects(kickobj, u.ux, u.uy, "fall")) { + place_object(kickobj, u.ux, u.uy); + stackobj(kickobj); + newsym(u.ux, u.uy); + } + return 1; + } /* a box gets a chance of breaking open here */ if(Is_box(kickobj)) { @@ -478,35 +509,6 @@ xchar x, y; /* fragile objects should not be kicked */ if (hero_breaks(kickobj, kickobj->ox, kickobj->oy, FALSE)) return 1; - if (IS_ROCK(levl[x][y].typ) || closed_door(x, y)) { - if ((!martial() && rn2(20) > ACURR(A_DEX)) - || IS_ROCK(levl[u.ux][u.uy].typ) - || closed_door(u.ux, u.uy)) { - if (Blind) pline("It doesn't come loose."); - else pline("%s %sn't come loose.", - The(distant_name(kickobj, xname)), - otense(kickobj, "do")); - return(!rn2(3) || martial()); - } - if (Blind) pline("It comes loose."); - else pline("%s %s loose.", - The(distant_name(kickobj, xname)), - otense(kickobj, "come")); - obj_extract_self(kickobj); - newsym(x, y); - if (costly && (!costly_spot(u.ux, u.uy) - || !index(u.urooms, *in_rooms(x, y, SHOPBASE)))) - addtobill(kickobj, FALSE, FALSE, FALSE); - if(!flooreffects(kickobj,u.ux,u.uy,"fall")) { - place_object(kickobj, u.ux, u.uy); - stackobj(kickobj); - newsym(u.ux, u.uy); - } - return(1); - } - - isgold = (kickobj->oclass == COIN_CLASS); - /* too heavy to move. range is calculated as potential distance from * player, so range == 2 means the object may move up to one square * from its current position -- 2.50.1