Skip to content

Commit

Permalink
Fix bonuses for enchanted, unidentified rings (#603)
Browse files Browse the repository at this point in the history
  • Loading branch information
flend authored Sep 30, 2023
1 parent 24ce4e9 commit ebdd0d7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions changes/issue-602.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-
Fixed issue where unidentified rings could have higher bonuses than they would have once identified
-
Fixed issue where unidentified positive rings give bonuses of `1 + timesEnchanted - 1` prior to identification, not `1 + timesEnchanted` as intended
12 changes: 6 additions & 6 deletions src/brogue/Items.c
Original file line number Diff line number Diff line change
Expand Up @@ -1780,12 +1780,11 @@ short effectiveRingEnchant(item *theItem) {
if (theItem->category != RING) {
return 0;
}
if (!(theItem->flags & ITEM_IDENTIFIED)
&& theItem->enchant1 > 0) {

return theItem->timesEnchanted + 1; // Unidentified positive rings act as +1 until identified.
if (theItem->flags & ITEM_IDENTIFIED) {
return theItem->enchant1;
} else {
return min(theItem->enchant1, theItem->timesEnchanted + 1);
}
return theItem->enchant1;
}

short apparentRingBonus(const enum ringKind kind) {
Expand Down Expand Up @@ -6914,6 +6913,8 @@ void readScroll(item *theItem) {
} while (theItem == NULL || !(theItem->category & (WEAPON | ARMOR | RING | STAFF | WAND | CHARM)));
recordKeystroke(theItem->inventoryLetter, false, false);
confirmMessages();

theItem->timesEnchanted += enchantMagnitude();
switch (theItem->category) {
case WEAPON:
theItem->strengthRequired = max(0, theItem->strengthRequired - enchantMagnitude());
Expand Down Expand Up @@ -6953,7 +6954,6 @@ void readScroll(item *theItem) {
default:
break;
}
theItem->timesEnchanted += enchantMagnitude();
if ((theItem->category & (WEAPON | ARMOR | STAFF | RING | CHARM))
&& theItem->enchant1 >= 16) {

Expand Down

0 comments on commit ebdd0d7

Please sign in to comment.