* Workaround to fix problem with deck layout.

This commit is contained in:
LevelX2 2016-10-08 19:03:09 +02:00
parent 769a37958d
commit 5d8ae4d411
5 changed files with 38 additions and 16 deletions

View file

@ -3,6 +3,7 @@ package mage.cards;
import mage.ObjectColor;
public final class CardGraphicInfo {
private final ObjectColor frameColor;
private final FrameStyle frameStyle;
private final boolean useVariousArt;
@ -17,9 +18,15 @@ public final class CardGraphicInfo {
this.useVariousArt = useVariousArt;
}
public ObjectColor getFrameColor() { return this.frameColor != null ? this.frameColor.copy() : null; }
public ObjectColor getFrameColor() {
return this.frameColor != null ? this.frameColor.copy() : null;
}
public FrameStyle getFrameStyle() { return this.frameStyle; }
public FrameStyle getFrameStyle() {
return this.frameStyle;
}
public boolean getUsesVariousArt() { return this.useVariousArt; }
public boolean getUsesVariousArt() {
return this.useVariousArt;
}
}

View file

@ -6,8 +6,9 @@ import java.util.List;
* Created by stravant@gmail.com on 2016-10-03.
*/
public class DeckCardLayout {
private List<List<List<DeckCardInfo>>> cards;
private String settings;
private final List<List<List<DeckCardInfo>>> cards;
private final String settings;
public DeckCardLayout(List<List<List<DeckCardInfo>>> cards, String settings) {
this.cards = cards;

View file

@ -121,18 +121,22 @@ public class DckDeckImporter extends DeckImporter {
//
DeckCardLayout layout = new DeckCardLayout(grid, settings);
int expectedCount = 0;
if (target.equals("MAIN")) {
deckList.setCardLayout(layout);
expectedCount = deckList.getCards().size();
} else if (target.equals("SIDEBOARD")) {
deckList.setSideboardLayout(layout);
expectedCount = deckList.getSideboard().size();
} else {
sbMessage.append("Bad target `" + target + "` for layout.\n");
switch (target) {
case "MAIN":
deckList.setCardLayout(layout);
expectedCount = deckList.getCards().size();
break;
case "SIDEBOARD":
deckList.setSideboardLayout(layout);
expectedCount = deckList.getSideboard().size();
break;
default:
sbMessage.append("Bad target `").append(target).append("` for layout.\n");
break;
}
//
if (totalCardCount != expectedCount) {
sbMessage.append("Layout mismatch: Expected " + expectedCount + " cards, but got " + totalCardCount + " in layout `" + target + "`\n.");
sbMessage.append("Layout mismatch: Expected ").append(expectedCount).append(" cards, but got ").append(totalCardCount).append(" in layout `").append(target).append("`\n.");
}
} else {