mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 02:08:00 +00:00
translate enum ZoneType
This commit is contained in:
@@ -752,10 +752,10 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
if (optional) {
|
||||
String prompt;
|
||||
if (defined) {
|
||||
prompt = Localizer.getInstance().getMessage("lblPutThatCardFromPlayerOriginToDestination", "{player's}", Lang.joinHomogenous(origin).toLowerCase(), destination.name().toLowerCase());
|
||||
prompt = Localizer.getInstance().getMessage("lblPutThatCardFromPlayerOriginToDestination", "{player's}", Lang.joinHomogenous(origin, ZoneType.Accessors.GET_TRANSLATED_NAME).toLowerCase(), destination.name().toLowerCase());
|
||||
}
|
||||
else {
|
||||
prompt = Localizer.getInstance().getMessage("lblSearchPlayerZoneConfirm", "{player's}", Lang.joinHomogenous(origin).toLowerCase());
|
||||
prompt = Localizer.getInstance().getMessage("lblSearchPlayerZoneConfirm", "{player's}", Lang.joinHomogenous(origin, ZoneType.Accessors.GET_TRANSLATED_NAME).toLowerCase());
|
||||
}
|
||||
String message = MessageUtil.formatMessage(prompt , decider, player);
|
||||
if (!decider.getController().confirmAction(sa, PlayerActionConfirmMode.ChangeZoneGeneral, message)) {
|
||||
@@ -861,7 +861,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
final boolean champion = sa.hasParam("Champion");
|
||||
final boolean forget = sa.hasParam("ForgetChanged");
|
||||
final boolean imprint = sa.hasParam("Imprint");
|
||||
String selectPrompt = sa.hasParam("SelectPrompt") ? sa.getParam("SelectPrompt") : MessageUtil.formatMessage(Localizer.getInstance().getMessage("lblSelectCardFromPlayerZone", "{player's}", Lang.joinHomogenous(origin).toLowerCase()), decider, player);
|
||||
String selectPrompt = sa.hasParam("SelectPrompt") ? sa.getParam("SelectPrompt") : MessageUtil.formatMessage(Localizer.getInstance().getMessage("lblSelectCardFromPlayerZone", "{player's}", Lang.joinHomogenous(origin, ZoneType.Accessors.GET_TRANSLATED_NAME).toLowerCase()), decider, player);
|
||||
final String totalcmc = sa.getParam("WithTotalCMC");
|
||||
int totcmc = AbilityUtils.calculateAmount(source, totalcmc, sa);
|
||||
|
||||
@@ -875,9 +875,9 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
// new default messaging for multi select
|
||||
if (fetchList.size() > changeNum) {
|
||||
//Select up to %changeNum cards from %players %origin
|
||||
selectPrompt = MessageUtil.formatMessage(Localizer.getInstance().getMessage("lblSelectUpToNumCardFromPlayerZone", String.valueOf(changeNum), "{player's}", Lang.joinHomogenous(origin).toLowerCase()), decider, player);
|
||||
selectPrompt = MessageUtil.formatMessage(Localizer.getInstance().getMessage("lblSelectUpToNumCardFromPlayerZone", String.valueOf(changeNum), "{player's}", Lang.joinHomogenous(origin, ZoneType.Accessors.GET_TRANSLATED_NAME).toLowerCase()), decider, player);
|
||||
} else {
|
||||
selectPrompt = MessageUtil.formatMessage(Localizer.getInstance().getMessage("lblSelectCardsFromPlayerZone", "{player's}", Lang.joinHomogenous(origin).toLowerCase()), decider, player);
|
||||
selectPrompt = MessageUtil.formatMessage(Localizer.getInstance().getMessage("lblSelectCardsFromPlayerZone", "{player's}", Lang.joinHomogenous(origin, ZoneType.Accessors.GET_TRANSLATED_NAME).toLowerCase()), decider, player);
|
||||
}
|
||||
}
|
||||
// ensure that selection is within maximum allowed changeNum
|
||||
|
||||
@@ -246,7 +246,7 @@ public class DigEffect extends SpellAbilityEffect {
|
||||
if (sa.hasParam("PrimaryPrompt")) {
|
||||
prompt = sa.getParam("PrimaryPrompt");
|
||||
} else {
|
||||
prompt = Localizer.getInstance().getMessage("lblChooseCardsPutIntoZone", destZone1.name());
|
||||
prompt = Localizer.getInstance().getMessage("lblChooseCardsPutIntoZone", destZone1.getTranslatedName());
|
||||
if (destZone1.equals(ZoneType.Library)) {
|
||||
if (libraryPosition == -1) {
|
||||
prompt = Localizer.getInstance().getMessage("lblChooseCardPutOnTargetLibarayBottom", "{player's}");
|
||||
|
||||
@@ -160,7 +160,7 @@ public class DigUntilEffect extends SpellAbilityEffect {
|
||||
final Card c = itr.next();
|
||||
final ZoneType origin = c.getZone().getZoneType();
|
||||
if (optionalFound && !p.getController().confirmAction(sa, null,
|
||||
Localizer.getInstance().getMessage("lblDoYouWantPutCardToZone", foundDest.name()))) {
|
||||
Localizer.getInstance().getMessage("lblDoYouWantPutCardToZone", foundDest.getTranslatedName()))) {
|
||||
continue;
|
||||
} else {
|
||||
Card m = null;
|
||||
|
||||
@@ -1,32 +1,38 @@
|
||||
package forge.game.zone;
|
||||
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
|
||||
/**
|
||||
* The Enum Zone.
|
||||
*/
|
||||
public enum ZoneType {
|
||||
Hand(true),
|
||||
Library(true),
|
||||
Graveyard(false),
|
||||
Battlefield(false),
|
||||
Exile(false),
|
||||
Flashback(false),
|
||||
Command(false),
|
||||
Stack(false),
|
||||
Sideboard(true),
|
||||
Ante(false),
|
||||
SchemeDeck(true),
|
||||
PlanarDeck(true),
|
||||
None(true);
|
||||
Hand(true, Localizer.getInstance().getMessage("lblHandZone")),
|
||||
Library(true, Localizer.getInstance().getMessage("lblLibraryZone")),
|
||||
Graveyard(false, Localizer.getInstance().getMessage("lblGraveyardZone")),
|
||||
Battlefield(false, Localizer.getInstance().getMessage("lblBattlefieldZone")),
|
||||
Exile(false, Localizer.getInstance().getMessage("lblExileZone")),
|
||||
Flashback(false, Localizer.getInstance().getMessage("lblFlashbackZone")),
|
||||
Command(false, Localizer.getInstance().getMessage("lblCommandZone")),
|
||||
Stack(false, Localizer.getInstance().getMessage("lblStackZone")),
|
||||
Sideboard(true, Localizer.getInstance().getMessage("lblSideboardZone")),
|
||||
Ante(false, Localizer.getInstance().getMessage("lblAnteZone")),
|
||||
SchemeDeck(true, Localizer.getInstance().getMessage("lblSchemeDeckZone")),
|
||||
PlanarDeck(true, Localizer.getInstance().getMessage("lblPlanarDeckZone")),
|
||||
None(true, Localizer.getInstance().getMessage("lblNoneZone"));
|
||||
|
||||
public static final List<ZoneType> STATIC_ABILITIES_SOURCE_ZONES = Arrays.asList(Battlefield, Graveyard, Exile, Command/*, Hand*/);
|
||||
|
||||
private final boolean holdsHiddenInfo;
|
||||
ZoneType(boolean holdsHidden) {
|
||||
private final String zoneName;
|
||||
ZoneType(boolean holdsHidden, String name) {
|
||||
holdsHiddenInfo = holdsHidden;
|
||||
zoneName = name;
|
||||
}
|
||||
|
||||
public static ZoneType smartValueOf(final String value) {
|
||||
@@ -64,6 +70,10 @@ public enum ZoneType {
|
||||
return !holdsHiddenInfo;
|
||||
}
|
||||
|
||||
public String getTranslatedName() {
|
||||
return zoneName;
|
||||
}
|
||||
|
||||
public static boolean isHidden(final String origin) {
|
||||
List<ZoneType> zone = ZoneType.listValueOf(origin);
|
||||
|
||||
@@ -82,4 +92,13 @@ public enum ZoneType {
|
||||
public static boolean isKnown(final String origin) {
|
||||
return !isHidden(origin);
|
||||
}
|
||||
|
||||
public static class Accessors {
|
||||
public static Function<ZoneType, String> GET_TRANSLATED_NAME = new Function<ZoneType, String>() {
|
||||
@Override
|
||||
public String apply(final ZoneType arg0) {
|
||||
return arg0.getTranslatedName();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -504,7 +504,7 @@ public class HumanPlay {
|
||||
// replace this with input
|
||||
CardCollection newList = new CardCollection();
|
||||
for (int i = 0; i < nNeeded; i++) {
|
||||
final Card c = p.getGame().getCard(SGuiChoose.oneOrNone(Localizer.getInstance().getMessage("lblExileFromZone", from.toString()), CardView.getCollection(list)));
|
||||
final Card c = p.getGame().getCard(SGuiChoose.oneOrNone(Localizer.getInstance().getMessage("lblExileFromZone", from.getTranslatedName()), CardView.getCollection(list)));
|
||||
if (c == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -540,7 +540,7 @@ public class HumanPlay {
|
||||
payableZone.add(player);
|
||||
}
|
||||
}
|
||||
Player chosen = controller.getGame().getPlayer(SGuiChoose.oneOrNone(Localizer.getInstance().getMessage("lblPutCardFromWhoseZone", from.toString()), PlayerView.getCollection(payableZone)));
|
||||
Player chosen = controller.getGame().getPlayer(SGuiChoose.oneOrNone(Localizer.getInstance().getMessage("lblPutCardFromWhoseZone", from.getTranslatedName()), PlayerView.getCollection(payableZone)));
|
||||
if (chosen == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -733,9 +733,9 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
@Override
|
||||
public void reveal(final List<CardView> cards, final ZoneType zone, final PlayerView owner, String message) {
|
||||
if (StringUtils.isBlank(message)) {
|
||||
message = localizer.getMessage("lblLookCardInPlayerZone", "{player's}", zone.name().toLowerCase());
|
||||
message = localizer.getMessage("lblLookCardInPlayerZone", "{player's}", zone.getTranslatedName().toLowerCase());
|
||||
} else {
|
||||
message += localizer.getMessage("lblPlayerZone", "{player's}", zone.name().toLowerCase());
|
||||
message += localizer.getMessage("lblPlayerZone", "{player's}", zone.getTranslatedName().toLowerCase());
|
||||
}
|
||||
final String fm = MessageUtil.formatMessage(message, getLocalPlayerView(), owner);
|
||||
if (!cards.isEmpty()) {
|
||||
@@ -743,7 +743,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
getGui().reveal(fm, cards);
|
||||
endTempShowCards();
|
||||
} else {
|
||||
getGui().message(MessageUtil.formatMessage(localizer.getMessage("lblThereNoCardInPlayerZone", "{player's}", zone.name().toLowerCase()),
|
||||
getGui().message(MessageUtil.formatMessage(localizer.getMessage("lblThereNoCardInPlayerZone", "{player's}", zone.getTranslatedName().toLowerCase()),
|
||||
player, owner), fm);
|
||||
}
|
||||
}
|
||||
@@ -2366,7 +2366,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
final ZoneType targetZone = repeatLast ? lastAddedZone : zone;
|
||||
String message = null;
|
||||
if (targetZone != ZoneType.Battlefield) {
|
||||
message = localizer.getMessage("lblPutCardInWhichPlayerZone", targetZone.name().toLowerCase());
|
||||
message = localizer.getMessage("lblPutCardInWhichPlayerZone", targetZone.getTranslatedName().toLowerCase());
|
||||
}
|
||||
else {
|
||||
if (noTriggers) {
|
||||
|
||||
Reference in New Issue
Block a user