diff --git a/.gitignore b/.gitignore index e30c48c6d6..b7e5239232 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ Mage.Plugins/Mage.Rating.Plugin/target Mage.Server.Console/target/ Mage.Server.Plugins/Mage.Deck.Constructed/target Mage.Server.Plugins/Mage.Deck.Limited/target +Mage.Server.Plugins/Mage.Game.CommanderDuel/target Mage.Server.Plugins/Mage.Game.FreeForAll/target Mage.Server.Plugins/Mage.Game.TwoPlayerDuel/target Mage.Server.Plugins/Mage.Player.AI/target diff --git a/Mage.Server.Plugins/Mage.Game.CommanderDuel/pom.xml b/Mage.Server.Plugins/Mage.Game.CommanderDuel/pom.xml new file mode 100644 index 0000000000..f611af94a8 --- /dev/null +++ b/Mage.Server.Plugins/Mage.Game.CommanderDuel/pom.xml @@ -0,0 +1,50 @@ + + + + 4.0.0 + + + org.mage + mage-server-plugins + 0.10.1 + + + mage-game-commanderduel + jar + Mage Game Commander Two Player + + + + ${project.groupId} + mage + ${project.version} + + + + + src + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.6 + 1.6 + + + + maven-resources-plugin + + UTF-8 + + + + + + mage-game-commanderduel + + + + + diff --git a/Mage.Server.Plugins/Mage.Game.CommanderDuel/src/mage/game/CommanderDuel.java b/Mage.Server.Plugins/Mage.Game.CommanderDuel/src/mage/game/CommanderDuel.java new file mode 100644 index 0000000000..9e8fb5af53 --- /dev/null +++ b/Mage.Server.Plugins/Mage.Game.CommanderDuel/src/mage/game/CommanderDuel.java @@ -0,0 +1,100 @@ +/* +* Copyright 2010 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.game; + +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; +import mage.Constants.MultiplayerAttackOption; +import mage.Constants.PhaseStep; +import mage.Constants.RangeOfInfluence; +import mage.game.match.MatchType; +import mage.game.turn.TurnMod; + +public class CommanderDuel extends GameImpl { + + public CommanderDuel(MultiplayerAttackOption attackOption, RangeOfInfluence range) { + super(attackOption, range); + } + + public CommanderDuel(final CommanderDuel game) { + super(game); + } + + @Override + public MatchType getGameType() { + return new CommanderDuelType(); + } + + @Override + public int getNumPlayers() { + return 2; + } + + // MTG Rules 20121001 + // 903.7. Once the starting player has been determined, each player sets his or her life total to 40 and + // draws a hand of seven cards. + @Override + public int getLife() { + return 40; + } + + @Override + protected void init(UUID choosingPlayerId, GameOptions gameOptions) { + super.init(choosingPlayerId, gameOptions); + state.getTurnMods().add(new TurnMod(startingPlayerId, PhaseStep.DRAW)); + } + + @Override + public void quit(UUID playerId) { + super.quit(playerId); + end(); + } + + @Override + public Set getOpponents(UUID playerId) { + Set opponents = new HashSet(); + for (UUID opponentId: this.getPlayer(playerId).getInRange()) { + if (!opponentId.equals(playerId)) + opponents.add(opponentId); + } + return opponents; + } + + @Override + public void leave(UUID playerId) { + + } + + @Override + public CommanderDuel copy() { + return new CommanderDuel(this); + } + +} diff --git a/Mage.Server.Plugins/Mage.Game.CommanderDuel/src/mage/game/CommanderDuelMatch.java b/Mage.Server.Plugins/Mage.Game.CommanderDuel/src/mage/game/CommanderDuelMatch.java new file mode 100644 index 0000000000..2ce2275b4d --- /dev/null +++ b/Mage.Server.Plugins/Mage.Game.CommanderDuel/src/mage/game/CommanderDuelMatch.java @@ -0,0 +1,51 @@ +/* + * Copyright 2010 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.game; + +import mage.game.match.MatchImpl; +import mage.game.match.MatchOptions; + +/** + * + * @author BetaSteward_at_googlemail.com + */ +public class CommanderDuelMatch extends MatchImpl { + + public CommanderDuelMatch(MatchOptions options) { + super(options); + } + + @Override + public void startGame() throws GameException { + CommanderDuel game = new CommanderDuel(options.getAttackOption(), options.getRange()); + initGame(game); + games.add(game); + } + +} diff --git a/Mage.Server.Plugins/Mage.Game.CommanderDuel/src/mage/game/CommanderDuelType.java b/Mage.Server.Plugins/Mage.Game.CommanderDuel/src/mage/game/CommanderDuelType.java new file mode 100644 index 0000000000..650f124fa2 --- /dev/null +++ b/Mage.Server.Plugins/Mage.Game.CommanderDuel/src/mage/game/CommanderDuelType.java @@ -0,0 +1,57 @@ +/* + * Copyright 2010 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.game; + +import mage.game.match.MatchType; + +/** + * + * @author BetaSteward_at_googlemail.com + */ +public class CommanderDuelType extends MatchType { + + public CommanderDuelType() { + this.name = "Commander Duel"; + this.maxPlayers = 2; + this.minPlayers = 2; + this.numTeams = 0; + this.useAttackOption = false; + this.useRange = false; + } + + protected CommanderDuelType(final CommanderDuelType matchType) { + super(matchType); + } + + @Override + public CommanderDuelType copy() { + return new CommanderDuelType(this); + } + +} diff --git a/Mage.Server.Plugins/pom.xml b/Mage.Server.Plugins/pom.xml index bffaeef6ad..452026d42b 100644 --- a/Mage.Server.Plugins/pom.xml +++ b/Mage.Server.Plugins/pom.xml @@ -17,6 +17,7 @@ Mage.Deck.Constructed Mage.Deck.Limited + Mage.Game.CommanderDuel Mage.Game.FreeForAll Mage.Game.TwoPlayerDuel Mage.Player.AI diff --git a/Mage.Server/config/config.xml b/Mage.Server/config/config.xml index 5c5f7b2783..58521a754e 100644 --- a/Mage.Server/config/config.xml +++ b/Mage.Server/config/config.xml @@ -10,6 +10,7 @@ + diff --git a/Mage.Server/pom.xml b/Mage.Server/pom.xml index e59adc3e5f..b34bf7ac80 100644 --- a/Mage.Server/pom.xml +++ b/Mage.Server/pom.xml @@ -63,6 +63,12 @@ ${project.version} runtime + + ${project.groupId} + mage-game-commanderduel + ${project.version} + runtime + ${project.groupId} mage-game-freeforall diff --git a/Mage.Server/release/config/config.xml b/Mage.Server/release/config/config.xml index a99664f76a..8830a91627 100644 --- a/Mage.Server/release/config/config.xml +++ b/Mage.Server/release/config/config.xml @@ -8,6 +8,7 @@ + diff --git a/Mage.Server/src/main/assembly/distribution.xml b/Mage.Server/src/main/assembly/distribution.xml index 68c815c18e..3d02dc94d4 100644 --- a/Mage.Server/src/main/assembly/distribution.xml +++ b/Mage.Server/src/main/assembly/distribution.xml @@ -19,6 +19,7 @@ org.mage:mage-deck-constructed org.mage:mage-deck-limited + org.mage:mage-game-commanderduel org.mage:mage-game-freeforall org.mage:mage-game-twoplayerduel org.mage:mage-player-aiminimax @@ -35,6 +36,7 @@ org.mage:mage-server org.mage:mage-deck-constructed org.mage:mage-deck-limited + org.mage:mage-game-commanderduel org.mage:mage-game-freeforall org.mage:mage-game-twoplayerduel org.mage:mage-player-aiminimax