Fix Armor misscalculation (#46)
Changes: + mod operation "add" can't go into negative numbers
This commit is contained in:
parent
db23081a9a
commit
b5cffae778
|
|
@ -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);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue