forge icon indicating copy to clipboard operation
forge copied to clipboard

Import Parses Tyrannax Rex Incorrectly

Open EminentEmily opened this issue 1 year ago • 3 comments

Describe the bug When using the Import Feature, the importer interprets the "Rex" in "Tyrannax Rex" as a set, instead of part of its name. Adding the card via Card Catalog works normally.

To Reproduce Steps to reproduce the behavior:

  1. Go to Deck Editor
  2. Click on Import
  3. Input "1 Tyrannax Rex" as a card to import
  4. The importer displays "Tyrannax [Rex]" and of course doesn't fetch the card.

Expected behavior The importer should recognize Tyrannax Rex as the name of the card, not interpret "Rex" as a set.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows
  • Version 1.6.64

Additional context I'm only a amateur programmer myself and a bit of a novice, but I suspect the fact that "Rex" has three letters might be what's causing the parser to trip and think it's a set code?

EminentEmily avatar Aug 16 '24 23:08 EminentEmily

This is a known issue. It's because REX is an actual set code.

tehdiplomat avatar Aug 21 '24 17:08 tehdiplomat

@tehdiplomat can we somehow prioritize full string "Tyrannax Rex" as Cardname before checking if "Rex" could be a SetCode?

Hanmac avatar Aug 28 '24 15:08 Hanmac

Looking at the order the DeckRecognizer does things in, a fallback might be simpler than changing the order the patterns are checked in. Maybe something similar to the one for double faced cards? https://github.com/Card-Forge/forge/blob/4b533d22a03dd57442557194f38d0f17a9db87d3/forge-core/src/main/java/forge/deck/DeckRecognizer.java#L627-L630

So if the name isn't a real card but there's a set code, see if tacking the set code onto the name makes it a real card, and if so, proceed from there?

Jetz72 avatar Aug 28 '24 15:08 Jetz72