Commit Graph

1445 Commits

Author SHA1 Message Date
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
Lyu Zong-Hong
26adc5ca7b Get Paper Card for unknown edition 2021-07-27 22:17:10 +09:00
leriomaggio
286533cf90 Aligned CardDb calls after API revision for getCardFromEditionsReleasedBefore(date). 2021-07-27 07:40:13 +01:00
leriomaggio
8de07821e0 Refactoring and Second Update to the new ICardDatabase APIs
This new revision of the APi brings a more consistent distribution of the different parameters and settings in DB API calls.
In particular, the changes affect the getCardFromEditions which are now separated into three sets of methods:

- methods to retrieve a card based on CardArtPreference
- methods to also include a Release Date restriction,
that can be now considered in both directions
(as in "releasedBefore" and "releasedAfter" a specified date).

These changes will be functional for new additions in future changes to Deck Importer, as well as will be used
to refine the implementation of the new Smart Card Art Selection in Decks.

From an implementation perspective, it is important to emphasise that all those methods are just syntactic sugar
for parameter passing to the **same** core (private) retrieval method (centralised single point of failure)
which incorporates all the required parameters, that would also be cumbersome to use in a public API.
2021-07-27 07:40:12 +01:00
Michael Kamensky
c9036f90ef Merge branch 'mdfc' into 'master'
Correctly evaluate modal faces

See merge request core-developers/forge!5112
2021-07-27 04:53:19 +00:00
Lyu Zong-Hong
5f39b98cc5 Also render tokens and emblems when not using images 2021-07-27 12:10:26 +09:00
tool4EvEr
91e8c24769 Clean up 2021-07-26 21:55:48 +02:00
leriomaggio
04ae8fc28a FIX cardDB implementation (and corresponding Tests) for a bug not accounting for too-strict art preference policy for some cards. 2021-07-26 11:31:11 +01:00
tool4EvEr
c3d276f3a9 SealedProduct: fix crash 2021-07-25 18:27:30 +02:00
leriomaggio
e803899d6a Renamed param in constructor for artPreference and BUG FIX in load unknown Card
Even if UNKNOWN card load is enabled, we should check whether the card was not found because of originally filtered.

Therefore, the actual UNKNOWN card will be added now ONLY IF it is not contained in the filtered Blacklist.
2021-07-25 11:17:37 +01:00
leriomaggio
1fecdd255a Simplified attemptToLoadCard by removing extra unused setCode param 2021-07-25 08:45:48 +01:00
leriomaggio
e28f6cf16f Removed useless param from attemptLoadCard 2021-07-25 08:44:22 +01:00
leriomaggio
2d189cda9a Merge remote-tracking branch 'upstream/master' into collector-number-in-card-list-and-card-db-refactoring 2021-07-25 08:09:09 +01:00
leriomaggio
d9620a5556 TEMP implementation of Smart Card Art Selection method 2021-07-24 11:33:37 +01:00
leriomaggio
56080cdf3f Added support to the new Smart Card Art Preference Option
The new "Smart Card Art Selection" option for card images in deck has been added.
The Ui and forge preferences have been updated (default is False), as well as corresponding support in StaticData.
On this note, the old `getAlternativeCardPrint` has been re-implemented to enforce a "Latest_Art" based preference selection so that editions could be selected accordingly (as the smart method was originally designed)

Actual implementation of the method will be part of future commits as still under dev - and requires better encapsulation
2021-07-24 11:07:20 +01:00
leriomaggio
6277bc0c0f Added note on behaviour for candidate w/ no edition
Left note only for (internal) documentation purposes!
2021-07-24 11:02:05 +01:00
leriomaggio
ec89ff755b more robust and reliable method to check for card images
The getImagefile will be invoked since this method will also account for any difference in `full` and `fullborder` naming for card images.
In particular, it will try everything possible before giving up and assume the card has no image.
This is **crucial** for cardDB card retrieval, as well as determines the boolean value returned by PaperCard.hasImage method/property
2021-07-24 10:51:26 +01:00