* UI: improved mulligan dialog with color, added free mulligan info in game log;

This commit is contained in:
Oleg Agafonov 2019-03-17 06:11:20 +04:00
parent bf2861c309
commit 83d8f5a538
2 changed files with 16 additions and 10 deletions

View file

@ -8,6 +8,7 @@ import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.RequirementEffect;
import mage.abilities.hint.HintUtils;
import mage.abilities.mana.ActivatedManaAbilityImpl;
import mage.cards.Card;
import mage.cards.Cards;
@ -45,7 +46,10 @@ import mage.util.ManaUtil;
import mage.util.MessageToClient;
import org.apache.log4j.Logger;
import java.awt.*;
import java.io.Serializable;
import java.util.List;
import java.util.Queue;
import java.util.*;
import static mage.constants.PlayerAction.REQUEST_AUTO_ANSWER_RESET_ALL;
@ -232,9 +236,15 @@ public class HumanPlayer extends PlayerImpl {
updateGameStatePriority("chooseMulligan", game);
int nextHandSize = game.mulliganDownTo(playerId);
do {
String message = "Mulligan "
+ (getHand().size() > nextHandSize ? "down to " : "for free, draw ")
+ nextHandSize + (nextHandSize == 1 ? " card?" : " cards?");
String cardsCountInfo = nextHandSize + (nextHandSize == 1 ? " card" : " cards");
String message;
if (getHand().size() > nextHandSize) {
// pay
message = "Mulligan " + HintUtils.prepareText("down to " + cardsCountInfo, Color.YELLOW) + "?";
} else {
// free
message = "Mulligan " + HintUtils.prepareText("for free", Color.GREEN) + ", draw another " + cardsCountInfo + "?";
}
Map<String, Serializable> options = new HashMap<>();
options.put("UI.left.btn.text", "Mulligan");
options.put("UI.right.btn.text", "Keep");

View file

@ -1,11 +1,5 @@
package mage.game.match;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import mage.cards.decks.Deck;
import mage.game.Game;
import mage.game.GameException;
@ -21,8 +15,9 @@ import mage.util.DateFormat;
import mage.util.RandomUtil;
import org.apache.log4j.Logger;
import java.util.*;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public abstract class MatchImpl implements Match {
@ -421,6 +416,7 @@ public abstract class MatchImpl implements Match {
if (options.getRange() != null) {
sb.append(" Range: ").append(options.getRange().toString()).append("<br/>");
}
sb.append(" Free mulligans: ").append(options.getFreeMulligans()).append("<br/>");
sb.append("<br/>").append("Match is ").append(this.getOptions().isRated() ? "" : "not ").append("rated<br/>");
sb.append("You have to win ").append(this.getWinsNeeded()).append(this.getWinsNeeded() == 1 ? " game" : " games").append(" to win the complete match<br/>");
sb.append("<br/>Game has started<br/><br/>");