Skip to content

Commit 1ae6efd

Browse files
Fix: Enchanting armor of excellence didn't adjust charisma
Commit 6306c1f last year took some "redundant" code out of adj_abon(), but it turns out adj_abon had been used to adjust charisma bonuses when the armor's enchantment was modified by scrolls, cancellation, etc. Oops. Revert the change to adj_abon, and instead special-case helms of brilliance and gauntlets of dexterity inside oprops_o(n|ff).
1 parent 44b8e07 commit 1ae6efd

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

doc/evilhack-changelog.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3496,4 +3496,4 @@ The following changes to date are:
34963496
- Draugr are properly vulnerable to fire
34973497
- Fix: Infidel Draugr kept getting fire resistance back after
34983498
save/reload
3499-
3499+
- Fix: Enchanting armor of excellence didn't adjust charisma

src/do_wear.c

+23-6
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,12 @@ long mask;
207207
EHunger |= mask;
208208
if (props & ITEM_EXCEL) {
209209
int which = A_CHA, old_attrib = ACURR(which);
210-
/* borrowing this from Ring_on() as I may want
211-
to add other attributes in the future */
212-
ABON(which) += otmp->spe;
210+
/* HoB and GoD adjust CHA in adj_abon() */
211+
if (otmp->otyp != HELM_OF_BRILLIANCE
212+
&& otmp->otyp != GAUNTLETS_OF_DEXTERITY)
213+
/* borrowing this from Ring_on() as I may want
214+
to add other attributes in the future */
215+
ABON(which) += otmp->spe;
213216
if (old_attrib != ACURR(which))
214217
otmp->oprops_known |= ITEM_EXCEL;
215218
set_moreluck();
@@ -255,9 +258,12 @@ long mask;
255258
EHunger &= ~mask;
256259
if (props & ITEM_EXCEL) {
257260
int which = A_CHA, old_attrib = ACURR(which);
258-
/* borrowing this from Ring_off() as I may want
259-
to add other attributes in the future */
260-
ABON(which) -= otmp->spe;
261+
/* HoB and GoD adjust CHA in adj_abon() */
262+
if (otmp->otyp != HELM_OF_BRILLIANCE
263+
&& otmp->otyp != GAUNTLETS_OF_DEXTERITY)
264+
/* borrowing this from Ring_off() as I may want
265+
to add other attributes in the future */
266+
ABON(which) -= otmp->spe;
261267
if (old_attrib != ACURR(which))
262268
otmp->oprops_known |= ITEM_EXCEL;
263269
otmp->oprops &= ~ITEM_EXCEL;
@@ -3713,6 +3719,17 @@ register schar delta;
37133719
}
37143720
context.botl = 1;
37153721
}
3722+
if (otmp && (otmp->oprops & ITEM_EXCEL) && (otmp->owornmask & W_ARMOR)) {
3723+
if (delta) {
3724+
int which = A_CHA,
3725+
old_attrib = ACURR(which);
3726+
ABON(which) += (delta);
3727+
if (old_attrib != ACURR(which))
3728+
otmp->oprops_known |= ITEM_EXCEL;
3729+
set_moreluck();
3730+
}
3731+
context.botl = 1;
3732+
}
37163733
}
37173734

37183735
/* decide whether a worn item is covered up by some other worn item,

0 commit comments

Comments
 (0)