mirror of
https://github.com/correl/mage.git
synced 2024-12-26 19:16:54 +00:00
Streamline London Mulligan UX.
- Choose cards to put on bottom directly from hand. - Put cards on bottom in order chosen instead of asking afterwards.
This commit is contained in:
parent
55a8e34f7a
commit
1e8f006448
1 changed files with 13 additions and 22 deletions
|
@ -1,13 +1,12 @@
|
||||||
package mage.game.mulligan;
|
package mage.game.mulligan;
|
||||||
|
|
||||||
import mage.cards.Cards;
|
|
||||||
import mage.cards.CardsImpl;
|
import mage.cards.CardsImpl;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.filter.FilterCard;
|
import mage.filter.FilterCard;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.TargetCard;
|
import mage.target.Target;
|
||||||
|
import mage.target.common.TargetCardInHand;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -15,8 +14,8 @@ import java.util.UUID;
|
||||||
|
|
||||||
public class LondonMulligan extends Mulligan {
|
public class LondonMulligan extends Mulligan {
|
||||||
|
|
||||||
protected Map<UUID, Integer> startingHandSizes = new HashMap<>();
|
private final Map<UUID, Integer> startingHandSizes = new HashMap<>();
|
||||||
protected Map<UUID, Integer> openingHandSizes = new HashMap<>();
|
private final Map<UUID, Integer> openingHandSizes = new HashMap<>();
|
||||||
|
|
||||||
public LondonMulligan(int freeMulligans) {
|
public LondonMulligan(int freeMulligans) {
|
||||||
super(freeMulligans);
|
super(freeMulligans);
|
||||||
|
@ -93,27 +92,20 @@ public class LondonMulligan extends Mulligan {
|
||||||
openingHandSizes.put(playerId, openingHandSizes.get(playerId) - deduction);
|
openingHandSizes.put(playerId, openingHandSizes.get(playerId) - deduction);
|
||||||
int newHandSize = openingHandSizes.get(player.getId());
|
int newHandSize = openingHandSizes.get(player.getId());
|
||||||
if (deduction == 0) {
|
if (deduction == 0) {
|
||||||
game.fireInformEvent(new StringBuilder(player.getLogName())
|
game.fireInformEvent(player.getLogName() +
|
||||||
.append(" mulligans for free.")
|
" mulligans for free.");
|
||||||
.toString());
|
|
||||||
} else {
|
} else {
|
||||||
game.fireInformEvent(new StringBuilder(player.getLogName())
|
game.fireInformEvent(player.getLogName() +
|
||||||
.append(" mulligans")
|
" mulligans down to " +
|
||||||
.append(" down to ")
|
newHandSize +
|
||||||
.append(newHandSize)
|
(newHandSize == 1 ? " card" : " cards"));
|
||||||
.append(newHandSize == 1 ? " card" : " cards").toString());
|
|
||||||
}
|
}
|
||||||
player.drawCards(numCards, null, game);
|
player.drawCards(numCards, null, game);
|
||||||
|
|
||||||
if (player.getHand().size() > newHandSize) {
|
while (player.getHand().size() > newHandSize) {
|
||||||
int cardsToDiscard = player.getHand().size() - newHandSize;
|
Target target = new TargetCardInHand(new FilterCard("card (" + (player.getHand().size() - newHandSize) + " more) to put on the bottom of your library"));
|
||||||
Cards cards = new CardsImpl();
|
player.chooseTarget(Outcome.Discard, target, null, game);
|
||||||
cards.addAll(player.getHand());
|
|
||||||
TargetCard target = new TargetCard(cardsToDiscard, cardsToDiscard, Zone.HAND,
|
|
||||||
new FilterCard("card" + (cardsToDiscard > 1 ? "s" : "") + " to PUT on the BOTTOM of your library (Discard for Mulligan)"));
|
|
||||||
player.chooseTarget(Outcome.Neutral, cards, target, null, game);
|
|
||||||
player.putCardsOnBottomOfLibrary(new CardsImpl(target.getTargets()), game, null, true);
|
player.putCardsOnBottomOfLibrary(new CardsImpl(target.getTargets()), game, null, true);
|
||||||
cards.removeAll(target.getTargets());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,5 +120,4 @@ public class LondonMulligan extends Mulligan {
|
||||||
mulligan.startingHandSizes.putAll(startingHandSizes);
|
mulligan.startingHandSizes.putAll(startingHandSizes);
|
||||||
return mulligan;
|
return mulligan;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue