mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
Fix titles on dig effect prompts
Make reveal dialogs have more consistent titles
This commit is contained in:
@@ -138,4 +138,42 @@ public class Lang {
|
||||
}
|
||||
return Integer.toString(n);
|
||||
}
|
||||
|
||||
public enum PhraseCase {
|
||||
Title,
|
||||
Sentence,
|
||||
Lower
|
||||
}
|
||||
|
||||
public static String splitCompoundWord(String word, PhraseCase phraseCase) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (int i = 0; i < word.length(); i++) {
|
||||
char ch = word.charAt(i);
|
||||
if (Character.isUpperCase(ch)) {
|
||||
if (i > 0) {
|
||||
builder.append(" ");
|
||||
}
|
||||
switch (phraseCase) {
|
||||
case Title:
|
||||
builder.append(ch);
|
||||
break;
|
||||
case Sentence:
|
||||
if (i > 0) {
|
||||
builder.append(ch);
|
||||
}
|
||||
else {
|
||||
builder.append(Character.toLowerCase(ch));
|
||||
}
|
||||
break;
|
||||
case Lower:
|
||||
builder.append(Character.toLowerCase(ch));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else {
|
||||
builder.append(ch);
|
||||
}
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ public class ComputerUtil {
|
||||
if (pay.payComputerCosts(ai, game)) {
|
||||
game.getStack().addAndUnfreeze(sa);
|
||||
if (sa.getSplicedCards() != null && !sa.getSplicedCards().isEmpty()) {
|
||||
game.getAction().reveal("Computer reveals spliced cards:", sa.getSplicedCards(), ai, true);
|
||||
game.getAction().reveal(sa.getSplicedCards(), ai, true, "Computer reveals spliced cards from ");
|
||||
}
|
||||
return true;
|
||||
// TODO: solve problems with TapsForMana triggers by adding
|
||||
|
||||
@@ -1452,20 +1452,24 @@ public class GameAction {
|
||||
}
|
||||
|
||||
public void reveal(Collection<Card> cards, Player cardOwner, boolean dontRevealToOwner) {
|
||||
Card firstCard = Iterables.getFirst(cards, null);
|
||||
if (firstCard == null)
|
||||
return;
|
||||
|
||||
ZoneType zt = game.getZoneOf(firstCard).getZoneType();
|
||||
reveal(cardOwner + " reveals card from " + zt, cards, zt, cardOwner, dontRevealToOwner);
|
||||
reveal(cards, cardOwner, dontRevealToOwner, null);
|
||||
}
|
||||
|
||||
public void reveal(String message, Collection<Card> cards, Player cardOwner, boolean dontRevealToOwner) {
|
||||
public void reveal(Collection<Card> cards, Player cardOwner, boolean dontRevealToOwner, String messagePrefix) {
|
||||
Card firstCard = Iterables.getFirst(cards, null);
|
||||
if (firstCard == null)
|
||||
if (firstCard == null) {
|
||||
return;
|
||||
}
|
||||
reveal(cards, game.getZoneOf(firstCard).getZoneType(), cardOwner, dontRevealToOwner, messagePrefix);
|
||||
}
|
||||
|
||||
reveal(message, cards, game.getZoneOf(firstCard).getZoneType(), cardOwner, dontRevealToOwner);
|
||||
public void reveal(Collection<Card> cards, ZoneType zt, Player cardOwner, boolean dontRevealToOwner, String messagePrefix) {
|
||||
for (Player p : game.getPlayers()) {
|
||||
if (dontRevealToOwner && cardOwner == p) {
|
||||
continue;
|
||||
}
|
||||
p.getController().reveal(cards, zt, cardOwner, messagePrefix);
|
||||
}
|
||||
}
|
||||
|
||||
public void revealAnte(String title, Multimap<Player, PaperCard> removedAnteCards) {
|
||||
@@ -1474,13 +1478,6 @@ public class GameAction {
|
||||
}
|
||||
}
|
||||
|
||||
public void reveal(String message, Collection<Card> cards, ZoneType zt, Player cardOwner, boolean dontRevealToOwner) {
|
||||
for (Player p : game.getPlayers()) {
|
||||
if (dontRevealToOwner && cardOwner == p) continue;
|
||||
p.getController().reveal(message, cards, zt, cardOwner);
|
||||
}
|
||||
}
|
||||
|
||||
/** Delivers a message to all players. (use reveal to show Cards) */
|
||||
public void nofityOfValue(SpellAbility saSource, GameObject relatedTarget, String value, Player playerExcept) {
|
||||
for (Player p : game.getPlayers()) {
|
||||
|
||||
@@ -70,7 +70,7 @@ public class ChangeZoneAllEffect extends SpellAbilityEffect {
|
||||
if (!libCardsYouOwn.isEmpty()) { // Only searching one's own library would fire Archive Trap's altcost
|
||||
sa.getActivatingPlayer().incLibrarySearched();
|
||||
}
|
||||
sa.getActivatingPlayer().getController().reveal("Looking at the Library", libCards, ZoneType.Library, sa.getActivatingPlayer());
|
||||
sa.getActivatingPlayer().getController().reveal(libCards, ZoneType.Library, sa.getActivatingPlayer());
|
||||
}
|
||||
cards = AbilityUtils.filterListByType(cards, sa.getParam("ChangeType"), sa);
|
||||
|
||||
|
||||
@@ -713,12 +713,12 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
final int fetchNum = Math.min(player.getCardsIn(ZoneType.Library).size(), 4);
|
||||
List<Card> shown = !decider.hasKeyword("LimitSearchLibrary") ? player.getCardsIn(ZoneType.Library) : player.getCardsIn(ZoneType.Library, fetchNum);
|
||||
// Look at whole library before moving onto choosing a card
|
||||
decider.getController().reveal(source.getName() + " - Looking at library", shown, ZoneType.Library, player);
|
||||
decider.getController().reveal(shown, ZoneType.Library, player, source.getName() + " - Looking at cards in ");
|
||||
}
|
||||
|
||||
// Look at opponents hand before moving onto choosing a card
|
||||
if (origin.contains(ZoneType.Hand) && player.isOpponentOf(decider)) {
|
||||
decider.getController().reveal(source.getName() + " - Looking at Opponent's Hand", player.getCardsIn(ZoneType.Hand), ZoneType.Hand, player);
|
||||
decider.getController().reveal(player.getCardsIn(ZoneType.Hand), ZoneType.Hand, player, source.getName() + " - Looking at cards in ");
|
||||
}
|
||||
fetchList = AbilityUtils.filterListByType(fetchList, sa.getParam("ChangeType"), sa);
|
||||
}
|
||||
@@ -918,7 +918,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
if (!origin.isEmpty()) {
|
||||
zt = origin.get(0);
|
||||
}
|
||||
decider.getController().reveal(source + " - Revealed card: ", movedCards, zt, player);
|
||||
decider.getController().reveal(movedCards, zt, player, source + " - Revealed card" + (movedCards.size() > 1 ? "s" : "") + " from ");
|
||||
}
|
||||
|
||||
if ((origin.contains(ZoneType.Library) && !destination.equals(ZoneType.Library) && !defined && shuffleMandatory)
|
||||
|
||||
@@ -34,9 +34,10 @@ public class DigEffect extends SpellAbilityEffect {
|
||||
|
||||
if (tgtPlayers.contains(host.getController())) {
|
||||
sb.append("his or her ");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
for (final Player p : tgtPlayers) {
|
||||
sb.append(p).append("'s ");
|
||||
sb.append(Lang.getPossesive(p.getName())).append(" ");
|
||||
}
|
||||
}
|
||||
sb.append("library.");
|
||||
@@ -48,7 +49,7 @@ public class DigEffect extends SpellAbilityEffect {
|
||||
final Card host = sa.getSourceCard();
|
||||
final Player player = sa.getActivatingPlayer();
|
||||
final Game game = player.getGame();
|
||||
Player choser = player;
|
||||
Player chooser = player;
|
||||
int numToDig = AbilityUtils.calculateAmount(host, sa.getParam("DigNum"), sa);
|
||||
|
||||
final ZoneType srcZone = sa.hasParam("SourceZone") ? ZoneType.smartValueOf(sa.getParam("SourceZone")) : ZoneType.Library;
|
||||
@@ -79,9 +80,11 @@ public class DigEffect extends SpellAbilityEffect {
|
||||
if (sa.hasParam("ChangeNum")) {
|
||||
if (sa.getParam("ChangeNum").equalsIgnoreCase("All")) {
|
||||
changeAll = true;
|
||||
} else if (sa.getParam("ChangeNum").equalsIgnoreCase("AllButOne")) {
|
||||
}
|
||||
else if (sa.getParam("ChangeNum").equalsIgnoreCase("AllButOne")) {
|
||||
allButOne = true;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
destZone1ChangeNum = AbilityUtils.calculateAmount(host, sa.getParam("ChangeNum"), sa);
|
||||
}
|
||||
}
|
||||
@@ -90,9 +93,9 @@ public class DigEffect extends SpellAbilityEffect {
|
||||
final List<Player> tgtPlayers = getTargetPlayers(sa);
|
||||
|
||||
if (sa.hasParam("Choser")) {
|
||||
final List<Player> chosers = AbilityUtils.getDefinedPlayers(sa.getSourceCard(), sa.getParam("Choser"), sa);
|
||||
if (!chosers.isEmpty()) {
|
||||
choser = chosers.get(0);
|
||||
final List<Player> choosers = AbilityUtils.getDefinedPlayers(sa.getSourceCard(), sa.getParam("Choser"), sa);
|
||||
if (!choosers.isEmpty()) {
|
||||
chooser = choosers.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,25 +106,27 @@ public class DigEffect extends SpellAbilityEffect {
|
||||
final List<Card> top = new ArrayList<Card>();
|
||||
List<Card> valid = new ArrayList<Card>();
|
||||
final List<Card> rest = new ArrayList<Card>();
|
||||
final PlayerZone library = p.getZone(srcZone);
|
||||
final PlayerZone sourceZone = p.getZone(srcZone);
|
||||
|
||||
numToDig = Math.min(numToDig, library.size());
|
||||
numToDig = Math.min(numToDig, sourceZone.size());
|
||||
for (int i = 0; i < numToDig; i++) {
|
||||
top.add(library.get(i));
|
||||
top.add(sourceZone.get(i));
|
||||
}
|
||||
|
||||
if (top.size() > 0) {
|
||||
boolean hasRevealed = true;
|
||||
if (sa.hasParam("Reveal")) {
|
||||
game.getAction().reveal(top, p, false);
|
||||
} else if (sa.hasParam("RevealOptional")) {
|
||||
}
|
||||
else if (sa.hasParam("RevealOptional")) {
|
||||
String question = "Reveal: " + Lang.joinHomogenous(top) +"?";
|
||||
|
||||
hasRevealed = p.getController().confirmAction(sa, null, question);
|
||||
if ( hasRevealed )
|
||||
if (hasRevealed) {
|
||||
game.getAction().reveal(top, p);
|
||||
|
||||
} else if (sa.hasParam("RevealValid")) {
|
||||
}
|
||||
}
|
||||
else if (sa.hasParam("RevealValid")) {
|
||||
final String revealValid = sa.getParam("RevealValid");
|
||||
final List<Card> toReveal = CardLists.getValidCards(top, revealValid, host.getController(), host);
|
||||
if (!toReveal.isEmpty()) {
|
||||
@@ -134,9 +139,10 @@ public class DigEffect extends SpellAbilityEffect {
|
||||
}
|
||||
// Singletons.getModel().getGameAction().revealToCopmuter(top.toArray());
|
||||
// - for when it exists
|
||||
} else if (!sa.hasParam("NoLooking")) {
|
||||
}
|
||||
else if (!sa.hasParam("NoLooking")) {
|
||||
// show the user the revealed cards
|
||||
choser.getController().reveal("Looking at cards from library", top, library.getZoneType(), library.getPlayer());
|
||||
chooser.getController().reveal(top, srcZone, p);
|
||||
}
|
||||
|
||||
if ((sa.hasParam("RememberRevealed")) && !sa.hasParam("RevealValid") && hasRevealed) {
|
||||
@@ -153,7 +159,8 @@ public class DigEffect extends SpellAbilityEffect {
|
||||
}
|
||||
if (mitosis) {
|
||||
valid = sharesNameWithCardOnBattlefield(game, top);
|
||||
} else if (!changeValid.equals("")) {
|
||||
}
|
||||
else if (!changeValid.isEmpty()) {
|
||||
if (changeValid.contains("ChosenType")) {
|
||||
changeValid = changeValid.replace("ChosenType", host.getChosenType());
|
||||
}
|
||||
@@ -163,50 +170,62 @@ public class DigEffect extends SpellAbilityEffect {
|
||||
andOrCards.removeAll(valid);
|
||||
valid.addAll(andOrCards);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
valid = top;
|
||||
}
|
||||
|
||||
if (changeAll) {
|
||||
movedCards.addAll(valid);
|
||||
} else if (sa.hasParam("RandomChange")) {
|
||||
}
|
||||
else if (sa.hasParam("RandomChange")) {
|
||||
int numChanging = Math.min(destZone1ChangeNum, valid.size());
|
||||
movedCards = CardLists.getRandomSubList(valid, numChanging);
|
||||
} else if (allButOne) {
|
||||
movedCards.addAll(valid);
|
||||
String prompt = "Choose a card to leave in ";
|
||||
if (destZone2.equals(ZoneType.Library) && (libraryPosition2 == 0)) {
|
||||
prompt = "Leave which card on top of the ";
|
||||
}
|
||||
else if (allButOne) {
|
||||
movedCards.addAll(valid);
|
||||
String prefix;
|
||||
if (destZone2.equals(ZoneType.Library) && (libraryPosition2 == 0)) {
|
||||
prefix = "Choose a card to leave on top of ";
|
||||
}
|
||||
else {
|
||||
prefix = "Choose a card to leave in ";
|
||||
}
|
||||
String prompt = destZone2.createMessage(p, prefix);
|
||||
|
||||
Card chosen = choser.getController().chooseSingleEntityForEffect(valid, sa, prompt + destZone2, false, p);
|
||||
Card chosen = chooser.getController().chooseSingleEntityForEffect(valid, sa, prompt, false, p);
|
||||
movedCards.remove(chosen);
|
||||
if (sa.hasParam("RandomOrder")) {
|
||||
final Random random = MyRandom.getRandom();
|
||||
Collections.shuffle(movedCards, random);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
int j = 0;
|
||||
String prompt = "Choose a card to put into the ";
|
||||
if (destZone1.equals(ZoneType.Library) && libraryPosition == -1) {
|
||||
prompt = "Chose a card to put on the bottom of the ";
|
||||
String prefix = "Choose a card to put into ";
|
||||
if (destZone1.equals(ZoneType.Library)) {
|
||||
if (libraryPosition == -1) {
|
||||
prefix = "Choose a card to put on the bottom of ";
|
||||
}
|
||||
if (destZone1.equals(ZoneType.Library) && libraryPosition == 0) {
|
||||
prompt = "Chose a card to put on top of the ";
|
||||
else if (libraryPosition == 0) {
|
||||
prefix = "Choose a card to put on top of ";
|
||||
}
|
||||
|
||||
}
|
||||
String prompt = destZone1.createMessage(p, prefix);
|
||||
|
||||
while ((j < destZone1ChangeNum) || (anyNumber && (j < numToDig))) {
|
||||
// let user get choice
|
||||
|
||||
Card chosen = null;
|
||||
if(!valid.isEmpty())
|
||||
chosen = choser.getController().chooseSingleEntityForEffect(valid, sa, prompt, anyNumber || optional, p);
|
||||
else
|
||||
choser.getController().notifyOfValue(sa, null, "No valid cards");
|
||||
if (!valid.isEmpty()) {
|
||||
chosen = chooser.getController().chooseSingleEntityForEffect(valid, sa, prompt, anyNumber || optional, p);
|
||||
}
|
||||
else {
|
||||
chooser.getController().notifyOfValue(sa, null, destZone1.createMessage(p, "No valid cards in "));
|
||||
}
|
||||
|
||||
if( chosen == null )
|
||||
if (chosen == null) {
|
||||
break;
|
||||
}
|
||||
|
||||
movedCards.add(chosen);
|
||||
valid.remove(chosen);
|
||||
@@ -214,7 +233,8 @@ public class DigEffect extends SpellAbilityEffect {
|
||||
andOrCards.remove(chosen);
|
||||
if (!chosen.isValid(andOrValid.split(","), host.getController(), host)) {
|
||||
valid = new ArrayList<Card>(andOrCards);
|
||||
} else if (!chosen.isValid(changeValid.split(","), host.getController(), host)) {
|
||||
}
|
||||
else if (!chosen.isValid(changeValid.split(","), host.getController(), host)) {
|
||||
valid.removeAll(andOrCards);
|
||||
}
|
||||
}
|
||||
@@ -222,7 +242,8 @@ public class DigEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
if (changeValid.length() > 0) {
|
||||
game.getAction().reveal(choser + " picked:", movedCards, choser, true);
|
||||
game.getAction().reveal(movedCards, chooser, true,
|
||||
chooser + " picked " + (movedCards.size() == 1 ? "this card" : "these cards") + " from ");
|
||||
}
|
||||
}
|
||||
if (sa.hasParam("ForgetOtherRemembered")) {
|
||||
@@ -237,7 +258,8 @@ public class DigEffect extends SpellAbilityEffect {
|
||||
libraryPosition = zone.size();
|
||||
}
|
||||
c = game.getAction().moveTo(zone, c, libraryPosition);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
c = game.getAction().moveTo(zone, c);
|
||||
if (destZone1.equals(ZoneType.Battlefield)) {
|
||||
for (final String kw : keywords) {
|
||||
@@ -268,7 +290,7 @@ public class DigEffect extends SpellAbilityEffect {
|
||||
if (destZone2 == ZoneType.Library || destZone2 == ZoneType.PlanarDeck || destZone2 == ZoneType.SchemeDeck) {
|
||||
List<Card> afterOrder = rest;
|
||||
if (!skipReorder && rest.size() > 1) {
|
||||
afterOrder = choser.getController().orderMoveToZoneList(rest, destZone2);
|
||||
afterOrder = chooser.getController().orderMoveToZoneList(rest, destZone2);
|
||||
}
|
||||
if (libraryPosition2 != -1) {
|
||||
// Closest to top
|
||||
@@ -277,11 +299,13 @@ public class DigEffect extends SpellAbilityEffect {
|
||||
for (final Card c : afterOrder) {
|
||||
if (destZone2 == ZoneType.Library) {
|
||||
game.getAction().moveToLibrary(c, libraryPosition2);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
game.getAction().moveToVariantDeck(c, destZone2, libraryPosition2);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// just move them randomly
|
||||
for (int i = 0; i < rest.size(); i++) {
|
||||
Card c = rest.get(i);
|
||||
|
||||
@@ -180,7 +180,7 @@ public class DiscardEffect extends SpellAbilityEffect {
|
||||
// Reveal
|
||||
final List<Card> dPHand = p.getCardsIn(ZoneType.Hand);
|
||||
|
||||
p.getOpponent().getController().reveal("Reveal " + p + " hand" , dPHand, ZoneType.Hand, p);
|
||||
p.getOpponent().getController().reveal(dPHand, ZoneType.Hand, p, "Reveal ");
|
||||
|
||||
String valid = sa.hasParam("DiscardValid") ? sa.getParam("DiscardValid") : "Card";
|
||||
|
||||
@@ -226,7 +226,8 @@ public class DiscardEffect extends SpellAbilityEffect {
|
||||
List<Card> toBeDiscarded = validCards.isEmpty() ? CardLists.emptyList : chooser.getController().chooseCardsToDiscardFrom(p, sa, validCards, min, max);
|
||||
|
||||
if (mode.startsWith("Reveal") ) {
|
||||
p.getController().reveal(chooser + " has chosen", toBeDiscarded, ZoneType.Hand, p);
|
||||
p.getController().reveal(toBeDiscarded, ZoneType.Hand, p,
|
||||
chooser + " has chosen " + (toBeDiscarded.size() == 1 ? "this card" : "these cards") + " from ");
|
||||
}
|
||||
|
||||
if (toBeDiscarded != null) {
|
||||
|
||||
@@ -51,7 +51,7 @@ public class PeekAndRevealEffect extends SpellAbilityEffect {
|
||||
List<Card> revealableCards = CardLists.getValidCards(peekCards, revealValid, sa.getActivatingPlayer(), sa.getSourceCard());
|
||||
boolean doReveal = !sa.hasParam("NoReveal") && !revealableCards.isEmpty();
|
||||
if (!sa.hasParam("NoPeek")) {
|
||||
peekingPlayer.getController().reveal(source + "Revealing cards from library", peekCards, ZoneType.Library, peekingPlayer);
|
||||
peekingPlayer.getController().reveal(peekCards, ZoneType.Library, peekingPlayer, source + " - Revealing cards from ");
|
||||
}
|
||||
|
||||
if( doReveal && sa.hasParam("RevealOptional") )
|
||||
|
||||
@@ -44,7 +44,7 @@ public class RevealHandEffect extends SpellAbilityEffect {
|
||||
continue;
|
||||
}
|
||||
final List<Card> hand = p.getCardsIn(ZoneType.Hand);
|
||||
sa.getActivatingPlayer().getController().reveal(p.getName() + "'s hand", hand, ZoneType.Hand, p);
|
||||
sa.getActivatingPlayer().getController().reveal(hand, ZoneType.Hand, p);
|
||||
if (sa.hasParam("RememberRevealed")) {
|
||||
for (final Card c : hand) {
|
||||
host.addRemembered(c);
|
||||
|
||||
@@ -1376,7 +1376,7 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
}
|
||||
}
|
||||
if (reveal) {
|
||||
game.getAction().reveal("Revealing the first card drawn", drawn, this, true);
|
||||
game.getAction().reveal(drawn, this, true, "Revealing the first card drawn from ");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -146,7 +146,10 @@ public abstract class PlayerController {
|
||||
public abstract List<Card> orderAttackers(Card blocker, List<Card> attackers);
|
||||
|
||||
/** Shows the card to this player*/
|
||||
public abstract void reveal(String string, Collection<Card> cards, ZoneType zone, Player owner);
|
||||
public final void reveal(Collection<Card> cards, ZoneType zone, Player owner) {
|
||||
reveal(cards, zone, owner, null);
|
||||
}
|
||||
public abstract void reveal(Collection<Card> cards, ZoneType zone, Player owner, String messagePrefix);
|
||||
/** Shows message to player to reveal chosen cardName, creatureType, number etc. AI must analyze API to understand what that is */
|
||||
public abstract void notifyOfValue(SpellAbility saSource, GameObject realtedTarget, String value);
|
||||
public abstract ImmutablePair<List<Card>, List<Card>> arrangeForScry(List<Card> topN);
|
||||
|
||||
@@ -221,7 +221,7 @@ public class PlayerControllerAi extends PlayerController {
|
||||
* @see forge.game.player.PlayerController#reveal(java.lang.String, java.util.List)
|
||||
*/
|
||||
@Override
|
||||
public void reveal(String string, Collection<Card> cards, ZoneType zone, Player owner) {
|
||||
public void reveal(Collection<Card> cards, ZoneType zone, Player owner, String messagePrefix) {
|
||||
// We don't know how to reveal cards to AI
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,10 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import forge.game.player.Player;
|
||||
import forge.net.FServer;
|
||||
import forge.util.Lang;
|
||||
|
||||
/**
|
||||
* The Enum Zone.
|
||||
*/
|
||||
@@ -62,7 +66,6 @@ public enum ZoneType {
|
||||
return !holdsHiddenInfo;
|
||||
}
|
||||
|
||||
|
||||
public static boolean isHidden(final String origin) {
|
||||
List<ZoneType> zone = ZoneType.listValueOf(origin);
|
||||
|
||||
@@ -81,4 +84,38 @@ public enum ZoneType {
|
||||
public static boolean isKnown(final String origin) {
|
||||
return !isHidden(origin);
|
||||
}
|
||||
|
||||
public String createMessage(Player player, String prefix) {
|
||||
return createMessage(player, prefix, null);
|
||||
}
|
||||
public String createMessage(Player player, String prefix, String suffix) {
|
||||
StringBuilder message = new StringBuilder();
|
||||
|
||||
String owner;
|
||||
if (player.getLobbyPlayer() == FServer.instance.getLobby().getGuiPlayer()) {
|
||||
owner = "your";
|
||||
}
|
||||
else {
|
||||
owner = Lang.getPossesive(player.getName());
|
||||
}
|
||||
|
||||
if (prefix != null && !prefix.isEmpty()) {
|
||||
message.append(prefix);
|
||||
if (!prefix.endsWith(" ")) {
|
||||
message.append(" ");
|
||||
}
|
||||
message.append(owner);
|
||||
}
|
||||
else {
|
||||
message.append(owner.substring(0, 1).toUpperCase() + owner.substring(1));
|
||||
}
|
||||
|
||||
message.append(" " + Lang.splitCompoundWord(this.toString(), Lang.PhraseCase.Lower));
|
||||
|
||||
if (suffix != null && !suffix.isEmpty()) {
|
||||
message.append(" " + suffix);
|
||||
}
|
||||
|
||||
return message.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -455,12 +455,11 @@ public class PlayerControllerHuman extends PlayerController {
|
||||
* @see forge.game.player.PlayerController#reveal(java.lang.String, java.util.List, forge.game.zone.ZoneType, forge.game.player.Player)
|
||||
*/
|
||||
@Override
|
||||
public void reveal(String string, Collection<Card> cards, ZoneType zone, Player owner) {
|
||||
String message = string;
|
||||
if (StringUtils.isBlank(message)) {
|
||||
message = String.format("Looking at %s's %s", owner, zone);
|
||||
public void reveal(Collection<Card> cards, ZoneType zone, Player owner, String messagePrefix) {
|
||||
if (StringUtils.isBlank(messagePrefix)) {
|
||||
messagePrefix = "Looking at cards in ";
|
||||
}
|
||||
GuiChoose.reveal(message, cards);
|
||||
GuiChoose.reveal(zone.createMessage(owner, messagePrefix), cards);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -204,7 +204,7 @@ public class PlayerControllerForTests extends PlayerController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reveal(String string, Collection<Card> cards, ZoneType zone, Player owner) {
|
||||
public void reveal(Collection<Card> cards, ZoneType zone, Player owner, String messagePrefix) {
|
||||
//nothing needs to be done here
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user