Added Operations and Combat Conditions (#22)

* Added Operations and Combat Conditions

+ Added Multiply, Division and Subtract operations for modifiers
+ Added Combat Conditions Effects form Ars Armorum

* Added Math.floor()
This commit is contained in:
LeFrique
2023-12-01 15:26:49 +01:00
committed by GitHub
parent 48883c3102
commit 725dd8c504
14 changed files with 273 additions and 0 deletions
+3
View File
@@ -95,6 +95,9 @@ export enum M5ModOperation {
ADD = "add",
SET = "set",
FIXED = "fixed",
MULTIPLY = "multiply",
SUBTRACT = "subtract",
DIVISION = "division",
}
export interface M5ItemMod {
+21
View File
@@ -126,6 +126,27 @@ export default class M5ModAggregate {
const bonus = mods.map((p) => p.mod.value).reduce((a, b) => a + b, 0);
ret.value = Math.max(0, ret.value + bonus);
}
mods = arr.filter((pair) => pair.mod.operation === M5ModOperation.SUBTRACT);
if (mods.length !== 0) {
ret.mods = ret.mods.concat(mods.map(this.pairAsSource));
const bonus = mods.map((p) => p.mod.value).reduce((a, b) => a - b, 0);
ret.value = Math.max(0, ret.value + bonus);
}
mods = arr.filter((pair) => pair.mod.operation === M5ModOperation.MULTIPLY);
if (mods.length !== 0) {
ret.mods = ret.mods.concat(mods.map(this.pairAsSource));
const bonus = mods.map((p) => p.mod.value).reduce((a, b) => a * b, 0);
ret.value = Math.max(0, ret.value + bonus);
}
mods = arr.filter((pair) => pair.mod.operation === M5ModOperation.DIVISION);
if (mods.length !== 0) {
ret.mods = ret.mods.concat(mods.map(this.pairAsSource));
const bonus = mods.map((p) => p.mod.value).reduce((a, b) => Math.floor(a / b), 0);
ret.value = Math.max(0, ret.value + bonus);
}
}
return ret;
+7
View File
@@ -48,6 +48,13 @@
"path": "./packs/items/ausrustung.db",
"type": "Item"
},
{
"name": "kampfzustaende",
"label": "Kampfzustände",
"system": "midgard5",
"path": "./packs/items/kampfzustaende.db",
"type": "Item"
},
{
"name": "waffenkammer",
"label": "Waffenkammer",