From f2b89b606baf9152d7737930aad4cd5f1b450787 Mon Sep 17 00:00:00 2001 From: NilsUeter Date: Tue, 9 May 2023 18:00:00 +0200 Subject: [PATCH] Astra Militarum fixes --- src/App.jsx | 2 +- src/Roster.jsx | 11 +++++------ src/Weapons.jsx | 11 +++++++++++ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index cc90751..32b8c6f 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -240,7 +240,7 @@ const getPrimaryColor = (catalog) => { return "#536766"; case "Adeptus Mechanicus": return "#536766"; - case "Astra Militarum": + case "Imperium - Astra Militarum": return "#375441"; case "Chaos - Daemons": return "#383c46"; diff --git a/src/Roster.jsx b/src/Roster.jsx index 9b0ba71..aff4c43 100644 --- a/src/Roster.jsx +++ b/src/Roster.jsx @@ -76,10 +76,7 @@ const Unit = ({ unit, index, catalog, onePerPage }) => { } = unit; const meleeWeapons = weapons - .filter( - (weapon) => - weapon.range === "Melee" && weapon.range !== "-" && weapon.range !== "" - ) + .filter((weapon) => weapon.range === "Melee" || weapon.type === "Melee") .sort((a, b) => a.selectionName.localeCompare(b.selectionName)); if (meleeWeapons.length === 0) { meleeWeapons.push({ @@ -100,7 +97,10 @@ const Unit = ({ unit, index, catalog, onePerPage }) => { .sort((a, b) => a.selectionName.localeCompare(b.selectionName)); const weaponDescriptions = weapons - .filter((weapon) => weapon.range === "-" || weapon.range === "") + .filter( + (weapon) => + (weapon.range === "-" || weapon.range === "") && weapon.abilities + ) .sort((a, b) => a.selectionName.localeCompare(b.selectionName)); const modelsWithDifferentProfiles = weapons.filter( (weapon) => @@ -819,5 +819,4 @@ const getOverridePrimary = (factions, keywords) => { if (factions.has("Tzeentch") || keywords.has("Tzeentch")) return "#1f3d7a"; if (factions.has("Nurgle") || keywords.has("Nurgle")) return "#5c672b"; if (factions.has("Slaanesh") || keywords.has("Slaanesh")) return "#634c74"; - console.log(factions); }; diff --git a/src/Weapons.jsx b/src/Weapons.jsx index c719559..4c8bbad 100644 --- a/src/Weapons.jsx +++ b/src/Weapons.jsx @@ -97,6 +97,17 @@ const Weapon = ({ weapon, modelStats, isMelee, className }) => { type = "Plague Weapon"; } } + if (abilities?.toLowerCase().includes("turret weapon")) { + abilities = abilities + .replaceAll("Turret weapon.", "") + .replaceAll("Turret Weapon", "") + .replaceAll("Turret weapon", ""); + if (type) { + type += ", Turret weapon"; + } else { + type = "Turret weapon"; + } + } /* if ( abilities?.includes( "Each time an attack made with this weapon targets an enemy within half range, that attack has a Damage characteristic of D6+2."