Skip to content

Commit

Permalink
Fix: monster stealing worn gold objects from other monsters (AD_SGLD)…
Browse files Browse the repository at this point in the history
… not properly handled.

This was discovered when a player's steed wearing gold barding had it
stolen by a leprechaun. When trying to fit another of barding onto their
steed, they couldn't, as the oworkmask hadn't been properly cleared.
This commit fixes that.
  • Loading branch information
k21971 committed Oct 7, 2024
1 parent eee7ca7 commit 105e3e1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
2 changes: 2 additions & 0 deletions doc/evilhack-changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3646,4 +3646,6 @@ The following changes to date are:
- New terrain type - sand, add grass and sand to various levels
- Fix: shield bash damage with large shields
- Filler levels for Druid quest
- Fix: monster stealing worn gold objects from other monsters (AD_SGLD)
not properly handled

13 changes: 12 additions & 1 deletion src/mhitm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2149,7 +2149,18 @@ struct obj **ootmp; /* to return worn armor for caller to disintegrate */
pline("%s steals %s.", buf, distant_name(gold, yname));
}
obj_extract_self(gold);
add_to_minv(magr, gold);
if (gold->owornmask) {
mdef->misc_worn_check &= ~gold->owornmask;
if (gold->owornmask & W_WEP)
mwepgone(mdef);
gold->owornmask = 0L;
update_mon_intrinsics(mdef, gold, FALSE, FALSE);
/* give monster a chance to wear other equipment on its next
move instead of waiting until it picks something up */
check_gear_next_turn(mdef);
}
(void) add_to_minv(magr, gold);
possibly_unwield(mdef, FALSE);
mdef->mstrategy &= ~STRAT_WAITFORU;
if (!tele_restrict(magr)) {
boolean couldspot = canspotmon(magr);
Expand Down
5 changes: 2 additions & 3 deletions src/uhitm.c
Original file line number Diff line number Diff line change
Expand Up @@ -3159,15 +3159,14 @@ int specialdmg; /* blessed and/or silver bonus against various things */
tmp = 0;
break;
case AD_SGLD:
/* This you as a leprechaun, so steal
/* This is you as a leprechaun, so steal
real gold only, no lesser coins */
mongold = findgold(mdef->minvent, FALSE);
if (mongold) {
if (mongold->otyp != GOLD_PIECE) {
/* stole a gold non-coin object */
(void) really_steal(mongold, mdef);
}
else if (merge_choice(invent, mongold) || inv_cnt(FALSE) < 52) {
} else if (merge_choice(invent, mongold) || inv_cnt(FALSE) < 52) {
Your("purse feels heavier.");
obj_extract_self(mongold);
addinv(mongold);
Expand Down

0 comments on commit 105e3e1

Please sign in to comment.