Skip to content

Commit 2fba95d

Browse files
Fix: various monsters showing as having claws when they don't.
Thanks terrapin for the bulk of the code fix. Co-authored-by: saltwaterterrapin <[email protected]>
1 parent c82de13 commit 2fba95d

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

doc/evilhack-changelog.md

+1
Original file line numberDiff line numberDiff line change
@@ -3395,4 +3395,5 @@ The following changes to date are:
33953395
- Fix: cmap ordering in tilemap.c (addition of ice trap)
33963396
- Prevent levelporting throughout the Wizard's tower until the Wizard of
33973397
Yendor has been defeated
3398+
- Fix: various monsters showing as having claws when they don't
33983399

src/objnam.c

+10-5
Original file line numberDiff line numberDiff line change
@@ -1270,7 +1270,8 @@ unsigned doname_flags;
12701270
boolean ispoisoned = FALSE, istainted = FALSE,
12711271
with_price = (doname_flags & DONAME_WITH_PRICE) != 0,
12721272
vague_quan = (doname_flags & DONAME_VAGUE_QUAN) != 0,
1273-
weightshown = FALSE;
1273+
weightshown = FALSE,
1274+
isyours = carried(obj);
12741275
boolean known, dknown, cknown, bknown, lknown;
12751276
long orig_opknwn = obj->oprops_known;
12761277
int omndx = obj->corpsenm;
@@ -1279,6 +1280,9 @@ unsigned doname_flags;
12791280
the start of prefix instead of the
12801281
end (Strcat is used on the end) */
12811282
register char *bp = xname(obj);
1283+
struct monst *owner = isyours ? &youmonst
1284+
: mcarried(obj) ? obj->ocarry
1285+
: (struct monst *) 0;
12821286

12831287
if (iflags.override_ID) {
12841288
known = dknown = cknown = bknown = lknown = TRUE;
@@ -1426,6 +1430,7 @@ unsigned doname_flags;
14261430
* change to "(something; slippery)" */
14271431
Strcpy(rindex(bp, ')'), "; slippery)");
14281432
} else if (obj->otyp == MUMMIFIED_HAND) {
1433+
/* monsters don't wear these, so assuming it's yours is fine */
14291434
if (Glib)
14301435
Sprintf(rindex(bp, ' '), " (merged to your left %s; slippery)",
14311436
body_part(ARM));
@@ -1512,7 +1517,7 @@ unsigned doname_flags;
15121517
if (obj->owornmask & W_RINGL)
15131518
Strcat(bp, " (on left ");
15141519
if (obj->owornmask & W_RING) {
1515-
Strcat(bp, body_part(HAND));
1520+
Strcat(bp, mbodypart(owner, HAND));
15161521
Strcat(bp, ")");
15171522
}
15181523
if (known && objects[obj->otyp].oc_charged) {
@@ -1555,7 +1560,7 @@ unsigned doname_flags;
15551560
case CHAIN_CLASS:
15561561
add_erosion_words(obj, prefix);
15571562
if (obj->owornmask & W_BALL)
1558-
Strcat(bp, " (chained to you)");
1563+
Sprintf(eos(bp), " (chained to %s)", isyours ? "you" : mon_nam(owner));
15591564
break;
15601565
case GEM_CLASS:
15611566
if (obj->otyp == SLING_BULLET)
@@ -1567,7 +1572,7 @@ unsigned doname_flags;
15671572
if (obj->quan != 1L) {
15681573
Strcat(bp, " (wielded)");
15691574
} else {
1570-
const char *hand_s = body_part(HAND);
1575+
const char *hand_s = mbodypart(owner, HAND);
15711576

15721577
if (bimanual(obj))
15731578
hand_s = makeplural(hand_s);
@@ -1582,7 +1587,7 @@ unsigned doname_flags;
15821587
}
15831588
if (obj->owornmask & W_SWAPWEP) {
15841589
if (u.twoweap) {
1585-
Sprintf(eos(bp), " (wielded in other %s)", body_part(HAND));
1590+
Sprintf(eos(bp), " (wielded in other %s)", mbodypart(owner, HAND));
15861591
} else {
15871592
Strcat(bp, " (alternate weapon; not wielded)");
15881593
}

src/polyself.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -1234,7 +1234,7 @@ int alone;
12341234
}
12351235
update_inventory();
12361236
/* must follow the bimanual check, since that never leaves you
1237-
two-weaponing but this block might leave you wielding a
1237+
two-weaponing but this block might leave you wielding a
12381238
two-hander and wearing a shield */
12391239
} else if (!could_twoweap(youmonst.data)) {
12401240
untwoweapon();
@@ -1996,10 +1996,12 @@ int part;
19961996
}
19971997
if ((part == HAND || part == HANDED)
19981998
&& ((humanoid(mptr) && attacktype(mptr, AT_CLAW)
1999-
&& (has_claws(mptr) || has_claws_undead(mptr))
20001999
&& !index(not_claws, mptr->mlet) && mptr != &mons[PM_STONE_GOLEM]
20012000
&& mptr != &mons[PM_INCUBUS] && mptr != &mons[PM_SUCCUBUS])
2002-
|| Race_if(PM_DEMON) || Race_if(PM_ILLITHID) || Race_if(PM_TORTLE)))
2001+
|| (has_claws(mptr) || has_claws_undead(mptr))
2002+
|| (mon == &youmonst
2003+
&& (Race_if(PM_DEMON) || Race_if(PM_ILLITHID)
2004+
|| Race_if(PM_TORTLE)))))
20032005
return (part == HAND) ? "claw" : "clawed";
20042006
if ((mptr == &mons[PM_MUMAK] || mptr == &mons[PM_MASTODON]
20052007
|| mptr == &mons[PM_WOOLLY_MAMMOTH])

0 commit comments

Comments
 (0)