Commit Graph

1668 Commits

Author SHA1 Message Date
leriomaggio
c9faba36a9 Change to isCardType Matching: from contains to startswith
This is to avoid matching things like "island" as a "land" card type token

Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-09-29 07:30:55 +01:00
leriomaggio
45114fc7e0 DeckRecognizer (and Tokens) extended with support for Banned and Restricted Cards
TokenType instantiated by the DeckRecognizer have been further specialised and extended to also include Banned and Restricted Cards.
Therefore, controls when recognising cards has also been extended and improved.

Now DeckRecognizer include specific extensions for additional constraints imposed by Game Format, Deck Format, release date and art preference. Consequently, all methods used to retrieve cards from CardDb have been updated accordingly, using recognizer settings.

Test suite has been updated accordingly - and all tests re-organised with comments for better code navigation.

Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-09-27 18:53:04 +01:00
Northmoc
40e9f13806 better regex 2021-09-27 13:02:52 -04:00
leriomaggio
2e35935aca new Predicate to get CardEdition with Basic Lands based on Art Preference
A new CardEdition.Predicates has been added to return the CardEdition with all basic lands according to current default Card Art Preference.
This predicate will be used in DeckProxy to getDefaultSet whenever None is specified.
Moreover, quick fix to javadoc and made "isCustomEditions" final.
2021-09-26 00:29:28 +01:00
leriomaggio
5f138b1123 FIX Issue #1974
Fixing NPE occurring when gathering statistics on Card Edition in CardPool and the Edition does not exist.
This patch simply discards any stats about not-found card editions
2021-09-23 12:24:09 +01:00
tool4EvEr
69464e165c Fix Portcullis Vine 2021-09-18 20:20:40 +02:00
leriomaggio
ee35fd9e37 FIX to recognise SB as Sideboard placeholder
Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-09-18 12:17:28 +01:00
leriomaggio
bdd4a7083c New tests and FIX bug on foil request.
Added tests for new setting w/ CardArtPreference and FIX bug on foil request when no edition is specified.

Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-09-18 10:46:31 +01:00
leriomaggio
e6cfafb431 Adding ArtPreference attr to allow for more flexibility when recognising cards
Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-09-17 19:29:03 +01:00
leriomaggio
7d1542ced3 Updating new methods in StaticData to also support a specified CardArtPreference
This artPreference will be passed in by DeckImport for extra flexibility

Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-09-17 19:28:05 +01:00
leriomaggio
3fc4389f30 Restoring back card-parsing first.
Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-09-16 19:18:22 +01:00
leriomaggio
4f86e9d494 adding support to sb as for sideboard, multicolo(u)r and swapping non-token recognition prior to card tokens.
Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-09-16 19:12:35 +01:00
leriomaggio
00723b462c FIX typo in DeckSection extraction from token Key
Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-09-16 18:49:39 +01:00
leriomaggio
02fcc0efb5 FIX incorporating tokenKey with tokenSection if Any
(tokenSection is null for non-legal-card-type token)

Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-09-15 20:07:47 +01:00
leriomaggio
5e1b85c924 Merge remote-tracking branch 'upstream/master' into deck-importer-decks-file-format 2021-09-15 19:36:54 +01:00
Northmoc
489062390b normalize "*+" for Consuming Blob and token 2021-09-15 13:32:32 -04:00
leriomaggio
c732289690 Updates to DeckRecognizer (& tests) by using the new methods from StaticData
(Any reference to CardDb has been dropped, along with corresponding card fetching methods).

Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-09-14 08:18:24 +01:00
leriomaggio
82372ec5ba New methods to retrieve cards from all supported databases.
The API now includes three new methods to proxy card requests to any available database of cards. These methods are currently used by the DeckRecognizer to match any card request from the Deck Importer - so the API adapts to those particular use cases.
However, method signatures are general enough to be further used elsewhere in forge, if necessary.

