From fb092c77a48c570d0a95ff9604ae18ddf66a0d80 Mon Sep 17 00:00:00 2001 From: leriomaggio Date: Sun, 12 Sep 2021 00:56:44 +0100 Subject: [PATCH] BUG FIX for Smart Card Art selection This subtle bug occurred whenever the algorithm for smart card art selection wanted to add a card with multiple arts and the number of cards per art to add was not even. To avoid zeros, the cardsPerArtIndex was set at least to one, and so the rest - leading then to adding too many (extra) cards not originally present in the deck. Thanks to @Snoops for the heads up. --- forge-core/src/main/java/forge/deck/Deck.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forge-core/src/main/java/forge/deck/Deck.java b/forge-core/src/main/java/forge/deck/Deck.java index 9d15cf578bb..11062d0d153 100644 --- a/forge-core/src/main/java/forge/deck/Deck.java +++ b/forge-core/src/main/java/forge/deck/Deck.java @@ -366,8 +366,8 @@ public class Deck extends DeckBase implements Iterable 0 ? totalNrToAdd % nrOfAvailableArts : 0; cardsPerArtIndex = Math.max(1, cardsPerArtIndex); // make sure is never zero - int restOfCardsToAdd = totalNrToAdd % nrOfAvailableArts; int cardsAdded = 0; PaperCard alternativeCardArt = null; for (int artIndex = 1; artIndex <= nrOfAvailableArts; artIndex++){