From a23e6ae000b7b152cb636630fb2f86fdb67632ba Mon Sep 17 00:00:00 2001 From: drdev Date: Wed, 6 Aug 2014 15:03:22 +0000 Subject: [PATCH] Account for commander as part of main deck size --- .../src/main/java/forge/deck/DeckProxy.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/forge-gui/src/main/java/forge/deck/DeckProxy.java b/forge-gui/src/main/java/forge/deck/DeckProxy.java index a9526edbdc8..e6399463829 100644 --- a/forge-gui/src/main/java/forge/deck/DeckProxy.java +++ b/forge-gui/src/main/java/forge/deck/DeckProxy.java @@ -51,8 +51,8 @@ public class DeckProxy implements InventoryItem { protected ColorSet color; protected ColorSet colorIdentity; protected Iterable formats; - private int mainSize = Integer.MIN_VALUE; - private int sbSize = Integer.MIN_VALUE; + private Integer mainSize = null; + private Integer sbSize = null; private final String path; private final Function fnGetDeck; private CardEdition edition; @@ -134,8 +134,8 @@ public class DeckProxy implements InventoryItem { highestRarity = null; formats = null; edition = null; - mainSize = Integer.MIN_VALUE; - sbSize = Integer.MIN_VALUE; + mainSize = null; + sbSize = null; } public ColorSet getColor() { @@ -231,19 +231,26 @@ public class DeckProxy implements InventoryItem { } public int getMainSize() { - if (mainSize == Integer.MIN_VALUE) { + if (mainSize == null) { if (deck == null) { mainSize = -1; } else { - mainSize = getDeck().getMain().countAll(); + Deck d = getDeck(); + mainSize = d.getMain().countAll(); + + //account for commander as part of main deck size + CardPool commander = d.get(DeckSection.Commander); + if (commander != null) { + mainSize += commander.countAll(); + } } } return mainSize; } public int getSideSize() { - if (sbSize == Integer.MIN_VALUE) { + if (sbSize == null) { CardPool sb = getDeck().get(DeckSection.Sideboard); sbSize = sb == null ? -1 : sb.countAll(); if (sbSize == 0) {