mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
Improvements to limited with Freeform Unlimited Commander (#10114)
* Limited-style sideboarding with unlimited basics enabled for Freeform Unlimited Commander * FreeformUnlimitedCommander does not depend on FreeformCommanderFreeForAll anymore. FreeformUnlimitedCommander has sideboarding. In two-player matches of FreeformUnlimitedCommander, the player who goes first doesn't draw a card on their first turn anymore. * FreeformUnlimitedCommanderTypeTest takes into account that sideboarding is allowed * Fix to startingPlayerSkipsDraw condition --------- Co-authored-by: sprangg <a@b.c>
This commit is contained in:
parent
91d7a0a88c
commit
99701e08e7
6 changed files with 61 additions and 10 deletions
|
@ -603,7 +603,6 @@ public class NewTableDialog extends MageDialog {
|
||||||
options.getPlayerTypes().add(player.getPlayerType());
|
options.getPlayerTypes().add(player.getPlayerType());
|
||||||
}
|
}
|
||||||
options.setDeckType((String) this.cbDeckType.getSelectedItem());
|
options.setDeckType((String) this.cbDeckType.getSelectedItem());
|
||||||
options.setLimited(options.getDeckType().startsWith("Limited"));
|
|
||||||
options.setMatchTimeLimit((MatchTimeLimit) this.cbTimeLimit.getSelectedItem());
|
options.setMatchTimeLimit((MatchTimeLimit) this.cbTimeLimit.getSelectedItem());
|
||||||
options.setAttackOption((MultiplayerAttackOption) this.cbAttackOption.getSelectedItem());
|
options.setAttackOption((MultiplayerAttackOption) this.cbAttackOption.getSelectedItem());
|
||||||
options.setSkillLevel((SkillLevel) this.cbSkillLevel.getSelectedItem());
|
options.setSkillLevel((SkillLevel) this.cbSkillLevel.getSelectedItem());
|
||||||
|
@ -621,6 +620,10 @@ public class NewTableDialog extends MageDialog {
|
||||||
options.setMullgianType((MulliganType) this.cbMulligan.getSelectedItem());
|
options.setMullgianType((MulliganType) this.cbMulligan.getSelectedItem());
|
||||||
String serverAddress = SessionHandler.getSession().getServerHostname().orElse("");
|
String serverAddress = SessionHandler.getSession().getServerHostname().orElse("");
|
||||||
options.setBannedUsers(IgnoreList.getIgnoredUsers(serverAddress));
|
options.setBannedUsers(IgnoreList.getIgnoredUsers(serverAddress));
|
||||||
|
options.setLimited(options.getDeckType().startsWith("Limited"));
|
||||||
|
if (options.getDeckType().startsWith("Variant Magic - Freeform Unlimited Commander")) {
|
||||||
|
options.setLimited(true); // limited-style sideboarding with unlimited basics enabled for Freeform Unlimited Commander
|
||||||
|
}
|
||||||
|
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1329,6 +1329,9 @@ public class NewTournamentDialog extends MageDialog {
|
||||||
tOptions.getMatchOptions().setDeckType((String) this.cbDeckType.getSelectedItem());
|
tOptions.getMatchOptions().setDeckType((String) this.cbDeckType.getSelectedItem());
|
||||||
tOptions.getMatchOptions().setGameType(((GameTypeView) this.cbGameType.getSelectedItem()).getName());
|
tOptions.getMatchOptions().setGameType(((GameTypeView) this.cbGameType.getSelectedItem()).getName());
|
||||||
tOptions.getMatchOptions().setLimited(tOptions.getMatchOptions().getDeckType().startsWith("Limited"));
|
tOptions.getMatchOptions().setLimited(tOptions.getMatchOptions().getDeckType().startsWith("Limited"));
|
||||||
|
if (tOptions.getMatchOptions().getDeckType().startsWith("Variant Magic - Freeform Unlimited Commander")) {
|
||||||
|
tOptions.getMatchOptions().setLimited(true); // limited-style sideboarding with unlimited basics enabled for Freeform Unlimited Commander
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String serverAddress = SessionHandler.getSession().getServerHostname().orElse("");
|
String serverAddress = SessionHandler.getSession().getServerHostname().orElse("");
|
||||||
|
|
|
@ -1,19 +1,49 @@
|
||||||
|
|
||||||
package mage.game;
|
package mage.game;
|
||||||
|
|
||||||
|
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.mulligan.Mulligan;
|
import mage.game.mulligan.Mulligan;
|
||||||
|
|
||||||
public class FreeformUnlimitedCommander extends FreeformCommanderFreeForAll {
|
public class FreeformUnlimitedCommander extends GameCommanderImpl {
|
||||||
|
|
||||||
protected int numPlayers;
|
private int numPlayers;
|
||||||
|
|
||||||
public FreeformUnlimitedCommander(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife) {
|
public FreeformUnlimitedCommander(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife) {
|
||||||
super(attackOption, range, mulligan, startLife);
|
super(attackOption, range, mulligan, startLife, 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FreeformUnlimitedCommander(final FreeformUnlimitedCommander game) {
|
public FreeformUnlimitedCommander(final FreeformUnlimitedCommander game) {
|
||||||
super(game);
|
super(game);
|
||||||
this.numPlayers = game.numPlayers;
|
this.numPlayers = game.numPlayers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void init(UUID choosingPlayerId) {
|
||||||
|
if (state.getPlayerList().size() > 2) {
|
||||||
|
startingPlayerSkipsDraw = false;
|
||||||
|
}
|
||||||
|
super.init(choosingPlayerId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MatchType getGameType() {
|
||||||
|
return new FreeformUnlimitedCommanderType();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getNumPlayers() {
|
||||||
|
return numPlayers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumPlayers(int numPlayers) {
|
||||||
|
this.numPlayers = numPlayers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FreeformUnlimitedCommander copy() {
|
||||||
|
return new FreeformUnlimitedCommander(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,23 @@
|
||||||
package mage.game;
|
package mage.game;
|
||||||
|
|
||||||
|
import mage.game.match.MatchImpl;
|
||||||
import mage.game.match.MatchOptions;
|
import mage.game.match.MatchOptions;
|
||||||
|
import mage.game.mulligan.Mulligan;
|
||||||
|
|
||||||
public class FreeformUnlimitedCommanderMatch extends FreeformCommanderFreeForAllMatch {
|
public class FreeformUnlimitedCommanderMatch extends MatchImpl {
|
||||||
|
|
||||||
public FreeformUnlimitedCommanderMatch(MatchOptions options) {
|
public FreeformUnlimitedCommanderMatch(MatchOptions options) {
|
||||||
super(options);
|
super(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void startGame() throws GameException {
|
||||||
|
int startLife = 40;
|
||||||
|
Mulligan mulligan = options.getMulliganType().getMulligan(options.getFreeMulligans());
|
||||||
|
FreeformUnlimitedCommander game = new FreeformUnlimitedCommander(options.getAttackOption(), options.getRange(), mulligan, startLife);
|
||||||
|
game.setStartMessage(this.createGameStartMessage());
|
||||||
|
initGame(game);
|
||||||
|
games.add(game);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,6 +1,8 @@
|
||||||
package mage.game;
|
package mage.game;
|
||||||
|
|
||||||
public class FreeformUnlimitedCommanderType extends FreeformCommanderFreeForAllType {
|
import mage.game.match.MatchType;
|
||||||
|
|
||||||
|
public class FreeformUnlimitedCommanderType extends MatchType {
|
||||||
|
|
||||||
public FreeformUnlimitedCommanderType() {
|
public FreeformUnlimitedCommanderType() {
|
||||||
this.name = "Freeform Unlimited Commander";
|
this.name = "Freeform Unlimited Commander";
|
||||||
|
@ -10,7 +12,7 @@ public class FreeformUnlimitedCommanderType extends FreeformCommanderFreeForAllT
|
||||||
this.playersPerTeam = 0;
|
this.playersPerTeam = 0;
|
||||||
this.useAttackOption = true;
|
this.useAttackOption = true;
|
||||||
this.useRange = true;
|
this.useRange = true;
|
||||||
this.sideboardingAllowed = false;
|
this.sideboardingAllowed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected FreeformUnlimitedCommanderType(final FreeformUnlimitedCommanderType matchType) {
|
protected FreeformUnlimitedCommanderType(final FreeformUnlimitedCommanderType matchType) {
|
||||||
|
|
|
@ -90,11 +90,11 @@ public class FreeformUnlimitedCommanderTypeTest extends MageTestPlayerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_isSideboardingAllowed_returnsFalse() {
|
public void test_isSideboardingAllowed_returnsTrue() {
|
||||||
// Arrange
|
// Arrange
|
||||||
MatchType gametype = new FreeformUnlimitedCommanderType();
|
MatchType gametype = new FreeformUnlimitedCommanderType();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.assertFalse(gametype.isSideboardingAllowed());
|
Assert.assertTrue(gametype.isSideboardingAllowed());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue