only show new rules if they exist in the units, genestealer colors
This commit is contained in:
@@ -305,6 +305,7 @@ const getPrimaryColor = (catalog) => {
|
|||||||
case "Thousand Sons":
|
case "Thousand Sons":
|
||||||
return "#536766";
|
return "#536766";
|
||||||
case "Tyranids":
|
case "Tyranids":
|
||||||
|
case "Tyranids - Genestealer Cults":
|
||||||
return "#44264C";
|
return "#44264C";
|
||||||
case "Ynnari":
|
case "Ynnari":
|
||||||
return "#536766";
|
return "#536766";
|
||||||
|
|||||||
+5
-21
@@ -53,6 +53,7 @@ const Force = ({ force, onePerPage }) => {
|
|||||||
unit={unit}
|
unit={unit}
|
||||||
catalog={catalog}
|
catalog={catalog}
|
||||||
onePerPage={onePerPage}
|
onePerPage={onePerPage}
|
||||||
|
forceRules={rules}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
<ForceRules rules={rules} onePerPage={onePerPage} />
|
<ForceRules rules={rules} onePerPage={onePerPage} />
|
||||||
@@ -60,7 +61,7 @@ const Force = ({ force, onePerPage }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const Unit = ({ unit, index, catalog, onePerPage }) => {
|
const Unit = ({ unit, index, catalog, onePerPage, forceRules }) => {
|
||||||
const [hide, setHide] = useState(false);
|
const [hide, setHide] = useState(false);
|
||||||
let {
|
let {
|
||||||
name,
|
name,
|
||||||
@@ -268,11 +269,13 @@ const Unit = ({ unit, index, catalog, onePerPage }) => {
|
|||||||
title="RANGED WEAPONS"
|
title="RANGED WEAPONS"
|
||||||
weapons={rangedWeapons}
|
weapons={rangedWeapons}
|
||||||
modelStats={modelStats}
|
modelStats={modelStats}
|
||||||
|
forceRules={forceRules}
|
||||||
/>
|
/>
|
||||||
<Weapons
|
<Weapons
|
||||||
title="MELEE WEAPONS"
|
title="MELEE WEAPONS"
|
||||||
weapons={meleeWeapons}
|
weapons={meleeWeapons}
|
||||||
modelStats={modelStats}
|
modelStats={modelStats}
|
||||||
|
forceRules={forceRules}
|
||||||
/>
|
/>
|
||||||
</table>
|
</table>
|
||||||
<div style={{ flex: "1" }}></div>
|
<div style={{ flex: "1" }}></div>
|
||||||
@@ -805,23 +808,6 @@ const getSpellClassNames = (spells, index) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const ForceRules = ({ rules, onePerPage }) => {
|
const ForceRules = ({ rules, onePerPage }) => {
|
||||||
rules.set(
|
|
||||||
"Torrent",
|
|
||||||
"When resolving an attack made with this weapon, do not make a hit roll: it automatically scores a hit."
|
|
||||||
);
|
|
||||||
rules.set(
|
|
||||||
"Indirect Fire",
|
|
||||||
"This weapon can target units that are not visible to the bearer."
|
|
||||||
);
|
|
||||||
rules.set(
|
|
||||||
"Melta X",
|
|
||||||
"Each time an attack made with this weapon targets a unit within half range, that attack's Damagae characteristic is increased by the amount denotex by 'X'."
|
|
||||||
);
|
|
||||||
rules.set(
|
|
||||||
"Lethal Hits",
|
|
||||||
"Each time an attack is made with this weapon profile, an unmodified hit roll of 6 automatically wounds the target."
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={"avoid-page-break " + (onePerPage ? "page-break" : "")}
|
className={"avoid-page-break " + (onePerPage ? "page-break" : "")}
|
||||||
@@ -835,9 +821,7 @@ const ForceRules = ({ rules, onePerPage }) => {
|
|||||||
marginBottom: 32,
|
marginBottom: 32,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{[...rules.keys()]
|
{[...rules.keys()].map((rule) => (
|
||||||
.filter((rule) => !rule.startsWith("Explodes"))
|
|
||||||
.map((rule) => (
|
|
||||||
<div
|
<div
|
||||||
key={rule}
|
key={rule}
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
+25
-16
@@ -2,7 +2,7 @@ import meleeIcon from "./assets/meleeIcon.png";
|
|||||||
import rangedIcon from "./assets/rangedIcon.png";
|
import rangedIcon from "./assets/rangedIcon.png";
|
||||||
import { Arrow } from "./assets/icons";
|
import { Arrow } from "./assets/icons";
|
||||||
|
|
||||||
export const Weapons = ({ title, weapons, modelStats }) => {
|
export const Weapons = ({ title, weapons, modelStats, forceRules }) => {
|
||||||
const isMelee = title === "MELEE WEAPONS";
|
const isMelee = title === "MELEE WEAPONS";
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -37,6 +37,7 @@ export const Weapons = ({ title, weapons, modelStats }) => {
|
|||||||
modelStats={modelStats}
|
modelStats={modelStats}
|
||||||
isMelee={isMelee}
|
isMelee={isMelee}
|
||||||
className={getWeaponClassNames(weapons, index)}
|
className={getWeaponClassNames(weapons, index)}
|
||||||
|
forceRules={forceRules}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
{weapons.length > 0 && (
|
{weapons.length > 0 && (
|
||||||
@@ -50,7 +51,7 @@ export const Weapons = ({ title, weapons, modelStats }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const Weapon = ({ weapon, modelStats, isMelee, className }) => {
|
const Weapon = ({ weapon, modelStats, isMelee, className, forceRules }) => {
|
||||||
let { name, selectionName, range, type, str, ap, damage, abilities } = weapon;
|
let { name, selectionName, range, type, str, ap, damage, abilities } = weapon;
|
||||||
var lastWhiteSpace = type.lastIndexOf(" ");
|
var lastWhiteSpace = type.lastIndexOf(" ");
|
||||||
const attacks = type.substring(lastWhiteSpace + 1);
|
const attacks = type.substring(lastWhiteSpace + 1);
|
||||||
@@ -83,7 +84,11 @@ const Weapon = ({ weapon, modelStats, isMelee, className }) => {
|
|||||||
name = name.split(" - ")[1];
|
name = name.split(" - ")[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
const replaceAbilityWithType = (occurences, typeName) => {
|
const replaceAbilityWithType = (
|
||||||
|
occurences,
|
||||||
|
typeName,
|
||||||
|
ruleTextForForceRules
|
||||||
|
) => {
|
||||||
if (!abilities) return;
|
if (!abilities) return;
|
||||||
if (occurences.some((occurence) => abilities.includes(occurence))) {
|
if (occurences.some((occurence) => abilities.includes(occurence))) {
|
||||||
for (let i = 0; i < occurences.length; i++) {
|
for (let i = 0; i < occurences.length; i++) {
|
||||||
@@ -94,7 +99,12 @@ const Weapon = ({ weapon, modelStats, isMelee, className }) => {
|
|||||||
} else {
|
} else {
|
||||||
type = typeName;
|
type = typeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ruleTextForForceRules) {
|
||||||
|
forceRules.set(typeName, ruleTextForForceRules);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return abilities;
|
return abilities;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -105,20 +115,16 @@ const Weapon = ({ weapon, modelStats, isMelee, className }) => {
|
|||||||
"This weapon automatically hits its target.",
|
"This weapon automatically hits its target.",
|
||||||
"When resolving an attack made with this weapon, do not make a hit roll: it automatically scores a hit.",
|
"When resolving an attack made with this weapon, do not make a hit roll: it automatically scores a hit.",
|
||||||
],
|
],
|
||||||
"Torrent"
|
"Torrent",
|
||||||
|
"When resolving an attack made with this weapon, do not make a hit roll: it automatically scores a hit."
|
||||||
);
|
);
|
||||||
replaceAbilityWithType(
|
replaceAbilityWithType(
|
||||||
["This weapon can target units that are not visible to the bearer."],
|
["This weapon can target units that are not visible to the bearer."],
|
||||||
"Indirect Fire"
|
"Indirect Fire",
|
||||||
);
|
"This weapon can target units that are not visible to the bearer."
|
||||||
replaceAbilityWithType(
|
|
||||||
[
|
|
||||||
"Plague Weapon.",
|
|
||||||
"Plague Weapon",
|
|
||||||
"Each time an attack is made with this weapon, re-roll a wound roll of 1.",
|
|
||||||
],
|
|
||||||
"Plague Weapon"
|
|
||||||
);
|
);
|
||||||
|
replaceAbilityWithType(["Plague Weapon.", "Plague Weapon"], "Plague Weapon");
|
||||||
|
replaceAbilityWithType(["Sonic Weapon.", "Sonic Weapon"], "Sonic Weapon");
|
||||||
replaceAbilityWithType(
|
replaceAbilityWithType(
|
||||||
["Turret Weapon.", "Turret weapon.", "Turret Weapon", "Turret weapon"],
|
["Turret Weapon.", "Turret weapon.", "Turret Weapon", "Turret weapon"],
|
||||||
"Turret Weapon"
|
"Turret Weapon"
|
||||||
@@ -129,21 +135,24 @@ const Weapon = ({ weapon, modelStats, isMelee, className }) => {
|
|||||||
"Each time an attack made with this weapon targets a unit within half range, that attack has a Damage characteristic of D6+2.",
|
"Each time an attack made with this weapon targets a unit within half range, that attack has a Damage characteristic of D6+2.",
|
||||||
"Each time an attack made with this weapon targets a unit within half range, that attack has a Damage characteristic of D6+2",
|
"Each time an attack made with this weapon targets a unit within half range, that attack has a Damage characteristic of D6+2",
|
||||||
],
|
],
|
||||||
"Melta 2"
|
"Melta 2",
|
||||||
|
"Each time an attack made with this weapon targets a unit within half range, that attack attack has a Damage characteristic of D6+2."
|
||||||
);
|
);
|
||||||
replaceAbilityWithType(
|
replaceAbilityWithType(
|
||||||
[
|
[
|
||||||
"Each time an attack made with this weapon targets an enemy within half range, that attack has a Damage characteristic of D6+4.",
|
"Each time an attack made with this weapon targets an enemy within half range, that attack has a Damage characteristic of D6+4.",
|
||||||
"Each time an attack made with this weapon targets a unit within half range, that attack has a Damage characteristic of D6+4.",
|
"Each time an attack made with this weapon targets a unit within half range, that attack has a Damage characteristic of D6+4.",
|
||||||
],
|
],
|
||||||
"Melta 4"
|
"Melta 4",
|
||||||
|
"Each time an attack made with this weapon targets a unit within half range, that attack attack has a Damage characteristic of D6+4."
|
||||||
);
|
);
|
||||||
replaceAbilityWithType(
|
replaceAbilityWithType(
|
||||||
[
|
[
|
||||||
"Each time an attack is made with this weapon profile, an unmodified hit roll of 6 automatically wounds the target.",
|
"Each time an attack is made with this weapon profile, an unmodified hit roll of 6 automatically wounds the target.",
|
||||||
"Each unmodified hit roll of 6 made for this weapon's attacks automatically hits and results in a wound (do not make a wound roll for that attack).",
|
"Each unmodified hit roll of 6 made for this weapon's attacks automatically hits and results in a wound (do not make a wound roll for that attack).",
|
||||||
],
|
],
|
||||||
"Lethal Hits"
|
"Lethal Hits",
|
||||||
|
"Each time an attack is made with this weapon profile, an unmodified hit roll of 6 automatically wounds the target."
|
||||||
);
|
);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|||||||
Reference in New Issue
Block a user