Commit Graph

1261 Commits

Author SHA1 Message Date
Anthony Calosa
4c09b11b63 remove redundant code 2021-08-16 12:48:19 +08:00
Anthony Calosa
3d322e47ee Support Set lookup for J21 and other future sets.
Forge loads all files found on the setlookup folder.
Example J21.txt (J21 set code) contains a list of set codes (sorted from Newest to Oldest beforehand) to lookup for images on other sets.
2021-08-16 12:06:20 +08:00
leriomaggio
838f817be7 Merge remote-tracking branch 'upstream/master' into collector-number-in-card-list-and-card-db-refactoring 2021-08-14 08:27:09 +01:00
tool4EvEr
be81ba5e15 Fix life lost triggers 2021-08-13 21:25:24 +02:00
leriomaggio
258f57e080 Merge remote-tracking branch 'upstream/master' into collector-number-in-card-list-and-card-db-refactoring 2021-08-13 11:25:38 +01:00
leriomaggio
b870d519c9 Updating Deck to use the new method in StaticData to get Card Art Preference Name
(Forgot to include this in prev. commit)
2021-08-13 10:19:37 +01:00
leriomaggio
beaf98793b Renamed method to retrieve card art preference name and new method to return actual card art preference instance. 2021-08-13 10:15:08 +01:00
leriomaggio
4b1e9b6c0c Improved Implementation for Card Art Optimisation
The new implementation now contains a completely refactored version of the algorithm, also including the invocation of the latest method for getAlternativeCardPrint in StaticData (with extra statistics paramenters gathered from current pool). This include optimisation for card frame, and cards from Expansion sets.

Moreover, the new implementation now automatically distribute card arts for **all** the cards in the pool - regardless they need to be "replaced" with alternative print or not.

THE ONLY case when this is not happening is when there is NO card to update in the current pool. This makes sense as this means editions has been specified, so the Deck won't receive any UNDESIRED alteration.
2021-08-12 16:35:08 +01:00
leriomaggio
e54916e837 Extended API with new methods to gather Pool Statistics and the Pivot CardEdition
CardPool API has been extended by including utility methods to gather specific statistics about a cardPool. These statistics include:
- Distribution (card count frequency) of the Card Edition included in the Pool
- Distribution of the Card Edition Type included in the Pool
- Retrieving the most common Card Edition Type among those included in the Pool
- Determine whether or not the Pool "isModern" (i.e. the majority of cards is gathered from Modern Sets)
- get the PivotCardEdition: this is the cornerstone of card art optimisation for decks

The PivotCardEdition is the edition that will be considered the threshold boundary for cards in the pool. Any decision of card arts for other cards will be considered based on the PivotEdition, that is "alternativeCardPrint" released BEFORE or AFTER (depending on the current Card Art Preference) the PIVOT EDITION RELEASE DATE.

Also, this commit includes an optimisation in add method implementation, getting rid of lots of duplicated code!
2021-08-12 16:30:33 +01:00
leriomaggio
788c2d8c14 Better renaming to existing methods for Card Art Preference and NEW getAlternativeCardPrint implementations
Methods related to Card Art Preference Settings, and for Card Art Smart Selection have been renamed with better wording.

Most importantly, StaticData now includes a new method to retrieve the number of art count for a given PaperCard, as well as a completely refactored and improved method for getAlternativeCardPrint.
In particular, the class now provides three different implementation of getAlternativeCardPrint, with the more sophisticated one also including normalisation wrt. the card frame, and whether or not the chosen alternative print should be gathered from an Expansion edition.

