From 060ebe655e5446999c6c60a6acf3e399681b5cf7 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Tue, 30 Apr 2019 16:33:41 +0400 Subject: [PATCH] * Added new game type: Freeform Commander Two Player Duel (#5771) --- .../mage/client/dialog/NewTableDialog.java | 3 +- .../Mage.Game.FreeformCommanderDuel/pom.xml | 50 +++++++++++++++++++ .../src/mage/game/FreeformCommanderDuel.java | 36 +++++++++++++ .../mage/game/FreeformCommanderDuelMatch.java | 31 ++++++++++++ .../mage/game/FreeformCommanderDuelType.java | 29 +++++++++++ Mage.Server.Plugins/pom.xml | 5 +- Mage.Server/config/config.xml | 1 + Mage.Server/pom.xml | 6 +++ Mage.Server/release/config/config.xml | 1 + 9 files changed, 159 insertions(+), 3 deletions(-) create mode 100644 Mage.Server.Plugins/Mage.Game.FreeformCommanderDuel/pom.xml create mode 100644 Mage.Server.Plugins/Mage.Game.FreeformCommanderDuel/src/mage/game/FreeformCommanderDuel.java create mode 100644 Mage.Server.Plugins/Mage.Game.FreeformCommanderDuel/src/mage/game/FreeformCommanderDuelMatch.java create mode 100644 Mage.Server.Plugins/Mage.Game.FreeformCommanderDuel/src/mage/game/FreeformCommanderDuelType.java diff --git a/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java b/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java index c488ff9621..1fece57129 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java @@ -683,8 +683,9 @@ public class NewTableDialog extends MageDialog { return false; } break; + case "Freeform Commander Two Player Duel": case "Freeform Commander Free For All": - if (!options.getDeckType().equals("Variant Magic - Freeform Commander")){ + if (!options.getDeckType().equals("Variant Magic - Freeform Commander")) { JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Deck type Freeform Commander needs also a Freeform Commander game type", "Error", JOptionPane.ERROR_MESSAGE); return false; } diff --git a/Mage.Server.Plugins/Mage.Game.FreeformCommanderDuel/pom.xml b/Mage.Server.Plugins/Mage.Game.FreeformCommanderDuel/pom.xml new file mode 100644 index 0000000000..96f60f12a1 --- /dev/null +++ b/Mage.Server.Plugins/Mage.Game.FreeformCommanderDuel/pom.xml @@ -0,0 +1,50 @@ + + + + 4.0.0 + + + org.mage + mage-server-plugins + 1.4.35 + + + mage-game-freeformcommanderduel + jar + Mage Game Freeform Commander Two Player + + + + ${project.groupId} + mage + ${project.version} + + + + + src + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + maven-resources-plugin + + UTF-8 + + + + + + mage-game-freeformcommanderduel + + + + + diff --git a/Mage.Server.Plugins/Mage.Game.FreeformCommanderDuel/src/mage/game/FreeformCommanderDuel.java b/Mage.Server.Plugins/Mage.Game.FreeformCommanderDuel/src/mage/game/FreeformCommanderDuel.java new file mode 100644 index 0000000000..d57f520f07 --- /dev/null +++ b/Mage.Server.Plugins/Mage.Game.FreeformCommanderDuel/src/mage/game/FreeformCommanderDuel.java @@ -0,0 +1,36 @@ +package mage.game; + +import mage.constants.MultiplayerAttackOption; +import mage.constants.RangeOfInfluence; +import mage.game.match.MatchType; +import mage.game.mulligan.Mulligan; + +/** + * @author JayDi85 + */ +public class FreeformCommanderDuel extends GameCommanderImpl { + + public FreeformCommanderDuel(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife) { + super(attackOption, range, mulligan, startLife); + } + + public FreeformCommanderDuel(final FreeformCommanderDuel game) { + super(game); + } + + @Override + public MatchType getGameType() { + return new FreeformCommanderDuelType(); + } + + @Override + public int getNumPlayers() { + return 2; + } + + @Override + public FreeformCommanderDuel copy() { + return new FreeformCommanderDuel(this); + } + +} diff --git a/Mage.Server.Plugins/Mage.Game.FreeformCommanderDuel/src/mage/game/FreeformCommanderDuelMatch.java b/Mage.Server.Plugins/Mage.Game.FreeformCommanderDuel/src/mage/game/FreeformCommanderDuelMatch.java new file mode 100644 index 0000000000..1f3e141929 --- /dev/null +++ b/Mage.Server.Plugins/Mage.Game.FreeformCommanderDuel/src/mage/game/FreeformCommanderDuelMatch.java @@ -0,0 +1,31 @@ +package mage.game; + +import mage.game.match.MatchImpl; +import mage.game.match.MatchOptions; +import mage.game.mulligan.Mulligan; + +/** + * @author JayDi85 + */ +public class FreeformCommanderDuelMatch extends MatchImpl { + + public FreeformCommanderDuelMatch(MatchOptions options) { + super(options); + } + + @Override + public void startGame() throws GameException { + int startLife = 20; + boolean alsoHand = true; + boolean checkCommanderDamage = true; + + Mulligan mulligan = options.getMulliganType().getMulligan(options.getFreeMulligans()); + FreeformCommanderDuel game = new FreeformCommanderDuel(options.getAttackOption(), options.getRange(), mulligan, startLife); + game.setCheckCommanderDamage(checkCommanderDamage); + game.setStartMessage(this.createGameStartMessage()); + game.setAlsoHand(alsoHand); + game.setAlsoLibrary(true); + initGame(game); + games.add(game); + } +} diff --git a/Mage.Server.Plugins/Mage.Game.FreeformCommanderDuel/src/mage/game/FreeformCommanderDuelType.java b/Mage.Server.Plugins/Mage.Game.FreeformCommanderDuel/src/mage/game/FreeformCommanderDuelType.java new file mode 100644 index 0000000000..586617ee51 --- /dev/null +++ b/Mage.Server.Plugins/Mage.Game.FreeformCommanderDuel/src/mage/game/FreeformCommanderDuelType.java @@ -0,0 +1,29 @@ +package mage.game; + +import mage.game.match.MatchType; + +/** + * @author JayDi85 + */ +public class FreeformCommanderDuelType extends MatchType { + + public FreeformCommanderDuelType() { + this.name = "Freeform Commander Two Player Duel"; + this.maxPlayers = 2; + this.minPlayers = 2; + this.numTeams = 0; + this.useAttackOption = false; + this.useRange = false; + this.sideboardingAllowed = false; + } + + protected FreeformCommanderDuelType(final FreeformCommanderDuelType matchType) { + super(matchType); + } + + @Override + public FreeformCommanderDuelType copy() { + return new FreeformCommanderDuelType(this); + } + +} diff --git a/Mage.Server.Plugins/pom.xml b/Mage.Server.Plugins/pom.xml index cf0611b51e..248976e212 100644 --- a/Mage.Server.Plugins/pom.xml +++ b/Mage.Server.Plugins/pom.xml @@ -25,8 +25,9 @@ Mage.Game.TinyLeadersDuel Mage.Game.CanadianHighlanderDuel Mage.Game.PennyDreadfulCommanderFreeForAll - Mage.Game.FreeformCommanderFreeForAll - Mage.Game.BrawlDuel + Mage.Game.FreeformCommanderDuel + Mage.Game.FreeformCommanderFreeForAll + Mage.Game.BrawlDuel Mage.Game.BrawlFreeForAll Mage.Game.TwoPlayerDuel Mage.Player.AI diff --git a/Mage.Server/config/config.xml b/Mage.Server/config/config.xml index 0475c3cbe6..aa2223ceab 100644 --- a/Mage.Server/config/config.xml +++ b/Mage.Server/config/config.xml @@ -79,6 +79,7 @@ + diff --git a/Mage.Server/pom.xml b/Mage.Server/pom.xml index 9386469d6c..72d63a77d6 100644 --- a/Mage.Server/pom.xml +++ b/Mage.Server/pom.xml @@ -184,6 +184,12 @@ ${project.version} runtime + + ${project.groupId} + mage-game-freeformcommanderduel + ${project.version} + runtime + ${project.groupId} diff --git a/Mage.Server/release/config/config.xml b/Mage.Server/release/config/config.xml index 2a294b3093..bea0cd3d65 100644 --- a/Mage.Server/release/config/config.xml +++ b/Mage.Server/release/config/config.xml @@ -73,6 +73,7 @@ +