Skip to content

Commit

Permalink
Merge pull request #363 from scottbenton/fix/integrity
Browse files Browse the repository at this point in the history
fix(integrity): Fixed custom moves not properly setting vehicle integ…
  • Loading branch information
scottbenton authored Feb 18, 2024
2 parents 57783c2 + b899d72 commit 8c46dec
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ export function CreateCustomAsset(props: CreateCustomAssetProps) {
key={index}
action={
<Button
color="inherit"
color='inherit'
onClick={() => remove(index)}
>
Remove
Expand Down Expand Up @@ -425,7 +425,7 @@ export function CreateCustomAsset(props: CreateCustomAssetProps) {
? getIn(form.errors, "track.label")
: `For companion health, please label this field "companion health"${
isStarforged
? ". For integrity, please label this field integrity."
? '. For integrity, please label this field "vehicle integrity."'
: ""
}`
}
Expand Down Expand Up @@ -487,7 +487,7 @@ export function CreateCustomAsset(props: CreateCustomAssetProps) {
<SectionHeading label={"Asset Abilities"} />
</Grid>
<Grid item xs={12}>
<FieldArray name="abilities">
<FieldArray name='abilities'>
{({ remove, push }) => (
<TableContainer component={Paper} variant={"outlined"}>
<Table size={"small"}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,11 @@ export function CustomMoveDialog(props: CustomMoveDialogProps) {
/>
<Box>
<FormControl
component="fieldset"
variant="standard"
component='fieldset'
variant='standard'
fullWidth
>
<FormLabel component="legend">Character Stats</FormLabel>
<FormLabel component='legend'>Character Stats</FormLabel>
<Box display={"flex"} justifyContent={"space-between"}>
<FormGroup>
<FormControlLabel
Expand All @@ -209,7 +209,7 @@ export function CustomMoveDialog(props: CustomMoveDialogProps) {
name={`enabledStats.${Stat.Edge}`}
/>
}
label="Edge"
label='Edge'
/>
<FormControlLabel
control={
Expand All @@ -226,7 +226,7 @@ export function CustomMoveDialog(props: CustomMoveDialogProps) {
name={`enabledStats.${Stat.Heart}`}
/>
}
label="Heart"
label='Heart'
/>
<FormControlLabel
control={
Expand All @@ -243,7 +243,7 @@ export function CustomMoveDialog(props: CustomMoveDialogProps) {
name={`enabledStats.${Stat.Iron}`}
/>
}
label="Iron"
label='Iron'
/>
<FormControlLabel
control={
Expand All @@ -260,7 +260,7 @@ export function CustomMoveDialog(props: CustomMoveDialogProps) {
name={`enabledStats.${Stat.Shadow}`}
/>
}
label="Shadow"
label='Shadow'
/>
<FormControlLabel
control={
Expand All @@ -277,7 +277,7 @@ export function CustomMoveDialog(props: CustomMoveDialogProps) {
name={`enabledStats.${Stat.Wits}`}
/>
}
label="Wits"
label='Wits'
/>
</FormGroup>
{customStats.length > 0 && (
Expand Down Expand Up @@ -351,7 +351,7 @@ export function CustomMoveDialog(props: CustomMoveDialogProps) {
name={`enabledStats.${PlayerConditionMeter.Health}`}
/>
}
label="Health"
label='Health'
/>
<FormControlLabel
control={
Expand All @@ -370,7 +370,7 @@ export function CustomMoveDialog(props: CustomMoveDialogProps) {
name={`enabledStats.${PlayerConditionMeter.Spirit}`}
/>
}
label="Spirit"
label='Spirit'
/>
<FormControlLabel
control={
Expand All @@ -389,7 +389,7 @@ export function CustomMoveDialog(props: CustomMoveDialogProps) {
name={`enabledStats.${PlayerConditionMeter.Supply}`}
/>
}
label="Supply"
label='Supply'
/>
<FormControlLabel
control={
Expand All @@ -407,25 +407,27 @@ export function CustomMoveDialog(props: CustomMoveDialogProps) {
name={`enabledStats.companion health`}
/>
}
label="Companion Health"
label='Companion Health'
/>
{isStarforged && (
<FormControlLabel
control={
<Checkbox
checked={
form.values.enabledStats["integrity"] ?? false
form.values.enabledStats[
"vehicle integrity"
] ?? false
}
onChange={(evt, checked) =>
form.setFieldValue(
`enabledStats.integrity`,
`enabledStats.vehicle integrity`,
checked
)
}
name={`enabledStats.integrity`}
name={`enabledStats['vehicle integrity']`}
/>
}
label="Integrity"
label='Vehicle Integrity'
/>
)}
</FormGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ export function MoveStatRoller(props: MoveStatRollerProps) {
);
}

if (statName === "companion health" && Object.keys(stats).length > 0) {
if (
statName.toLowerCase() === "companion health" &&
Object.keys(stats).length > 0
) {
return (
<>
{companions.map((companion, index) => (
Expand All @@ -44,7 +47,11 @@ export function MoveStatRoller(props: MoveStatRollerProps) {
);
}

if (statName === "vehicle integrity" && Object.keys(stats).length > 0) {
if (
(statName.toLowerCase() === "vehicle integrity" ||
statName.toLowerCase() === "integrity") &&
Object.keys(stats).length > 0
) {
return (
<>
{vehicles.map((vehicle, index) => (
Expand All @@ -61,7 +68,7 @@ export function MoveStatRoller(props: MoveStatRollerProps) {
}

if (
statName === "quests legacy" &&
statName.toLowerCase() === "quests legacy" &&
legacies[LEGACY_TRACK_TYPES.QUESTS] !== undefined
) {
return (
Expand All @@ -85,7 +92,7 @@ export function MoveStatRoller(props: MoveStatRollerProps) {
}

if (
statName === "bonds legacy" &&
statName.toLowerCase() === "bonds legacy" &&
legacies[LEGACY_TRACK_TYPES.BONDS] !== undefined
) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ export function MoveStatRollers(props: MoveStatsProps) {
const actualAsset = asset.customAsset ?? assetMap[asset.id];
if (
asset.trackValue &&
actualAsset?.["Condition meter"]?.Label === "companion health"
actualAsset?.["Condition meter"]?.Label.toLowerCase() ===
"companion health"
) {
const inputKeys = Object.keys(asset.inputs ?? {});
const assetInputName =
Expand All @@ -91,7 +92,7 @@ export function MoveStatRollers(props: MoveStatsProps) {
});
} else if (
asset.trackValue &&
actualAsset?.["Condition meter"]?.Label === "integrity"
actualAsset?.["Condition meter"]?.Label.toLowerCase() === "integrity"
) {
const inputKeys = Object.keys(asset.inputs ?? {});
const assetInputName =
Expand Down Expand Up @@ -143,7 +144,7 @@ export function MoveStatRollers(props: MoveStatsProps) {

{stats &&
Object.keys(visibleStats).filter(
(statKey) => statKey !== "vow progress"
(statKey) => statKey.toLowerCase() !== "vow progress"
).length > 0 && (
<StatComponent
label={`Adds`}
Expand Down

0 comments on commit 8c46dec

Please sign in to comment.