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>
This commit is contained in:
leriomaggio
2021-09-10 18:23:36 +01:00
parent e90b0323b7
commit 455acffeab
2 changed files with 10 additions and 0 deletions

View File

@@ -402,6 +402,10 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
return false;
}
public boolean hasPreferredArt(String cardName){
return artPrefs.getOrDefault(cardName, null) != null;
}
public CardRules getRules(String cardName) {
CardRules result = rulesByName.get(cardName);
if (result != null) {

View File

@@ -443,6 +443,12 @@ public class Deck extends DeckBase implements Iterable<Entry<DeckSection, CardPo
if (card.getRules().isVariant())
return false; // skip variant cards
if (StaticData.instance().getCommonCards().hasPreferredArt(card.getName())){
// if there is any preferred art, never update it!
CardDb.CardRequest request = CardDb.CardRequest.fromString(card.getName());
if (request.edition.equals(card.getEdition()) && request.artIndex == card.getArtIndex())
return false;
}
boolean isLatestCardArtPreference = StaticData.instance().cardArtPreferenceIsLatest();
CardEdition cardEdition = StaticData.instance().getCardEdition(card.getEdition());
if (cardEdition == null) return false;