Fix Armor misscalculation (#46)

Changes:
 + mod operation "add" can't go into negative numbers
This commit is contained in:
2023-12-06 14:49:12 +01:00
committed by GitHub
parent db23081a9a
commit b5cffae778
+1 -1
View File
@@ -126,7 +126,7 @@ export default class M5ModAggregate {
if (mods.length !== 0) { if (mods.length !== 0) {
ret.mods = ret.mods.concat(mods.map(this.pairAsSource)); ret.mods = ret.mods.concat(mods.map(this.pairAsSource));
const bonus = mods.map((p) => p.mod.value).reduce((a, b) => a + b, 0); const bonus = mods.map((p) => p.mod.value).reduce((a, b) => a + b, 0);
ret.value = ret.value + bonus; ret.value = Math.max(0, ret.value + bonus);
} }
mods = arr.filter((pair) => pair.mod.operation === M5ModOperation.SUBTRACT); mods = arr.filter((pair) => pair.mod.operation === M5ModOperation.SUBTRACT);