diff --git a/.gitattributes b/.gitattributes
index b2a78059519..96d26ae5dc0 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -11251,12 +11251,9 @@ src/main/java/forge/deck/DeckBase.java -text
src/main/java/forge/deck/DeckGroup.java -text
src/main/java/forge/deck/DeckRecognizer.java -text
src/main/java/forge/deck/DeckSection.java -text
-src/main/java/forge/deck/generate/DeckGenerator.java -text
src/main/java/forge/deck/generate/Generate2ColorDeck.java svneol=native#text/plain
src/main/java/forge/deck/generate/Generate3ColorDeck.java svneol=native#text/plain
src/main/java/forge/deck/generate/Generate5ColorDeck.java svneol=native#text/plain
-src/main/java/forge/deck/generate/GenerateConstructedDeck.java svneol=native#text/plain
-src/main/java/forge/deck/generate/GenerateConstructedMultiColorDeck.java svneol=native#text/plain
src/main/java/forge/deck/generate/GenerateDeckUtil.java -text
src/main/java/forge/deck/generate/GenerateThemeDeck.java svneol=native#text/plain
src/main/java/forge/deck/generate/package-info.java svneol=native#text/plain
@@ -11531,8 +11528,6 @@ src/test/java/forge/card/mana/ManaPartTest.java svneol=native#text/plain
src/test/java/forge/deck/generate/Generate2ColorDeckTest.java svneol=native#text/plain
src/test/java/forge/deck/generate/Generate3ColorDeckTest.java svneol=native#text/plain
src/test/java/forge/deck/generate/Generate5ColorDeckTest.java svneol=native#text/plain
-src/test/java/forge/deck/generate/GenerateConstructedDeckTest.java svneol=native#text/plain
-src/test/java/forge/deck/generate/GenerateConstructedMultiColorDeckTest.java svneol=native#text/plain
src/test/java/forge/gui/ListChooserTest.java svneol=native#text/plain
src/test/java/forge/gui/game/CardDetailPanelTest.java svneol=native#text/plain
src/test/java/forge/model/BuildInfoTest.java -text
diff --git a/src/main/java/forge/deck/generate/DeckGenerator.java b/src/main/java/forge/deck/generate/DeckGenerator.java
deleted file mode 100644
index b0d27288d47..00000000000
--- a/src/main/java/forge/deck/generate/DeckGenerator.java
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * Forge: Play Magic: the Gathering.
- * Copyright (C) 2011 Forge Team
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see
- * genDecks. - *
- * - * @param playerType - * the player type {@link java.lang.String} object. - */ - public static void genDecks(final PlayerType playerType) { - // TODO jendave to refactor deck generation - Deck d = null; - - final ArrayList- * generateConstructedDeck. - *
- * - * @return a {@link forge.deck.Deck} object. - */ - private static Deck generateConstructedDeck() { - final GenerateConstructedDeck gen = new GenerateConstructedDeck(); - final Deck deck = new Deck(); - deck.getMain().add(gen.generateDeck()); - return deck; - } - - /** - *- * generateConstructed3ColorDeck. - *
- * - * @return a {@link forge.deck.Deck} object. - */ - private static Deck generateConstructed3ColorDeck() { - final GenerateConstructedMultiColorDeck gen = new GenerateConstructedMultiColorDeck(); - final Deck deck = new Deck(); - deck.getMain().add(gen.generate3ColorDeck()); - return deck; - } - - /** - *- * generateConstructed5ColorDeck. - *
- * - * @return a {@link forge.deck.Deck} object. - */ - private static Deck generateConstructed5ColorDeck() { - final GenerateConstructedMultiColorDeck gen = new GenerateConstructedMultiColorDeck(); - final Deck deck = new Deck(); - deck.getMain().add(gen.generate5ColorDeck()); - return deck; - } - - /** - *- * generateConstructedThemeDeck. - *
- * - * @return a {@link forge.deck.Deck} object. - */ - private static Deck generateConstructedThemeDeck() { - final GenerateThemeDeck gen = new GenerateThemeDeck(); - final ArrayList- * generate2ColorDeck. - *
- * - * @param p - * a {@link java.lang.String} object. - * @return a {@link forge.deck.Deck} object. - */ - private static Deck generate2ColorDeck(final PlayerType p) { - final Random r = MyRandom.getRandom(); - - final ArrayList- * generate3ColorDeck. - *
- * - * @param p - * a {@link java.lang.String} object. - * @return a {@link forge.deck.Deck} object. - */ - private static Deck generate3ColorDeck(final PlayerType p) { - final Random r = MyRandom.getRandom(); - - final ArrayList- * generate5ColorDeck. - *
- * - * @param p - * a {@link java.lang.String} object. - * @return a {@link forge.deck.Deck} object. - */ - private static Deck generate5ColorDeck(final PlayerType p) { - // Random r = MyRandom.random; - - // ArrayList- * GenerateConstructedDeck class. - *
- * - * @author Forge - * @version $Id$ - */ -public class GenerateConstructedDeck { - private String color1; - private String color2; - - private final Map- * Constructor for GenerateConstructedDeck. - *
- */ - public GenerateConstructedDeck() { - this.setupMap(); - } - - /** - *- * setupMap. - *
- */ - private void setupMap() { - this.map.put(Constant.Color.BLACK, "Swamp"); - this.map.put(Constant.Color.BLUE, "Island"); - this.map.put(Constant.Color.GREEN, "Forest"); - this.map.put(Constant.Color.RED, "Mountain"); - this.map.put(Constant.Color.WHITE, "Plains"); - } - - /** - *- * generateDeck. - *
- * - * @return a {@link forge.CardList} object. - */ - public final CardList generateDeck() { - CardList deck; - - int check; - - do { - deck = this.get2ColorDeck(); - check = deck.getType("Creature").size(); - - } while ((check < 16) || (24 < check)); - - this.addLand(deck); - - if (deck.size() != 60) { - throw new RuntimeException( - "GenerateConstructedDeck() : generateDeck() error, deck size it not 60, deck size is " - + deck.size()); - } - return deck; - } - - // 25 lands - /** - *- * addLand. - *
- * - * @param list - * a {@link forge.CardList} object. - */ - private void addLand(final CardList list) { - Card land; - for (int i = 0; i < 13; i++) { - land = AllZone.getCardFactory().getCard(this.map.get(this.color1).toString(), AllZone.getComputerPlayer()); - list.add(land); - - land = AllZone.getCardFactory().getCard(this.map.get(this.color2).toString(), AllZone.getComputerPlayer()); - list.add(land); - } - } // addLand() - - /** - * Creates a CardList from the set of all cards that meets the criteria for - * color(s), type, whether the card is suitable for placement in random - * decks and in AI decks, etc. - * - * @see #filterBadCards(Iterable) - * - * @return a subset of cards <= the set of all cards; might be empty, but - * never null - */ - private CardList getCards() { - return this.filterBadCards(AllZone.getCardFactory()); - } // getCards() - - /** - *- * get2ColorDeck. - *
- * - * @return a {@link forge.CardList} object. - */ - private CardList get2ColorDeck() { - final CardList deck = this.get2Colors(this.getCards()); - - final CardList out = new CardList(); - deck.shuffle(); - - // trim deck size down to 34 cards, presumes 26 land, for a total of 60 - // cards - for (int i = 0; (i < 34) && (i < deck.size()); i++) { - out.add(deck.get(i)); - } - return out; - } - - /** - *- * get2Colors. - *
- * - * @param in - * a {@link forge.CardList} object. - * @return a {@link forge.CardList} object. - */ - private CardList get2Colors(final CardList in) { - int a; - int b; - - do { - a = CardUtil.getRandomIndex(Constant.Color.ONLY_COLORS); - b = CardUtil.getRandomIndex(Constant.Color.ONLY_COLORS); - } while (a == b); // do not want to get the same color twice - - this.color1 = Constant.Color.ONLY_COLORS[a]; - this.color2 = Constant.Color.ONLY_COLORS[b]; - - CardList out = new CardList(); - out.addAll(CardListUtil.getColor(in, this.color1)); - out.addAll(CardListUtil.getColor(in, this.color2)); - out.shuffle(); - - final CardList artifact = in.filter(new CardListFilter() { - @Override - public boolean addCard(final Card c) { - // is this really a colorless artifact and not something - // weird like Sarcomite Myr which is a colored artifact - return c.isArtifact() && CardUtil.getColors(c).contains(Constant.Color.COLORLESS) - && !Singletons.getModel().getPreferences().getPrefBoolean(FPref.DECKGEN_ARTIFACTS); - } - }); - out.addAll(artifact); - - out = out.filter(new CardListFilter() { - @Override - public boolean addCard(final Card c) { - if (c.isCreature() && (c.getNetAttack() <= 1) - && Singletons.getModel().getPreferences().getPrefBoolean(FPref.DECKGEN_NOSMALL)) { - return false; - } - - return true; - } - }); - - out = this.filterBadCards(out); - return out; - } - - /** - * Creates a CardList from the given sequence that meets the criteria for - * color(s), type, whether the card is suitable for placement in random - * decks and in AI decks, etc. - * - * @param sequence - * an iterable over Card instances - * - * @return a subset of sequence <= sequence; might be empty, but never null - */ - private CardList filterBadCards(final Iterable- * GenerateConstructedMultiColorDeck class. - *
- * - * @author Forge - * @version $Id$ - */ -public class GenerateConstructedMultiColorDeck { - private String color1; - private String color2; - private String color3; - private String color4; - private String color5; - - private final Map- * Constructor for GenerateConstructedMultiColorDeck. - *
- */ - public GenerateConstructedMultiColorDeck() { - this.setupBasicLandMap(); - this.setupMultiMap(); - } - - /** - *- * setupBasicLandMap. - *
- */ - private void setupBasicLandMap() { - this.map.put(Constant.Color.BLACK, "Swamp"); - this.map.put(Constant.Color.BLUE, "Island"); - this.map.put(Constant.Color.GREEN, "Forest"); - this.map.put(Constant.Color.RED, "Mountain"); - this.map.put(Constant.Color.WHITE, "Plains"); - } - - /** - *- * setupMultiMap. - *
- */ - private void setupMultiMap() { - this.multiMap.put(Constant.Color.BLACK + Constant.Color.BLUE, - new String[] { "Underground Sea", "Watery Grave" }); - this.multiMap.put(Constant.Color.BLACK + Constant.Color.GREEN, new String[] { "Bayou", "Overgrown Tomb" }); - this.multiMap.put(Constant.Color.BLACK + Constant.Color.RED, new String[] { "Badlands", "Blood Crypt" }); - this.multiMap.put(Constant.Color.BLACK + Constant.Color.WHITE, new String[] { "Scrubland", "Godless Shrine" }); - this.multiMap.put(Constant.Color.BLUE + Constant.Color.BLACK, - new String[] { "Underground Sea", "Watery Grave" }); - this.multiMap.put(Constant.Color.BLUE + Constant.Color.GREEN, - new String[] { "Tropical Island", "Breeding Pool" }); - this.multiMap.put(Constant.Color.BLUE + Constant.Color.RED, new String[] { "Volcanic Island", "Steam Vents" }); - this.multiMap.put(Constant.Color.BLUE + Constant.Color.WHITE, new String[] { "Tundra", "Hallowed Fountain" }); - this.multiMap.put(Constant.Color.GREEN + Constant.Color.BLACK, new String[] { "Bayou", "Overgrown Tomb" }); - this.multiMap.put(Constant.Color.GREEN + Constant.Color.BLUE, - new String[] { "Tropical Island", "Breeding Pool" }); - this.multiMap.put(Constant.Color.GREEN + Constant.Color.RED, new String[] { "Taiga", "Stomping Ground" }); - this.multiMap.put(Constant.Color.GREEN + Constant.Color.WHITE, new String[] { "Savannah", "Temple Garden" }); - this.multiMap.put(Constant.Color.RED + Constant.Color.BLACK, new String[] { "Badlands", "Blood Crypt" }); - this.multiMap.put(Constant.Color.RED + Constant.Color.BLUE, new String[] { "Volcanic Island", "Steam Vents" }); - this.multiMap.put(Constant.Color.RED + Constant.Color.GREEN, new String[] { "Taiga", "Stomping Ground" }); - this.multiMap.put(Constant.Color.RED + Constant.Color.WHITE, new String[] { "Plateau", "Sacred Foundry" }); - this.multiMap.put(Constant.Color.WHITE + Constant.Color.BLACK, new String[] { "Scrubland", "Godless Shrine" }); - this.multiMap.put(Constant.Color.WHITE + Constant.Color.BLUE, new String[] { "Tundra", "Hallowed Fountain" }); - this.multiMap.put(Constant.Color.WHITE + Constant.Color.GREEN, new String[] { "Savannah", "Temple Garden" }); - this.multiMap.put(Constant.Color.WHITE + Constant.Color.RED, new String[] { "Plateau", "Sacred Foundry" }); - } - - /** - *- * generate3ColorDeck. - *
- * - * @return a {@link forge.CardList} object. - */ - public final CardList generate3ColorDeck() { - CardList deck; - - int check; - - do { - deck = this.get3ColorDeck(); - check = deck.getType("Creature").size(); - - } while ((check < 16) || (24 < check)); - - this.addLand(deck, 3); - - if (deck.size() != 60) { - throw new RuntimeException( - "GenerateConstructedDeck() : generateDeck() error, deck size it not 60, deck size is " - + deck.size()); - } - - return deck; - } - - /** - *- * generate5ColorDeck. - *
- * - * @return a {@link forge.CardList} object. - */ - public final CardList generate5ColorDeck() { - CardList deck; - - deck = this.get5ColorDeck(); - - this.addLand(deck, 5); - - if (deck.size() != 60) { - throw new RuntimeException( - "GenerateConstructedDeck() : generateDeck() error, deck size it not 60, deck size is " - + deck.size()); - } - - return deck; - } - - /** - *- * addLand. - *
- * - * @param list - * a {@link forge.CardList} object. - * @param colors - * a int. - */ - private void addLand(final CardList list, final int colors) { - if (colors == 3) { - final int numberBasic = 2; - Card land; - for (int i = 0; i < numberBasic; i++) { - - land = AllZone.getCardFactory().getCard(this.map.get(this.color1).toString(), - AllZone.getComputerPlayer()); - list.add(land); - - land = AllZone.getCardFactory().getCard(this.map.get(this.color2).toString(), - AllZone.getComputerPlayer()); - list.add(land); - - land = AllZone.getCardFactory().getCard(this.map.get(this.color3).toString(), - AllZone.getComputerPlayer()); - list.add(land); - } - - final int numberDual = 4; - for (int i = 0; i < numberDual; i++) { - land = AllZone.getCardFactory().getCard(this.multiMap.get(this.color1 + this.color2)[0], - AllZone.getComputerPlayer()); - list.add(land); - - land = AllZone.getCardFactory().getCard(this.multiMap.get(this.color1 + this.color3)[0], - AllZone.getComputerPlayer()); - list.add(land); - - land = AllZone.getCardFactory().getCard(this.multiMap.get(this.color2 + this.color3)[0], - AllZone.getComputerPlayer()); - list.add(land); - } - for (int i = 0; i < 2; i++) { - land = AllZone.getCardFactory().getCard(this.multiMap.get(this.color1 + this.color2)[1], - AllZone.getComputerPlayer()); - list.add(land); - - land = AllZone.getCardFactory().getCard(this.multiMap.get(this.color1 + this.color3)[1], - AllZone.getComputerPlayer()); - list.add(land); - - land = AllZone.getCardFactory().getCard(this.multiMap.get(this.color2 + this.color3)[1], - AllZone.getComputerPlayer()); - list.add(land); - } - } else if (colors == 5) { - final int numberBasic = 1; - Card land; - for (int i = 0; i < numberBasic; i++) { - - land = AllZone.getCardFactory().getCard(this.map.get(this.color1).toString(), - AllZone.getComputerPlayer()); - list.add(land); - - land = AllZone.getCardFactory().getCard(this.map.get(this.color2).toString(), - AllZone.getComputerPlayer()); - list.add(land); - - land = AllZone.getCardFactory().getCard(this.map.get(this.color3).toString(), - AllZone.getComputerPlayer()); - list.add(land); - - land = AllZone.getCardFactory().getCard(this.map.get(this.color4).toString(), - AllZone.getComputerPlayer()); - list.add(land); - - land = AllZone.getCardFactory().getCard(this.map.get(this.color5).toString(), - AllZone.getComputerPlayer()); - list.add(land); - } - - final int numberDual = 2; - for (int i = 0; i < numberDual; i++) { - land = AllZone.getCardFactory().getCard(this.multiMap.get(this.color1 + this.color2)[0], - AllZone.getComputerPlayer()); - list.add(land); - - land = AllZone.getCardFactory().getCard(this.multiMap.get(this.color1 + this.color3)[0], - AllZone.getComputerPlayer()); - list.add(land); - - land = AllZone.getCardFactory().getCard(this.multiMap.get(this.color1 + this.color4)[0], - AllZone.getComputerPlayer()); - list.add(land); - - land = AllZone.getCardFactory().getCard(this.multiMap.get(this.color1 + this.color5)[0], - AllZone.getComputerPlayer()); - list.add(land); - - land = AllZone.getCardFactory().getCard(this.multiMap.get(this.color2 + this.color3)[0], - AllZone.getComputerPlayer()); - list.add(land); - - land = AllZone.getCardFactory().getCard(this.multiMap.get(this.color2 + this.color4)[0], - AllZone.getComputerPlayer()); - list.add(land); - - land = AllZone.getCardFactory().getCard(this.multiMap.get(this.color2 + this.color5)[0], - AllZone.getComputerPlayer()); - list.add(land); - - land = AllZone.getCardFactory().getCard(this.multiMap.get(this.color3 + this.color4)[0], - AllZone.getComputerPlayer()); - list.add(land); - - land = AllZone.getCardFactory().getCard(this.multiMap.get(this.color3 + this.color5)[0], - AllZone.getComputerPlayer()); - list.add(land); - - land = AllZone.getCardFactory().getCard(this.multiMap.get(this.color4 + this.color5)[0], - AllZone.getComputerPlayer()); - list.add(land); - } - - } - } // addLand() - - /** - * Filters out cards by color and their suitability for being placed in a - * randomly created deck. - * - * @param colors - * the number of different colors the deck should have; if this - * is a number other than 3 or 5, we return an empty list. - * - * @return a subset of all cards in the CardFactory database which might be - * empty, but never null - */ - private CardList getCards(final int colors) { - return this.filterBadCards(AllZone.getCardFactory(), colors); - } // getCards() - - /** - *- * get3ColorDeck. - *
- * - * @return a {@link forge.CardList} object. - */ - private CardList get3ColorDeck() { - final CardList deck = this.get3Colors(this.getCards(3)); - - final CardList out = new CardList(); - deck.shuffle(); - - // trim deck size down to 36 cards, presumes 24 land, for a total of 60 - // cards - for (int i = 0; (i < 36) && (i < deck.size()); i++) { - out.add(deck.get(i)); - } - - return out; - } - - /** - *- * get5ColorDeck. - *
- * - * @return a {@link forge.CardList} object. - */ - private CardList get5ColorDeck() { - final CardList deck = this.get5Colors(this.getCards(5)); - - final CardList out = new CardList(); - deck.shuffle(); - - // trim deck size down to 36 cards, presumes 24 land, for a total of 60 - // cards - for (int i = 0; (i < 36) && (i < deck.size()); i++) { - out.add(deck.get(i)); - } - - return out; - } - - /** - *- * get3Colors. - *
- * - * @param in - * a {@link forge.CardList} object. - * @return a {@link forge.CardList} object. - */ - private CardList get3Colors(final CardList in) { - int a; - int b; - int c; - - a = CardUtil.getRandomIndex(Constant.Color.ONLY_COLORS); - do { - b = CardUtil.getRandomIndex(Constant.Color.ONLY_COLORS); - c = CardUtil.getRandomIndex(Constant.Color.ONLY_COLORS); - } while ((a == b) || (a == c) || (b == c)); // do not want to get the - // same - // color thrice - - this.color1 = Constant.Color.ONLY_COLORS[a]; - this.color2 = Constant.Color.ONLY_COLORS[b]; - this.color3 = Constant.Color.ONLY_COLORS[c]; - - CardList out = new CardList(); - out.addAll(CardListUtil.getColor(in, this.color1)); - out.addAll(CardListUtil.getColor(in, this.color2)); - out.addAll(CardListUtil.getColor(in, this.color3)); - out.shuffle(); - - final CardList artifact = in.filter(new CardListFilter() { - @Override - public boolean addCard(final Card c) { - // is this really a colorless artifact and not something - // wierd like Sarcomite Myr which is a colored artifact - return c.isArtifact() && CardUtil.getColors(c).contains(Constant.Color.COLORLESS) - && !Singletons.getModel().getPreferences().getPrefBoolean(FPref.DECKGEN_ARTIFACTS); - } - }); - out.addAll(artifact); - - out = out.filter(new CardListFilter() { - @Override - public boolean addCard(final Card c) { - if (c.isCreature() && (c.getNetAttack() <= 1) - && Singletons.getModel().getPreferences().getPrefBoolean(FPref.DECKGEN_NOSMALL)) { - return false; - } - - return true; - } - }); - - out = this.filterBadCards(out, 3); - return out; - } - - /** - *- * get5Colors. - *
- * - * @param in - * a {@link forge.CardList} object. - * @return a {@link forge.CardList} object. - */ - private CardList get5Colors(final CardList in) { - - this.color1 = Constant.Color.BLACK; - this.color2 = Constant.Color.BLUE; - this.color3 = Constant.Color.GREEN; - this.color4 = Constant.Color.RED; - this.color5 = Constant.Color.WHITE; - - CardList out = new CardList(); - /* - * out.addAll(CardListUtil.getColor(in, color1)); - * out.addAll(CardListUtil.getColor(in, color2)); - * out.addAll(CardListUtil.getColor(in, color3)); - * out.addAll(CardListUtil.getColor(in, color4)); - * out.addAll(CardListUtil.getColor(in, color5)); - */ - out.addAll(CardListUtil.getGoldCards(in)); - out.shuffle(); - - final CardList artifact = in.filter(new CardListFilter() { - @Override - public boolean addCard(final Card c) { - // is this really a colorless artifact and not something - // wierd like Sarcomite Myr which is a colored artifact - return c.isArtifact() && CardUtil.getColors(c).contains(Constant.Color.COLORLESS) - && !Singletons.getModel().getPreferences().getPrefBoolean(FPref.DECKGEN_ARTIFACTS); - } - }); - out.addAll(artifact); - - out = out.filter(new CardListFilter() { - @Override - public boolean addCard(final Card c) { - if (c.isCreature() && (c.getNetAttack() <= 1) - && Singletons.getModel().getPreferences().getPrefBoolean(FPref.DECKGEN_NOSMALL)) { - return false; - } - - return true; - } - }); - - out = this.filterBadCards(out, 3); - return out; - } - - /** - * Filters out cards by color and their suitability for being placed in a - * randomly created deck. - * - * @param sequence - * an Iterable of Card instances - * - * @param colors - * the number of different colors the deck should have; if this - * is a number other than 3 or 5, we return an empty list. - * - * @return a subset of sequence <= sequence which might be empty, but never - * null - */ - private CardList filterBadCards(final Iterable