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",
damage: "1",
type: "Melee",
str: "0",
str: "+0",
ap: "0",
});
}
+7 -2
View File
@@ -292,7 +292,12 @@ const getWeaponClassNames = (weapons, index) => {
const calculateWeaponStrength = (strModel, strWeapon) => {
if (strWeapon.startsWith("User")) return strModel;
if (strWeapon.startsWith("x"))
if (strWeapon.startsWith("x")) {
return strModel * parseInt(strWeapon.replace("x", ""));
return strModel + parseInt(strWeapon, 10);
}
if (strWeapon.includes("+")) {
return strModel + parseInt(strWeapon, 10);
}
if (!strWeapon) return strModel;
return parseInt(strWeapon, 10);
};