The first immediate advantage here is that with this addition, Deck Import automagically extends support to also including custom cards.
Moreover, this avoids DeckRecognizer to have lower-level references to CardDb - therefore, better encapsulation so that any DB interaction is correctly proxied by StaticData.

Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-09-14 08:13:25 +01:00
leriomaggio
9562064213 Updated (w/ tests) behaviour for compose with foil request, when input card Name is or isn't foil already
Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-09-14 07:56:33 +01:00
leriomaggio
f8cb6141bd Further optimised cardDb method with filter using AlwaysTrue + and Chain
Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-09-13 18:58:54 +01:00
leriomaggio
a9f1cd3c97 Merge remote-tracking branch 'upstream/master' into deck-importer-decks-file-format 2021-09-13 18:47:35 +01:00
Anthony Calosa
ac350a0bfb [Mobile] Fix card image not loading 2021-09-13 23:01:13 +08:00
leriomaggio
236fd99862 FIX cardDb tests in Maven for ImageKeys Mock configuration between subclasses 2021-09-13 10:15:32 +01:00
leriomaggio
ab0b964772 Full support to XMage format recognition with tests
Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-09-12 18:30:59 +01:00
leriomaggio
5beb350faf Support for DeckNames as in NetDecks with brackets and hashtags
Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-09-12 11:42:10 +01:00
leriomaggio
014783dfbe Added planes deck section to nonCardToken recognition (left out by mistake)
Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-09-12 11:06:07 +01:00
leriomaggio
95f1d6df07 Updated Card Tokens (with test) to retain cards even if not legal.
This will be now used in DeckImporter in combination with Card Preview.

Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-09-12 10:56:32 +01:00
leriomaggio
5400546399 Aligned with bug fixed on multipleArts with SmartCardArt
Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-09-12 10:28:50 +01:00
Anthony Calosa
6f0ba03d24 [Mobile] Fix blinking card images while using online image fetcher
- also cache card list for faster lookup
2021-09-12 15:52:57 +08:00
leriomaggio
fb092c77a4 BUG FIX for Smart Card Art selection
This subtle bug occurred whenever the algorithm for smart card art selection wanted to add a card with multiple arts and the number of cards per art to add was not even. To avoid zeros, the cardsPerArtIndex was set at least to one, and so the rest - leading then to adding too many (extra) cards not originally present in the deck.

Thanks to @Snoops for the heads up.
2021-09-12 00:56:44 +01:00
leriomaggio
455acffeab Update to SmartCardArt accounting for any preferred art.
If there is any preferredArt, update will never be applied.
The scenario is: if card was originally without any specified edition, AND there is preferred art, that would've been returned in the first place.

Thus, if the smartCardArt optimisation is enabled, any card with the preferred art won't be updated iff edition and artIndex coincide.

Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-09-10 18:23:36 +01:00
leriomaggio
e90b0323b7 Merge remote-tracking branch 'upstream/master' into deck-importer-decks-file-format 2021-09-10 16:10:13 +01:00
leriomaggio
ade839bec4 Removed from Deck controls on Deck Sections as now the DeckSection validation mechanism has been already integrated when loading deck.
Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-09-10 14:27:31 +01:00
leriomaggio
27ab4c35a3 Re-add to carddb the integration with CardPreferences on Mobile version
On Mobile Forge Port (only) there is the possibility to set a preferred art for a card, from card catalog.
Once a card art is selected, it will always be returned for that specific art whenever no other specific edition is specified.
This commit adds changes to cardDb setPreferredArtMethod (API) and CardRequest.fromString to work with any preferred art (if any).

CardRequests reflects this change by adding another (private) constructor which expects to create a CardRequest from a preferredArt entry in the form of (CardName|SetCode|ArtIndex)
2021-09-10 14:09:25 +01:00
leriomaggio
9d235924ec Re-add to carddb the integration with CardPreferences on Mobile version
On Mobile Forge Port (only) there is the possibility to set a preferred art for a card, from card catalog.
Once a card art is selected, it will always be returned for that specific art.
This commit adds changes to cardDb setPreferredArtMethod (API) and CardRequest.fromString to work with any preferred art (if any).

