fix strength for melee weapons

This commit is contained in:
NilsUeter
2023-05-08 07:48:29 +02:00
parent f4f3e355bf
commit 4c3e3a84e5
2 changed files with 8 additions and 3 deletions
+1 -1
View File
@@ -142,7 +142,7 @@ const Unit = ({ unit, index, catalog, onePerPage }) => {
range: "Melee", range: "Melee",
damage: "1", damage: "1",
type: "Melee", type: "Melee",
str: "0", str: "+0",
ap: "0", ap: "0",
}); });
} }
+6 -1
View File
@@ -292,7 +292,12 @@ const getWeaponClassNames = (weapons, index) => {
const calculateWeaponStrength = (strModel, strWeapon) => { const calculateWeaponStrength = (strModel, strWeapon) => {
if (strWeapon.startsWith("User")) return strModel; if (strWeapon.startsWith("User")) return strModel;
if (strWeapon.startsWith("x")) if (strWeapon.startsWith("x")) {
return strModel * parseInt(strWeapon.replace("x", "")); return strModel * parseInt(strWeapon.replace("x", ""));
}
if (strWeapon.includes("+")) {
return strModel + parseInt(strWeapon, 10); return strModel + parseInt(strWeapon, 10);
}
if (!strWeapon) return strModel;
return parseInt(strWeapon, 10);
}; };