DawnbrandBots / yaml-yugi

A machine-readable, human-editable database of the Yu-Gi-Oh! Trading Card Game, Official Card Game, Master Duel, Rush Duel, Speed Duel.
https://dawnbrandbots.github.io/yaml-yugi/cards.json
GNU Affero General Public License v3.0
13 stars 2 forks source link

Split up and normalize monster_type_line #57

Open kevinlul opened 1 year ago

kevinlul commented 1 year ago

monster_type_line should be broken up into an array of tokens kept in the same order.

monster_type_line as it currently exists, obtained from Yugipedia, has the following limitations:

This is because the string as it exists on Yugipedia reflects the latest available physical print of the card (confirmed with admin). Normalization involves obtaining data from the official database, which has the modern representation regardless of recent prints, or a heuristic (PowerShell snippet from @NeilBeforeMemes):

            $types = $content.monster_type_line.Split(" / ")

            if($types.length -eq 1) {
                $types += "Normal"
            }

            if(($types[$types.length - 1] -eq "Sprit") -or 
                ($types[$types.length - 1] -eq "Gemini") -or 
                ($types[$types.length - 1] -eq "Toon") -or 
                ($types[$types.length - 1] -eq "Union") -or 
                ($types[$types.length - 1] -eq "Flip")) {
                $types += "Effect"
            }

            if($types[$types.length - 1] -eq "Tuner") {
                if(($data.name -eq "Water Spirit") -or
                ($data.name -eq "Dragon Core Hexer") -or
                ($data.name -eq "Angel Trumpeter") -or
                ($data.name -eq "Tune Warrior")) {
                    $types += "Normal"
                }
                else {
                    $types += "Effect"
                }
            }

This would fix DawnbrandBots/bastion-bot#174. Inferring the OCG "Special Summon" type (DawnbrandBots/bastion-bot#134) could also be done as part of the data here. This would help native language support for advanced queries (DawnbrandBots/bastion-bot#343) as the translations of these card properties can be added in the load step.

NeilBeforeMemes commented 1 year ago

just a note here as a heads up! You also need to check for pendulum along with the abilities! We had an issue come up because I forgot this one haha

kevinlul commented 1 year ago

~there's also a typo in "Spirit" in the snippet that I pasted verbatim~

kevinlul commented 8 months ago

Most of this seems no longer applicable due to https://yugipedia.com/wiki/Template:Unprinted_erratum being applied to affected cards.

kevinlul commented 8 months ago

Gishki Natalia and Emilia are still affected, but now there's precedent to simply apply the edits to the wiki.