From 4f528f2a7d0ec1f0c7c5b6c85f7b4fd6dc4e50a1 Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Sun, 18 Feb 2007 05:54:15 +0000 Subject: [PATCH] #force fixes Trunk and branch, noticed while working on an interface enhancement: you could use #force to break the lock of a chest that's on the floor while you're engulfed, also while levitating or mounted w/o riding skill. Trunk only: refine an earlier fix that bills for breaking the lock of a shop-owned chest. The item which the hero is forced to buy showed up in the bill as unlockable, which is accurate after the fact but didn't reflect the shop's item. Fix by billing for chest before altering it. --- doc/fixes34.4 | 1 + src/lock.c | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/doc/fixes34.4 b/doc/fixes34.4 index a000473c1..b5efe1e06 100644 --- a/doc/fixes34.4 +++ b/doc/fixes34.4 @@ -323,6 +323,7 @@ hero's sleep resistance shouldn't protect steed from sleeping gas trap dropped wielded, in use leash should remain in inventory, since it's in-use wielded, in use leash can't be snatched by whip-wielding monster when using two weapons at once, whip-wielding monster can target either one +can't #force floor item while engulfed, levitating, or unskilled riding Platform- and/or Interface-Specific Fixes diff --git a/src/lock.c b/src/lock.c index b0e77eb6f..6b04f8f28 100644 --- a/src/lock.c +++ b/src/lock.c @@ -131,15 +131,15 @@ breakchestlock(box, destroyit) struct obj *box; boolean destroyit; { - box->olocked = 0; - box->obroken = 1; - box->lknown = 1; if (!destroyit) { /* bill for the box but not for its contents */ struct obj *hide_contents = box->cobj; box->cobj = 0; costly_alteration(box, COST_BRKLCK); box->cobj = hide_contents; + box->olocked = 0; + box->obroken = 1; + box->lknown = 1; } else { /* #force has destroyed this box (at ) */ struct obj *otmp; struct monst *shkp = (*u.ushops && costly_spot(u.ux, u.uy)) ? @@ -447,6 +447,10 @@ doforce() /* try to force a chest with your weapon */ register int c, picktyp; char qbuf[QBUFSZ]; + if (u.uswallow) { + You_cant("force anything from inside here."); + return 0; + } if (!uwep || /* proper type test */ ((uwep->oclass == WEAPON_CLASS || is_weptool(uwep)) ? (objects[uwep->otyp].oc_skill < P_DAGGER || @@ -459,6 +463,10 @@ doforce() /* try to force a chest with your weapon */ "without a proper" : "with that"); return(0); } + if (!can_reach_floor(TRUE)) { + cant_reach_floor(u.ux, u.uy, FALSE, TRUE); + return 0; + } picktyp = is_blade(uwep) && !is_pick(uwep); if(xlock.usedtime && xlock.box && picktyp == xlock.picktyp) {