All these specialisation are part of the "Card Art Optimisation" algorithm included in Deck, and instructed by statistics gathered from Card Pool (next commit)
2021-08-12 16:17:31 +01:00
leriomaggio
000622cfae Added MEMO comment to get rid of retrieveCollectorNumber method 2021-08-12 15:52:58 +01:00
leriomaggio
a195bfd2b6 Minor adjustment to getArtCount implementation. 2021-08-11 08:16:21 +01:00
leriomaggio
8f99123059 Add new method to traverse and extract all directories recursively given a FilenameFilter
This method is part of the FIX for Issue #1949, that will be invoked by all the NetDeckXXX classes.
2021-08-11 08:05:08 +01:00
tool4EvEr
805e65d30c Small combat fixes for Planeswalkers 2021-08-10 21:10:45 +02:00
Michael Kamensky
1a7845117b [maven-release-plugin] prepare for next development iteration 2021-08-07 06:30:54 +03:00
Michael Kamensky
5c768baf64 [maven-release-plugin] prepare release forge-1.6.44 2021-08-07 06:30:45 +03:00
leriomaggio
05cfc48b43 Improved mechanism for on-the-fly (no restart) card art update in decks.
Now the smart card art selection is also included in the set of checkings that are performed to see whether or not card arts in Pools require any update.
2021-08-05 12:36:43 +01:00
leriomaggio
fe9274dabb Added mechanism to update card art when necessary
Deferred sections for deck are only used once, and just when the deck needs to be loaded. At that time, if any optimisation to card art is enabled (and required, that is "there are cards with no pre-specified edition").

After that, sections are memorised and later updated if anything needs updates, and the last used card art preference was different.
2021-08-04 18:00:13 +01:00
leriomaggio
f0f881dbeb Attempt to load Card now with setcode in use (also overloaded when not necessary) 2021-08-04 16:01:56 +01:00
leriomaggio
40b20e961a CASE INSENSITIVE card map lookup for lazy card load 2021-08-04 15:59:57 +01:00
leriomaggio
a9c1c01a20 FIXED bug in CardStorageReader to support numbers in card names w/ lazy card loading
Borrowing 100,000 Arrows was the driver test case
2021-08-04 15:59:31 +01:00
leriomaggio
58b2a070ed Added test for corner cases with different case in card name and set code (also compared to legacy implementation)
Also, now LoadCard also uses the provided setCode (if any).
If null or empty string is provided in request, all editions will be used!
2021-08-04 15:58:41 +01:00
leriomaggio
09822bdda2 Overloading PaperCard constructor without artIndex with default constant 2021-08-04 10:59:34 +01:00
leriomaggio
ce589ca6e8 removed previously introduced workaround for lowercase comparison 2021-08-04 10:58:23 +01:00
leriomaggio
ead4d134ea Merge remote-tracking branch 'upstream/master' into collector-number-in-card-list-and-card-db-refactoring 2021-08-04 08:51:56 +01:00
leriomaggio
eb9646a0c9 Faster method to load card w/ lazy card load 2021-08-04 08:24:11 +01:00
leriomaggio
5ff8174b4d New data structure in CardEdition allocated for quick cardInset lookup
CardEdition now includes a new Map data strcuture that is allocated only if necessary (i.e. when lazy card loading is enabled) and it will be used for faster card in set lookup by card name. The Map will return a List of cards to account for multiple versions (prints) of a card with the same name within a CardEdition
2021-08-04 08:23:48 +01:00
tool4EvEr
a634860ffd Fix typechange Auras not attaching on reload (e.g. Minimus Containment) 2021-08-02 23:37:21 +02:00
Alumi
2c9b3f648d Support art crop in Card Image Renderer 2021-08-02 08:21:23 +00:00
leriomaggio
0e5611cfea Merge remote-tracking branch 'upstream/master' into collector-number-in-card-list-and-card-db-refactoring 2021-08-02 07:49:18 +01:00
Lyu Zong-Hong
1cd8255ab6 Fix token related crash 2021-08-02 14:29:53 +09:00
tool4EvEr
168cc31955 Fix crash with The Monarch 2021-07-31 19:21:45 +02:00
Michael Kamensky
74038eefb5 Merge branch 'fixnpe' into 'master'
Fix NPE

