Commit Graph

1629 Commits

Author SHA1 Message Date
leriomaggio
f21612c2c4 Major Update to CardDb (along with tests).
This commit includes major updates to the CardDb aligned with the new ICardDatabase (refactored) API.

The implementation of the API now includes a more standardised and linear approach in (single) card retrieval which leverages on the refactored methods.

All these methods rely on the **new** and revised CardRequest object that now support a new method to compose request strings, as well as extending support to requests including the collector numbers.
This is a major update going towards the direction of integrating the collector number in Deck Importer when analysing cards lists.

All these new implementations have been thoroughly tested considering all possible conditions, foil cards, cards with multiple arts, and date filtering, and results compared with **previous** card DB implementation to be sure no behaviour was left uncovered from previous implementation.
(Please see `LegacyDb` class in `forge.card` tests for more details).

Cards in CardPool are now added also including the collector number directly. This should avoid PaperCard instances to rely on the retrieveCollectorNumber methods in PaperCard. [THIS needs to be tested yet].

Another major change to class structure regards the new renamed SetPreference to a more intuitive CardArtPreference.
This will be used to set up card art preference in the UI, as well as to guide card retrieval default behaviour.
(This option will be later included in the Desktop GUI as well).
Tests to compare the behaviour of these new options, and the old ones have been conducted, and all passed.
Also, this attribute has been moved from StaticData to CardDb as it seems more appropriate encapsulation, without any circular dependency.
A new method (not included in ICardDatabase) has been added to CardDb API (i.e. getCardFromEditions(name) ) which relies on the default Card Art preference.

Last but not least, Anthologies edition file receives an update on the TYPE (from other to reprint) to also deal with expected testings - case "Hymn To Tourach" when `LatestPrintNoPromoNoOnline` is selected.
2021-06-09 17:22:42 +01:00
leriomaggio
48859a32a3 ITokenDatabase API have been aligned in names with those for cards. 2021-06-09 16:59:14 +01:00
leriomaggio
dad3cafd7a IPaperCard now includes a constant placeholder for NO Art Index.
This is an attempt to start removing all the hard-coded values
used throughout the code base whenever art index should be
invoked, by relying on a more stable approach based on
constants.
2021-06-09 16:58:48 +01:00
leriomaggio
d4c19a0a1f Complete Refactoring of the CardDb API
The API for Magic Card Database has been refactored so to include card look up methods as organised in three main categories:
- single card lookup based on details (name, ed code, collector number)
- card lookup from a given edition (i.e. CardEdition instance)
- card lookup based on Art Preference

Methods to retrieve collection of cards have been renamed to allow
for overloading, within a more consistent API.
Same for utility methods to retrieve cards' art index and count.

Last but not least, the old "getFoiled" method has been removed to leave space to the new method in PaperCard API.
2021-06-09 16:57:09 +01:00
leriomaggio
3704204371 Refactoring: Using IPaperCard constant for artIndex instead of hard coded number 2021-06-06 14:55:14 +01:00
leriomaggio
7dfc48744c Merge remote-tracking branch 'upstream/master' into patch-imagefetcher-scryfall 2021-06-05 17:00:53 +01:00
Michael Kamensky
1633dedee3 Merge branch 'master' of git.cardforge.org:core-developers/forge into agetian-master 2021-06-05 17:34:06 +03:00
Michael Kamensky
1f2cc92533 Merge branch 'phasing' into 'master'
Phasing Fixes

Closes #531

