]> granicus.if.org Git - nethack/commitdiff
fix B15007 - boomerangs used hand-to-hand
authornethack.rankin <nethack.rankin>
Fri, 10 Jan 2003 03:33:03 +0000 (03:33 +0000)
committernethack.rankin <nethack.rankin>
Fri, 10 Jan 2003 03:33:03 +0000 (03:33 +0000)
     Hitting with a wielded boomerang was supposed to have a chance to
break it, but the code was located in a spot that would never be reached
when bashing with a missile weapon.  Also, its rnl() usage would have
made the bad effect--losing your weapon--be more likely to occur when
you had good luck and less likely when you had bad luck.  And it wasn't
setting `unweapon', so you wouldn't have gotten a bashing with barehands
message on the next attack after the weapon had been destroyed.

src/uhitm.c

index f03e12aff56aa9179376be64a98f414d697989f6..6f43a0504598ec400c91313458ee8f067a023180 100644 (file)
@@ -578,6 +578,17 @@ int thrown;
                        tmp = 0;
                    else
                        tmp = rnd(2);
+                   if (!thrown && obj == uwep && obj->otyp == BOOMERANG &&
+                           rnl(4) == 4-1) {
+                       pline("As you hit %s, %s %s breaks into splinters.",
+                           mon_nam(mon), shk_your(yourbuf, obj), xname(obj));
+                       uwepgone();             /* set unweapon */
+                       useup(obj);
+                       obj = (struct obj *) 0;
+                       hittxt = TRUE;
+                       if (mdat != &mons[PM_SHADE])
+                           tmp++;
+                   }
                } else {
                    tmp = dmgval(obj, mon);
                    /* a minimal hit doesn't exercise proficiency */
@@ -637,16 +648,7 @@ int thrown;
                        if (jousting) valid_weapon_attack = TRUE;
                    }
 #endif
-                   if(!thrown && obj == uwep && obj->otyp == BOOMERANG &&
-                      !rnl(3)) {
-                       pline("As you hit %s, %s breaks into splinters.",
-                             mon_nam(mon), the(xname(obj)));
-                       useup(obj);
-                       obj = (struct obj *) 0;
-                       hittxt = TRUE;
-                       if (mdat != &mons[PM_SHADE])
-                           tmp++;
-                   } else if(thrown && (is_ammo(obj) || is_missile(obj))) {
+                   if (thrown && (is_ammo(obj) || is_missile(obj))) {
                        if (ammo_and_launcher(obj, uwep)) {
                            /* Elves and Samurai do extra damage using
                             * their bows&arrows; they're highly trained.