mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
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:
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user