Skip to content

Commit

Permalink
fix: profession with due to EL impossible attribute values can be sel…
Browse files Browse the repository at this point in the history
…ected

Fixes #1109
  • Loading branch information
elyukai committed May 8, 2021
1 parent c1b2e26 commit fdde329
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/App/Selectors/professionSelectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { Culture } from "../Models/Wiki/Culture"
import { ExperienceLevel } from "../Models/Wiki/ExperienceLevel"
import { LiturgicalChant } from "../Models/Wiki/LiturgicalChant"
import { ProfessionRequireActivatable } from "../Models/Wiki/prerequisites/ActivatableRequirement"
import { RequireIncreasable } from "../Models/Wiki/prerequisites/IncreasableRequirement"
import { ProfessionRequireIncreasable } from "../Models/Wiki/prerequisites/ProfessionRequireIncreasable"
import { Profession } from "../Models/Wiki/Profession"
import { CombatTechniquesSelection, CombatTechniquesSelectionL } from "../Models/Wiki/professionSelections/CombatTechniquesSelection"
Expand Down Expand Up @@ -486,13 +485,20 @@ const areProfessionOrVariantPrerequisitesValid =
return isProfessionValid
&& thrush (prerequisites)
(all (d => {
if (RequireIncreasable.is (d)) {
const category = getCategoryById (PRIA.id (d))

const isAttribute = Maybe.elemF (category) (Category.ATTRIBUTES)
const isGreaterThanMax = PRIA.value (d) > ELA.maxAttributeValue (start_el)

return isAttribute && isGreaterThanMax
if (ProfessionRequireIncreasable.is (d)) {
return pipe_ (
getCategoryById (PRIA.id (d)),
maybe (true)
(category => {
switch (category) {
case Category.ATTRIBUTES:
return PRIA.value (d) <= ELA.maxAttributeValue (start_el)

default:
return true
}
})
)
}

return true
Expand Down

0 comments on commit fdde329

Please sign in to comment.