See merge request core-developers/forge!4808
2021-06-05 14:27:11 +00:00
leriomaggio
2e550b95ca New Card Language option to support fetching cards in different languages 2021-06-05 15:21:49 +01:00
leriomaggio
ace7998c40 Removed unused method 2021-06-05 15:17:10 +01:00
leriomaggio
e2b30b8f71 Extended Regexp to support Historic Anthology 5 CN types
Historic Anthology 5 introduced a new "type" of collector number, namely
"999-CH". Regexp has been extended to also include those cases.
2021-06-05 10:50:16 +01:00
Northmoc
7e682810fb final tweaks for now 2021-06-04 15:11:39 -04:00
leriomaggio
446fc7dc35 Enhancing regexp to also support CN with symbol in front (e.g. *180 in Theros promos) 2021-06-04 19:55:16 +01:00
tool4EvEr
08d6b11add Clean up 2021-06-04 20:27:44 +02:00
Northmoc
ca4e9c2ea5 add "alternate frame" and "bundle" to EditionSectionWithCollectorNumbers, tweak Edition 2021-06-04 12:59:07 -04:00
leriomaggio
9539060404 Merge remote-tracking branch 'upstream/master' into patch-imagefetcher-scryfall 2021-06-04 15:20:59 +01:00
leriomaggio
321360e180 Added new ScryfallCode to CardEdition (used by ImageFetcher) 2021-06-04 15:20:21 +01:00
tool4EvEr
069403ab6c Clean up 2021-06-03 14:22:56 +02:00
leriomaggio
7cfb37a116 Make constructor w/ collectorNumber robust for non-existing cards. 2021-05-31 20:54:17 +01:00
leriomaggio
560d8ec5c0 Refactored duplicate code in StaticData w/ new getCardEdition method
StaticData now includes a new method, namely `getCardEdition` which looks for a CardEdition instance into editions and customeditions given an input set code.

This new method has been refactored and used throughout the new changes in Advanced Search and Filters.
2021-05-31 19:57:33 +01:00
leriomaggio
32cc860eda Changed getSortedEditions to now also include Custom Sets 2021-05-31 10:18:21 +01:00
leriomaggio
03d6687c64 Merge remote-tracking branch 'upstream/master' into fix-deck-editor-custom-editions-image-view 2021-05-31 09:12:32 +01:00
leriomaggio
9902718082 FIX and Impros to CardEdition, CardInSet and Reader
- Reader has a new updated regexp to deal with non-numerical collectorNumbers
- CardInSet have been now made sortable based on CollectorNumber.
To do so, collectorNumbers are transformed accordingly to allow for natural ordering (as expected) instead of lexicographic order.
- CardEdition now return cards (CardInSet) as sorted, to allow for correct artIndex matching when creating corresponding `PaperCard` instances.
Moreover, `compareTo` of card edition has been improved to also take into account set name (in cases of same release date).
2021-05-30 05:36:09 +00:00
leriomaggio
0217c4b4b2 Support collectorNumber for Cards in Custom sets
retrieveCollectorNumber now also considers customEditions when looking for the matching collectorNumber of a PaperCard instance.
2021-05-30 00:21:05 +01:00
leriomaggio
f5563ccedb New method to return the Collection of Custom Editions 2021-05-29 23:42:34 +01:00
leriomaggio
348365b8fd Merge remote-tracking branch 'upstream/master' into patch-imagefetcher-scryfall 2021-05-28 23:30:06 +01:00
leriomaggio
b076a57811 New utility method to compose Scryfall Download url that is compliant with new API specs 2021-05-28 19:19:08 +01:00
leriomaggio
8b7ae19508 FIX and Impros to CardEdition, CardInSet and Reader
- Reader has a new updated regexp to deal with non-numerical collectorNumbers
- CardInSet have been now made sortable based on CollectorNumber.
To do so, collectorNumbers are transformed accordingly to allow for natural ordering (as expected) instead of lexicographic order.
- CardEdition now return cards (CardInSet) as sorted, to allow for correct artIndex matching when creating corresponding `PaperCard` instances.
Moreover, `compareTo` of card edition has been improved to also take into account set name (in cases of same release date).
2021-05-28 15:37:44 +00:00
Anthony Calosa
cb9a2d7b8b unused import 2021-05-28 10:20:13 +00:00
Anthony Calosa
367170d33b Update FileUtil.java 2021-05-28 10:10:54 +00:00
Lyu Zong-Hong
81d0a71060 Update FileUtil.readFile to use UTF-8 charset to read files. 2021-05-28 17:25:12 +09:00
leriomaggio
8d2d633f6d FIX and Impros to CardEdition, CardInSet and Reader
- Reader has a new updated regexp to deal with non-numerical collectorNumbers
- CardInSet have been now made sortable based on CollectorNumber.
To do so, collectorNumbers are transformed accordingly to allow for natural ordering (as expected) instead of lexicographic order.
- CardEdition now return cards (CardInSet) as sorted, to allow for correct artIndex matching when creating corresponding `PaperCard` instances.
Moreover, `compareTo` of card edition has been improved to also take into account set name (in cases of same release date).
2021-05-27 10:38:51 +00:00
leriomaggio
d448b59dcc Just code formatting 2021-05-24 11:48:22 +01:00
leriomaggio
189b0ea122 Formatting adjustments 2021-05-24 10:13:40 +01:00
leriomaggio
c03da7eb74 Revert to CollectorNumber in PaperCard as String to handle cases of mulitple art (e.g. 21a). 2021-05-23 16:52:12 +01:00
leriomaggio
a0c126f39e Merge remote-tracking branch 'upstream/master' into collector-number-in-card-list-and-card-db-refactoring 2021-05-23 14:50:49 +01:00
leriomaggio
0e49d103b1 Update to the new getFoiledMethod in PaperCard API 2021-05-23 14:34:38 +01:00
leriomaggio
12387f0efb Refactoring of PaperCard API for collectorNumber and GetFoil.
PaperCard instance now includes a new attribute (i.e. `collectorNumber`) that will be used later on to fill in the "CN" Column in List view (see `ColumnDef.java`).
To allow for minor disruption to existing API, the collectorNumber attribute will be handled in a _Property-like_ fashion via the getter method (i.e. `getCollectorNumber`).
In particular, if collectorNumber is marked as `UNSET` (i.e. `PaperCard.UNSET_COLLECTOR_NUMBER`), the corresponding value will be automatically retrieved from the matched `CardEdition`, and updated for later use.
Nevertheless, Constructors including the new parameter have been also set for future API change.
Moreover, the new attribute has been also considered in methods for object comparison, for a more accurate sorting criterion.

