fix weapon selection, add more cases for subtract ws

This commit is contained in:
NilsUeter
2023-04-18 22:03:36 +02:00
parent d67df22b4d
commit cd51f6af3d
+52 -8
View File
@@ -68,32 +68,76 @@ const Weapon = ({ weapon, modelStats, isMelee, className }) => {
selectionName !== name && selectionName !== name &&
!name.includes("(Shooting)") && !name.includes("(Shooting)") &&
!name.includes("(Melee)"); !name.includes("(Melee)");
const interestingType = type && type !== "Melee";
if (differentProfiles && name.endsWith(" grenades")) { if (differentProfiles && name.endsWith(" grenades")) {
name = name.replace(" grenades", ""); name = name.replace(" grenades", "");
} }
if (differentProfiles && name.endsWith(" grenade")) { if (differentProfiles && name.endsWith(" grenade")) {
name = name.replace(" grenade", ""); name = name.replace(" grenade", "");
} }
if (name.startsWith("Missile launcher, ")) {
name = name.replace("Missile launcher, ", "");
}
if (differentProfiles && name.includes(" - ")) { if (differentProfiles && name.includes(" - ")) {
name = name.split(" - ")[1]; name = name.split(" - ")[1];
} }
if (abilities === "Blast") { if (abilities?.includes("Blast")) {
abilities = abilities.replaceAll("Blast", ""); abilities = abilities.replaceAll("Blast.", "").replaceAll("Blast", "");
type += ", Blast"; type += ", Blast";
} }
if (abilities?.includes("Plague Weapon")) {
abilities = abilities
.replaceAll("Plague Weapon.", "")
.replaceAll("Plague Weapon", "");
if (type) {
type += ", Plague Weapon";
} else {
type = "Plague Weapon";
}
}
if ( if (
abilities?.includes( abilities?.includes(
"Each time an attack is made with this weapon, subtract 1 from that attacks hit roll." "Each time an attack is made with this weapon, subtract 1 from that attacks hit roll."
) ||
abilities?.includes(
"Each time an attack is made with this weapon, subtract 1 from that attack's hit roll."
) ||
abilities?.includes(
"Each time an attack is made with this weapon profile, subtract 1 from that attack's hit roll."
) ||
abilities?.includes(
"Each time an attack is made with this weapon, you must subtract 1 from the hit roll."
) ||
abilities?.includes(
"When attacking with this weapon, you must subtract 1 from the hit rolls."
) )
) { ) {
abilities = abilities.replaceAll( abilities = abilities
"Each time an attack is made with this weapon, subtract 1 from that attacks hit roll.", .replaceAll(
"" "Each time an attack is made with this weapon, subtract 1 from that attacks hit roll.",
); ""
)
.replaceAll(
"Each time an attack is made with this weapon, subtract 1 from that attack's hit roll.",
""
)
.replaceAll(
"Each time an attack is made with this weapon profile, subtract 1 from that attack's hit roll.",
""
)
.replaceAll(
"Each time an attack is made with this weapon, you must subtract 1 from the hit roll.",
""
)
.replaceAll(
"When attacking with this weapon, you must subtract 1 from the hit rolls.",
""
);
ws = `${parseInt(ws, 10) + 1}+`; ws = `${parseInt(ws, 10) + 1}+`;
} }
name = name.replaceAll(" (Shooting)", "").replaceAll(" (Melee)", "");
return ( return (
<> <>
@@ -112,7 +156,7 @@ const Weapon = ({ weapon, modelStats, isMelee, className }) => {
> >
{differentProfiles && selectionName + " - "} {differentProfiles && selectionName + " - "}
{name} {name}
{interestingType && ( {type && (
<span <span
style={{ style={{
fontSize: ".8em", fontSize: ".8em",