See merge request core-developers/forge!5141
2021-07-31 04:47:09 +00:00
Lyu Zong-Hong
ac516168e4 Fix crash when create token with unknown edition 2021-07-31 13:44:38 +09:00
tool4EvEr
39bf803a92 Clean up 2021-07-30 21:39:44 +02:00
leriomaggio
857cf20466 Aligned implementations to add card to pool from cardrequest
Implementation aligned with method getting in cardName, setcode and artIndex.
2021-07-29 13:30:17 +01:00
leriomaggio
e09826a1f0 Improved verification on CardEdition not null for a card (also on date)
When this happens, no card update will be issued!
2021-07-29 12:16:19 +01:00
leriomaggio
beec4915c4 Just cleanup and formattings for getMaxArtIndex and getArtCount 2021-07-28 16:51:32 +01:00
leriomaggio
6ae1a7a5d7 Refined implementation (refactored and optimised) for add method in a CardPool from cardName, Set code and artIndex. 2021-07-28 16:51:10 +01:00
leriomaggio
6726d1f776 New method to retrieve all available databases in a MAP (w/ names)
This method is used in CardPool to add a card, and keep track of the original DB.
2021-07-28 16:50:18 +01:00
leriomaggio
3e63a0c54d Renamed attr. and methods related to "allowCustomCardsInDecksConformance" options and improved API for alternativeCardArt
The new `getAlternativeCardArt` method builds on the previous `getCardFromEdition` which generates alternative card art given a PaperCard and a reference date.
Extension to this method is also incorporated to force the options to adopt for card art preference policy.
If None provided, default options set up in Game preferences will be used!
2021-07-28 16:02:34 +01:00
leriomaggio
dc10c6217e Improved code formatting and extensive refactoring of code for smart card art optimisation
Note: deferred section are still kept alive for live testing. Will be restored and fixed next commit.
2021-07-28 15:59:55 +01:00
leriomaggio
93fa6b28b2 All the logic used in Deck for OptimisedCardArt relating to Pivot Edition and Editions Frequency Map has been now moved in CardPool
CardPool now includes the logic to (a) retrieve the edition frequency map of itself, as well as retrieving its corresponding PivotEdition (depending on cards in the pool).

This refactoring optimises the code in Deck class for "smartCardArt" selection
2021-07-28 15:58:39 +01:00
leriomaggio
1eaf644e5b Renamed and optimised implementation for getTheLatestOfAllTheOriginalEditionsOfCardsIn + tests
`getTheLatestOfAllTheOriginalEditionsOfCardsIn` is the new name for `getEarliestEditionWithAllCards` which better clarifies the intent of the method.
The implementation has been optimised, according to the new CardDb behaviour and APIs.

The tests have been extended to verify that the output of the method is always consistent regardless of the edition of cards in the input CardPool.
2021-07-28 15:56:17 +01:00
leriomaggio
1697c1205f Refined implementation (+ test) for getEarliestEditionWithAllCards
This method should still be optimised, and definetly renamed.
2021-07-28 01:19:41 +01:00
leriomaggio
b893283abc Merge remote-tracking branch 'upstream/master' into collector-number-in-card-list-and-card-db-refactoring 2021-07-28 01:14:00 +01:00
leriomaggio
c8052e00a8 New method processCardList that generates the List of Pair per request.
This method will be also re-used in Decks when inspecting the list of cards to add in a Deck Section.

This refactoring avoids code duplications, and improves modularization.
2021-07-27 17:58:49 +01:00
leriomaggio
f7e85b1f64 Updated with new method call from StaticData to account for conformance of custom cards 2021-07-27 16:16:26 +01:00
leriomaggio
79a4e71968 New test cases (and extended implementation) accounting for cards from UNKNONW sets to be correctly retrieved. 2021-07-27 16:15:25 +01:00
leriomaggio
e5350c83d6 Extended test cases to verify that any CardRequest passed in works with no side effect.
New tests (and fixed updated CardRequest implementation) verify that any method used for Card Retrieval when receiving directly CardRequest formatted strings as cardName won't have any side effect. In particular, the code is reliable to be robust enough to support passing in both card name (only) or a full cardRequest string.

If the latter, any parameter in the request will be updated - accordingly - only when explicit params in function calls are provided.
Also, new tests demonstrate that the current implementation has NO side effect when testing for multiple combinations. Therefore, whatever is requested in requestString won't be overruled, unless really requested too.
2021-07-27 14:31:37 +01:00