add missing two-weapon feedback

When dual-wielding and you wield a different weapon, two weapon combat
was silently toggled off even when the new weapon was eligible to be
dual-wielded.  If the verbose flag is On, explicitly tell the player
when wielding something toggles off two-weapon mode.  Wielding '-' is
an exception because you already get told that you're empty handed.
This commit is contained in:
PatR
2020-04-07 07:40:33 -07:00
parent 297eb934a7
commit f694f3b644
2 changed files with 26 additions and 13 deletions

View File

@@ -117,6 +117,7 @@ demon lords hate Demonbane
pets avoid eating shapeshifter corpses unless starving or nearly feral
blessed scroll of teleportation gives a single controlled teleport
allow opening a tin without interruption if slimed
tell player when wielding a different weapon toggles off dual-wielding
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository

View File

@@ -65,6 +65,19 @@ static int FDECL(ready_weapon, (struct obj *));
#define will_weld(optr) \
((optr)->cursed && (erodeable_wep(optr) || (optr)->otyp == TIN_OPENER))
/* to dual-wield, 'obj' must be a weapon or a weapon-tool, and not a bow
or arrow or missile (dart, shuriken, boomerang), so not matching the
one-handed weapons which yield "you begin bashing" if used for melee;
empty hands and two-handed weapons have to be handled separately */
#define TWOWEAPOK(obj) \
(((obj)->oclass == WEAPON_CLASS) \
? !(is_launcher(obj) ||is_ammo(obj) || is_missile(obj)) \
: is_weptool(obj))
static const char
are_no_longer_twoweap[] = "are no longer using two weapons at once",
can_no_longer_twoweap[] = "can no longer wield two weapons at once";
/*** Functions that place a given item in a slot ***/
/* Proper usage includes:
* 1. Initializing the slot during character generation or a
@@ -139,7 +152,7 @@ struct obj *wep;
{
/* Separated function so swapping works easily */
int res = 0;
boolean had_wep = (uwep != 0);
boolean was_twoweap = u.twoweap, had_wep = (uwep != 0);
if (!wep) {
/* No weapon */
@@ -192,7 +205,16 @@ struct obj *wep;
prinv((char *) 0, wep, 0L);
wep->owornmask = dummy;
}
setuwep(wep);
if (was_twoweap && !u.twoweap && flags.verbose) {
/* skip this message if we already got "empty handed" one above;
also, Null is not safe for neither TWOWEAPOK() or bimanual() */
if (uwep)
You("%s.", ((TWOWEAPOK(uwep) && !bimanual(uwep))
? are_no_longer_twoweap
: can_no_longer_twoweap));
}
/* KMH -- Talking artifacts are finally implemented */
arti_speak(wep);
@@ -571,7 +593,7 @@ dowieldquiver()
You("are now empty %s.", body_part(HANDED));
res = 1;
} else if (was_twoweap && !u.twoweap) {
You("are no longer wielding two weapons at once.");
You("%s.", are_no_longer_twoweap);
res = 1;
}
return res;
@@ -662,16 +684,6 @@ can_twoweapon()
{
struct obj *otmp;
/* to dual-wield, obj must be a weapon or a weapon-tool, and not
a bow or arrow or missile (dart, shuriken, boomerang), matching
the sorts of weapons which yield "you begin bashing" when used
for melee; we don't bother including polearms here because
they'll be rejected as two-weapon because they're two-handed */
#define TWOWEAPOK(obj) \
(((obj)->oclass == WEAPON_CLASS) \
? !(is_launcher(obj) ||is_ammo(obj) || is_missile(obj)) \
: is_weptool(obj))
if (!could_twoweap(g.youmonst.data)) {
if (Upolyd)
You_cant("use two weapons in your current form.");
@@ -797,7 +809,7 @@ void
untwoweapon()
{
if (u.twoweap) {
You("can no longer use two weapons at once.");
You("%s.", can_no_longer_twoweap);
set_twoweap(FALSE); /* u.twoweap = FALSE */
update_inventory();
}