twoweapon tweaks

Don't allow dual-wielding if either wielded or alternate weapon
(or both) is a launcher:  bow, crossbow, or sling.  (I thought that
this had been addressed ages ago.)

Refine the "can't twoweapon" feedback.  The message for having
either or both hands empty is the same, but sentence construction
is different.  The not-a-weapon feedback is slightly different, now
mentioning whether it's the wielded or alternate weapon which isn't
allowed.  The case where neither are acceptable still just reports
uwep; mentioning both it and uswapwep would be too verbose.

Make more things be described as "(wielded)" instead of "(weapon in
hand)".  It was just stacks with quantity more than 1.  That's now
joined by ammo and missiles (any stack size, but in reality just 1
since greater was already being caught here) and any quantity of
non-weapon, non-weptool.  It's overridden if dual-wielding so that
right/left stay matched.

When dual-wielding, list primary as "(wielded in right hand)" and
secondary as "(wielded in left hand)" instead of "(weapon in hand)"
and "(wielded in other hand)".  The vaguer wording was better for
bows since they're held in the off hand but now that they can't be
dual-wielded that doesn't matter.  (Single-wielding a bow is still
"(weapon in hand)".)

When not dual-wielding, the item in the alternate weapon slot is
still described as "(alternate weapon; not wielded)" even if it's
not actually a weapon.  I couldn't think of better phrasing.
This commit is contained in:
PatR
2020-01-04 18:22:04 -08:00
parent 17468a8ae9
commit 4b2ba5acc7
3 changed files with 50 additions and 24 deletions

View File