The second new addition to PaperCard API regards FOIL cards (i.e. `getFoiled()`).
This method was originally part of `CardDb` API as described in ISSUE #1848.
With this API change, an internal reference to a `PaperCard` (foil) instance will be used to return the foil version of "itself" for each PaperCard Instance. This will avoid proliferation of PaperCard instances in memory, while keeping all information consistent with the original "unfoiled" card.
NOTE: at the moment, every card can be Foiled, with no restriction whatsoever on the _actual_ existence of original (true) PaperCard.
2021-05-23 13:07:39 +01:00
leriomaggio
41be0bb069 PaperToken aligned with the new IPaperCard Interface (collectorNr always to default for tokens) 2021-05-23 12:56:10 +01:00
leriomaggio
6edcb95aab Refactor IPaperCard Interface to include collectorNumber
The IPaperCard interface now includes a method to return the Collector Number of a Card.
Moreover, two new constants have been included for Default Art Index (i.e. 1) and a flag to mark the absence of a Collector Number (i.e. 0).
2021-05-23 12:55:15 +01:00
tool4EvEr
4aafafb5bd Minor cleanup 2021-05-16 12:52:02 +02:00
Bug Hunter
d9340349fa ColorIdentity: Check for CDA text 2021-05-10 19:36:09 +00:00
Anthony Calosa
c5d6214ab2 fix localizer 2021-05-02 19:44:19 +08:00
Anthony Calosa
322ebdf8a6 Update spacing 2021-05-02 09:16:55 +08:00
Anthony Calosa
3d3296d1b7 [Mobile] Fix ExceptionInInitializerError forge.screens.home.NewGameMenu$NewGameScreen
- some mobile issues reported via Sentry is related to Translation errors and it should return the default original value from English locale.
2021-05-02 09:13:49 +08:00
Anthony Calosa
28ec418c76 unused Import 2021-04-30 14:46:49 +00:00
Anthony Calosa
6d3155dff9 prevent NPE 2021-04-30 22:27:07 +08:00
Anthony Calosa
1e1c5fa139 update Filter 2021-04-30 22:20:26 +08:00
Anthony Calosa
d227da0c10 refactor getStartingPlaneswalkerOptions 2021-04-25 11:49:05 +08:00
Michael Kamensky
8feaf9ed3e [maven-release-plugin] prepare for next development iteration 2021-04-24 08:26:10 +03:00