diff --git a/src/App/Selectors/derivedCharacteristicsSelectors.ts b/src/App/Selectors/derivedCharacteristicsSelectors.ts index 403b93a39..774e952ad 100644 --- a/src/App/Selectors/derivedCharacteristicsSelectors.ts +++ b/src/App/Selectors/derivedCharacteristicsSelectors.ts @@ -73,7 +73,7 @@ export const getLP = createMaybeSelector ( base: Just (base), currentAdd: Just (Maybe.sum (added)), id: DCId.LP, - maxAdd: Just (Maybe.sum (fmap (AttributeDependent.A.value) (mcon))), + maxAdd: Just (Maybe.fromMaybe (8) (fmap (AttributeDependent.A.value) (mcon))), mod: Just (mod), permanentLost: Just (Maybe.sum (lost)), permanentRedeemed: Nothing, @@ -154,7 +154,7 @@ export const getAE = createMaybeSelector ( calc, currentAdd: Just (Maybe.sum (added)), id: DCId.AE, - maxAdd: Just (Maybe.sum (fmapF (mbaseAndAdd) (sel2))), + maxAdd: Just (Maybe.maybe (0) (sel2) (mbaseAndAdd)), mod: Just (mod), permanentLost: Just (Maybe.sum (mlost)), permanentRedeemed: Just (Maybe.sum (mredeemed)), diff --git a/src/App/Views/Attributes/AttributeCalcItem.tsx b/src/App/Views/Attributes/AttributeCalcItem.tsx index 1116ae7bb..8a85c1c07 100644 --- a/src/App/Views/Attributes/AttributeCalcItem.tsx +++ b/src/App/Views/Attributes/AttributeCalcItem.tsx @@ -44,9 +44,11 @@ export const AttributeCalcItem: React.FC = props => { removeKarmaPoint, } = props + const id = DCA.id (fst (attribute)) + const handleAddMaxEnergyPoint = React.useCallback ( () => { - switch (DCA.id (fst (attribute))) { + switch (id) { case "LP": addLifePoint () break @@ -63,12 +65,12 @@ export const AttributeCalcItem: React.FC = props => { break } }, - [ addArcaneEnergyPoint, addKarmaPoint, addLifePoint, attribute ] + [ addArcaneEnergyPoint, addKarmaPoint, addLifePoint, id ] ) const handleRemoveMaxEnergyPoint = React.useCallback ( () => { - switch (DCA.id (fst (attribute))) { + switch (id) { case "LP": removeLifePoint () break @@ -85,7 +87,7 @@ export const AttributeCalcItem: React.FC = props => { break } }, - [ removeArcaneEnergyPoint, removeKarmaPoint, removeLifePoint, attribute ] + [ removeArcaneEnergyPoint, removeKarmaPoint, removeLifePoint, id ] ) const base = DCVA.base (snd (attribute)) @@ -162,11 +164,14 @@ export const AttributeCalcItem: React.FC = props => { onClick={handleAddMaxEnergyPoint} disabled={ current_add >= max_add - || or (fmapF (mpermanent_lost) - (pipe ( - subtractBy (Maybe.sum (mpermanent_redeemed)), - gt (0) - ))) + || ( + id !== "LP" + && or (fmapF (mpermanent_lost) + (pipe ( + subtractBy (Maybe.sum (mpermanent_redeemed)), + gt (0) + ))) + ) } /> )) @@ -187,11 +192,14 @@ export const AttributeCalcItem: React.FC = props => { onClick={handleRemoveMaxEnergyPoint} disabled={ current_add <= 0 - || or (fmapF (mpermanent_lost) - (pipe ( - subtractBy (Maybe.sum (mpermanent_redeemed)), - gt (0) - ))) + || ( + id !== "LP" + && or (fmapF (mpermanent_lost) + (pipe ( + subtractBy (Maybe.sum (mpermanent_redeemed)), + gt (0) + ))) + ) } /> ))