GLC Decklist Validator updated with Astral Radiance
In August 2021, I built and published the first version of Gym Leader Challenge Decklist Validator. It's a webapp that allows Pokemon TCG players who build decks for community-made Gym Leader Challenge format to validate that their decklists are legal for the format. Back in August, I wrote about the format and why I think it's currently the most enjoyable way to play the game but I apparently I never wrote an introduction post to this project.
I did write about my rewrite project when I took the early prototype and completely rewrote it to make the project what it is today.
Introducing GLC Decklist Validator
GLC Decklist Validator is a vanilla Javascript project that consists of three main parts
- an admin toolkit for downloading card info from API, managing ban list and so on
- a serverless Netlify Function that validates the list
- and a web frontend which consists of one text area and performs one API call to the serverless function
So it's exactly the kind of project I thrive to build: as small and simple as possible.
The project is MIT licensed open source project and its code is available in hamatti/gym-leader-challenge-deck-validator.
Admin tooling
This project uses the PokemonTCG.io API but not live directly from the web UI. Instead, I have built a custom tooling on the backend.
First part is a CLI that provides an interactive menu to choose operations: downloading new sets, inspecting current flat JSON "database" and managing the ban list. I use inquirer library for building interactive menus.
A key reason why I chose to build an interactive CLI tool instead of one that relies on arguments and options was that the admin side is run once every 3 months – when a new set is published – and very rarely other than that. I wanted a tool that can guide me through the process rather than having to browse through the docs everytime.
The aptly named utils.js
is the powerhouse that performs the actions. I decided to built this intermediate step for two reasons: first, the live web app is not dependent on if the API is up and available or not and second, because querying up to 60 cards in one swoop is not that feasible with the API.
Finally I have build.js
that copies the data into the serveless function's folder.
Web frontend & serverless function
The serverless function takes in a decklist in PTCGO format (see example for example in my blog post about custom syntax highlighting), parses it and checks each card for validity on various metrics: rulebox, set legality, singleton, banned and monotype.
The function then returns a legality boolean with info of all the cards that fail the check.
The web frontend provides a text area for deck list and upon receiving the information from the serverless function, displays whether or not the deck is valid and what, if any, concerns it has.
Updated for Astral Radiance
Last Friday, the newest Pokemon TCG set Astral Radiance was released and it introduced a new type of rulebox Pokemon, Radiant Pokemon, that is not allowed in GLC so in addition to my regular update of downloading new cards, I had to add a new check into the validator:
if (
(subtypes &&
(subtypes.includes("EX") ||
subtypes.includes("GX") ||
subtypes.includes("BREAK") ||
subtypes.includes("V") ||
subtypes.includes("VMAX") ||
subtypes.includes("VSTAR"))) ||
rarity === "Rare ACE" ||
rarity === "Radiant Rare" ||
name.includes("◇")
) {
ruleBox = true;
}
Given that the official format and its cards are referring to rule boxes as a mechanic, I hope one day the API would have that information directly to avoid mistakes with compound checks like these.
Go test it out
If you're a Gym Leader Challenge player or interested in the format, give the deck validator a go at https://glc-checker.netlify.app/. And if you want to learn more about the format, https://gymleaderchallenge.com/ is your best starting point.