bullwhip and polearm attack feedback

When testing the urgent message for having weapon be snagged by a
bullwhip, in between the occasional weapon grabs (which mention
flicking the bullwhip) I saw lots of regular attacks that said
"<mon> swings his bullwhip."  That is accurate but seems odd, so
change it to "<mon> lashes his bullwhip."  Do same for the hero.

While working on that, I discovered that monsters using a polearm
for a ranged attack always showed "<mon> thrusts <a polearm>" even
for ones that aren't defined as piercing so should be swung rather
that thrust.  And they're allowed to do that when adjacent where
there isn't enough room to thrust or swing a long polearm.  Now it's
"<mon> bashes with <a polearm>" in that situation.
This commit is contained in:
PatR
2021-12-21 02:56:59 -08:00
parent 81a7157d7d
commit f08c7f2101
6 changed files with 74 additions and 15 deletions

View File

@@ -717,7 +717,9 @@ mark some messages as urgent ("You die*.", having equipment stolen, being
if a leashed pet changed name (#name m) or an unnamed pet changed type
(polymorph or grow-up) and perm_invent was On, persistent inventory
display didn't get updated to show the leash's changed information
give some dragon armor extra effects when worn
attack feedback when using a bullwhip said "swing"; change to "lash"
attack feedback for monster using polearm when adjacent said "thrust"; change
to "bash"
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
@@ -1291,6 +1293,7 @@ decaying globs of {ooze,pudding,slime} shrink over time based on their total
time, and while doing so they no longer give the tainted corpse food
poisoning effect when eaten
track peak maximum HP and peak maximum energy/power; no noticeable effect
give some dragon armor extra effects when worn
Platform- and/or Interface-Specific New Features

View File

@@ -1227,6 +1227,7 @@ extern void rustm(struct monst *, struct obj *);
/* ### mhitu.c ### */
extern void hitmsg(struct monst *, struct attack *);
extern const char *mswings_verb(struct obj *, boolean);
extern const char *mpoisons_subj(struct monst *, struct attack *);
extern void u_slow_down(void);
extern struct monst *cloneu(void);

View File

@@ -1116,11 +1116,16 @@ rustm(struct monst *mdef, struct obj *obj)
}
static void
mswingsm(struct monst *magr, struct monst *mdef, struct obj *otemp)
mswingsm(
struct monst *magr, /* attacker */
struct monst *mdef, /* defender */
struct obj *otemp) /* attacker's weapon */
{
if (flags.verbose && !Blind && mon_visible(magr)) {
pline("%s %s %s%s %s at %s.", Monnam(magr),
(objects[otemp->otyp].oc_dir & PIERCE) ? "thrusts" : "swings",
boolean bash = (is_pole(otemp)
&& dist2(magr->mx, magr->my, mdef->mx, mdef->my) <= 2);
pline("%s %s %s%s %s at %s.", Monnam(magr), mswings_verb(otemp, bash),
(otemp->quan > 1L) ? "one of " : "", mhis(magr), xname(otemp),
mon_nam(mdef));
}

View File

@@ -9,7 +9,7 @@
static NEARDATA struct obj *mon_currwep = (struct obj *) 0;
static void missmu(struct monst *, boolean, struct attack *);
static void mswings(struct monst *, struct obj *);
static void mswings(struct monst *, struct obj *, boolean);
static void wildmiss(struct monst *, struct attack *);
static void summonmu(struct monst *, boolean);
static int hitmu(struct monst *, struct attack *);
@@ -85,13 +85,40 @@ missmu(struct monst *mtmp, boolean nearmiss, struct attack *mattk)
stop_occupation();
}
/* strike types P|S|B: Pierce (pointed: stab) => "thrusts",
Slash (edged: slice) or whack (blunt: Bash) => "swings" */
const char *
mswings_verb(
struct obj *mwep, /* attacker's weapon */
boolean bash) /* True: using polearm while too close */
{
const char *verb;
int otyp = mwep->otyp,
lash = (otyp == BULLWHIP),
/* some weapons can have more than one strike type; for those,
give a mix of thrust and swing (caller doesn't care either way) */
thrust = ((objects[otyp].oc_dir & PIERCE) != 0
&& ((objects[otyp].oc_dir & ~PIERCE) == 0 || !rn2(2)));
verb = bash ? "bashes with" /*sigh*/
: lash ? "lashes"
: thrust ? "thrusts"
: "swings";
/* (might have caller also pass attacker's formatted name so that
if hallucination makes that be plural, we could use vtense() to
adjust the result to match) */
return verb;
}
/* monster swings obj */
static void
mswings(struct monst *mtmp, struct obj *otemp)
mswings(
struct monst *mtmp, /* attacker */
struct obj *otemp, /* attacker's weapon */
boolean bash) /* True: polearm used at too close range */
{
if (flags.verbose && !Blind && mon_visible(mtmp)) {
pline("%s %s %s%s %s.", Monnam(mtmp),
(objects[otemp->otyp].oc_dir & PIERCE) ? "thrusts" : "swings",
pline("%s %s %s%s %s.", Monnam(mtmp), mswings_verb(otemp, bash),
(otemp->quan > 1L) ? "one of " : "", mhis(mtmp), xname(otemp));
}
}
@@ -727,9 +754,12 @@ mattacku(register struct monst *mtmp)
if (foundyou) {
mon_currwep = MON_WEP(mtmp);
if (mon_currwep) {
boolean bash = (is_pole(mon_currwep)
&& distu(mtmp->mx, mtmp->my) <= 2);
hittmp = hitval(mon_currwep, &g.youmonst);
tmp += hittmp;
mswings(mtmp, mon_currwep);
mswings(mtmp, mon_currwep, bash);
}
if (tmp > (j = g.mhitu_dieroll = rnd(20 + i)))
sum[i] = hitmu(mtmp, mattk);

View File

@@ -909,17 +909,34 @@ thrwmu(struct monst* mtmp)
return;
if (is_pole(otmp)) {
int dam, hitv;
int dam, hitv, rang;
if (otmp != MON_WEP(mtmp))
return; /* polearm must be wielded */
if (dist2(mtmp->mx, mtmp->my, mtmp->mux, mtmp->muy) > MON_POLE_DIST
|| !couldsee(mtmp->mx, mtmp->my))
/*
* MON_POLE_DIST encompasses knight's move range (5): two spots
* away provided it's not on a straight diagonal, same as skilled
* hero. Using polearm while adjacent is allowed but the verb
* is adjusted from "thrusts" to "bashes", where the hero would
* have to switch from applying a polearm to ordinary melee attack
* to accomplish that.
*
* .545.
* 52125
* 41014
* 52125
* .545.
*/
rang = dist2(mtmp->mx, mtmp->my, mtmp->mux, mtmp->muy);
if (rang > MON_POLE_DIST || !couldsee(mtmp->mx, mtmp->my))
return; /* Out of range, or intervening wall */
if (canseemon(mtmp)) {
onm = xname(otmp);
pline("%s thrusts %s.", Monnam(mtmp),
pline("%s %s %s.", Monnam(mtmp),
/* "thrusts" or "swings", or "bashes with" if adjacent */
mswings_verb(otmp, (rang <= 2) ? TRUE : FALSE),
obj_is_pname(otmp) ? the(onm) : an(onm));
}

View File

@@ -1351,8 +1351,11 @@ hmon_hitmon(struct monst *mon,
You("hit it.");
else
You("%s %s%s",
(obj && (is_shield(obj) || obj->otyp == HEAVY_IRON_BALL))
? "bash" : Role_if(PM_BARBARIAN) ? "smite" : "hit",
(obj && (is_shield(obj)
|| obj->otyp == HEAVY_IRON_BALL)) ? "bash"
: (obj && obj->otyp == BULLWHIP) ? "lash" /* hand_to_hand */
: Role_if(PM_BARBARIAN) ? "smite"
: "hit",
mon_nam(mon), canseemon(mon) ? exclam(tmp) : ".");
}