bug fixes for 10th
This commit is contained in:
+29
-201
@@ -74,7 +74,6 @@ const Unit = ({ unit, index, catalog, onePerPage, forceRules }) => {
|
|||||||
rules,
|
rules,
|
||||||
modelStats,
|
modelStats,
|
||||||
modelList,
|
modelList,
|
||||||
psykers,
|
|
||||||
spells,
|
spells,
|
||||||
cost,
|
cost,
|
||||||
woundTracker,
|
woundTracker,
|
||||||
@@ -266,8 +265,6 @@ const Unit = ({ unit, index, catalog, onePerPage, forceRules }) => {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
|
|
||||||
<WoundTracker woundTracker={woundTracker} />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
@@ -341,7 +338,6 @@ const Unit = ({ unit, index, catalog, onePerPage, forceRules }) => {
|
|||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Spells title="PSYCHIC" spells={spells} />
|
|
||||||
<table
|
<table
|
||||||
cellSpacing="0"
|
cellSpacing="0"
|
||||||
className="weapons-table"
|
className="weapons-table"
|
||||||
@@ -359,6 +355,7 @@ const Unit = ({ unit, index, catalog, onePerPage, forceRules }) => {
|
|||||||
modelStats={modelStats}
|
modelStats={modelStats}
|
||||||
forceRules={forceRules}
|
forceRules={forceRules}
|
||||||
/>
|
/>
|
||||||
|
<OtherAbilities abilities={abilities} />
|
||||||
</table>
|
</table>
|
||||||
<div style={{ flex: "1" }}></div>
|
<div style={{ flex: "1" }}></div>
|
||||||
<table
|
<table
|
||||||
@@ -427,7 +424,7 @@ const Unit = ({ unit, index, catalog, onePerPage, forceRules }) => {
|
|||||||
</div>
|
</div>
|
||||||
<Rules rules={rules} />
|
<Rules rules={rules} />
|
||||||
<Abilities abilities={abilities.Abilities} />
|
<Abilities abilities={abilities.Abilities} />
|
||||||
<Psykers psykers={psykers} />
|
|
||||||
<Factions factions={factions} />
|
<Factions factions={factions} />
|
||||||
<FactionIcon catalog={catalog} />
|
<FactionIcon catalog={catalog} />
|
||||||
</div>
|
</div>
|
||||||
@@ -608,9 +605,7 @@ const Rules = ({ rules }) => {
|
|||||||
const Abilities = ({ abilities }) => {
|
const Abilities = ({ abilities }) => {
|
||||||
if (!abilities) return null;
|
if (!abilities) return null;
|
||||||
let keys = [...abilities.keys()];
|
let keys = [...abilities.keys()];
|
||||||
keys = keys.filter(
|
|
||||||
(key) => key !== "Stratagem: Warlord Trait" && key !== "Stratagem: Relic"
|
|
||||||
);
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
@@ -680,214 +675,47 @@ const FancyBox = ({ children }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const Psykers = ({ title, psykers }) => {
|
const OtherAbilities = ({ abilities }) => {
|
||||||
return (
|
let keys = [...Object.keys(abilities)?.filter((key) => key !== "Abilities")];
|
||||||
<table
|
return keys.map((key) => {
|
||||||
cellSpacing="0"
|
|
||||||
className="weapons-table"
|
|
||||||
style={{ width: "100%", margin: "4px 2px" }}
|
|
||||||
>
|
|
||||||
{psykers.length > 0 && (
|
|
||||||
<thead>
|
|
||||||
<tr
|
|
||||||
style={{
|
|
||||||
backgroundColor: "var(--primary-color)",
|
|
||||||
color: "#fff",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<th style={{ textAlign: "left" }}>PSYKER</th>
|
|
||||||
<th>CAST</th>
|
|
||||||
<th>DENY</th>
|
|
||||||
<th style={{ textAlign: "left", width: "100%" }} colSpan="4">
|
|
||||||
POWERS KNOWN
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
)}
|
|
||||||
<tbody>
|
|
||||||
{psykers.map((psyker, index) => (
|
|
||||||
<Psyker key={psyker.name} psyker={psyker} index={index} />
|
|
||||||
))}
|
|
||||||
{psykers.length > 0 && (
|
|
||||||
<tr className="emptyRow">
|
|
||||||
<td colSpan={4}></td>
|
|
||||||
</tr>
|
|
||||||
)}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const Psyker = ({ psyker, index }) => {
|
|
||||||
let { name, cast, deny, powers } = psyker;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<tr
|
|
||||||
className={index % 2 ? "rowOtherColor" : ""}
|
|
||||||
style={{ fontSize: ".8em" }}
|
|
||||||
>
|
|
||||||
<td style={{ textAlign: "left" }}></td>
|
|
||||||
<td>{cast}</td>
|
|
||||||
<td>{deny}</td>
|
|
||||||
<td style={{ textAlign: "left" }} colSpan="4">
|
|
||||||
{powers}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const WoundTracker = ({ woundTracker }) => {
|
|
||||||
if (!woundTracker || woundTracker.length === 0) return null;
|
|
||||||
const uniqueWoundTracker = woundTracker.filter((woundTrack, index) => {
|
|
||||||
const firstIndex = woundTracker.findIndex(
|
|
||||||
(woundTrack2) => woundTrack2.name === woundTrack.name
|
|
||||||
);
|
|
||||||
return firstIndex === index;
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div style={{ display: "flex" }}>
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
display: "flex",
|
|
||||||
flexDirection: "column",
|
|
||||||
alignItems: "center",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<table
|
|
||||||
cellSpacing="0"
|
|
||||||
className="weapons-table"
|
|
||||||
style={{ width: "100%", margin: "4px 2px", marginBottom: -16 }}
|
|
||||||
>
|
|
||||||
<thead>
|
|
||||||
<tr
|
|
||||||
style={{
|
|
||||||
backgroundColor: "var(--primary-color)",
|
|
||||||
color: "#fff",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{[...uniqueWoundTracker[0].table.keys()].map((key) => (
|
|
||||||
<th key={key}>{key}</th>
|
|
||||||
))}
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{uniqueWoundTracker.map((woundTrack, index) => (
|
|
||||||
<tr key={index}>
|
|
||||||
{[...woundTrack.table.values()].map((entry) => (
|
|
||||||
<td key={entry} style={{ borderTop: "none" }}>
|
|
||||||
{entry}
|
|
||||||
</td>
|
|
||||||
))}
|
|
||||||
</tr>
|
|
||||||
))}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const Spells = ({ title, spells }) => {
|
|
||||||
return (
|
|
||||||
<table
|
|
||||||
cellSpacing="0"
|
|
||||||
className="weapons-table"
|
|
||||||
style={{ width: "100%", marginTop: "var(--size-20)" }}
|
|
||||||
>
|
|
||||||
{spells.length > 0 && (
|
|
||||||
<thead>
|
|
||||||
<tr
|
|
||||||
style={{
|
|
||||||
backgroundColor: "var(--primary-color)",
|
|
||||||
color: "#fff",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<th style={{ width: 37 }}>
|
|
||||||
<div style={{ display: "flex" }}>
|
|
||||||
<img src={rangedIcon} />
|
|
||||||
</div>
|
|
||||||
</th>
|
|
||||||
<th style={{ textAlign: "left" }}>{title}</th>
|
|
||||||
<th>RANGE</th>
|
|
||||||
<th>WARP CHARGE</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
)}
|
|
||||||
<tbody>
|
|
||||||
{spells.map((spell, index) => (
|
|
||||||
<Spell
|
|
||||||
key={spell.name}
|
|
||||||
spell={spell}
|
|
||||||
index={index}
|
|
||||||
className={getSpellClassNames(spells, index)}
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
{spells.length > 0 && (
|
|
||||||
<tr className="emptyRow">
|
|
||||||
<td style={{ width: 37, borderTop: "none" }}></td>
|
|
||||||
<td colSpan={7}></td>
|
|
||||||
</tr>
|
|
||||||
)}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const Spell = ({ spell, index, className }) => {
|
|
||||||
let { name, range, manifest, details } = spell;
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<tr className={className}>
|
<thead>
|
||||||
<td style={{ borderTop: "none", backgroundColor: "#dfe0e2" }}></td>
|
<tr
|
||||||
<td style={{ textAlign: "left" }}>
|
|
||||||
<div
|
|
||||||
style={{
|
style={{
|
||||||
display: "flex",
|
backgroundColor: "var(--primary-color)",
|
||||||
alignItems: "center",
|
color: "#fff",
|
||||||
flexWrap: "wrap",
|
|
||||||
gap: "0 4px",
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{name}
|
<th></th>
|
||||||
</div>
|
<th colspan="7" style={{ textAlign: "left" }}>
|
||||||
</td>
|
{key}
|
||||||
<td>{range}</td>
|
</th>
|
||||||
<td>{manifest}</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr className={className + " noBorderTop"}>
|
</thead>
|
||||||
<td style={{ backgroundColor: "#dfe0e2" }}></td>
|
<tbody>
|
||||||
|
{[...abilities[key]].map(([name, value]) => (
|
||||||
|
<tr key={name}>
|
||||||
|
<td></td>
|
||||||
<td
|
<td
|
||||||
colSpan="7"
|
colspan={7}
|
||||||
|
key={name}
|
||||||
style={{
|
style={{
|
||||||
textAlign: "left",
|
fontSize: ".9em",
|
||||||
fontSize: "0.8em",
|
|
||||||
paddingTop: 0,
|
|
||||||
paddingBottom: 1,
|
|
||||||
lineHeight: 1.4,
|
lineHeight: 1.4,
|
||||||
|
textAlign: "left",
|
||||||
|
paddingTop: 4,
|
||||||
|
paddingBottom: 4,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{details}
|
<span style={{ fontWeight: 700 }}>{name}:</span> {value}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
))}
|
||||||
|
</tbody>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
});
|
||||||
|
|
||||||
const getSpellClassNames = (spells, index) => {
|
|
||||||
let differentColor = false;
|
|
||||||
for (let i = 1; i <= index; i++) {
|
|
||||||
let { name } = spells[i];
|
|
||||||
if (name !== spells[i - 1].name) {
|
|
||||||
differentColor = !differentColor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const classes = [];
|
|
||||||
if (differentColor) classes.push("rowOtherColor");
|
|
||||||
if (index === 0) classes.push("noBorderTop");
|
|
||||||
if (index > 0 && spells[index].name === spells[index - 1].name)
|
|
||||||
classes.push("noBorderTop");
|
|
||||||
return classes.join(" ");
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const ForceRules = ({ rules, onePerPage }) => {
|
const ForceRules = ({ rules, onePerPage }) => {
|
||||||
|
|||||||
@@ -62,15 +62,7 @@ export const hasDifferentProfiles = (selectionName, name) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const Weapon = ({
|
const Weapon = ({ weapon, previousWeapon, nextWeapon, isMelee, className }) => {
|
||||||
weapon,
|
|
||||||
previousWeapon,
|
|
||||||
nextWeapon,
|
|
||||||
modelStats,
|
|
||||||
isMelee,
|
|
||||||
className,
|
|
||||||
forceRules,
|
|
||||||
}) => {
|
|
||||||
let {
|
let {
|
||||||
name,
|
name,
|
||||||
selectionName,
|
selectionName,
|
||||||
|
|||||||
+10
-7
@@ -959,13 +959,7 @@ function ParseModelProfiles(profiles, model, unit) {
|
|||||||
} else if (typeName == "Psychic Power") {
|
} else if (typeName == "Psychic Power") {
|
||||||
const power = ParsePsychicPowerProfile(profile);
|
const power = ParsePsychicPowerProfile(profile);
|
||||||
model.psychicPowers.push(power);
|
model.psychicPowers.push(power);
|
||||||
} else if (typeName.includes("Explosion")) {
|
} else if (typeName == "Abilities") {
|
||||||
const explosion = ParseExplosionProfile(profile);
|
|
||||||
model.explosions.push(explosion);
|
|
||||||
} else if (typeName == "Psyker") {
|
|
||||||
model.psyker = ParsePsykerProfile(profile);
|
|
||||||
} else {
|
|
||||||
// Everything else, like Prayers and Warlord Traits.
|
|
||||||
if (!unit.abilities.Abilities) unit.abilities["Abilities"] = new Map();
|
if (!unit.abilities.Abilities) unit.abilities["Abilities"] = new Map();
|
||||||
ParseProfileCharacteristics(
|
ParseProfileCharacteristics(
|
||||||
profile,
|
profile,
|
||||||
@@ -973,6 +967,15 @@ function ParseModelProfiles(profiles, model, unit) {
|
|||||||
typeName,
|
typeName,
|
||||||
unit.abilities.Abilities
|
unit.abilities.Abilities
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
// Everything else, like Prayers and Warlord Traits.
|
||||||
|
if (!unit.abilities[typeName]) unit.abilities[typeName] = new Map();
|
||||||
|
ParseProfileCharacteristics(
|
||||||
|
profile,
|
||||||
|
profileName,
|
||||||
|
typeName,
|
||||||
|
unit.abilities[typeName]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user