Commit Graph

1485 Commits

Author SHA1 Message Date
tool4EvEr
654e671afb Clean up 2021-10-16 23:16:32 +02:00
tool4EvEr
1a1088399e Cleanup 2021-10-16 21:34:12 +02:00
Michael Kamensky
87521416b2 Merge branch 'deck-importer-decks-file-format' into 'master'
NEW Deck Importer

See merge request core-developers/forge!5296
2021-10-16 16:47:29 +00:00
Michael Kamensky
5520cd2a67 [maven-release-plugin] prepare for next development iteration 2021-10-16 18:52:21 +03:00
Michael Kamensky
340a6b2af5 [maven-release-plugin] prepare release forge-1.6.45 2021-10-16 18:52:12 +03:00
leriomaggio
d056d2a683 Added "Special" placeholder for card rarity
Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-10-15 19:40:02 +01:00
leriomaggio
30a7c6aed4 Adding support for Dual/Double-sided cards in parsing + patch for commander export from Deckstats
Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-10-15 19:33:13 +01:00
leriomaggio
e91277f271 Merge remote-tracking branch 'upstream/master' into deck-importer-decks-file-format 2021-10-15 13:39:00 +01:00
leriomaggio
a012b236a5 Few changes to Deck Name and CC tokens trimmed and uppercase (resp).
Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-10-15 13:11:25 +01:00
leriomaggio
44cfc76552 Added support for Foiled cards in Token Key (w. tests)
Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-10-10 08:24:47 +01:00
leriomaggio
1934f27da3 Typo in documentation
Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-10-09 00:17:34 +01:00
leriomaggio
9f04f0cec7 Improved Token Mana Symbol Regexp with support for two colours tokens (and symbols)
All corresponding tests have been extended, and improved to cover the new supported Mana Tokens

Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-10-08 13:45:31 +01:00
Michael Kamensky
ccc423dd26 - Patch getPaperCardFromImageKey not to crash for the Commander replacement effect 2021-10-07 22:09:53 +03:00
leriomaggio
835b05e573 Added support for corner case to match correct section accounting for unsupported sections.
Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-10-06 20:13:25 +01:00
leriomaggio
65001478b7 Heavy refactoring of DeckRecognizer to introduce cardList parsing, allowed sections, and revised TokenTypes
This commit includes a substantial change//integration into main body of DeckRecognizer API.
First off, the types of tokens emitted by recognised as now increased, leaving place to newly specialised WARNING messages, as well as tokens for cards in invalid set or sections. Moreover, a new token for UNSUPPORTED_DECK_SECTION has been introduced, which works in pair with the new extra addition of allowed Deck sections.
This new list of allowed sections is also used whenever a new DeckSection token is created (constructor) so that if the section is not currently supported, an UNSUPPORTED_DECK_SECTION token is emitted instead.

Similarly, the card recognition step has been updated so that now deck validation mechanism has been integrated at the token level. In other words, everytime each card token is now matched to the most correct section, regardless of what's been specified in card list.

Last but not least, DeckRecognizer now includes the method to parse the whole card list (and not just a single line) to better encapsulate all the logics.
Added control to include Banned and Restricted cards, as well as a newly regExp to specify Mana colour tokens using MANA symbols placeholders (e.g. {G} for green).

Tests for new features have been added and internal documentation improved, and old ones updated with new tokens and APIs.

Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-10-06 16:43:24 +01:00
leriomaggio
08ca0bf175 Improved implementation of DeckSection Matching
Previous implementation was lacking to check for commander section, plus re-used the code of validators. This one is a refined and refactored implementation.

Note: as default, the method will always return Main, as there is no possibility, in general, to say whether Sideboard should be preferred instead - without any other knowledge about the deck.
Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-10-02 07:38:17 +01:00
leriomaggio
3e3cdc6808 Remove duplicated code to align all card tokens to have the same message.
All card tokens (those having an instance of PaperCard set) now share the same message with no code duplication.
The message has been also update - and so corresponding tests - to include set code in square brackets, and collector number (identified by sharp symbol).
This change will also simplify token formatting in Deck import.

Signed-off-by: leriomaggio <valeriomaggio@gmail.com>
2021-09-29 08:03:39 +01:00
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