foul-magics/Mage.Server.Plugins/Mage.Game.TwoPlayerDuel/src/mage/game/TwoPlayerMatch.java
Susucre f14479c53c
Add custom options for starting life total and starting hand size (#11259)
* add startHandSize / startLife to the custom option panel

* use the custom startLife/startHandsize in all Game Modes
2023-10-06 23:22:48 -04:00

36 lines
1.3 KiB
Java

package mage.game;
import mage.game.match.MatchImpl;
import mage.game.match.MatchOptions;
import mage.game.mulligan.Mulligan;
/**
* @author BetaSteward_at_googlemail.com
*/
public class TwoPlayerMatch extends MatchImpl {
public TwoPlayerMatch(MatchOptions options) {
super(options);
}
@Override
public void startGame() throws GameException {
Mulligan mulligan = options.getMulliganType().getMulligan(options.getFreeMulligans());
// workaround to enable limited deck size in limited set as deck type (Yorion, Sky Nomad)
// see comments from https://github.com/magefree/mage/commit/4874ad31c199ea573187ea2790268be3a4d4c95a
boolean isLimitedDeck = options.isLimited() || "Limited".equals(options.getDeckType());
int startLife = options.isCustomStartLifeEnabled() ? options.getCustomStartLife() : 20;
int startHandSize = options.isCustomStartHandSizeEnabled() ? options.getCustomStartHandSize() : 7;
TwoPlayerDuel game = new TwoPlayerDuel(
options.getAttackOption(), options.getRange(), mulligan,
isLimitedDeck ? 40 : 60, startLife, startHandSize
);
// Sets a start message about the match score
game.setStartMessage(this.createGameStartMessage());
initGame(game);
games.add(game);
}
}