@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.43 $ $NHDT-Date: 1578137629 2020/01/04 11:33:49 $
$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.49 $ $NHDT-Date: 1578190894 2020/01/05 02:21:34 $
General Fixes and Modified Features
-----------------------------------
@@ -27,6 +27,7 @@ fix accessing mons[-1] when monster figures out if a tin cures stoning
monster wielding Stormbringer or healer's Staff against another monster would
heal the hero instead of the wielding monster when draining life
change twoweapon feedback from "not a weapon" to "not a suitable weapon"
don't allow twoweapon combat if either weapon is a bow, crossbow, or sling
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 objnam.c $NHDT-Date: 1576638500 2019/12/18 03:08:20 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.257 $ */
/* NetHack 3.7 objnam.c $NHDT-Date: 1578190895 2020/01/05 02:21:35 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.279 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1174,7 +1174,18 @@ unsigned doname_flags;
}
if ((obj->owornmask & W_WEP) && !g.mrg_to_wielded) {
if (obj->quan != 1L) {
boolean twoweap_primary = (obj == uwep && u.twoweap);
/* use alternate phrasing for non-weapons and for wielded ammo
(arrows, bolts), or missiles (darts, shuriken, boomerangs)
except when those are being actively dual-wielded where the
regular phrasing will list them as "in right hand" to
contrast with secondary weapon's "in left hand" */
if ((obj->quan != 1L
|| ((obj->oclass == WEAPON_CLASS)
? (is_ammo(obj) || is_missile(obj))
: !is_weptool(obj)))
&& !twoweap_primary) {
Strcat(bp, " (wielded)");
} else {
const char *hand_s = body_part(HAND);
@@ -1183,10 +1194,13 @@ unsigned doname_flags;
hand_s = makeplural(hand_s);
/* note: Sting's glow message, if added, will insert text
in front of "(weapon in hand)"'s closing paren */
Sprintf(eos(bp), " (%sweapon in %s)",
(obj->otyp == AKLYS) ? "tethered " : "", hand_s);
Sprintf(eos(bp), " (%s%s in %s%s)",
twoweap_primary ? "wielded" : "weapon",
(obj->otyp == AKLYS) ? "tethered " : "",
twoweap_primary ? "right " : "", hand_s);
if (g.warn_obj_cnt && obj == uwep && (EWarn_of_mon & W_WEP) != 0L) {
if (g.warn_obj_cnt && obj == uwep
&& (EWarn_of_mon & W_WEP) != 0L) {
if (!Blind) /* we know bp[] ends with ')'; overwrite that */
Sprintf(eos(bp) - 1, ", %s %s)",
glow_verb(g.warn_obj_cnt, TRUE),
@@ -1196,9 +1210,11 @@ unsigned doname_flags;
}
if (obj->owornmask & W_SWAPWEP) {
if (u.twoweap)
Sprintf(eos(bp), " (wielded in other %s)", body_part(HAND));
Sprintf(eos(bp), " (wielded in left %s)", body_part(HAND));
else
Strcat(bp, " (alternate weapon; not wielded)");
/* TODO: rephrase this when obj isn't a weapon or weptool */
Sprintf(eos(bp), " (alternate weapon%s; not wielded)",
plur(obj->quan));
}
if (obj->owornmask & W_QUIVER) {
switch (obj->oclass) {

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 wield.c $NHDT-Date: 1577186790 2019/12/24 11:26:30 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.69 $ */
/* NetHack 3.6 wield.c $NHDT-Date: 1578190903 2020/01/05 02:21:43 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.72 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2009. */
/* NetHack may be freely redistributed. See license for details. */
@@ -659,32 +659,41 @@ can_twoweapon()
{
struct obj *otmp;
#define NOT_WEAPON(obj) (!is_weptool(obj) && obj->oclass != WEAPON_CLASS)
/* to dual-wield, must be a weapon-tool or a weapon other than a bow */
#define TWOWEAPOK(obj) \
(((obj)->oclass == WEAPON_CLASS) ? !is_launcher(obj) : is_weptool(obj))
if (!could_twoweap(g.youmonst.data)) {
if (Upolyd)
You_cant("use two weapons in your current form.");
else
pline("%s aren't able to use two weapons at once.",
makeplural((flags.female && g.urole.name.f) ? g.urole.name.f
: g.urole.name.m));
} else if (!uwep || !uswapwep)
Your("%s%s%s empty.", uwep ? "left " : uswapwep ? "right " : "",
body_part(HAND), (!uwep && !uswapwep) ? "s are" : " is");
else if (NOT_WEAPON(uwep) || NOT_WEAPON(uswapwep)) {
otmp = NOT_WEAPON(uwep) ? uwep : uswapwep;
pline("%s %s.", Yname2(otmp),
is_plural(otmp) ? "aren't suitable weapons"
: "isn't a suitable weapon");
makeplural((flags.female && g.urole.name.f)
? g.urole.name.f : g.urole.name.m));
} else if (!uwep || !uswapwep) {
const char *hand_s = body_part(HAND);
if (!uwep && !uswapwep)
hand_s = makeplural(hand_s);
/* "your hands are empty" or "your {left|right} hand is empty" */
Your("%s%s %s empty.", uwep ? "left " : uswapwep ? "right " : "",
hand_s, vtense(hand_s, "are"));
} else if (!TWOWEAPOK(uwep) || !TWOWEAPOK(uswapwep)) {
otmp = !TWOWEAPOK(uwep) ? uwep : uswapwep;
pline("%s %s suitable %s weapon%s.", Yname2(otmp),
is_plural(otmp) ? "aren't" : "isn't a",
(otmp == uwep) ? "primary" : "secondary",
plur(otmp->quan));
} else if (bimanual(uwep) || bimanual(uswapwep)) {
otmp = bimanual(uwep) ? uwep : uswapwep;
pline("%s isn't one-handed.", Yname2(otmp));
} else if (uarms)
} else if (uarms) {
You_cant("use two weapons while wearing a shield.");
else if (uswapwep->oartifact)
} else if (uswapwep->oartifact) {
pline("%s being held second to another weapon!",
Yobjnam2(uswapwep, "resist"));
else if (uswapwep->otyp == CORPSE && cant_wield_corpse(uswapwep)) {
/* [Note: NOT_WEAPON() check prevents ever getting here...] */
} else if (uswapwep->otyp == CORPSE && cant_wield_corpse(uswapwep)) {
/* [Note: !TWOWEAPOK() check prevents ever getting here...] */
; /* must be life-saved to reach here; return FALSE */
} else if (Glib || uswapwep->cursed) {
if (!Glib)