mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
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.
This commit is contained in:
@@ -366,8 +366,8 @@ public class Deck extends DeckBase implements Iterable<Entry<DeckSection, CardPo
|
|||||||
String setCode = alternativeCardPrint.getEdition();
|
String setCode = alternativeCardPrint.getEdition();
|
||||||
boolean isFoil = alternativeCardPrint.isFoil();
|
boolean isFoil = alternativeCardPrint.isFoil();
|
||||||
int cardsPerArtIndex = totalNrToAdd / nrOfAvailableArts;
|
int cardsPerArtIndex = totalNrToAdd / nrOfAvailableArts;
|
||||||
|
int restOfCardsToAdd = cardsPerArtIndex > 0 ? totalNrToAdd % nrOfAvailableArts : 0;
|
||||||
cardsPerArtIndex = Math.max(1, cardsPerArtIndex); // make sure is never zero
|
cardsPerArtIndex = Math.max(1, cardsPerArtIndex); // make sure is never zero
|
||||||
int restOfCardsToAdd = totalNrToAdd % nrOfAvailableArts;
|
|
||||||
int cardsAdded = 0;
|
int cardsAdded = 0;
|
||||||
PaperCard alternativeCardArt = null;
|
PaperCard alternativeCardArt = null;
|
||||||
for (int artIndex = 1; artIndex <= nrOfAvailableArts; artIndex++){
|
for (int artIndex = 1; artIndex <= nrOfAvailableArts; artIndex++){
|
||||||
|
|||||||
Reference in New Issue
Block a user