Add mulligan options to NewTableDialog, passing mulligan information to games.

This commit is contained in:
John Hitchings 2019-03-19 06:00:22 -07:00
parent 7885a42168
commit 4a232b148c
51 changed files with 532 additions and 364 deletions

View file

@ -24,6 +24,18 @@
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0"> <Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="btnOK" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="btnCancel" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="jSeparator2" alignment="1" max="32767" attributes="0"/>
<Component id="player1Panel" alignment="0" max="32767" attributes="0"/>
<Component id="pnlOtherPlayers" alignment="1" max="32767" attributes="0"/>
<Component id="jSeparator1" alignment="0" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="1" attributes="0"> <Group type="103" groupAlignment="1" attributes="0">
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
@ -45,7 +57,6 @@
<Component id="chkSpectatorsAllowed" min="-2" max="-2" attributes="0"/> <Component id="chkSpectatorsAllowed" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="13" max="-2" attributes="0"/> <EmptySpace min="-2" pref="13" max="-2" attributes="0"/>
<Component id="chkPlaneChase" min="-2" max="-2" attributes="0"/> <Component id="chkPlaneChase" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="13" max="-2" attributes="0"/>
</Group> </Group>
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<Component id="txtName" min="-2" pref="178" max="-2" attributes="0"/> <Component id="txtName" min="-2" pref="178" max="-2" attributes="0"/>
@ -77,12 +88,6 @@
</Group> </Group>
<Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="btnOK" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="btnCancel" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="lblNumPlayers" min="-2" max="-2" attributes="0"/> <Component id="lblNumPlayers" min="-2" max="-2" attributes="0"/>
@ -108,14 +113,18 @@
</Group> </Group>
<EmptySpace type="separate" max="-2" attributes="0"/> <EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="lblNumWins" min="-2" max="-2" attributes="0"/>
<Component id="spnNumWins" alignment="0" min="-2" pref="50" max="-2" attributes="0"/> <Component id="spnNumWins" alignment="0" min="-2" pref="50" max="-2" attributes="0"/>
<Component id="lblNumWins" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="lblMullgian" min="-2" max="-2" attributes="0"/>
<Component id="cbMulligan" min="-2" pref="140" max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
<Component id="jSeparator2" alignment="1" max="32767" attributes="0"/> </Group>
<Component id="player1Panel" alignment="0" max="32767" attributes="0"/> <EmptySpace min="-2" pref="13" max="-2" attributes="0"/>
<Component id="pnlOtherPlayers" alignment="1" max="32767" attributes="0"/> </Group>
<Component id="jSeparator1" alignment="0" max="32767" attributes="0"/>
</Group> </Group>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
</Group> </Group>
@ -174,7 +183,10 @@
</Group> </Group>
<Group type="102" alignment="1" attributes="0"> <Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="lblSkillLevel" alignment="0" min="-2" max="-2" attributes="0"/> <Group type="103" alignment="0" groupAlignment="3" attributes="0">
<Component id="lblSkillLevel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lblMullgian" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="lblNumWins" alignment="0" min="-2" max="-2" attributes="0"/> <Component id="lblNumWins" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0"> <Group type="103" groupAlignment="3" attributes="0">
<Component id="lblRange" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="lblRange" alignment="3" min="-2" max="-2" attributes="0"/>
@ -187,6 +199,7 @@
<Component id="cbAttackOption" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="cbAttackOption" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="cbSkillLevel" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="cbSkillLevel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spnNumWins" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="spnNumWins" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="cbMulligan" alignment="3" min="-2" max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
</Group> </Group>
@ -293,7 +306,6 @@
<Property name="toolTipText" type="java.lang.String" value="Use the PlaneChase variant for your game."/> <Property name="toolTipText" type="java.lang.String" value="Use the PlaneChase variant for your game."/>
</Properties> </Properties>
</Component> </Component>
<Component class="javax.swing.JSpinner" name="spnFreeMulligans"> <Component class="javax.swing.JSpinner" name="spnFreeMulligans">
</Component> </Component>
<Component class="javax.swing.JLabel" name="lblNumPlayers"> <Component class="javax.swing.JLabel" name="lblNumPlayers">
@ -432,5 +444,32 @@
</Component> </Component>
<Component class="javax.swing.JSpinner" name="spnEdhPowerLevel"> <Component class="javax.swing.JSpinner" name="spnEdhPowerLevel">
</Component> </Component>
<Component class="javax.swing.JComboBox" name="cbMulligan">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="0"/>
</Property>
<Property name="toolTipText" type="java.lang.String" value="Selections the type of mulligan for games."/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="lblMullgian">
<Properties>
<Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="spnNumWins"/>
</Property>
<Property name="text" type="java.lang.String" value="Mulligan"/>
<Property name="toolTipText" type="java.lang.String" value="What style of mulligan?"/>
</Properties>
<AccessibilityProperties>
<Property name="AccessibleContext.accessibleName" type="java.lang.String" value="Mullgian"/>
<Property name="AccessibleContext.accessibleDescription" type="java.lang.String" value="What style of mulligan?"/>
</AccessibilityProperties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_SerializeTo" type="java.lang.String" value="NewTableDialog_lblMullgian"/>
</AuxValues>
</Component>
</SubComponents> </SubComponents>
</Form> </Form>

View file