CardRequests reflects this change by adding another (private) constructor which expects to create a CardRequest from a preferredArt entry in the form of (CardName|SetCode|ArtIndex)
2021-09-10 13:26:30 +01:00
leriomaggio
2297f34ce2 Added full support to all Deckstats deck exports + bug fix&extra tests
Now DeckRecognizer supports all the exports of decks from Deckstats.net.
This now also includes card lists grouped by Rarity, CMC, and Mana Colours.

A new set of tests have been also added to test for the new non-card token types parsing, as well as a condition with multiple constraints imposed on the deck recogniser at a time. In particular, now all the combinations of constraints (also together) have been tested, and therefore the types of token returned has been adjusted.

Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-09-08 21:27:43 +01:00
leriomaggio
20d9dbdb57 Perf Impro to Deck Editor Loading Issue #1847
This is another extra improvement which avoids setting up card catalog in current editor whenever it is actually **not** needed.

To do so, ItemPool now implements and equal method, which reflects to equality of contained items.
This is because card pool is set up multiple times whenever the Deck Editor tab is initialised - and the operation of setting up the catalog manager is particularly expensive (let alone useless when it's already done!)

Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-09-07 11:46:44 +01:00
leriomaggio
84763e5dbc Adding support for deck name in Forge Deck Format
Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-09-07 00:35:08 +01:00
leriomaggio
ef1ea8e60d FIX Issue #1413
This commit includes support to the XMage format in Deck Recognizer along with corresponding new tests and updates to labels for UI

Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-09-06 12:41:04 +01:00
leriomaggio
54193e0ac0 Added support to TappedOut Markdown format, and to TOARENA MTGGOLDFISH export.
Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-09-06 12:07:11 +01:00
leriomaggio
60f93853c4 Revert "Replacing GetFilteredPoolWithCount with GetFilteredPool"
This reverts commit 64b72bbf89.
2021-09-06 01:56:14 +01:00
tool4EvEr
ba5ef78f31 Revert Comment out some currently unsupported cards in Commander precons 2021-09-06 01:55:42 +01:00
Anthony Calosa
9ea7772d7b add Artist & adjust crop for modern/old frames 2021-09-06 01:55:42 +01:00
leriomaggio
64b72bbf89 Replacing GetFilteredPoolWithCount with GetFilteredPool 2021-09-06 01:47:12 +01:00
leriomaggio
e56b9183b1 Renamed validator for Main and Side. 2021-09-06 01:45:51 +01:00
leriomaggio
71793fb747 Added tests for latest additions in supporting MTGGoldfish (special) format for collector numbers.
DeckRecognizer now also support the (special) format for request lines in MTGGoldfish deck exports.
In Addition, changes to reduce comparisons, and general performance in card matching.
2021-09-05 20:44:03 +01:00
Michael Kamensky
d367f8abf9 Merge branch 'master' into 'master'
[Mobile] add Artist & adjust crop for modern/old frames

See merge request core-developers/forge!5290
2021-09-04 18:46:15 +00:00
Anthony Calosa
cd47c591b3 add Artist & adjust crop for modern/old frames 2021-09-04 18:54:49 +08:00
tool4EvEr
3bf978991c Revert Comment out some currently unsupported cards in Commander precons 2021-09-04 11:33:44 +02:00
leriomaggio
83853280b6 Completely re-implemented and tested Matchers for DeckRecognizer
The new DeckRecognizer implementation comes fully tested to check the new multiple line request format supported.
The DeckRecognizer has been made very versatile for card recognition - supporting request with multiple formats - as well as for NON-CARD tokens including "Deck Name", "Deck Sections", and "Card (Core) Types".

There is also integration for constraints imposed on card matching due to
restrictions (in set) from Game Format, Deck Format (banned cards), and Date (Release Before).
In those cases, new Token Types will be returned (i.e. "IllegalCard" and "InvalidCard", respectively) that could be pretty-printed or emphasised in DeckImport.
2021-09-02 17:43:13 +01:00