Skip to content

Commit

Permalink
feat: adding new legality check
Browse files Browse the repository at this point in the history
  • Loading branch information
accassid committed Nov 15, 2023
1 parent fdf25d8 commit 8f87247
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion frontend/lib/backend-processors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export const processBackendResponses = (variants: VariantBulkData['variants'], r
p : getPrerequisiteString(variant),
s : variant.description,
r : variant.produces.map(feature => feature.name).join('. '),
b : variant.legal ? 0 : 1,
b : (variant.legal || variant.legalities?.commander) ? 0 : 1,
o : variant.spoiler ? 1 : 0
}
output.push(compressedVariant)
Expand Down
19 changes: 16 additions & 3 deletions frontend/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@ export type BackendCard = {
name: string,
oracleId: string,
identity: string,
legal: boolean,
spoiled: boolean,
spoiler: boolean,
}

export type CardComponent = {
Expand Down Expand Up @@ -186,7 +185,21 @@ export type Variant = {
manaNeeded: string,
otherPrerequisites: string,
description: string,
legal: boolean,
legal?: boolean, // old api (deprecated)
legalities?: { // new api
commander: boolean,
pauperCommanderMain: boolean,
pauperCommanderCommander: boolean,
oathbreaker: boolean,
predh: boolean,
brawl: boolean,
vintage: boolean,
legacy: boolean,
modern: boolean,
pioneer: boolean,
standard: boolean,
pauper: boolean,
},
spoiler: boolean,
}

Expand Down

0 comments on commit 8f87247

Please sign in to comment.