Skip to content

Commit ebdd0d7

Browse files
authored
Fix bonuses for enchanted, unidentified rings (#603)
1 parent 24ce4e9 commit ebdd0d7

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

changes/issue-602.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-
2+
Fixed issue where unidentified rings could have higher bonuses than they would have once identified
3+
-
4+
Fixed issue where unidentified positive rings give bonuses of `1 + timesEnchanted - 1` prior to identification, not `1 + timesEnchanted` as intended

src/brogue/Items.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -1780,12 +1780,11 @@ short effectiveRingEnchant(item *theItem) {
17801780
if (theItem->category != RING) {
17811781
return 0;
17821782
}
1783-
if (!(theItem->flags & ITEM_IDENTIFIED)
1784-
&& theItem->enchant1 > 0) {
1785-
1786-
return theItem->timesEnchanted + 1; // Unidentified positive rings act as +1 until identified.
1783+
if (theItem->flags & ITEM_IDENTIFIED) {
1784+
return theItem->enchant1;
1785+
} else {
1786+
return min(theItem->enchant1, theItem->timesEnchanted + 1);
17871787
}
1788-
return theItem->enchant1;
17891788
}
17901789

17911790
short apparentRingBonus(const enum ringKind kind) {
@@ -6914,6 +6913,8 @@ void readScroll(item *theItem) {
69146913
} while (theItem == NULL || !(theItem->category & (WEAPON | ARMOR | RING | STAFF | WAND | CHARM)));
69156914
recordKeystroke(theItem->inventoryLetter, false, false);
69166915
confirmMessages();
6916+
6917+
theItem->timesEnchanted += enchantMagnitude();
69176918
switch (theItem->category) {
69186919
case WEAPON:
69196920
theItem->strengthRequired = max(0, theItem->strengthRequired - enchantMagnitude());
@@ -6953,7 +6954,6 @@ void readScroll(item *theItem) {
69536954
default:
69546955
break;
69556956
}
6956-
theItem->timesEnchanted += enchantMagnitude();
69576957
if ((theItem->category & (WEAPON | ARMOR | STAFF | RING | CHARM))
69586958
&& theItem->enchant1 >= 16) {
69596959

0 commit comments

Comments
 (0)