1
0
mirror of https://github.com/tcgdex/cards-database.git synced 2025-04-22 19:02:10 +00:00

Swap from a card/set based Legal generation to a file based one (#16)

* Added legal.ts file (currently using 2022 system)

Signed-off-by: Florian BOUILLON <florian.bouillon@delta-wings.net>

* Put back to the 2021 season

Signed-off-by: Avior <florian.bouillon@delta-wings.net>
This commit is contained in:
Florian Bouillon 2021-06-18 22:16:15 +02:00 committed by GitHub
parent abbffb45b7
commit 37642b962b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 165 additions and 0 deletions

33
interfaces.d.ts vendored
View File

@ -224,3 +224,36 @@ export interface Card {
energyType?: 'Normal' | // https://www.tcgdex.net/database/ecard/ecard1/160
'Special' // https://www.tcgdex.net/database/ecard/ecard1/158
}
/**
* Filter for cards legality
*/
export interface Filter {
includes: {
/**
* series to be included
*/
series: Array<string>
/**
* Set to be included in the filter
* ex: swsh1
*/
sets: Array<string>
/**
* Filter by regulation Marks on the cards
* ex: 'D'
*/
regulationMark: Array<string>
}
excludes: {
/**
* sets to be excluded
*/
sets: Array<string>
/**
* Global Ids of banned cards
* ex: swsh1-1
*/
cards: Array<string>
}
}

132
legals.ts Normal file
View File

@ -0,0 +1,132 @@
import { Filter } from './interfaces'
/**
* File Explanation
*
* The main goal of this file is to update quickly the current list of authorized/banned cards in the standard and expanded formats
*
* For included cards/set/etc we are currently using the April post of each years (note: posts seems to be coming each April)
* - 2022: https://www.pokemon.com/us/pokemon-news/2022-pokemon-tcg-championship-series-season-format-rotation/
* - 2021: https://www.pokemon.com/us/pokemon-news/2021-season-pokemon-tcg-format-rotation/
* - 2020: https://www.pokemon.com/us/pokemon-news/2020-season-pokemon-tcg-format-rotation/
*
* For banned cards we are currently following this webpage
* - https://www.pokemon.com/us/pokemon-tcg-banned-card-list/
*/
/**
* for each cards the compiler will check
* - if the card is in the `series` list
* - if the card is in the `sets` list
* - if the card is in the `regulationMark` list
*
* then it will check if the card is currently excluded
* - if the card is in the `sets` list
* - if the card is in the `cards` list
*/
export const standard: Filter = {
includes: {
series: ['sm', 'swsh'],
sets: ['sm9', 'det1', 'sm10', 'sm11', 'sm115', 'sm12'],
regulationMark: ['D']
},
excludes: {
sets: [],
cards: [
// SM
'smp-SM85',
'sm35-45',
'sm5-114',
'sm6-83',
'sm8-90',
'sm8-91',
'sm10-78',
'sm10-165',
'sm10-178',
'sm11-206',
'sm11-253',
'sm115-58',
'sm115-68',
'sm12-186',
'sm12-194',
'sm12-265',
]
}
}
export const expanded: Filter = {
includes: {
series: ['bw', 'xy', 'sm', 'swsh'],
sets: [],
regulationMark: []
},
excludes: {
sets: [],
cards: [
// BW
'bw3-67',
'bw5-110',
'bw9-101',
'bw9-115',
// XY
'xy1-124',
'xy2-23',
'xy4-99',
'xy4-118',
'xy5-133',
'xy5-158',
'xy6-77',
'xy6-106',
'xy7-74',
'xy7-75',
'xy9-98',
'xy9-109',
'g1-71',
// SM
'smp-SM85',
'sm35-45',
'sm5-114',
'sm6-83',
'sm8-90',
'sm8-91',
'sm10-78',
'sm10-165',
'sm10-178',
'sm11-206',
'sm11-253',
'sm115-58',
'sm115-68',
'sm12-186',
'sm12-194',
'sm12-265',
]
}
}