when showing invul in characteristics, remove it from abilities section
This commit is contained in:
+49
-26
@@ -470,7 +470,7 @@ const Unit = ({
|
|||||||
|
|
||||||
<Keywords keywords={keywords} />
|
<Keywords keywords={keywords} />
|
||||||
</div>
|
</div>
|
||||||
<div className="relative max-w-[400px] flex-1 p-1 pb-[50px] pt-5 print:p-[20px] sm:p-2 sm:pb-[50px] sm:pt-5 sm:print:p-[20px] sm:print:pb-[50px] md:p-[20px] md:pb-[50px] md:pt-5 md:print:p-[20px] md:print:pb-[50px]">
|
<div className="relative max-w-[400px] flex-1 p-1 pb-[50px] pt-5 sm:p-2 sm:pb-[50px] sm:pt-5 md:p-[20px] md:pb-[50px] md:pt-5 print:p-[20px] sm:print:p-[20px] sm:print:pb-[50px] md:print:p-[20px] md:print:pb-[50px]">
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
fontSize: "1.1em",
|
fontSize: "1.1em",
|
||||||
@@ -575,28 +575,6 @@ const checkAbilitiesForInvul = (abilitiesMap, name) => {
|
|||||||
case "this model has a 6+ invulnerable save against ranged weapons.":
|
case "this model has a 6+ invulnerable save against ranged weapons.":
|
||||||
return "6+*";
|
return "6+*";
|
||||||
|
|
||||||
case "while this model is leading a unit, models in that unit have a 2+ invulnerable save.":
|
|
||||||
return "2+*";
|
|
||||||
case "while this model is leading a unit, models in that unit have a 3+ invulnerable save.":
|
|
||||||
return "3+*";
|
|
||||||
case "while this model is leading a unit, models in that unit have a 4+ invulnerable save.":
|
|
||||||
return "4+*";
|
|
||||||
case "while this model is leading a unit, models in that unit have a 5+ invulnerable save.":
|
|
||||||
return "5+*";
|
|
||||||
case "while this model is leading a unit, models in that unit have a 6+ invulnerable save.":
|
|
||||||
return "6+*";
|
|
||||||
|
|
||||||
case "while this model is leading a unit, models in that unit have a 2+ invulnerable save against ranged attacks.":
|
|
||||||
return "2+*";
|
|
||||||
case "while this model is leading a unit, models in that unit have a 3+ invulnerable save against ranged attacks.":
|
|
||||||
return "3+*";
|
|
||||||
case "while this model is leading a unit, models in that unit have a 4+ invulnerable save against ranged attacks.":
|
|
||||||
return "4+*";
|
|
||||||
case "while this model is leading a unit, models in that unit have a 5+ invulnerable save against ranged attacks.":
|
|
||||||
return "5+*";
|
|
||||||
case "while this model is leading a unit, models in that unit have a 6+ invulnerable save against ranged attacks.":
|
|
||||||
return "6+*";
|
|
||||||
|
|
||||||
case "this model has a 2+ invulnerable save. you cannot re-roll invulnerable saving throws made for this model.":
|
case "this model has a 2+ invulnerable save. you cannot re-roll invulnerable saving throws made for this model.":
|
||||||
return "2+*";
|
return "2+*";
|
||||||
case "this model has a 3+ invulnerable save. you cannot re-roll invulnerable saving throws made for this model.":
|
case "this model has a 3+ invulnerable save. you cannot re-roll invulnerable saving throws made for this model.":
|
||||||
@@ -806,9 +784,54 @@ const Rules = ({ rules }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const removeInvulnsWithoutSpecialRules = (abilities) => {
|
||||||
|
const filteredAbilities = new Map();
|
||||||
|
for (let [key, value] of abilities) {
|
||||||
|
switch (value?.trim()?.toLowerCase()) {
|
||||||
|
case "2+":
|
||||||
|
if (!key?.toLowerCase().includes("invulnerable save"))
|
||||||
|
filteredAbilities.set(key, value);
|
||||||
|
break;
|
||||||
|
case "3+":
|
||||||
|
if (!key?.toLowerCase().includes("invulnerable save"))
|
||||||
|
filteredAbilities.set(key, value);
|
||||||
|
break;
|
||||||
|
case "4+":
|
||||||
|
if (!key?.toLowerCase().includes("invulnerable save"))
|
||||||
|
filteredAbilities.set(key, value);
|
||||||
|
break;
|
||||||
|
case "5+":
|
||||||
|
if (!key?.toLowerCase().includes("invulnerable save"))
|
||||||
|
filteredAbilities.set(key, value);
|
||||||
|
break;
|
||||||
|
case "6+":
|
||||||
|
if (!key?.toLowerCase().includes("invulnerable save"))
|
||||||
|
filteredAbilities.set(key, value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "models in this unit have a 2+ invulnerable save.":
|
||||||
|
case "models in this unit have a 3+ invulnerable save.":
|
||||||
|
case "models in this unit have a 4+ invulnerable save.":
|
||||||
|
case "models in this unit have a 5+ invulnerable save.":
|
||||||
|
case "models in this unit have a 6+ invulnerable save.":
|
||||||
|
case "this model has a 2+ invulnerable save.":
|
||||||
|
case "this model has a 3+ invulnerable save.":
|
||||||
|
case "this model has a 4+ invulnerable save.":
|
||||||
|
case "this model has a 5+ invulnerable save.":
|
||||||
|
case "this model has a 6+ invulnerable save.":
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
filteredAbilities.set(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return filteredAbilities;
|
||||||
|
};
|
||||||
|
|
||||||
const Abilities = ({ abilities }) => {
|
const Abilities = ({ abilities }) => {
|
||||||
if (!abilities) return null;
|
if (!abilities) return null;
|
||||||
let keys = [...abilities.keys()];
|
const filteredAbilities = removeInvulnsWithoutSpecialRules(abilities);
|
||||||
|
|
||||||
|
let keys = [...filteredAbilities.keys()];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@@ -820,7 +843,7 @@ const Abilities = ({ abilities }) => {
|
|||||||
borderBottom: "1px dotted rgb(158, 159, 161)",
|
borderBottom: "1px dotted rgb(158, 159, 161)",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{abilities &&
|
{filteredAbilities &&
|
||||||
keys.map((ability) => (
|
keys.map((ability) => (
|
||||||
<div
|
<div
|
||||||
key={ability}
|
key={ability}
|
||||||
@@ -830,7 +853,7 @@ const Abilities = ({ abilities }) => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<span style={{ fontWeight: 700 }}>{ability}:</span>{" "}
|
<span style={{ fontWeight: 700 }}>{ability}:</span>{" "}
|
||||||
{abilities.get(ability)}
|
{filteredAbilities.get(ability)}
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user