diff --git a/src/10th/Roster.jsx b/src/10th/Roster.jsx index a9df9db..293e5d4 100644 --- a/src/10th/Roster.jsx +++ b/src/10th/Roster.jsx @@ -8,6 +8,7 @@ import tyranidBackground from "../assets/tyranidBackground.png"; import mechanicusBackground from "../assets/mechanicusBackground.png"; import orkBackground from "../assets/orkBackground.png"; import necronBackground from "../assets/necronBackground.png"; +import custodesBackground from "../assets/custodesBackground.png"; import { Arrow, wavyLine } from "../assets/icons"; import { Weapons, hasDifferentProfiles } from "./Weapons"; import { useIndexedDB } from "../helpers/useIndexedDB"; // New hook for IndexedDB @@ -577,6 +578,7 @@ const Unit = ({ const backgrounds = { "Imperium - Adeptus Mechanicus": mechanicusBackground, + "Imperium - Adeptus Custodes": custodesBackground, "Chaos - Death Guard": dgBackground, "Xenos - T'au Empire": tauBackground, "Xenos - Tyranids": tyranidBackground, @@ -864,6 +866,14 @@ const factionIcons = { ), + "Imperium - Adeptus Custodes": ( + + + + + + + ), "Chaos - Death Guard": ( { style={{ fontSize: joinedKeywords.length > 70 ? ".8em" : "1em", fontWeight: 800, + marginTop: 1, }} > {joinedKeywords} diff --git a/src/10th/ShortSummaryTable.jsx b/src/10th/ShortSummaryTable.jsx index ed41782..80bcb4f 100644 --- a/src/10th/ShortSummaryTable.jsx +++ b/src/10th/ShortSummaryTable.jsx @@ -181,7 +181,8 @@ export const ShortSummaryTable = ({ force, primaryColor, name, points }) => {
{sortedUnits.map((unit, index) => { let { name, cost, models } = unit; - const count = models?.[0]?.count || 1; + const count = + models?.length === 1 ? models?.[0]?.count || 1 : 1; return (
{
{unit.modelStats?.reduce((sum, stat, index) => { - const count = unit.models?.[index]?.count || 1; - return sum + (stat.wounds || 0) * count; + const modelName = unit.models?.reduce( + (bestMatch, model) => { + const similarity = (str1, str2) => { + let matches = 0; + for ( + let i = 0; + i < Math.min(str1.length, str2.length); + i++ + ) { + if (str1[i] === str2[i]) matches++; // Match only if characters are at the same position + } + return matches; + }; + const currentSimilarity = similarity( + stat.name, + model.name, + ); + + return currentSimilarity > + similarity(stat.name, bestMatch.name) + ? model + : bestMatch; + }, + unit.models[0], + ); + + const modelCount = modelName?.count || 1; + return sum + (stat.wounds || 0) * modelCount; }, 0)}
diff --git a/src/assets/custodesBackground.png b/src/assets/custodesBackground.png new file mode 100644 index 0000000..eddc149 Binary files /dev/null and b/src/assets/custodesBackground.png differ