diff --git a/src/Roster.jsx b/src/Roster.jsx index da67fa2..3622d7c 100644 --- a/src/Roster.jsx +++ b/src/Roster.jsx @@ -115,6 +115,7 @@ const Unit = ({ unit, catalog }) => { modelStats, modelList, psykers, + cost, } = unit; const hasDifferentProfiles = weapons.some( @@ -214,9 +215,15 @@ const Unit = ({ unit, catalog }) => { textTransform: "uppercase", zIndex: 1, position: "relative", + display: "flex", + justifyContent: "space-between", + alignItems: "center", }} > {name} + + {cost.points}pts +
{ modelList={modelList} index={index} showName={modelStats.length > 1} + showWeapons={ + modelList.length > 1 || modelList[0].includes("x ") // show Weapons when multiple weapons of same type, for example (2x Atomiser Beam, Reanimator's Claws) + } /> ))}
@@ -321,7 +331,13 @@ const Unit = ({ unit, catalog }) => { ); }; -const ModelStats = ({ modelStats, index, showName, modelList }) => { +const ModelStats = ({ + modelStats, + index, + showName, + showWeapons, + modelList, +}) => { let { move, toughness, save, wounds, leadership, name } = modelStats; if (!wounds) { wounds = "/"; @@ -348,29 +364,30 @@ const ModelStats = ({ modelStats, index, showName, modelList }) => { + {showName && ( - <> -
- {name} -
-
- {modelListMatches.map((model, index) => ( -
{model}
- ))} -
- +
+ {name} +
+ )} + {showWeapons && ( +
+ {modelListMatches.map((model, index) => ( +
{model}
+ ))} +
)} ); @@ -548,9 +565,12 @@ const FancyBox = ({ children }) => { alignItems: "center", justifyContent: "center", background: "linear-gradient(315deg, transparent 3px, #E8EDE7 0)", + padding: 3, + fontSize: "1.6em", + fontWeight: 800, }} > -
{children}
+ {children} ); diff --git a/src/Weapons.jsx b/src/Weapons.jsx index 5bcf55f..7963f3e 100644 --- a/src/Weapons.jsx +++ b/src/Weapons.jsx @@ -19,7 +19,7 @@ export const Weapons = ({ title, weapons, modelStats }) => { - {title} + {title} RANGE A {isMelee ? "WS" : "BS"} @@ -59,7 +59,7 @@ const Weapon = ({ weapon, modelStats, isMelee, className }) => { const bs = modelStats[0].bs; let ws = modelStats[0].ws; const strModel = modelStats[0].str; - const meleeAttacks = modelStats[0].attacks; + let meleeAttacks = modelStats[0].attacks; if (name === "Krak grenades") { name = "Krak grenade"; @@ -97,6 +97,30 @@ const Weapon = ({ weapon, modelStats, isMelee, className }) => { type = "Plague 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." + ) || + abilities?.includes( + "Each time an attack made with this weapon targets a unit within half range, that attack has a Damage characteristic of D6+2." + ) + ) { + abilities = abilities + .replaceAll( + "Each time an attack made with this weapon targets an enemy within half range, that attack has a Damage characteristic of D6+2.", + "" + ) + .replaceAll( + "Each time an attack made with this weapon targets a unit within half range, that attack has a Damage characteristic of D6+2.", + "" + ); + if (type) { + type += ", Melta 2"; + } else { + type = "Melta 2"; + } + } + if ( abilities?.includes( "Each time an attack is made with this weapon, subtract 1 from that attack’s hit roll." @@ -137,6 +161,55 @@ const Weapon = ({ weapon, modelStats, isMelee, className }) => { ); ws = `${parseInt(ws, 10) + 1}+`; } + + if ( + abilities?.includes( + "Each time an attack is made with this weapon profile, make 2 hit rolls instead of 1." + ) || + abilities?.includes( + "Each time an attack is made with this weapon, make 2 attack rolls instead of 1." + ) || + abilities?.includes( + "Each time an attack is made with this weapon, make 2 hit rolls instead of 1." + ) + ) { + abilities = abilities + .replaceAll( + "Each time an attack is made with this weapon profile, make 2 hit rolls instead of 1.", + "" + ) + .replaceAll( + "Each time an attack is made with this weapon, make 2 attack rolls instead of 1.", + "" + ) + .replaceAll( + "Each time an attack is made with this weapon, make 2 hit rolls instead of 1.", + "" + ); + + meleeAttacks = meleeAttacks * 2; + } + if ( + abilities?.includes( + "Each time an attack is made with this weapon profile, make 3 hit rolls instead of 1." + ) || + abilities?.includes( + "Each time an attack is made with this weapon, make 3 hit rolls instead of 1." + ) + ) { + abilities = abilities + .replaceAll( + "Each time an attack is made with this weapon profile, make 3 hit rolls instead of 1.", + "" + ) + .replaceAll( + "Each time an attack is made with this weapon, make 3 hit rolls instead of 1.", + "" + ); + + meleeAttacks = meleeAttacks * 3; + } + name = name.replaceAll(" (Shooting)", "").replaceAll(" (Melee)", ""); return ( @@ -162,6 +235,7 @@ const Weapon = ({ weapon, modelStats, isMelee, className }) => { fontSize: ".8em", fontWeight: 700, color: "var(--primary-color)", + textTransform: "uppercase", }} > [{type}]