Fix on "fixed quartz modifier not adding attack due to overflow" (#323)

This commit is contained in:
Nybashirka authored and GitHub committed 2026-08-31 21:16:29 +02:00
1 parent 024f86db75
commit 976e9f231a
1 file changed
+2 -4
@@ -91,12 +91,11 @@ public class ModAttack extends ItemModTypeFilter {
if (tags.hasKey(key)) {
int[] keyPair = tags.getIntArray(key);
int overThreshold = increase / threshold;
int leftToBoost = threshold - (keyPair[0] % threshold);
if (increase >= leftToBoost) {
int attack = tags.getInteger("Attack");
attack += (overThreshold > 1) ? overThreshold : 1;
attack += 1 + (increase - leftToBoost) / threshold;
tags.setInteger("Attack", attack);
}
@@ -118,14 +117,13 @@ public class ModAttack extends ItemModTypeFilter {
int modifiers = tags.getInteger("Modifiers");
modifiers -= 1;
tags.setInteger("Modifiers", modifiers);
int overThreshold = increase / threshold;
String modName = "\u00a7f" + guiType + " (" + increase + "/" + max + ")";
int tooltipIndex = addToolTip(tool, tooltipName, modName);
int[] keyPair = new int[] { increase, max, tooltipIndex };
tags.setIntArray(key, keyPair);
int attack = tags.getInteger("Attack");
attack += (overThreshold >= 1) ? overThreshold : 0;
attack += 1 + increase / threshold;
tags.setInteger("Attack", attack);
}
}