diff --git a/Mage.Client/release/sample-decks/Boros.dck b/Mage.Client/release/sample-decks/Boros.dck new file mode 100644 index 00000000000..b57f4c3b72f --- /dev/null +++ b/Mage.Client/release/sample-decks/Boros.dck @@ -0,0 +1,24 @@ +NAME:Boros +3 [WWK:20] Stoneforge Mystic +3 [ZEN:195] Adventuring Gear +2 [SOM:94] Koth of the Hammer +4 [ZEN:223] Scalding Tarn +3 [ZEN:14] Journey to Nowhere +4 [ZEN:126] Goblin Guide +1 [M11:232] Plains +2 [M11:233] Plains +4 [M11:149] Lightning Bolt +1 [M11:230] Plains +4 [ZEN:219] Marsh Flats +1 [M11:231] Plains +1 [M11:243] Mountain +2 [M11:242] Mountain +4 [ZEN:36] Steppe Lynx +2 [M11:245] Mountain +1 [M11:244] Mountain +3 [SOM:104] Spikeshot Elder +4 [ZEN:211] Arid Mesa +4 [M11:33] Squadron Hawk +1 [SOM:208] Sword of Body and Mind +2 [M11:229] Terramorphic Expanse +4 [ZEN:141] Plated Geopede diff --git a/Mage.Client/src/main/java/mage/client/util/CardViewColorComparator.java b/Mage.Client/src/main/java/mage/client/util/CardViewColorComparator.java new file mode 100644 index 00000000000..eda9ce6ac1f --- /dev/null +++ b/Mage.Client/src/main/java/mage/client/util/CardViewColorComparator.java @@ -0,0 +1,51 @@ +/* + * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ + +package mage.client.util; + +import java.util.Comparator; +import mage.view.CardView; + +/** + * + * @author BetaSteward_at_googlemail.com + */ +public class CardViewColorComparator implements Comparator { + + @Override + public int compare(CardView o1, CardView o2) { + int val = o1.getColor().compareTo(o2.getColor()); + if (val == 0) { + return o1.getName().compareTo(o2.getName()); + } + else { + return val; + } + } + +} \ No newline at end of file diff --git a/Mage.Client/src/main/java/mage/client/util/CardViewCostComparator.java b/Mage.Client/src/main/java/mage/client/util/CardViewCostComparator.java new file mode 100644 index 00000000000..95d72a7f9a7 --- /dev/null +++ b/Mage.Client/src/main/java/mage/client/util/CardViewCostComparator.java @@ -0,0 +1,51 @@ +/* + * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ + +package mage.client.util; + +import java.util.Comparator; +import mage.view.CardView; + +/** + * + * @author BetaSteward_at_googlemail.com + */ +public class CardViewCostComparator implements Comparator { + + @Override + public int compare(CardView o1, CardView o2) { + int val = Integer.valueOf(o1.getConvertedManaCost()).compareTo(Integer.valueOf(o2.getConvertedManaCost())); + if (val == 0) { + return o1.getName().compareTo(o2.getName()); + } + else { + return val; + } + } + +} diff --git a/Mage.Client/src/main/java/mage/client/util/CardViewNameComparator.java b/Mage.Client/src/main/java/mage/client/util/CardViewNameComparator.java new file mode 100644 index 00000000000..1d7a5ba6014 --- /dev/null +++ b/Mage.Client/src/main/java/mage/client/util/CardViewNameComparator.java @@ -0,0 +1,45 @@ +/* + * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ + +package mage.client.util; + +import java.util.Comparator; +import mage.view.CardView; + +/** + * + * @author BetaSteward_at_googlemail.com + */ +public class CardViewNameComparator implements Comparator { + + @Override + public int compare(CardView o1, CardView o2) { + return o1.getName().compareTo(o2.getName()); + } + +} \ No newline at end of file diff --git a/Mage.Client/src/main/java/mage/client/util/CardViewRarityComparator.java b/Mage.Client/src/main/java/mage/client/util/CardViewRarityComparator.java new file mode 100644 index 00000000000..64f934c3711 --- /dev/null +++ b/Mage.Client/src/main/java/mage/client/util/CardViewRarityComparator.java @@ -0,0 +1,51 @@ +/* + * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ + +package mage.client.util; + +import java.util.Comparator; +import mage.view.CardView; + +/** + * + * @author BetaSteward_at_googlemail.com + */ +public class CardViewRarityComparator implements Comparator { + + @Override + public int compare(CardView o1, CardView o2) { + int val = o1.getRarity().compareTo(o2.getRarity()); + if (val == 0) { + return o1.getName().compareTo(o2.getName()); + } + else { + return val; + } + } + +} \ No newline at end of file diff --git a/Mage.Server/src/main/java/mage/server/TableController.java b/Mage.Server/src/main/java/mage/server/TableController.java index ff58f76c09c..7cad5bf66d0 100644 --- a/Mage.Server/src/main/java/mage/server/TableController.java +++ b/Mage.Server/src/main/java/mage/server/TableController.java @@ -369,7 +369,7 @@ public class TableController { private Game loadGame() { try{ - InputStream file = new FileInputStream("saved/" + match.getGame().toString() + ".game"); + InputStream file = new FileInputStream("saved/" + match.getGame().getId().toString() + ".game"); InputStream buffer = new BufferedInputStream(file); ObjectInput input = new CopierObjectInputStream(Main.classLoader, new GZIPInputStream(buffer)); try { diff --git a/Mage/src/mage/game/GameImpl.java b/Mage/src/mage/game/GameImpl.java index e02ccec4edb..9ae4963926b 100644 --- a/Mage/src/mage/game/GameImpl.java +++ b/Mage/src/mage/game/GameImpl.java @@ -322,9 +322,6 @@ public abstract class GameImpl> implements Game, Serializa } protected void init(UUID choosingPlayerId, boolean testMode) { - for (Player player: state.getPlayers().values()) { - player.init(this, testMode); - } for (Player player: state.getPlayers().values()) { player.beginTurn(this); } diff --git a/Mage/src/mage/game/match/MatchImpl.java b/Mage/src/mage/game/match/MatchImpl.java index c6b5370a78f..b207e6b0c02 100644 --- a/Mage/src/mage/game/match/MatchImpl.java +++ b/Mage/src/mage/game/match/MatchImpl.java @@ -124,6 +124,7 @@ public abstract class MatchImpl implements Match { protected void initGame(Game game) throws GameException { for (MatchPlayer matchPlayer: this.players) { + matchPlayer.getPlayer().init(game); game.loadCards(matchPlayer.getDeck().getCards(), matchPlayer.getPlayer().getId()); game.loadCards(matchPlayer.getDeck().getSideboard(), matchPlayer.getPlayer().getId()); game.addPlayer(matchPlayer.getPlayer(), matchPlayer.getDeck());