Add rules comments and handle mulliganing to less than 0 cards for London.

This commit is contained in:
John Hitchings 2019-03-19 23:32:18 -07:00
parent d77ad0ce1f
commit f7d785e406
3 changed files with 45 additions and 3 deletions

View file

@ -22,6 +22,22 @@ public class LondonMulligan extends Mulligan {
@Override
public void executeMulliganPhase(Game game, int startingHandSize) {
/*
* 103.4. Each player draws a number of cards equal to their starting hand size, which is normally
* seven. (Some effects can modify a players starting hand size.) A player who is dissatisfied with
* their initial hand may take a mulligan. First, the starting player declares whether they will
* take a mulligan. Then each other player in turn order does the same. Once each player has made a
* declaration, all players who decided to take mulligans do so at the same time. To take a mulligan,
* a player shuffles the cards in their hand back into their library, draws a new hand of cards equal
* to their starting hand size, then puts a number of those cards onto the bottom of their library in
* any order equal to the number of times that player has taken a mulligan. Once a player chooses not
* to take a mulligan, the remaining cards become the players opening hand, and that player may not
* take any further mulligans. This process is then repeated until no player takes a mulligan. A
* player cant take a number of mulligans greater their starting hand size.
*
* https://magic.wizards.com/en/articles/archive/competitive-gaming/mythic-championship-ii-format-and-london-test-2019-02-21
*/
for (UUID playerId : game.getState().getPlayerList(game.getStartingPlayerId())) {
startingHandSizes.put(playerId, startingHandSize);
}
@ -40,7 +56,6 @@ public class LondonMulligan extends Mulligan {
player.chooseTarget(Outcome.Neutral, cards, target, null, game);
player.putCardsOnBottomOfLibrary(new CardsImpl(target.getTargets()), game, null, true);
cards.removeAll(target.getTargets());
System.out.println(cardsToDiscard);
}
}
}
@ -62,6 +77,11 @@ public class LondonMulligan extends Mulligan {
return startingHandSizes.get(playerId) - deduction;
}
@Override
public boolean canTakeMulligan(Game game, Player player) {
return super.canTakeMulligan(game, player) && startingHandSizes.get(player.getId()) > 0;
}
@Override
public void mulligan(Game game, UUID playerId) {
Player player = game.getPlayer(playerId);

View file

@ -16,6 +16,19 @@ public abstract class Mulligan {
}
public void executeMulliganPhase(Game game, int startingHandSize) {
/*
* 103.4. Each player draws a number of cards equal to their starting hand size,
* which is normally seven. (Some effects can modify a players starting hand size.)
* A player who is dissatisfied with their initial hand may take a mulligan. First
* the starting player declares whether they will take a mulligan. Then each other
* player in turn order does the same. Once each player has made a declaration, all
* players who decided to take mulligans do so at the same time. To take a mulligan,
* a player shuffles their hand back into their library, then draws a new hand of one
* fewer cards than they had before. If a player kept their hand of cards, those cards
* become the players opening hand, and that player may not take any further mulligans.
* This process is then repeated until no player takes a mulligan. (Note that if a
* players hand size reaches zero cards, that player must keep that hand.)
*/
List<UUID> keepPlayers = new ArrayList<>();
List<UUID> mulliganPlayers = new ArrayList<>();
do {
@ -25,7 +38,7 @@ public abstract class Mulligan {
Player player = game.getPlayer(playerId);
boolean keep = true;
while (true) {
if (player.getHand().isEmpty()) {
if (!canTakeMulligan(game, player)) {
break;
}
GameEvent event = new GameEvent(GameEvent.EventType.CAN_TAKE_MULLIGAN, null, null, playerId);
@ -63,6 +76,10 @@ public abstract class Mulligan {
public abstract Mulligan copy();
public boolean canTakeMulligan(Game game, Player player) {
return !player.getHand().isEmpty();
}
public int getFreeMulligans() {
return freeMulligans;
}

View file

@ -14,7 +14,12 @@ public class VancouverMulligan extends ParisMulligan {
@Override
public void executeMulliganPhase(Game game, int startingHandSize) {
super.executeMulliganPhase(game, startingHandSize);
// new scry rule
/*
* 103.4 (scry rule) - After all players have kept an opening hand, each player in
* turn order whose hand contains fewer cards than that players starting hand size
* may look at the top card of their library. If a player does, that player may put
* that card on the bottom of their library.
*/
for (UUID playerId : game.getState().getPlayerList(game.getStartingPlayerId())) {
Player player = game.getPlayer(playerId);
if (player != null && player.getHand().size() < startingHandSize) {