wielded leash, monster bullwhip use

Simplify <Someone>'s patch (the part for the secondary weapon wasn't and
still isn't needed since dual-wielding can only occur when both primary
and alternate weapon slots contain weapons or weapon-tools, but we might
as well keep it).  There was at least one other case where wielded in-use
leash could be removed from inventory without becoming unleashed first:
a bullwhip-wielding monster could snatch it away.

     That lead to some other whip issues:  monsters who select disarming
via bullwhip as miscellaneous strategy had 80% chance of not using it on
any given turn, but had no chance to select another misc strategy on such
turns--they always resorted to ordinary nonMUSE behavior and usually just
attacked.  The adjacency check missed diagonal locations, also would aim
the disarm attempt accurately even when displacement or invisibility made
the hero's precise location unknown.  [I took the easy way out here and
only let them try to disarm when they know the hero's location.  It's
tempting to aim at the guessed location and sometimes accidentally disarm
a nearby monster, but disarming is an action which targets a particular
weapon rather than just a location.]  Lastly, disarming always targetted
hero's primary weapon, never a dual-wielder's secondary one.
This commit is contained in:
nethack.rankin
2007-02-13 04:54:35 +00:00
parent 2fde3bce8e
commit 658c931aad
3 changed files with 30 additions and 20 deletions
+18 -4
View File
@@ -1629,8 +1629,17 @@ struct monst *mtmp;
m.has_misc = MUSE_POT_GAIN_LEVEL;
}
nomore(MUSE_BULLWHIP);
if(obj->otyp == BULLWHIP && (MON_WEP(mtmp) == obj) &&
distu(mtmp->mx,mtmp->my)==1 && uwep && !mtmp->mpeaceful) {
if (obj->otyp == BULLWHIP && !mtmp->mpeaceful &&
/* the random test prevents whip-wielding
monster from attempting disarm every turn */
uwep && !rn2(5) && obj == MON_WEP(mtmp) &&
/* hero's location must be known and adjacent */
mtmp->mux == u.ux && mtmp->muy == u.uy &&
distu(mtmp->mx, mtmp->my) <= 2 &&
/* don't bother if it can't work (this doesn't
prevent cursed weapons from being targetted) */
(canletgo(uwep, "") ||
(u.twoweap && canletgo(uswapwep, "")))) {
m.misc = obj;
m.has_misc = MUSE_BULLWHIP;
}
@@ -1824,13 +1833,18 @@ skipmsg:
return 2;
case MUSE_BULLWHIP:
/* attempt to disarm hero */
if (uwep && !rn2(5)) {
{
const char *The_whip = vismon ? "The bullwhip" : "A whip";
int where_to = rn2(4);
struct obj *obj = uwep;
const char *hand;
char the_weapon[BUFSZ];
if (!obj || !canletgo(obj, "") ||
(u.twoweap && canletgo(uswapwep, "") && rn2(2)))
obj = uswapwep;
if (!obj) break; /* shouldn't happen after find_misc() */
Strcpy(the_weapon, the(xname(obj)));
hand = body_part(HAND);
if (bimanual(obj)) hand = makeplural(hand);
@@ -1861,8 +1875,8 @@ skipmsg:
weapon; drop it at hero's feet instead */
where_to = 2;
}
remove_worn_item(obj, FALSE);
freeinv(obj);
uwepgone();
switch (where_to) {
case 1: /* onto floor beneath mon */
pline("%s yanks %s from your %s!", Monnam(mtmp),