more weapon types

This commit is contained in:
NilsUeter
2023-04-19 22:18:53 +02:00
parent 5bcff97ff5
commit f2e813d5d7
2 changed files with 120 additions and 26 deletions
+24 -4
View File
@@ -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}
<span style={{ textTransform: "initial", fontSize: "1.1rem" }}>
{cost.points}pts
</span>
</div>
<div
style={{
@@ -235,6 +242,9 @@ const Unit = ({ unit, catalog }) => {
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)
}
/>
))}
</div>
@@ -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,8 +364,8 @@ const ModelStats = ({ modelStats, index, showName, modelList }) => {
<Characteristic title="SV" characteristic={save} index={index} />
<Characteristic title="W" characteristic={wounds} index={index} />
<Characteristic title="LD" characteristic={leadership} index={index} />
{showName && (
<>
<div
style={{
marginTop: index === 0 ? 16 : 0,
@@ -359,6 +375,8 @@ const ModelStats = ({ modelStats, index, showName, modelList }) => {
>
{name}
</div>
)}
{showWeapons && (
<div
style={{
marginTop: index === 0 ? 16 : 0,
@@ -370,7 +388,6 @@ const ModelStats = ({ modelStats, index, showName, modelList }) => {
<div>{model}</div>
))}
</div>
</>
)}
</div>
);
@@ -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,
}}
>
<div style={{ fontSize: "1.6em", fontWeight: 800 }}>{children}</div>
{children}
</div>
</div>
);
+76 -2
View File
@@ -19,7 +19,7 @@ export const Weapons = ({ title, weapons, modelStats }) => {
<img src={isMelee ? meleeIcon : rangedIcon} />
</div>
</th>
<th style={{ textAlign: "left", width: "44%" }}>{title}</th>
<th style={{ textAlign: "left" }}>{title}</th>
<th>RANGE</th>
<th>A</th>
<th>{isMelee ? "WS" : "BS"}</th>
@@ -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 attacks 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}]