@ -1,13 +1,6 @@
package mage.client.dialog; package mage.client.dialog;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import javax.swing.*;
import mage.cards.decks.importer.DeckImporter; import mage.cards.decks.importer.DeckImporter;
import mage.client.MageFrame; import mage.client.MageFrame;
import mage.client.SessionHandler; import mage.client.SessionHandler;
@ -21,11 +14,19 @@ import mage.constants.MultiplayerAttackOption;
import mage.constants.RangeOfInfluence; import mage.constants.RangeOfInfluence;
import mage.constants.SkillLevel; import mage.constants.SkillLevel;
import mage.game.match.MatchOptions; import mage.game.match.MatchOptions;
import mage.game.mulligan.MulliganType;
import mage.players.PlayerType; import mage.players.PlayerType;
import mage.view.GameTypeView; import mage.view.GameTypeView;
import mage.view.TableView; import mage.view.TableView;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import javax.swing.*;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/** /**
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
@ -77,6 +78,7 @@ public class NewTableDialog extends MageDialog {
lblGameType = new javax.swing.JLabel(); lblGameType = new javax.swing.JLabel();
cbGameType = new javax.swing.JComboBox(); cbGameType = new javax.swing.JComboBox();
chkRollbackTurnsAllowed = new javax.swing.JCheckBox(); chkRollbackTurnsAllowed = new javax.swing.JCheckBox();
lblFreeMulligans = new javax.swing.JLabel();
chkSpectatorsAllowed = new javax.swing.JCheckBox(); chkSpectatorsAllowed = new javax.swing.JCheckBox();
chkPlaneChase = new javax.swing.JCheckBox(); chkPlaneChase = new javax.swing.JCheckBox();
chkRated = new javax.swing.JCheckBox(); chkRated = new javax.swing.JCheckBox();
@ -109,6 +111,8 @@ public class NewTableDialog extends MageDialog {
spnQuitRatio = new javax.swing.JSpinner(); spnQuitRatio = new javax.swing.JSpinner();
spnMinimumRating = new javax.swing.JSpinner(); spnMinimumRating = new javax.swing.JSpinner();
spnEdhPowerLevel = new javax.swing.JSpinner(); spnEdhPowerLevel = new javax.swing.JSpinner();
lblMullgian = new javax.swing.JLabel();
cbMulligan = new javax.swing.JComboBox<>();
setTitle("New Table"); setTitle("New Table");
@ -121,31 +125,36 @@ public class NewTableDialog extends MageDialog {
lbDeckType.setText("Deck Type:"); lbDeckType.setText("Deck Type:");
lbTimeLimit.setText("Time Limit:"); lbTimeLimit.setText("Time Limit:");
lbTimeLimit.setToolTipText("The active time a player may use to finish the match. If their time runs out, the player looses the current game."); lbTimeLimit.setToolTipText("The active time a player may use to finish the match. If his or her time runs out, the player looses the current game.");
lblGameType.setText("Game Type:"); lblGameType.setText("Game Type:");
cbGameType.addActionListener(evt -> cbGameTypeActionPerformed(evt)); cbGameType.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cbGameTypeActionPerformed(evt);
}
});
chkRollbackTurnsAllowed.setText("Allow rollbacks"); chkRollbackTurnsAllowed.setText("Allow rollbacks");
chkRollbackTurnsAllowed.setToolTipText("<HTML>Allow to rollback to the start of previous turns<br>\nif all players agree.\n"); chkRollbackTurnsAllowed.setToolTipText("<HTML>Allow to rollback to the start of previous turns<br>\nif all players agree.\n");
chkSpectatorsAllowed.setText("Allow Spectators");
chkSpectatorsAllowed.setToolTipText("<HTML>Allow spectators to watch.\n");
chkPlaneChase.setText("Use PlaneChase");
chkPlaneChase.setToolTipText("<HTML>Use planechase variant (suitable for all game types).\n");
chkRated.setText("Rated");
chkRated.setToolTipText("Indicates if matches will be rated.");
lblFreeMulligans.setText("Free Mulligans:"); lblFreeMulligans.setText("Free Mulligans:");
lblFreeMulligans.setToolTipText("The number of mulligans a player can use without decreasing the number of drawn cards."); lblFreeMulligans.setToolTipText("The number of mulligans a player can use without decreasing the number of drawn cards.");
chkSpectatorsAllowed.setText("Spectators allowed");
chkSpectatorsAllowed.setToolTipText("Allow spectators to view your game.");
chkPlaneChase.setText("Use PlaneChase");
chkPlaneChase.setToolTipText("Use the PlaneChase variant for your game.");
lblNumPlayers.setLabelFor(spnNumPlayers); lblNumPlayers.setLabelFor(spnNumPlayers);
lblNumPlayers.setText("Players"); lblNumPlayers.setText("Players");
spnNumPlayers.addChangeListener(evt -> numPlayersChanged(evt)); spnNumPlayers.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
numPlayersChanged(evt);
}
});
lblRange.setLabelFor(cbRange); lblRange.setLabelFor(cbRange);
lblRange.setText("Range of Influence"); lblRange.setText("Range of Influence");
@ -166,7 +175,11 @@ public class NewTableDialog extends MageDialog {
lblNumWins.setText("Wins"); lblNumWins.setText("Wins");
lblNumWins.setToolTipText("How many games has a player to win to win the match."); lblNumWins.setToolTipText("How many games has a player to win to win the match.");
spnNumWins.addChangeListener(evt -> spnNumWinsnumPlayersChanged(evt)); spnNumWins.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
spnNumWinsnumPlayersChanged(evt);
}
});
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
jLabel1.setText("Player 1 (You)"); jLabel1.setText("Player 1 (You)");
@ -177,25 +190,28 @@ public class NewTableDialog extends MageDialog {
pnlOtherPlayers.setLayout(new java.awt.GridLayout(0, 1)); pnlOtherPlayers.setLayout(new java.awt.GridLayout(0, 1));
btnOK.setText("OK"); btnOK.setText("OK");
btnOK.addActionListener(evt -> btnOKActionPerformed(evt)); btnOK.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnPreviousConfiguration1.setText("M1"); btnOKActionPerformed(evt);
btnPreviousConfiguration1.setToolTipText("Load saved Match configuration #1"); }
btnPreviousConfiguration1.addActionListener(evt -> btnPreviousConfigurationActionPerformed(evt, 1)); });
btnPreviousConfiguration2.setText("M2");
btnPreviousConfiguration2.setToolTipText("Load saved Match configuration #2");
btnPreviousConfiguration2.addActionListener(evt -> btnPreviousConfigurationActionPerformed(evt, 2));
btnCancel.setText("Cancel"); btnCancel.setText("Cancel");
btnCancel.addActionListener(evt -> btnCancelActionPerformed(evt)); btnCancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnCancelActionPerformed(evt);
}
});
lblQuitRatio.setText("Allowed quit %"); lblQuitRatio.setText("Allowed quit %");
lblMinimumRating.setText("Minimum rating");
lblEdhPowerLevel.setText("EDH power level"); lblEdhPowerLevel.setText("EDH power level");
spnQuitRatio.setToolTipText("Players with quit % more than this value can't join this table"); cbMulligan.setToolTipText("Selections the type of mulligan for games.");
spnMinimumRating.setToolTipText("Players with rating less than this value can't join this table");
spnEdhPowerLevel.setToolTipText("Players with decks with a higher power level can't join this table"); lblMullgian.setLabelFor(spnNumWins);
lblMullgian.setText("Mulligan");
lblMullgian.setToolTipText("What style of mulligan?");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout); getContentPane().setLayout(layout);
@ -203,6 +219,17 @@ public class NewTableDialog extends MageDialog {
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap() .addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(btnOK)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnCancel))
.addComponent(jSeparator2)
.addComponent(player1Panel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(pnlOtherPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -210,7 +237,7 @@ public class NewTableDialog extends MageDialog {
.addComponent(lbDeckType) .addComponent(lbDeckType)
.addComponent(lblGameType)) .addComponent(lblGameType))
.addGap(6, 6, 6) .addGap(6, 6, 6)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addComponent(cbGameType, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(cbGameType, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18) .addGap(18, 18, 18)
@ -219,7 +246,7 @@ public class NewTableDialog extends MageDialog {
.addComponent(lblFreeMulligans) .addComponent(lblFreeMulligans)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spnFreeMulligans, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(spnFreeMulligans, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(13, 13, 13) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(chkSpectatorsAllowed) .addComponent(chkSpectatorsAllowed)
.addGap(13, 13, 13) .addGap(13, 13, 13)
.addComponent(chkPlaneChase)) .addComponent(chkPlaneChase))
@ -239,23 +266,16 @@ public class NewTableDialog extends MageDialog {
.addComponent(btnPreviousConfiguration2, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(btnPreviousConfiguration2, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addComponent(cbDeckType, javax.swing.GroupLayout.PREFERRED_SIZE, 332, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(cbDeckType, javax.swing.GroupLayout.PREFERRED_SIZE, 332, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(chkRated)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(lblQuitRatio) .addComponent(lblQuitRatio)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spnQuitRatio, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(spnQuitRatio, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(lblMinimumRating)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spnMinimumRating, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addComponent(lblEdhPowerLevel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spnEdhPowerLevel, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(btnOK)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnCancel))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblNumPlayers) .addComponent(lblNumPlayers)
@ -276,16 +296,13 @@ public class NewTableDialog extends MageDialog {
.addComponent(cbSkillLevel, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE))) .addComponent(cbSkillLevel, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(18, 18, 18) .addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblNumWins) .addComponent(spnNumWins, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spnNumWins, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(lblNumWins))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblEdhPowerLevel) .addComponent(lblMullgian)
.addComponent(spnEdhPowerLevel, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))) .addComponent(cbMulligan, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addComponent(jSeparator2) .addGap(13, 13, 13)))
.addComponent(player1Panel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(pnlOtherPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.LEADING))
.addContainerGap()) .addContainerGap())
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
@ -300,21 +317,20 @@ public class NewTableDialog extends MageDialog {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblName) .addComponent(lblName)
.addComponent(btnPreviousConfiguration1)
.addComponent(btnPreviousConfiguration2)
.addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnPreviousConfiguration1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnPreviousConfiguration2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblPassword) .addComponent(lblPassword)
.addComponent(lbTimeLimit) .addComponent(lbTimeLimit)
.addComponent(cbTimeLimit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(cbTimeLimit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lbDeckType)
.addComponent(cbDeckType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(cbDeckType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(chkRated) .addComponent(lbDeckType)
.addComponent(lblQuitRatio) .addComponent(lblQuitRatio)
.addComponent(spnQuitRatio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(spnQuitRatio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblMinimumRating) .addComponent(lblEdhPowerLevel)
.addComponent(spnMinimumRating, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(spnEdhPowerLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
@ -334,9 +350,10 @@ public class NewTableDialog extends MageDialog {
.addComponent(spnNumPlayers, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(spnNumPlayers, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblSkillLevel) .addComponent(lblSkillLevel)
.addComponent(lblMullgian))
.addComponent(lblNumWins) .addComponent(lblNumWins)
.addComponent(lblEdhPowerLevel)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblRange) .addComponent(lblRange)
.addComponent(lblAttack))) .addComponent(lblAttack)))
@ -346,7 +363,7 @@ public class NewTableDialog extends MageDialog {
.addComponent(cbAttackOption, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(cbAttackOption, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cbSkillLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(cbSkillLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spnNumWins, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(spnNumWins, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spnEdhPowerLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addComponent(cbMulligan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
@ -371,6 +388,9 @@ public class NewTableDialog extends MageDialog {
.addContainerGap(167, Short.MAX_VALUE))) .addContainerGap(167, Short.MAX_VALUE)))
); );
lblMullgian.getAccessibleContext().setAccessibleName("Mullgian");
lblMullgian.getAccessibleContext().setAccessibleDescription("What style of mulligan?");
pack(); pack();
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents
@ -408,6 +428,7 @@ public class NewTableDialog extends MageDialog {
options.setQuitRatio((Integer) this.spnQuitRatio.getValue()); options.setQuitRatio((Integer) this.spnQuitRatio.getValue());
options.setMinimumRating((Integer) this.spnMinimumRating.getValue()); options.setMinimumRating((Integer) this.spnMinimumRating.getValue());
options.setEdhPowerLevel((Integer) this.spnEdhPowerLevel.getValue()); options.setEdhPowerLevel((Integer) this.spnEdhPowerLevel.getValue());
options.setMullgianType((MulliganType) this.cbMulligan.getSelectedItem());
String serverAddress = SessionHandler.getSession().getServerHostname().orElseGet(() -> ""); String serverAddress = SessionHandler.getSession().getServerHostname().orElseGet(() -> "");
options.setBannedUsers(IgnoreList.ignoreList(serverAddress)); options.setBannedUsers(IgnoreList.ignoreList(serverAddress));
if (!checkMatchOptions(options)) { if (!checkMatchOptions(options)) {
@ -596,6 +617,7 @@ public class NewTableDialog extends MageDialog {
cbRange.setModel(new DefaultComboBoxModel(RangeOfInfluence.values())); cbRange.setModel(new DefaultComboBoxModel(RangeOfInfluence.values()));
cbAttackOption.setModel(new DefaultComboBoxModel(MultiplayerAttackOption.values())); cbAttackOption.setModel(new DefaultComboBoxModel(MultiplayerAttackOption.values()));
cbSkillLevel.setModel(new DefaultComboBoxModel(SkillLevel.values())); cbSkillLevel.setModel(new DefaultComboBoxModel(SkillLevel.values()));
cbMulligan.setModel(new DefaultComboBoxModel<MulliganType>(MulliganType.values()));
// Update the existing player panels (neccessary if server was changes = new session) // Update the existing player panels (neccessary if server was changes = new session)
int i = 2; int i = 2;
for (TablePlayerPanel tablePlayerPanel : players) { for (TablePlayerPanel tablePlayerPanel : players) {
@ -763,6 +785,7 @@ public class NewTableDialog extends MageDialog {
private javax.swing.JComboBox cbAttackOption; private javax.swing.JComboBox cbAttackOption;
private javax.swing.JComboBox cbDeckType; private javax.swing.JComboBox cbDeckType;
private javax.swing.JComboBox cbGameType; private javax.swing.JComboBox cbGameType;
private javax.swing.JComboBox<MulliganType> cbMulligan;
private javax.swing.JComboBox cbRange; private javax.swing.JComboBox cbRange;
private javax.swing.JComboBox cbSkillLevel; private javax.swing.JComboBox cbSkillLevel;
private javax.swing.JComboBox cbTimeLimit; private javax.swing.JComboBox cbTimeLimit;
@ -780,6 +803,7 @@ public class NewTableDialog extends MageDialog {
private javax.swing.JLabel lblAttack; private javax.swing.JLabel lblAttack;
private javax.swing.JLabel lblFreeMulligans; private javax.swing.JLabel lblFreeMulligans;
private javax.swing.JLabel lblGameType; private javax.swing.JLabel lblGameType;
private javax.swing.JLabel lblMullgian;
private javax.swing.JLabel lblName; private javax.swing.JLabel lblName;
private javax.swing.JLabel lblNumPlayers; private javax.swing.JLabel lblNumPlayers;
private javax.swing.JLabel lblNumWins; private javax.swing.JLabel lblNumWins;

View file

@ -5,11 +5,12 @@ package mage.game;
import mage.constants.MultiplayerAttackOption; import mage.constants.MultiplayerAttackOption;
import mage.constants.RangeOfInfluence; import mage.constants.RangeOfInfluence;
import mage.game.match.MatchType; import mage.game.match.MatchType;
import mage.game.mulligan.Mulligan;
public class BrawlDuel extends GameCommanderImpl { public class BrawlDuel extends GameCommanderImpl {
public BrawlDuel(MultiplayerAttackOption attackOption, RangeOfInfluence range, int freeMulligans, int startLife) { public BrawlDuel(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife) {
super(attackOption, range, freeMulligans, startLife); super(attackOption, range, mulligan, startLife);
} }
public BrawlDuel(final BrawlDuel game) { public BrawlDuel(final BrawlDuel game) {

View file

@ -3,6 +3,7 @@ package mage.game;
import mage.game.match.MatchImpl; import mage.game.match.MatchImpl;
import mage.game.match.MatchOptions; import mage.game.match.MatchOptions;
import mage.game.mulligan.Mulligan;
/** /**
* *
@ -17,8 +18,8 @@ public class BrawlDuelMatch extends MatchImpl {
@Override @Override
public void startGame() throws GameException { public void startGame() throws GameException {
int startLife = 25; int startLife = 25;
boolean alsoHand = true; Mulligan mulligan = options.getMulliganType().getMulligan(options.getFreeMulligans());
BrawlDuel game = new BrawlDuel(options.getAttackOption(), options.getRange(), options.getFreeMulligans(), startLife); BrawlDuel game = new BrawlDuel(options.getAttackOption(), options.getRange(), mulligan, startLife);
game.setCheckCommanderDamage(false); game.setCheckCommanderDamage(false);
game.setStartMessage(this.createGameStartMessage()); game.setStartMessage(this.createGameStartMessage());
game.setAlsoHand(true); game.setAlsoHand(true);

View file

@ -6,6 +6,7 @@ import java.util.UUID;
import mage.constants.MultiplayerAttackOption; import mage.constants.MultiplayerAttackOption;
import mage.constants.RangeOfInfluence; import mage.constants.RangeOfInfluence;
import mage.game.match.MatchType; import mage.game.match.MatchType;
import mage.game.mulligan.Mulligan;
/** /**
* *
@ -15,8 +16,8 @@ public class BrawlFreeForAll extends GameCommanderImpl {
private int numPlayers; private int numPlayers;
public BrawlFreeForAll(MultiplayerAttackOption attackOption, RangeOfInfluence range, int freeMulligans, int startLife) { public BrawlFreeForAll(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife) {
super(attackOption, range, freeMulligans, startLife); super(attackOption, range, mulligan, startLife);
} }
public BrawlFreeForAll(final BrawlFreeForAll game) { public BrawlFreeForAll(final BrawlFreeForAll game) {

View file

@ -3,6 +3,7 @@ package mage.game;
import mage.game.match.MatchImpl; import mage.game.match.MatchImpl;
import mage.game.match.MatchOptions; import mage.game.match.MatchOptions;
import mage.game.mulligan.Mulligan;
/** /**
* *
@ -17,10 +18,10 @@ public class BrawlFreeForAllMatch extends MatchImpl {
@Override @Override
public void startGame() throws GameException { public void startGame() throws GameException {
int startLife = 30; int startLife = 30;
boolean alsoHand = true; Mulligan mulligan = options.getMulliganType().getMulligan(options.getFreeMulligans());
BrawlFreeForAll game = new BrawlFreeForAll(options.getAttackOption(), options.getRange(), options.getFreeMulligans(), startLife); BrawlFreeForAll game = new BrawlFreeForAll(options.getAttackOption(), options.getRange(), mulligan, startLife);
game.setStartMessage(this.createGameStartMessage()); game.setStartMessage(this.createGameStartMessage());
game.setAlsoHand(alsoHand); game.setAlsoHand(true);
game.setCheckCommanderDamage(false); game.setCheckCommanderDamage(false);
game.setAlsoLibrary(true); game.setAlsoLibrary(true);
initGame(game); initGame(game);

View file

@ -5,11 +5,12 @@ package mage.game;
import mage.constants.MultiplayerAttackOption; import mage.constants.MultiplayerAttackOption;
import mage.constants.RangeOfInfluence; import mage.constants.RangeOfInfluence;
import mage.game.match.MatchType; import mage.game.match.MatchType;
import mage.game.mulligan.Mulligan;
public class CanadianHighlanderDuel extends GameCanadianHighlanderImpl { public class CanadianHighlanderDuel extends GameCanadianHighlanderImpl {
public CanadianHighlanderDuel(MultiplayerAttackOption attackOption, RangeOfInfluence range, int freeMulligans, int startLife) { public CanadianHighlanderDuel(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife) {
super(attackOption, range, freeMulligans, startLife); super(attackOption, range, mulligan, startLife);
} }
public CanadianHighlanderDuel(final CanadianHighlanderDuel game) { public CanadianHighlanderDuel(final CanadianHighlanderDuel game) {

View file

@ -3,6 +3,9 @@ package mage.game;
import mage.game.match.MatchImpl; import mage.game.match.MatchImpl;
import mage.game.match.MatchOptions; import mage.game.match.MatchOptions;
import mage.game.mulligan.Mulligan;
import static mage.game.mulligan.MulliganType.CANADIAN_HIGHLANDER;
/** /**
* *
@ -17,7 +20,8 @@ public class CanadianHighlanderDuelMatch extends MatchImpl {
@Override @Override
public void startGame() throws GameException { public void startGame() throws GameException {
int startLife = 20; int startLife = 20;
CanadianHighlanderDuel game = new CanadianHighlanderDuel(options.getAttackOption(), options.getRange(), options.getFreeMulligans(), startLife); Mulligan mulligan = options.getMulliganType().orDefault(CANADIAN_HIGHLANDER).getMulligan(options.getFreeMulligans());
CanadianHighlanderDuel game = new CanadianHighlanderDuel(options.getAttackOption(), options.getRange(), mulligan, startLife);
game.setStartMessage(this.createGameStartMessage()); game.setStartMessage(this.createGameStartMessage());
initGame(game); initGame(game);
games.add(game); games.add(game);

View file

@ -5,11 +5,12 @@ package mage.game;
import mage.constants.MultiplayerAttackOption; import mage.constants.MultiplayerAttackOption;
import mage.constants.RangeOfInfluence; import mage.constants.RangeOfInfluence;
import mage.game.match.MatchType; import mage.game.match.MatchType;
import mage.game.mulligan.Mulligan;
public class CommanderDuel extends GameCommanderImpl { public class CommanderDuel extends GameCommanderImpl {
public CommanderDuel(MultiplayerAttackOption attackOption, RangeOfInfluence range, int freeMulligans, int startLife) { public CommanderDuel(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife) {
super(attackOption, range, freeMulligans, startLife); super(attackOption, range, mulligan, startLife);
} }
public CommanderDuel(final CommanderDuel game) { public CommanderDuel(final CommanderDuel game) {

View file

@ -3,6 +3,7 @@ package mage.game;
import mage.game.match.MatchImpl; import mage.game.match.MatchImpl;
import mage.game.match.MatchOptions; import mage.game.match.MatchOptions;
import mage.game.mulligan.Mulligan;
/** /**
* *
@ -29,7 +30,8 @@ public class CommanderDuelMatch extends MatchImpl {
startLife = 30; startLife = 30;
alsoHand = true; // commander going to hand allowed to go to command zone effective July 17, 2015 alsoHand = true; // commander going to hand allowed to go to command zone effective July 17, 2015
} }
CommanderDuel game = new CommanderDuel(options.getAttackOption(), options.getRange(), options.getFreeMulligans(), startLife); Mulligan mulligan = options.getMulliganType().getMulligan(options.getFreeMulligans());
CommanderDuel game = new CommanderDuel(options.getAttackOption(), options.getRange(), mulligan, startLife);
game.setCheckCommanderDamage(checkCommanderDamage); game.setCheckCommanderDamage(checkCommanderDamage);
game.setStartMessage(this.createGameStartMessage()); game.setStartMessage(this.createGameStartMessage());
game.setAlsoHand(alsoHand); game.setAlsoHand(alsoHand);

View file

@ -6,6 +6,7 @@ import java.util.UUID;
import mage.constants.MultiplayerAttackOption; import mage.constants.MultiplayerAttackOption;
import mage.constants.RangeOfInfluence; import mage.constants.RangeOfInfluence;
import mage.game.match.MatchType; import mage.game.match.MatchType;
import mage.game.mulligan.Mulligan;
/** /**
* *
@ -15,8 +16,8 @@ public class CommanderFreeForAll extends GameCommanderImpl {
private int numPlayers; private int numPlayers;
public CommanderFreeForAll(MultiplayerAttackOption attackOption, RangeOfInfluence range, int freeMulligans, int startLife) { public CommanderFreeForAll(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife) {
super(attackOption, range, freeMulligans, startLife); super(attackOption, range, mulligan, startLife);
} }
public CommanderFreeForAll(final CommanderFreeForAll game) { public CommanderFreeForAll(final CommanderFreeForAll game) {

View file

@ -4,6 +4,7 @@ package mage.game;
import mage.game.match.MatchImpl; import mage.game.match.MatchImpl;
import mage.game.match.MatchOptions; import mage.game.match.MatchOptions;
import mage.game.mulligan.Mulligan;
/** /**
* *
@ -23,7 +24,8 @@ public class CommanderFreeForAllMatch extends MatchImpl {
startLife = 30; startLife = 30;
alsoHand = true; // commander going to hand allowed to go to command zone effective July 17, 2015 alsoHand = true; // commander going to hand allowed to go to command zone effective July 17, 2015
} }
CommanderFreeForAll game = new CommanderFreeForAll(options.getAttackOption(), options.getRange(), options.getFreeMulligans(), startLife); Mulligan mulligan = options.getMulliganType().getMulligan(options.getFreeMulligans());
CommanderFreeForAll game = new CommanderFreeForAll(options.getAttackOption(), options.getRange(), mulligan, startLife);
game.setStartMessage(this.createGameStartMessage()); game.setStartMessage(this.createGameStartMessage());
game.setAlsoHand(alsoHand); game.setAlsoHand(alsoHand);
game.setAlsoLibrary(true); game.setAlsoLibrary(true);

View file

@ -4,7 +4,7 @@ package mage.game;
import mage.constants.MultiplayerAttackOption; import mage.constants.MultiplayerAttackOption;
import mage.constants.RangeOfInfluence; import mage.constants.RangeOfInfluence;
import mage.game.match.MatchType; import mage.game.match.MatchType;
import mage.game.mulligan.VancouverMulligan; import mage.game.mulligan.Mulligan;
/** /**
* *
@ -14,8 +14,8 @@ public class FreeForAll extends GameImpl {
private int numPlayers; private int numPlayers;
public FreeForAll(MultiplayerAttackOption attackOption, RangeOfInfluence range, int freeMulligans, int startLife) { public FreeForAll(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife) {
super(attackOption, range, new VancouverMulligan(freeMulligans), startLife); super(attackOption, range, mulligan, startLife);
} }
public FreeForAll(final FreeForAll game) { public FreeForAll(final FreeForAll game) {

View file

@ -4,6 +4,7 @@ package mage.game;
import mage.game.match.MatchImpl; import mage.game.match.MatchImpl;
import mage.game.match.MatchOptions; import mage.game.match.MatchOptions;
import mage.game.mulligan.Mulligan;
/** /**
* *
@ -17,7 +18,8 @@ public class FreeForAllMatch extends MatchImpl {
@Override @Override
public void startGame() throws GameException { public void startGame() throws GameException {
FreeForAll game = new FreeForAll(options.getAttackOption(), options.getRange(), options.getFreeMulligans(), 20); Mulligan mulligan = options.getMulliganType().getMulligan(options.getFreeMulligans());
FreeForAll game = new FreeForAll(options.getAttackOption(), options.getRange(), mulligan, 20);
game.setStartMessage(this.createGameStartMessage()); game.setStartMessage(this.createGameStartMessage());
initGame(game); initGame(game);
games.add(game); games.add(game);

View file

@ -6,6 +6,7 @@ import java.util.UUID;
import mage.constants.MultiplayerAttackOption; import mage.constants.MultiplayerAttackOption;
import mage.constants.RangeOfInfluence; import mage.constants.RangeOfInfluence;
import mage.game.match.MatchType; import mage.game.match.MatchType;
import mage.game.mulligan.Mulligan;
/** /**
* *
@ -15,8 +16,8 @@ public class FreeformCommanderFreeForAll extends GameCommanderImpl {
private int numPlayers; private int numPlayers;
public FreeformCommanderFreeForAll(MultiplayerAttackOption attackOption, RangeOfInfluence range, int freeMulligans, int startLife) { public FreeformCommanderFreeForAll(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife) {
super(attackOption, range, freeMulligans, startLife); super(attackOption, range, mulligan, startLife);
} }
public FreeformCommanderFreeForAll(final FreeformCommanderFreeForAll game) { public FreeformCommanderFreeForAll(final FreeformCommanderFreeForAll game) {

View file

@ -3,6 +3,7 @@ package mage.game;
import mage.game.match.MatchImpl; import mage.game.match.MatchImpl;
import mage.game.match.MatchOptions; import mage.game.match.MatchOptions;
import mage.game.mulligan.Mulligan;
/** /**
* *
@ -18,7 +19,8 @@ public class FreeformCommanderFreeForAllMatch extends MatchImpl {
public void startGame() throws GameException { public void startGame() throws GameException {
int startLife = 40; int startLife = 40;
boolean alsoHand = true; boolean alsoHand = true;
FreeformCommanderFreeForAll game = new FreeformCommanderFreeForAll(options.getAttackOption(), options.getRange(), options.getFreeMulligans(), startLife); Mulligan mulligan = options.getMulliganType().getMulligan(options.getFreeMulligans());
FreeformCommanderFreeForAll game = new FreeformCommanderFreeForAll(options.getAttackOption(), options.getRange(), mulligan, startLife);
game.setStartMessage(this.createGameStartMessage()); game.setStartMessage(this.createGameStartMessage());
game.setAlsoHand(alsoHand); game.setAlsoHand(alsoHand);
game.setAlsoLibrary(true); game.setAlsoLibrary(true);

View file

@ -13,7 +13,7 @@ import mage.constants.RangeOfInfluence;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.command.emblems.MomirEmblem; import mage.game.command.emblems.MomirEmblem;
import mage.game.match.MatchType; import mage.game.match.MatchType;
import mage.game.mulligan.VancouverMulligan; import mage.game.mulligan.Mulligan;
import mage.game.turn.TurnMod; import mage.game.turn.TurnMod;
import mage.players.Player; import mage.players.Player;
@ -23,8 +23,8 @@ import mage.players.Player;
*/ */
public class MomirDuel extends GameImpl { public class MomirDuel extends GameImpl {
public MomirDuel(MultiplayerAttackOption attackOption, RangeOfInfluence range, int freeMulligans, int startLife) { public MomirDuel(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife) {
super(attackOption, range, new VancouverMulligan(freeMulligans), startLife); super(attackOption, range, mulligan, startLife);
} }
public MomirDuel(final MomirDuel game) { public MomirDuel(final MomirDuel game) {

View file

@ -3,6 +3,7 @@ package mage.game;
import mage.game.match.MatchImpl; import mage.game.match.MatchImpl;
import mage.game.match.MatchOptions; import mage.game.match.MatchOptions;
import mage.game.mulligan.Mulligan;
/** /**
* *
@ -19,7 +20,8 @@ public class MomirDuelMatch extends MatchImpl {
// Momir Vig, Simic Visionary gives +4 starting life // Momir Vig, Simic Visionary gives +4 starting life
int startLife = 24; int startLife = 24;
MomirDuel game = new MomirDuel(options.getAttackOption(), options.getRange(), options.getFreeMulligans(), startLife); Mulligan mulligan = options.getMulliganType().getMulligan(options.getFreeMulligans());
MomirDuel game = new MomirDuel(options.getAttackOption(), options.getRange(), mulligan, startLife);
game.setStartMessage(this.createGameStartMessage()); game.setStartMessage(this.createGameStartMessage());
this.initGame(game); this.initGame(game);

View file

@ -3,6 +3,7 @@ package mage.game;
import mage.game.match.MatchImpl; import mage.game.match.MatchImpl;
import mage.game.match.MatchOptions; import mage.game.match.MatchOptions;
import mage.game.mulligan.Mulligan;
/** /**
* *
@ -19,7 +20,8 @@ public class MomirFreeForAllMatch extends MatchImpl {
// Momir Vig, Simic Visionary gives +4 starting life // Momir Vig, Simic Visionary gives +4 starting life
int startLife = 24; int startLife = 24;
MomirGame game = new MomirGame(options.getAttackOption(), options.getRange(), options.getFreeMulligans(), startLife); Mulligan mulligan = options.getMulliganType().getMulligan(options.getFreeMulligans());
MomirGame game = new MomirGame(options.getAttackOption(), options.getRange(), mulligan, startLife);
game.setStartMessage(this.createGameStartMessage()); game.setStartMessage(this.createGameStartMessage());
this.initGame(game); this.initGame(game);

View file

@ -13,7 +13,7 @@ import mage.constants.RangeOfInfluence;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.command.emblems.MomirEmblem; import mage.game.command.emblems.MomirEmblem;
import mage.game.match.MatchType; import mage.game.match.MatchType;
import mage.game.mulligan.VancouverMulligan; import mage.game.mulligan.Mulligan;
import mage.game.turn.TurnMod; import mage.game.turn.TurnMod;
import mage.players.Player; import mage.players.Player;
@ -25,8 +25,8 @@ public class MomirGame extends GameImpl {
private int numPlayers; private int numPlayers;
public MomirGame(MultiplayerAttackOption attackOption, RangeOfInfluence range, int freeMulligans, int startLife) { public MomirGame(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife) {
super(attackOption, range, new VancouverMulligan(freeMulligans), startLife); super(attackOption, range, mulligan, startLife);
} }
public MomirGame(final MomirGame game) { public MomirGame(final MomirGame game) {

View file

@ -6,6 +6,7 @@ import java.util.UUID;
import mage.constants.MultiplayerAttackOption; import mage.constants.MultiplayerAttackOption;
import mage.constants.RangeOfInfluence; import mage.constants.RangeOfInfluence;
import mage.game.match.MatchType; import mage.game.match.MatchType;
import mage.game.mulligan.Mulligan;
/** /**
* *
@ -15,8 +16,8 @@ public class PennyDreadfulCommanderFreeForAll extends GameCommanderImpl {
private int numPlayers; private int numPlayers;
public PennyDreadfulCommanderFreeForAll(MultiplayerAttackOption attackOption, RangeOfInfluence range, int freeMulligans, int startLife) { public PennyDreadfulCommanderFreeForAll(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife) {
super(attackOption, range, freeMulligans, startLife); super(attackOption, range, mulligan, startLife);
} }
public PennyDreadfulCommanderFreeForAll(final PennyDreadfulCommanderFreeForAll game) { public PennyDreadfulCommanderFreeForAll(final PennyDreadfulCommanderFreeForAll game) {

View file

@ -4,6 +4,7 @@ package mage.game;
import mage.game.match.MatchImpl; import mage.game.match.MatchImpl;
import mage.game.match.MatchOptions; import mage.game.match.MatchOptions;
import mage.game.mulligan.Mulligan;
/** /**
* *
@ -23,7 +24,8 @@ public class PennyDreadfulCommanderFreeForAllMatch extends MatchImpl {
startLife = 30; startLife = 30;
alsoHand = true; // commander going to hand allowed to go to command zone effective July 17, 2015 alsoHand = true; // commander going to hand allowed to go to command zone effective July 17, 2015
} }
PennyDreadfulCommanderFreeForAll game = new PennyDreadfulCommanderFreeForAll(options.getAttackOption(), options.getRange(), options.getFreeMulligans(), startLife); Mulligan mulligan = options.getMulliganType().getMulligan(options.getFreeMulligans());
PennyDreadfulCommanderFreeForAll game = new PennyDreadfulCommanderFreeForAll(options.getAttackOption(), options.getRange(), mulligan, startLife);
game.setStartMessage(this.createGameStartMessage()); game.setStartMessage(this.createGameStartMessage());
game.setAlsoHand(alsoHand); game.setAlsoHand(alsoHand);
game.setAlsoLibrary(true); game.setAlsoLibrary(true);

View file

@ -5,6 +5,7 @@ package mage.game;
import mage.constants.MultiplayerAttackOption; import mage.constants.MultiplayerAttackOption;
import mage.constants.RangeOfInfluence; import mage.constants.RangeOfInfluence;
import mage.game.match.MatchType; import mage.game.match.MatchType;
import mage.game.mulligan.Mulligan;
/** /**
* *
@ -12,8 +13,8 @@ import mage.game.match.MatchType;
*/ */
public class TinyLeadersDuel extends GameTinyLeadersImpl { public class TinyLeadersDuel extends GameTinyLeadersImpl {
public TinyLeadersDuel(MultiplayerAttackOption attackOption, RangeOfInfluence range, int freeMulligans, int startLife) { public TinyLeadersDuel(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife) {
super(attackOption, range, freeMulligans, startLife); super(attackOption, range, mulligan, startLife);
} }
public TinyLeadersDuel(final TinyLeadersDuel game) { public TinyLeadersDuel(final TinyLeadersDuel game) {

View file

@ -4,6 +4,7 @@ package mage.game;
import mage.game.match.MatchImpl; import mage.game.match.MatchImpl;
import mage.game.match.MatchOptions; import mage.game.match.MatchOptions;
import mage.game.mulligan.Mulligan;
/** /**
* *
@ -20,7 +21,8 @@ public class TinyLeadersDuelMatch extends MatchImpl {
//Tiny Leaders Play Rule 13: Players begin the game with 25 life. //Tiny Leaders Play Rule 13: Players begin the game with 25 life.
int startLife = 25; int startLife = 25;
TinyLeadersDuel game = new TinyLeadersDuel(options.getAttackOption(), options.getRange(), options.getFreeMulligans(), startLife); Mulligan mulligan = options.getMulliganType().getMulligan(options.getFreeMulligans());
TinyLeadersDuel game = new TinyLeadersDuel(options.getAttackOption(), options.getRange(), mulligan, startLife);
game.setStartMessage(this.createGameStartMessage()); game.setStartMessage(this.createGameStartMessage());
//Tucking a Tiny Leader is legal //Tucking a Tiny Leader is legal

View file

@ -1,20 +1,16 @@
package mage.game; package mage.game;
import java.util.UUID;
import mage.constants.MultiplayerAttackOption; import mage.constants.MultiplayerAttackOption;
import mage.constants.PhaseStep; import mage.constants.PhaseStep;
import mage.constants.RangeOfInfluence; import mage.constants.RangeOfInfluence;
import mage.game.match.MatchType; import mage.game.match.MatchType;
import mage.game.mulligan.Mulligan; import mage.game.mulligan.Mulligan;
import mage.game.mulligan.VancouverMulligan;
import mage.game.turn.TurnMod; import mage.game.turn.TurnMod;
public class TwoPlayerDuel extends GameImpl { import java.util.UUID;
public TwoPlayerDuel(MultiplayerAttackOption attackOption, RangeOfInfluence range, int freeMulligans, int startLife) { public class TwoPlayerDuel extends GameImpl {
this(attackOption, range, new VancouverMulligan(freeMulligans), startLife);
}
public TwoPlayerDuel(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife) { public TwoPlayerDuel(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife) {
super(attackOption, range, mulligan, startLife); super(attackOption, range, mulligan, startLife);

View file

@ -3,6 +3,7 @@ package mage.game;
import mage.game.match.MatchImpl; import mage.game.match.MatchImpl;
import mage.game.match.MatchOptions; import mage.game.match.MatchOptions;
import mage.game.mulligan.Mulligan;
/** /**
* *
@ -16,7 +17,8 @@ public class TwoPlayerMatch extends MatchImpl {
@Override @Override
public void startGame() throws GameException { public void startGame() throws GameException {
TwoPlayerDuel game = new TwoPlayerDuel(options.getAttackOption(), options.getRange(), options.getFreeMulligans(), 20); Mulligan mulligan = options.getMulliganType().getMulligan(options.getFreeMulligans());
TwoPlayerDuel game = new TwoPlayerDuel(options.getAttackOption(), options.getRange(), mulligan, 20);
// Sets a start message about the match score // Sets a start message about the match score
game.setStartMessage(this.createGameStartMessage()); game.setStartMessage(this.createGameStartMessage());
initGame(game); initGame(game);

View file

@ -7,6 +7,7 @@ import mage.constants.Zone;
import mage.game.FreeForAll; import mage.game.FreeForAll;
import mage.game.Game; import mage.game.Game;
import mage.game.GameException; import mage.game.GameException;
import mage.game.mulligan.VancouverMulligan;
import org.junit.Test; import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase; import org.mage.test.serverside.base.CardTestPlayerBase;
@ -15,7 +16,7 @@ import java.io.FileNotFoundException;
public class NaturesWillTest extends CardTestPlayerBase { public class NaturesWillTest extends CardTestPlayerBase {
@Override @Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException { protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, 0, 20); Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, new VancouverMulligan(0), 20);
playerA = createPlayer(game, playerA, "PlayerA"); playerA = createPlayer(game, playerA, "PlayerA");
playerB = createPlayer(game, playerB, "PlayerB"); playerB = createPlayer(game, playerB, "PlayerB");
playerC = createPlayer(game, playerC, "PlayerC"); playerC = createPlayer(game, playerC, "PlayerC");

View file

@ -7,6 +7,7 @@ import mage.constants.Zone;
import mage.game.FreeForAll; import mage.game.FreeForAll;
import mage.game.Game; import mage.game.Game;
import mage.game.GameException; import mage.game.GameException;
import mage.game.mulligan.VancouverMulligan;
import org.junit.Test; import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase; import org.mage.test.serverside.base.CardTestPlayerBase;
@ -15,7 +16,7 @@ import java.io.FileNotFoundException;
public class StormTheVaultTest extends CardTestPlayerBase { public class StormTheVaultTest extends CardTestPlayerBase {
@Override @Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException { protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, 0, 20); Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, new VancouverMulligan(0), 20);
playerA = createPlayer(game, playerA, "PlayerA"); playerA = createPlayer(game, playerA, "PlayerA");
playerB = createPlayer(game, playerB, "PlayerB"); playerB = createPlayer(game, playerB, "PlayerB");
playerC = createPlayer(game, playerC, "PlayerC"); playerC = createPlayer(game, playerC, "PlayerC");

View file

@ -7,6 +7,7 @@ import mage.constants.Zone;
import mage.game.FreeForAll; import mage.game.FreeForAll;
import mage.game.Game; import mage.game.Game;
import mage.game.GameException; import mage.game.GameException;
import mage.game.mulligan.VancouverMulligan;
import org.junit.Test; import org.junit.Test;
import org.mage.test.serverside.base.CardTestMultiPlayerBase; import org.mage.test.serverside.base.CardTestMultiPlayerBase;
@ -18,7 +19,7 @@ import java.io.FileNotFoundException;
public class RagsRichesTest extends CardTestMultiPlayerBase { public class RagsRichesTest extends CardTestMultiPlayerBase {
@Override @Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException { protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new FreeForAll(MultiplayerAttackOption.LEFT, RangeOfInfluence.ALL, 0, 20); Game game = new FreeForAll(MultiplayerAttackOption.LEFT, RangeOfInfluence.ALL, new VancouverMulligan(0), 20);
// Player order: A -> D -> C -> B // Player order: A -> D -> C -> B
playerA = createPlayer(game, playerA, "PlayerA"); playerA = createPlayer(game, playerA, "PlayerA");
playerB = createPlayer(game, playerB, "PlayerB"); playerB = createPlayer(game, playerB, "PlayerB");

View file

@ -13,6 +13,7 @@ import mage.constants.Zone;
import mage.game.FreeForAll; import mage.game.FreeForAll;
import mage.game.Game; import mage.game.Game;
import mage.game.GameException; import mage.game.GameException;
import mage.game.mulligan.VancouverMulligan;
import org.junit.Test; import org.junit.Test;
import org.mage.test.serverside.base.CardTestMultiPlayerBase; import org.mage.test.serverside.base.CardTestMultiPlayerBase;
@ -24,7 +25,7 @@ public class BlatantThieveryTest extends CardTestMultiPlayerBase {
@Override @Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException { protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, 0, 20); Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, new VancouverMulligan(0), 20);
// Player order: A -> D -> C -> B // Player order: A -> D -> C -> B
playerA = createPlayer(game, playerA, "PlayerA"); playerA = createPlayer(game, playerA, "PlayerA");
playerB = createPlayer(game, playerB, "PlayerB"); playerB = createPlayer(game, playerB, "PlayerB");

View file

@ -8,6 +8,7 @@ import mage.constants.Zone;
import mage.game.FreeForAll; import mage.game.FreeForAll;
import mage.game.Game; import mage.game.Game;
import mage.game.GameException; import mage.game.GameException;
import mage.game.mulligan.VancouverMulligan;
import org.junit.Test; import org.junit.Test;
import org.mage.test.serverside.base.CardTestMultiPlayerBase; import org.mage.test.serverside.base.CardTestMultiPlayerBase;
@ -23,7 +24,7 @@ public class CreepingDreadTest extends CardTestMultiPlayerBase {
@Override @Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException { protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, 0, 40); Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, new VancouverMulligan(0), 40);
// Player order: A -> D -> C -> B // Player order: A -> D -> C -> B
playerA = createPlayer(game, playerA, "PlayerA"); playerA = createPlayer(game, playerA, "PlayerA");
playerB = createPlayer(game, playerB, "PlayerB"); playerB = createPlayer(game, playerB, "PlayerB");

View file

@ -8,6 +8,7 @@ import mage.constants.Zone;
import mage.game.FreeForAll; import mage.game.FreeForAll;
import mage.game.Game; import mage.game.Game;
import mage.game.GameException; import mage.game.GameException;
import mage.game.mulligan.VancouverMulligan;
import org.junit.Test; import org.junit.Test;
import org.mage.test.serverside.base.CardTestMultiPlayerBase; import org.mage.test.serverside.base.CardTestMultiPlayerBase;
@ -15,7 +16,7 @@ public class MultiplayerTriggerTest extends CardTestMultiPlayerBase {
@Override @Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException { protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, 0, 40); Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, new VancouverMulligan(0), 40);
// Player order: A -> D -> C -> B // Player order: A -> D -> C -> B
playerA = createPlayer(game, playerA, "PlayerA"); playerA = createPlayer(game, playerA, "PlayerA");
playerB = createPlayer(game, playerB, "PlayerB"); playerB = createPlayer(game, playerB, "PlayerB");

View file

@ -7,6 +7,7 @@ import mage.constants.Zone;
import mage.game.FreeForAll; import mage.game.FreeForAll;
import mage.game.Game; import mage.game.Game;
import mage.game.GameException; import mage.game.GameException;
import mage.game.mulligan.VancouverMulligan;
import org.junit.Test; import org.junit.Test;
import org.mage.test.serverside.base.CardTestMultiPlayerBase; import org.mage.test.serverside.base.CardTestMultiPlayerBase;
@ -19,7 +20,7 @@ public class MyriadTest extends CardTestMultiPlayerBase {
@Override @Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException { protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, 0, 40); Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, new VancouverMulligan(0), 40);
// Player order: A -> D -> C -> B // Player order: A -> D -> C -> B
playerA = createPlayer(game, playerA, "PlayerA"); playerA = createPlayer(game, playerA, "PlayerA");
playerB = createPlayer(game, playerB, "PlayerB"); playerB = createPlayer(game, playerB, "PlayerB");

View file

@ -13,6 +13,7 @@ import mage.constants.Zone;
import mage.game.FreeForAll; import mage.game.FreeForAll;
import mage.game.Game; import mage.game.Game;
import mage.game.GameException; import mage.game.GameException;
import mage.game.mulligan.VancouverMulligan;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.mage.test.serverside.base.CardTestMultiPlayerBase; import org.mage.test.serverside.base.CardTestMultiPlayerBase;
@ -26,7 +27,7 @@ public class PlayerDiedStackTargetHandlingTest extends CardTestMultiPlayerBase {
@Override @Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException { protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
// Start Life = 2 // Start Life = 2
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ONE, 0, 3); Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ONE, new VancouverMulligan(0), 3);
// Player order: A -> D -> C -> B // Player order: A -> D -> C -> B
playerA = createPlayer(game, playerA, "PlayerA"); playerA = createPlayer(game, playerA, "PlayerA");
playerB = createPlayer(game, playerB, "PlayerB"); playerB = createPlayer(game, playerB, "PlayerB");

View file

@ -10,6 +10,7 @@ import mage.counters.CounterType;
import mage.game.FreeForAll; import mage.game.FreeForAll;
import mage.game.Game; import mage.game.Game;
import mage.game.GameException; import mage.game.GameException;
import mage.game.mulligan.VancouverMulligan;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
@ -24,7 +25,7 @@ public class PlayerLeftGameRange1Test extends CardTestMultiPlayerBase {
@Override @Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException { protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
// Start Life = 2 // Start Life = 2
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ONE, 0, 2); Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ONE, new VancouverMulligan(0), 2);
// Player order: A -> D -> C -> B // Player order: A -> D -> C -> B
playerA = createPlayer(game, playerA, "PlayerA"); playerA = createPlayer(game, playerA, "PlayerA");
playerB = createPlayer(game, playerB, "PlayerB"); playerB = createPlayer(game, playerB, "PlayerB");

View file

@ -9,6 +9,7 @@ import mage.counters.CounterType;
import mage.game.FreeForAll; import mage.game.FreeForAll;
import mage.game.Game; import mage.game.Game;
import mage.game.GameException; import mage.game.GameException;
import mage.game.mulligan.VancouverMulligan;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.mage.test.serverside.base.CardTestMultiPlayerBase; import org.mage.test.serverside.base.CardTestMultiPlayerBase;
@ -22,7 +23,7 @@ public class PlayerLeftGameRangeAllTest extends CardTestMultiPlayerBase {
@Override @Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException { protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
// Start Life = 2 // Start Life = 2
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, 0, 2); Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, new VancouverMulligan(0), 2);
// Player order: A -> D -> C -> B // Player order: A -> D -> C -> B
playerA = createPlayer(game, playerA, "PlayerA"); playerA = createPlayer(game, playerA, "PlayerA");
playerB = createPlayer(game, playerB, "PlayerB"); playerB = createPlayer(game, playerB, "PlayerB");

View file

@ -9,6 +9,7 @@ import mage.counters.CounterType;
import mage.game.FreeForAll; import mage.game.FreeForAll;
import mage.game.Game; import mage.game.Game;
import mage.game.GameException; import mage.game.GameException;
import mage.game.mulligan.VancouverMulligan;
import org.junit.Test; import org.junit.Test;
import org.mage.test.serverside.base.CardTestMultiPlayerBase; import org.mage.test.serverside.base.CardTestMultiPlayerBase;
@ -21,7 +22,7 @@ public class PrivilegedPositionTest extends CardTestMultiPlayerBase {
@Override @Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException { protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, 0, 40); Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, new VancouverMulligan(0), 40);
// Player order: A -> D -> C -> B // Player order: A -> D -> C -> B
playerA = createPlayer(game, playerA, "PlayerA"); playerA = createPlayer(game, playerA, "PlayerA");
playerB = createPlayer(game, playerB, "PlayerB"); playerB = createPlayer(game, playerB, "PlayerB");

View file

@ -9,6 +9,7 @@ import mage.constants.Zone;
import mage.game.FreeForAll; import mage.game.FreeForAll;
import mage.game.Game; import mage.game.Game;
import mage.game.GameException; import mage.game.GameException;
import mage.game.mulligan.VancouverMulligan;
import org.junit.Test; import org.junit.Test;
import org.mage.test.serverside.base.CardTestMultiPlayerBase; import org.mage.test.serverside.base.CardTestMultiPlayerBase;
@ -20,7 +21,7 @@ public class VindictiveLichTest extends CardTestMultiPlayerBase {
@Override @Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException { protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, 0, 40); Game game = new FreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, new VancouverMulligan(0), 40);
// Player order: A -> D -> C -> B // Player order: A -> D -> C -> B
playerA = createPlayer(game, playerA, "PlayerA"); playerA = createPlayer(game, playerA, "PlayerA");
playerB = createPlayer(game, playerB, "PlayerB"); playerB = createPlayer(game, playerB, "PlayerB");

View file

@ -10,6 +10,7 @@ import mage.game.Game;
import mage.game.GameException; import mage.game.GameException;
import mage.game.GameOptions; import mage.game.GameOptions;
import mage.game.TwoPlayerDuel; import mage.game.TwoPlayerDuel;
import mage.game.mulligan.VancouverMulligan;
import mage.player.ai.ComputerPlayer; import mage.player.ai.ComputerPlayer;
import mage.players.Player; import mage.players.Player;
import mage.players.PlayerType; import mage.players.PlayerType;
@ -34,7 +35,7 @@ public class PlayGameTest extends MageTestBase {
@Ignore @Ignore
@Test @Test
public void playOneGame() throws GameException, FileNotFoundException, IllegalArgumentException { public void playOneGame() throws GameException, FileNotFoundException, IllegalArgumentException {
Game game = new TwoPlayerDuel(MultiplayerAttackOption.LEFT, RangeOfInfluence.ALL, 0, 20); Game game = new TwoPlayerDuel(MultiplayerAttackOption.LEFT, RangeOfInfluence.ALL, new VancouverMulligan(0), 20);
Player computerA = createPlayer("ComputerA", PlayerType.COMPUTER_MINIMAX_HYBRID); Player computerA = createPlayer("ComputerA", PlayerType.COMPUTER_MINIMAX_HYBRID);
// Player playerA = createPlayer("ComputerA", "Computer - mad"); // Player playerA = createPlayer("ComputerA", "Computer - mad");

View file

@ -10,6 +10,7 @@ import mage.game.Game;
import mage.game.GameException; import mage.game.GameException;
import mage.game.GameOptions; import mage.game.GameOptions;
import mage.game.TwoPlayerDuel; import mage.game.TwoPlayerDuel;
import mage.game.mulligan.VancouverMulligan;
import mage.player.ai.ComputerPlayer; import mage.player.ai.ComputerPlayer;
import mage.players.Player; import mage.players.Player;
import mage.util.RandomUtil; import mage.util.RandomUtil;
@ -40,7 +41,7 @@ public class TestPlayRandomGame extends MageTestBase {
} }
private void playOneGame() throws GameException, FileNotFoundException, IllegalArgumentException { private void playOneGame() throws GameException, FileNotFoundException, IllegalArgumentException {
Game game = new TwoPlayerDuel(MultiplayerAttackOption.LEFT, RangeOfInfluence.ALL, 0, 20); Game game = new TwoPlayerDuel(MultiplayerAttackOption.LEFT, RangeOfInfluence.ALL, new VancouverMulligan(0), 20);
Player computerA = createRandomPlayer("ComputerA"); Player computerA = createRandomPlayer("ComputerA");
Deck deck = generateRandomDeck(); Deck deck = generateRandomDeck();

View file

@ -6,6 +6,7 @@ import mage.constants.RangeOfInfluence;
import mage.game.CommanderFreeForAll; import mage.game.CommanderFreeForAll;
import mage.game.Game; import mage.game.Game;
import mage.game.GameException; import mage.game.GameException;
import mage.game.mulligan.VancouverMulligan;
import org.mage.test.serverside.base.impl.CardTestPlayerAPIImpl; import org.mage.test.serverside.base.impl.CardTestPlayerAPIImpl;
/** /**
@ -23,7 +24,7 @@ public abstract class CardTestCommander3PlayersFFA extends CardTestPlayerAPIImpl
@Override @Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException { protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new CommanderFreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ONE, 0, 40); Game game = new CommanderFreeForAll(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ONE, new VancouverMulligan(0), 40);
playerA = createPlayer(game, playerA, "PlayerA", deckNameA); playerA = createPlayer(game, playerA, "PlayerA", deckNameA);
playerB = createPlayer(game, playerB, "PlayerB", deckNameB); playerB = createPlayer(game, playerB, "PlayerB", deckNameB);
playerC = createPlayer(game, playerC, "PlayerC", deckNameC); playerC = createPlayer(game, playerC, "PlayerC", deckNameC);

View file

@ -7,6 +7,7 @@ import mage.constants.RangeOfInfluence;
import mage.game.CommanderDuel; import mage.game.CommanderDuel;
import mage.game.Game; import mage.game.Game;
import mage.game.GameException; import mage.game.GameException;
import mage.game.mulligan.VancouverMulligan;
import org.mage.test.serverside.base.impl.CardTestPlayerAPIImpl; import org.mage.test.serverside.base.impl.CardTestPlayerAPIImpl;
/** /**
@ -23,7 +24,7 @@ public abstract class CardTestCommanderDuelBase extends CardTestPlayerAPIImpl {
@Override @Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException { protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new CommanderDuel(MultiplayerAttackOption.LEFT, RangeOfInfluence.ONE, 0, 40); Game game = new CommanderDuel(MultiplayerAttackOption.LEFT, RangeOfInfluence.ONE, new VancouverMulligan(0), 40);
playerA = createPlayer(game, playerA, "PlayerA", deckNameA); playerA = createPlayer(game, playerA, "PlayerA", deckNameA);
playerB = createPlayer(game, playerB, "PlayerB", deckNameB); playerB = createPlayer(game, playerB, "PlayerB", deckNameB);

View file

@ -6,6 +6,7 @@ import mage.constants.RangeOfInfluence;
import mage.game.FreeForAll; import mage.game.FreeForAll;
import mage.game.Game; import mage.game.Game;
import mage.game.GameException; import mage.game.GameException;
import mage.game.mulligan.VancouverMulligan;
import org.mage.test.serverside.base.impl.CardTestPlayerAPIImpl; import org.mage.test.serverside.base.impl.CardTestPlayerAPIImpl;
/** /**
@ -20,7 +21,7 @@ public abstract class CardTestMultiPlayerBase extends CardTestPlayerAPIImpl {
@Override @Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException { protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new FreeForAll(MultiplayerAttackOption.LEFT, RangeOfInfluence.ONE, 0, 20); Game game = new FreeForAll(MultiplayerAttackOption.LEFT, RangeOfInfluence.ONE, new VancouverMulligan(0), 20);
// Player order: A -> D -> C -> B // Player order: A -> D -> C -> B
playerA = createPlayer(game, playerA, "PlayerA"); playerA = createPlayer(game, playerA, "PlayerA");
playerB = createPlayer(game, playerB, "PlayerB"); playerB = createPlayer(game, playerB, "PlayerB");

View file

@ -6,6 +6,7 @@ import mage.constants.RangeOfInfluence;
import mage.game.Game; import mage.game.Game;
import mage.game.GameException; import mage.game.GameException;
import mage.game.TwoPlayerDuel; import mage.game.TwoPlayerDuel;
import mage.game.mulligan.VancouverMulligan;
import org.mage.test.serverside.base.impl.CardTestPlayerAPIImpl; import org.mage.test.serverside.base.impl.CardTestPlayerAPIImpl;
/** /**
@ -22,7 +23,7 @@ public abstract class CardTestPlayerBase extends CardTestPlayerAPIImpl {
@Override @Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException { protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new TwoPlayerDuel(MultiplayerAttackOption.LEFT, RangeOfInfluence.ONE, 0, 20); Game game = new TwoPlayerDuel(MultiplayerAttackOption.LEFT, RangeOfInfluence.ONE, new VancouverMulligan(0), 20);
playerA = createPlayer(game, playerA, "PlayerA", deckNameA); playerA = createPlayer(game, playerA, "PlayerA", deckNameA);
playerB = createPlayer(game, playerB, "PlayerB", deckNameB); playerB = createPlayer(game, playerB, "PlayerB", deckNameB);

View file

@ -5,6 +5,7 @@ import mage.constants.RangeOfInfluence;
import mage.game.Game; import mage.game.Game;
import mage.game.GameException; import mage.game.GameException;
import mage.game.TwoPlayerDuel; import mage.game.TwoPlayerDuel;
import mage.game.mulligan.VancouverMulligan;
import org.mage.test.player.TestComputerPlayer7; import org.mage.test.player.TestComputerPlayer7;
import org.mage.test.player.TestPlayer; import org.mage.test.player.TestPlayer;
import org.mage.test.serverside.base.impl.CardTestPlayerAPIImpl; import org.mage.test.serverside.base.impl.CardTestPlayerAPIImpl;
@ -20,7 +21,7 @@ public abstract class CardTestPlayerBaseAI extends CardTestPlayerAPIImpl {
@Override @Override
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException { protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
Game game = new TwoPlayerDuel(MultiplayerAttackOption.LEFT, RangeOfInfluence.ONE, 0, 20); Game game = new TwoPlayerDuel(MultiplayerAttackOption.LEFT, RangeOfInfluence.ONE, new VancouverMulligan(0), 20);
playerA = createPlayer(game, playerA, "PlayerA"); playerA = createPlayer(game, playerA, "PlayerA");
playerB = createPlayer(game, playerB, "PlayerB"); playerB = createPlayer(game, playerB, "PlayerB");

View file

@ -7,6 +7,7 @@ import mage.constants.PlanarDieRoll;
import mage.constants.RangeOfInfluence; import mage.constants.RangeOfInfluence;
import mage.game.Game; import mage.game.Game;
import mage.game.TwoPlayerDuel; import mage.game.TwoPlayerDuel;
import mage.game.mulligan.VancouverMulligan;
import mage.player.human.HumanPlayer; import mage.player.human.HumanPlayer;
import mage.players.Player; import mage.players.Player;
import mage.util.RandomUtil; import mage.util.RandomUtil;
@ -92,7 +93,7 @@ public class RandomTest {
String dest = "f:/test/xmage/"; String dest = "f:/test/xmage/";
//RandomUtil.setSeed(123); //RandomUtil.setSeed(123);
Player player = new HumanPlayer("random", RangeOfInfluence.ALL, 1); Player player = new HumanPlayer("random", RangeOfInfluence.ALL, 1);
Game game = new TwoPlayerDuel(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, 0, 50); Game game = new TwoPlayerDuel(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, new VancouverMulligan(0), 50);
int height = 512; int height = 512;
int weight = 512; int weight = 512;
@ -115,7 +116,7 @@ public class RandomTest {
String dest = "f:/test/xmage/"; String dest = "f:/test/xmage/";
//RandomUtil.setSeed(123); //RandomUtil.setSeed(123);
Player player = new HumanPlayer("random", RangeOfInfluence.ALL, 1); Player player = new HumanPlayer("random", RangeOfInfluence.ALL, 1);
Game game = new TwoPlayerDuel(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, 0, 50); Game game = new TwoPlayerDuel(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, new VancouverMulligan(0), 50);
int height = 512; int height = 512;
int weight = 512; int weight = 512;
@ -140,7 +141,7 @@ public class RandomTest {
String dest = "f:/test/xmage/"; String dest = "f:/test/xmage/";
//RandomUtil.setSeed(123); //RandomUtil.setSeed(123);
Player player = new HumanPlayer("random", RangeOfInfluence.ALL, 1); Player player = new HumanPlayer("random", RangeOfInfluence.ALL, 1);
Game game = new TwoPlayerDuel(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, 0, 50); Game game = new TwoPlayerDuel(MultiplayerAttackOption.MULTIPLE, RangeOfInfluence.ALL, new VancouverMulligan(0), 50);
Deck deck = DeckTestUtils.buildRandomDeck("WGUBR", false, "GRN"); Deck deck = DeckTestUtils.buildRandomDeck("WGUBR", false, "GRN");
player.getLibrary().addAll(deck.getCards(), game); player.getLibrary().addAll(deck.getCards(), game);

View file

@ -1,19 +1,18 @@
package mage.game; package mage.game;
import java.util.*;
import mage.constants.MultiplayerAttackOption; import mage.constants.MultiplayerAttackOption;
import mage.constants.PhaseStep; import mage.constants.PhaseStep;
import mage.constants.RangeOfInfluence; import mage.constants.RangeOfInfluence;
import mage.game.mulligan.CanadianHighlanderMulligan;
import mage.game.mulligan.Mulligan; import mage.game.mulligan.Mulligan;
import mage.game.turn.TurnMod; import mage.game.turn.TurnMod;
import mage.players.Player;
import java.util.UUID;
public abstract class GameCanadianHighlanderImpl extends GameImpl { public abstract class GameCanadianHighlanderImpl extends GameImpl {
public GameCanadianHighlanderImpl(MultiplayerAttackOption attackOption, RangeOfInfluence range, int freeMulligans, int startLife) { public GameCanadianHighlanderImpl(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife) {
super(attackOption, range, new CanadianHighlanderMulligan(freeMulligans), startLife); super(attackOption, range, mulligan, startLife);
} }
public GameCanadianHighlanderImpl(final GameCanadianHighlanderImpl game) { public GameCanadianHighlanderImpl(final GameCanadianHighlanderImpl game) {

View file

@ -1,7 +1,5 @@
package mage.game; package mage.game;
import java.util.Map;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.InfoEffect; import mage.abilities.effects.common.InfoEffect;
@ -12,11 +10,14 @@ import mage.constants.MultiplayerAttackOption;
import mage.constants.PhaseStep; import mage.constants.PhaseStep;
import mage.constants.RangeOfInfluence; import mage.constants.RangeOfInfluence;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.mulligan.VancouverMulligan; import mage.game.mulligan.Mulligan;
import mage.game.turn.TurnMod; import mage.game.turn.TurnMod;
import mage.players.Player; import mage.players.Player;
import mage.watchers.common.CommanderInfoWatcher; import mage.watchers.common.CommanderInfoWatcher;
import java.util.Map;
import java.util.UUID;
public abstract class GameCommanderImpl extends GameImpl { public abstract class GameCommanderImpl extends GameImpl {
// private final Map<UUID, Cards> mulliganedCards = new HashMap<>(); // private final Map<UUID, Cards> mulliganedCards = new HashMap<>();
@ -25,8 +26,8 @@ public abstract class GameCommanderImpl extends GameImpl {
protected boolean alsoLibrary; // replace commander going to library protected boolean alsoLibrary; // replace commander going to library
protected boolean startingPlayerSkipsDraw = true; protected boolean startingPlayerSkipsDraw = true;
public GameCommanderImpl(MultiplayerAttackOption attackOption, RangeOfInfluence range, int freeMulligans, int startLife) { public GameCommanderImpl(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife) {
super(attackOption, range, new VancouverMulligan(freeMulligans), startLife); super(attackOption, range, mulligan, startLife);
} }
public GameCommanderImpl(final GameCommanderImpl game) { public GameCommanderImpl(final GameCommanderImpl game) {

View file

@ -16,7 +16,7 @@ import mage.cards.CardSetInfo;
import mage.cards.repository.CardInfo; import mage.cards.repository.CardInfo;
import mage.cards.repository.CardRepository; import mage.cards.repository.CardRepository;
import mage.constants.*; import mage.constants.*;
import mage.game.mulligan.VancouverMulligan; import mage.game.mulligan.Mulligan;
import mage.game.turn.TurnMod; import mage.game.turn.TurnMod;
import mage.players.Player; import mage.players.Player;
import mage.watchers.common.CommanderInfoWatcher; import mage.watchers.common.CommanderInfoWatcher;
@ -31,8 +31,8 @@ public abstract class GameTinyLeadersImpl extends GameImpl {
protected boolean alsoLibrary; // replace also commander going to library protected boolean alsoLibrary; // replace also commander going to library
protected boolean startingPlayerSkipsDraw = true; protected boolean startingPlayerSkipsDraw = true;
public GameTinyLeadersImpl(MultiplayerAttackOption attackOption, RangeOfInfluence range, int freeMulligans, int startLife) { public GameTinyLeadersImpl(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife) {
super(attackOption, range, new VancouverMulligan(freeMulligans), startLife); super(attackOption, range, mulligan, startLife);
} }
public GameTinyLeadersImpl(final GameTinyLeadersImpl game) { public GameTinyLeadersImpl(final GameTinyLeadersImpl game) {

View file

@ -5,6 +5,7 @@ import mage.constants.MatchTimeLimit;
import mage.constants.MultiplayerAttackOption; import mage.constants.MultiplayerAttackOption;
import mage.constants.RangeOfInfluence; import mage.constants.RangeOfInfluence;
import mage.constants.SkillLevel; import mage.constants.SkillLevel;
import mage.game.mulligan.MulliganType;
import mage.game.result.ResultProtos; import mage.game.result.ResultProtos;
import mage.players.PlayerType; import mage.players.PlayerType;
@ -47,6 +48,7 @@ public class MatchOptions implements Serializable {
* Time each player has during the game to play using his\her priority. * Time each player has during the game to play using his\her priority.
*/ */
protected MatchTimeLimit matchTimeLimit; // 0 = no priorityTime handling protected MatchTimeLimit matchTimeLimit; // 0 = no priorityTime handling
protected MulliganType mulliganType;
/*public MatchOptions(String name, String gameType) { /*public MatchOptions(String name, String gameType) {
this.name = name; this.name = name;
@ -257,4 +259,16 @@ public class MatchOptions implements Serializable {
return builder.build(); return builder.build();
} }
public void setMullgianType(MulliganType mulliganType) {
this.mulliganType = mulliganType;
}
public MulliganType getMulliganType() {
if (mulliganType == null) {
return MulliganType.GAME_DEFAULT;
}
return mulliganType;
}
} }

View file

@ -0,0 +1,43 @@
package mage.game.mulligan;
public enum MulliganType {
GAME_DEFAULT("Game Default"),
VANCOUVER("Vancouver"),
PARIS("Paris"),
LONDON("London"),
CANADIAN_HIGHLANDER("Canadian Highlander");
private final String displayName;
MulliganType(String displayName) {
this.displayName = displayName;
}
public Mulligan getMulligan(int freeMulligans) {
switch(this) {
case PARIS:
return new ParisMulligan(freeMulligans);
case CANADIAN_HIGHLANDER:
return new CanadianHighlanderMulligan(freeMulligans);
case LONDON:
return new LondonMulligan(freeMulligans);
default:
case VANCOUVER:
return new VancouverMulligan(freeMulligans);
}
}
@Override
public String toString() {
return displayName;
}
public MulliganType orDefault(MulliganType defaultMulligan) {
if (this == GAME_DEFAULT) {
return defaultMulligan;
}
return this;
}
}