]> granicus.if.org Git - nethack/commitdiff
dwarvish indecision
authorcohrs <cohrs>
Sun, 14 Jul 2002 02:48:27 +0000 (02:48 +0000)
committercohrs <cohrs>
Sun, 14 Jul 2002 02:48:27 +0000 (02:48 +0000)
<Someone> (and later <Someone>) reported along with several other
things of a dwarf that stood in place and switched between his pick-axe and
broadsword on successive turns.  Fixed by bringing the logic in the two
cases in line.  The code now prefers to leave the hostile dwarf with a weapon.

doc/fixes34.1
src/monmove.c

index d3a87a745feff6b4598acf8ef92dd53e734ce8b6..49024180f4435bbfd94ec2f33799d9ca28cc6294 100644 (file)
@@ -161,6 +161,8 @@ when a fountain dries up or a throne vanishes, make sure it really happens
 allow player to name polymorph potion if nothing seems to happen
 avoid crash when drinking a potion causes the hero to float up over a fire
        trap, for example, which might try to destroy the in-use potion
+in some situations, if hero stood still, a hostile dwarf would switch back
+       and forth between weapon and pick-axe and never move
 
 
 Platform- and/or Interface-Specific Fixes
index f2ac6e2c85399fb1da0f023c7852159e76402c0a..44595171cfd2f459d098aebe2ca07536ce672232 100644 (file)
@@ -875,9 +875,13 @@ not_special:
        }
       }
 
+       /* don't tunnel if needspick and wielding a non-pick that is known
+        * cursed or hostile and close enough to prefer a weapon */
        if (can_tunnel && needspick(ptr) &&
-               (mw_tmp = MON_WEP(mtmp)) != 0 && !is_pick(mw_tmp) &&
-               mw_tmp->cursed && mtmp->weapon_check == NO_WEAPON_WANTED)
+           (mw_tmp = MON_WEP(mtmp)) != 0 && !is_pick(mw_tmp) &&
+           ((mw_tmp->cursed && mtmp->weapon_check == NO_WEAPON_WANTED) ||
+            ((!mtmp->mpeaceful || Conflict) &&
+             dist2(mtmp->mx, mtmp->my, mtmp->mux, mtmp->muy) <= 8)))
            can_tunnel = FALSE;
 
        nix = omx;