]> granicus.if.org Git - nethack/commitdiff
fix #H11 - forcing lock with mattock
authornethack.rankin <nethack.rankin>
Tue, 3 Jan 2006 05:28:13 +0000 (05:28 +0000)
committernethack.rankin <nethack.rankin>
Tue, 3 Jan 2006 05:28:13 +0000 (05:28 +0000)
     From a bug report:  dwarvish mattock was
subject to breaking when attempting to force a lock, because it is treated
as a bladed weapon.  So is pick-axe; they're both defined as blunt (WHACK
attack mode), but the definition of is_blade() erroneously includes them
since P_PICK_AXE falls between P_DAGGER and P_SABER.  That skill should be
renumbered, but I haven't investigated what else might happen when that's
done so this fix uses a special case instead.

     I noticed that there was an unnecessary old check for rubber hose;
it's excluded along with whip by the skill > P_LANCE test.  When fixing
that up, I realized that the obscure feature of forcing via statue was
broken; it always failed the skill < P_DAGGER test.  Also, I took away the
exception for aklys; even though designed as a throwing weapon, it is used
as a club.  I wasn't sure about the exception for flail; it is perfectly
capable of bashing things but the code apparently excludes it for use as
a prying implement.  Switching its check to P_FLAIL catches grappling hook
along with it.

doc/fixes34.4
src/lock.c

index b99520276b3a7e97b733cc40b044eb3563cb4fa8..d54af647a7a6237472658ed7776f7fd416832b27 100644 (file)
@@ -175,6 +175,8 @@ large amorphous, whirly, noncorporeal, or slithy creatures can fit through
        tight diagonal gaps despite their size
 avoid "You summoned it!" for unseen monster produced by same-race offering
 recognize "mindflayer" as an alternative spelling for "mind flayer"
+treat mattock as blunt object when forcing locks
+restore capability to force locks with wielded statue
 
 
 Platform- and/or Interface-Specific Fixes
index 43e9df0afab748e3ae8c540fd3b5431730ffbfc1..f13f1cdba5c6a2499de8c7dfd8f0992538e3adfb 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)lock.c     3.5     2005/06/02      */
+/*     SCCS Id: @(#)lock.c     3.5     2006/01/02      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -11,7 +11,8 @@ STATIC_PTR int NDECL(forcelock);
 STATIC_VAR NEARDATA struct xlock_s {
        struct rm  *door;
        struct obj *box;
-       int picktyp, chance, usedtime;
+       int picktyp, /* key|pick|card for unlock, sharp vs blunt for #force */
+           chance, usedtime;
 } xlock;
 
 STATIC_DCL const char *NDECL(lock_action);
@@ -435,22 +436,20 @@ doforce()         /* try to force a chest with your weapon */
        register int c, picktyp;
        char qbuf[QBUFSZ];
 
-       if(!uwep ||     /* proper type test */
-          (uwep->oclass != WEAPON_CLASS && !is_weptool(uwep) &&
-           uwep->oclass != ROCK_CLASS) ||
-          (objects[uwep->otyp].oc_skill < P_DAGGER) ||
-          (objects[uwep->otyp].oc_skill > P_LANCE) ||
-          uwep->otyp == FLAIL || uwep->otyp == AKLYS
-#ifdef KOPS
-          || uwep->otyp == RUBBER_HOSE
-#endif
-         ) {
-           You_cant("force anything without a %sweapon.",
-                 (uwep) ? "proper " : "");
+       if (!uwep ||    /* proper type test */
+               ((uwep->oclass == WEAPON_CLASS || is_weptool(uwep)) ?
+                   (objects[uwep->otyp].oc_skill < P_DAGGER ||
+                    objects[uwep->otyp].oc_skill == P_FLAIL ||
+                    objects[uwep->otyp].oc_skill > P_LANCE) :
+                uwep->oclass != ROCK_CLASS)) {
+           You_cant("force anything %s weapon.",
+                    !uwep ? "when not wielding a" :
+                      (uwep->oclass != WEAPON_CLASS && !is_weptool(uwep)) ?
+                        "without a proper" : "with that");
            return(0);
        }
 
-       picktyp = is_blade(uwep);
+       picktyp = is_blade(uwep) && !is_pick(uwep);
        if(xlock.usedtime && xlock.box && picktyp == xlock.picktyp) {
            You("resume your attempt to force the lock.");
            set_occupation(forcelock, "forcing the lock", 0);