mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
Merge remote-tracking branch 'upstream/master' into display_localization_cardname
This commit is contained in:
@@ -40,6 +40,7 @@ import forge.util.TextUtil;
|
||||
import forge.util.gui.SGuiChoose;
|
||||
import forge.util.gui.SOptionPane;
|
||||
import forge.util.storage.IStorage;
|
||||
import forge.util.Localizer;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
@@ -100,7 +101,7 @@ public class BoosterDraft implements IBoosterDraft {
|
||||
}
|
||||
}
|
||||
|
||||
final CardBlock block = SGuiChoose.oneOrNone("Choose Block", blocks);
|
||||
final CardBlock block = SGuiChoose.oneOrNone(Localizer.getInstance().getMessage("lblChooseBlock"), blocks);
|
||||
if (block == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -118,7 +119,7 @@ public class BoosterDraft implements IBoosterDraft {
|
||||
}
|
||||
|
||||
if (sets.isEmpty()) {
|
||||
SOptionPane.showErrorDialog(block.toString() + " does not contain any set combinations.");
|
||||
SOptionPane.showErrorDialog(Localizer.getInstance().getMessage("lblBlockNotContainSetCombinations", block.toString()));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -127,7 +128,7 @@ public class BoosterDraft implements IBoosterDraft {
|
||||
if (sets.size() > 1) {
|
||||
Object p;
|
||||
if (nPacks == 3 && sets.size() < 4) {
|
||||
p = SGuiChoose.oneOrNone("Choose Set Combination", getSetCombos(sets));
|
||||
p = SGuiChoose.oneOrNone(Localizer.getInstance().getMessage("lblChooseSetCombination"), getSetCombos(sets));
|
||||
} else {
|
||||
p = choosePackByPack(sets, nPacks);
|
||||
}
|
||||
@@ -156,7 +157,7 @@ public class BoosterDraft implements IBoosterDraft {
|
||||
final List<CustomLimited> myDrafts = loadCustomDrafts();
|
||||
|
||||
if (myDrafts.isEmpty()) {
|
||||
SOptionPane.showMessageDialog("No custom draft files found.");
|
||||
SOptionPane.showMessageDialog(Localizer.getInstance().getMessage("lblNotFoundCustomDraftFiles"));
|
||||
} else {
|
||||
Collections.sort(myDrafts, new Comparator<CustomLimited>() {
|
||||
@Override
|
||||
@@ -165,7 +166,7 @@ public class BoosterDraft implements IBoosterDraft {
|
||||
}
|
||||
});
|
||||
|
||||
final CustomLimited customDraft = SGuiChoose.oneOrNone("Choose Custom Draft", myDrafts);
|
||||
final CustomLimited customDraft = SGuiChoose.oneOrNone(Localizer.getInstance().getMessage("lblChooseCustomDraft"), myDrafts);
|
||||
if (customDraft == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -416,7 +417,7 @@ public class BoosterDraft implements IBoosterDraft {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
for (int i = 1; i <= packs; i++) {
|
||||
String choice = SGuiChoose.oneOrNone(TextUtil.concatNoSpace("Choose set for Pack ", String.valueOf(i), " of ", String.valueOf(packs)), setz);
|
||||
String choice = SGuiChoose.oneOrNone(Localizer.getInstance().getMessage("lblChooseSetForNPack", String.valueOf(i), String.valueOf(packs)), setz);
|
||||
if (choice == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ public class CustomLimited extends DeckBase {
|
||||
* @return the custom limited
|
||||
*/
|
||||
public static CustomLimited parse(final List<String> dfData, final IStorage<Deck> cubes) {
|
||||
final FileSection data = FileSection.parse(dfData, ":");
|
||||
final FileSection data = FileSection.parse(dfData, FileSection.COLON_KV_SEPARATOR);
|
||||
|
||||
List<Pair<String, Integer>> slots = new ArrayList<>();
|
||||
String boosterData = data.get("Booster");
|
||||
|
||||
@@ -3,6 +3,7 @@ package forge.limited;
|
||||
public enum LimitedPoolType {
|
||||
Full("Full Cardpool"),
|
||||
Block("Block / Set"),
|
||||
Prerelease("Prerelease"),
|
||||
FantasyBlock("Fantasy Block"),
|
||||
Custom("Custom Cube"),
|
||||
Chaos("Chaos Draft");
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
*/
|
||||
package forge.limited;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import forge.StaticData;
|
||||
import forge.assets.FSkinProp;
|
||||
import forge.card.CardEdition;
|
||||
import forge.card.MagicColor;
|
||||
@@ -39,12 +41,14 @@ import forge.util.TextUtil;
|
||||
import forge.util.gui.SGuiChoose;
|
||||
import forge.util.gui.SOptionPane;
|
||||
import forge.util.storage.IStorage;
|
||||
|
||||
import forge.util.Localizer;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Stack;
|
||||
|
||||
@@ -66,7 +70,7 @@ public class SealedCardPoolGenerator {
|
||||
private String landSetCode = null;
|
||||
|
||||
public static DeckGroup generateSealedDeck(final boolean addBasicLands) {
|
||||
final String prompt = "Choose Sealed Deck Format";
|
||||
final String prompt = Localizer.getInstance().getMessage("lblChooseSealedDeckFormat");
|
||||
final LimitedPoolType poolType = SGuiChoose.oneOrNone(prompt, LimitedPoolType.values());
|
||||
if (poolType == null) { return null; }
|
||||
|
||||
@@ -80,8 +84,8 @@ public class SealedCardPoolGenerator {
|
||||
int rounds = 7;
|
||||
|
||||
final String sDeckName = SOptionPane.showInputDialog(
|
||||
"Save this card pool as:",
|
||||
"Save Card Pool",
|
||||
Localizer.getInstance().getMessage("lblSaveCardPoolAs") + ":",
|
||||
Localizer.getInstance().getMessage("lblSaveCardPool"),
|
||||
FSkinProp.ICO_QUESTION);
|
||||
|
||||
if (StringUtils.isBlank(sDeckName)) {
|
||||
@@ -91,8 +95,8 @@ public class SealedCardPoolGenerator {
|
||||
final IStorage<DeckGroup> sealedDecks = FModel.getDecks().getSealed();
|
||||
if (sealedDecks.contains(sDeckName)) {
|
||||
if (!SOptionPane.showConfirmDialog(
|
||||
"'" + sDeckName + "' already exists. Do you want to replace it?",
|
||||
"Sealed Deck Game Exists")) {
|
||||
Localizer.getInstance().getMessage("lblDeckExistsReplaceConfirm", sDeckName),
|
||||
Localizer.getInstance().getMessage("lblSealedDeckGameExists"))) {
|
||||
return null;
|
||||
}
|
||||
sealedDecks.delete(sDeckName);
|
||||
@@ -166,6 +170,67 @@ public class SealedCardPoolGenerator {
|
||||
landSetCode = CardEdition.Predicates.getRandomSetWithAllBasicLands(FModel.getMagicDb().getEditions()).getCode();
|
||||
break;
|
||||
|
||||
case Prerelease:
|
||||
ArrayList<CardEdition> editions = Lists.newArrayList(StaticData.instance().getEditions().getPrereleaseEditions());
|
||||
Collections.sort(editions);
|
||||
Collections.reverse(editions);
|
||||
|
||||
CardEdition chosenEdition = SGuiChoose.oneOrNone(Localizer.getInstance().getMessage("lblChooseAnEdition"), editions);
|
||||
if (chosenEdition == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
String bundle = chosenEdition.getPrerelease();
|
||||
|
||||
// Parse prerelease bundle.
|
||||
// More recent sets are like 6 boosters of this edition + 1 Promo RareMythic from this edition
|
||||
|
||||
// Expecting to see things like
|
||||
// # <Edition> Boosters, # Rarity+
|
||||
|
||||
String[] parts = bundle.split(", ");
|
||||
for(String part : parts) {
|
||||
boolean promo = part.endsWith("+");
|
||||
if (promo) {
|
||||
part = part.substring(0, part.length() - 1);
|
||||
}
|
||||
|
||||
String[] pieces = part.split(" ");
|
||||
int num = Integer.parseInt(pieces[0]);
|
||||
String thing = pieces[pieces.length - 1];
|
||||
|
||||
// Booster, Rarity, Named, SpecialBooster?
|
||||
|
||||
if (thing.equalsIgnoreCase("Booster") || thing.equalsIgnoreCase("Boosters")) {
|
||||
// Normal Boosters of this or block editions
|
||||
String code = chosenEdition.getCode();
|
||||
if (pieces.length > 2) {
|
||||
// 2 USG Boosters
|
||||
code = pieces[1];
|
||||
}
|
||||
|
||||
// Generate boosters
|
||||
for(int i = 0; i < num; i++) {
|
||||
this.product.add(new UnOpenedProduct(FModel.getMagicDb().getBoosters().get(code)));
|
||||
}
|
||||
} else {
|
||||
// Rarity
|
||||
List<Pair<String, Integer>> promoSlot = new ArrayList<>();
|
||||
promoSlot.add(Pair.of(pieces[1], num));
|
||||
|
||||
SealedProduct.Template promoProduct = new SealedProduct.Template("Prerelease Promo", promoSlot);
|
||||
|
||||
// Create a "booster" with just the promo card. Rarity + Edition into a Template
|
||||
this.product.add(new UnOpenedProduct(promoProduct, FModel.getMagicDb().getCommonCards().getAllCardsFromEdition(chosenEdition)));
|
||||
// TODO This product should be Foiled only. How do I do that?
|
||||
}
|
||||
// TODO Add support for special boosters like GuildPacks
|
||||
}
|
||||
|
||||
//chosenEdition but really it should be defined by something in the edition file?
|
||||
landSetCode = chosenEdition.getCode();
|
||||
|
||||
break;
|
||||
case Block:
|
||||
case FantasyBlock:
|
||||
List<CardBlock> blocks = new ArrayList<>();
|
||||
@@ -174,7 +239,7 @@ public class SealedCardPoolGenerator {
|
||||
blocks.add(b);
|
||||
}
|
||||
|
||||
final CardBlock block = SGuiChoose.oneOrNone("Choose Block", blocks);
|
||||
final CardBlock block = SGuiChoose.oneOrNone(Localizer.getInstance().getMessage("lblChooseBlock"), blocks);
|
||||
if (block == null) { return; }
|
||||
|
||||
final int nPacks = block.getCntBoostersSealed();
|
||||
@@ -194,7 +259,7 @@ public class SealedCardPoolGenerator {
|
||||
throw new RuntimeException("Unsupported amount of packs (" + nPacks + ") in a Sealed Deck block!");
|
||||
}
|
||||
|
||||
final String p = setCombos.size() > 1 ? SGuiChoose.oneOrNone("Choose packs to play with", setCombos) : setCombos.get(0);
|
||||
final String p = setCombos.size() > 1 ? SGuiChoose.oneOrNone(Localizer.getInstance().getMessage("lblChoosePackNumberToPlay"), setCombos) : setCombos.get(0);
|
||||
if (p == null) { return; }
|
||||
|
||||
for (String pz : TextUtil.split(p, ',')) {
|
||||
@@ -245,11 +310,11 @@ public class SealedCardPoolGenerator {
|
||||
|
||||
// present list to user
|
||||
if (customs.isEmpty()) {
|
||||
SOptionPane.showMessageDialog("No custom sealed files found.");
|
||||
SOptionPane.showMessageDialog(Localizer.getInstance().getMessage("lblNotFoundCustomSealedFiles"));
|
||||
return;
|
||||
}
|
||||
|
||||
final CustomLimited draft = SGuiChoose.oneOrNone("Choose Custom Sealed Pool", customs);
|
||||
final CustomLimited draft = SGuiChoose.oneOrNone(Localizer.getInstance().getMessage("lblChooseCustomSealedPool"), customs);
|
||||
if (draft == null) { return; }
|
||||
|
||||
UnOpenedProduct toAdd = new UnOpenedProduct(draft.getSealedProductTemplate(), draft.getCardPool());
|
||||
@@ -264,7 +329,7 @@ public class SealedCardPoolGenerator {
|
||||
}
|
||||
|
||||
private boolean chooseNumberOfBoosters(final IUnOpenedProduct product1) {
|
||||
Integer boosterCount = SGuiChoose.getInteger("How many booster packs?", 3, 12);
|
||||
Integer boosterCount = SGuiChoose.getInteger(Localizer.getInstance().getMessage("lblHowManyBoosterPacks"), 3, 12);
|
||||
if (boosterCount == null) { return false; }
|
||||
|
||||
for (int i = 0; i < boosterCount; i++) {
|
||||
@@ -439,7 +504,6 @@ public class SealedCardPoolGenerator {
|
||||
*
|
||||
* @param isHuman
|
||||
* boolean, get pool for human (possible choices)
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public CardPool getCardPool(final boolean isHuman) {
|
||||
final CardPool pool = new CardPool();
|
||||
|
||||
@@ -60,6 +60,7 @@ public class HostedMatch {
|
||||
private String title;
|
||||
public HashMap<LobbySlot, IGameController> gameControllers = null;
|
||||
private Runnable startGameHook = null;
|
||||
private Runnable endGameHook = null;
|
||||
private final List<PlayerControllerHuman> humanControllers = Lists.newArrayList();
|
||||
private Map<RegisteredPlayer, IGuiGame> guis;
|
||||
private int humanCount;
|
||||
@@ -73,6 +74,7 @@ public class HostedMatch {
|
||||
public void setStartGameHook(Runnable hook) {
|
||||
startGameHook = hook;
|
||||
}
|
||||
public void setEndGameHook(Runnable hook) { endGameHook = hook; }
|
||||
|
||||
private static GameRules getDefaultRules(final GameType gameType) {
|
||||
final GameRules gameRules = new GameRules(gameType);
|
||||
@@ -241,6 +243,10 @@ public class HostedMatch {
|
||||
}
|
||||
// Actually start the game!
|
||||
match.startGame(game, startGameHook);
|
||||
// this function waits?
|
||||
if (endGameHook != null){
|
||||
endGameHook.run();
|
||||
}
|
||||
|
||||
// After game is over...
|
||||
isMatchOver = match.isMatchOver();
|
||||
|
||||
@@ -33,6 +33,7 @@ import forge.game.zone.ZoneType;
|
||||
import forge.player.PlayerControllerHuman;
|
||||
import forge.util.ITriggerEvent;
|
||||
import forge.util.collect.FCollectionView;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -84,12 +85,14 @@ public class InputAttack extends InputSyncronizedBase {
|
||||
}
|
||||
|
||||
private void updatePrompt() {
|
||||
String alphaLabel = canCallBackAttackers() ? "Call Back" : "Alpha Strike";
|
||||
getController().getGui().updateButtons(getOwner(), "OK", alphaLabel, true, true, true);
|
||||
Localizer localizer = Localizer.getInstance();
|
||||
String alphaLabel = canCallBackAttackers() ? localizer.getMessage("lblCallBack") : localizer.getMessage("lblAlphaStrike");
|
||||
getController().getGui().updateButtons(getOwner(), localizer.getMessage("lblOk"), alphaLabel, true, true, true);
|
||||
}
|
||||
|
||||
private void disablePrompt() {
|
||||
getController().getGui().updateButtons(getOwner(), "Disabled", "Disabled", false, false, false);
|
||||
Localizer localizer = Localizer.getInstance();
|
||||
getController().getGui().updateButtons(getOwner(), localizer.getMessage("lblDisabled"), localizer.getMessage("lblDisabled"), false, false, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -323,9 +326,10 @@ public class InputAttack extends InputSyncronizedBase {
|
||||
}
|
||||
|
||||
private void updateMessage() {
|
||||
String message = "Select creatures to attack " + currentDefender + " or select player/planeswalker you wish to attack.";
|
||||
Localizer localizer = Localizer.getInstance();
|
||||
String message = localizer.getMessage("lblSelectAttackCreatures") + currentDefender + localizer.getMessage("lblSelectAttackTarget");
|
||||
if (potentialBanding) {
|
||||
message += " To attack as a band, select an attacking creature to activate its 'band' then select another to join it.";
|
||||
message += localizer.getMessage("lblSelectBandingTarget");
|
||||
}
|
||||
showMessage(message);
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import forge.game.zone.ZoneType;
|
||||
import forge.player.PlayerControllerHuman;
|
||||
import forge.util.ITriggerEvent;
|
||||
import forge.util.ThreadUtil;
|
||||
import forge.util.Localizer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -76,14 +77,15 @@ public class InputBlock extends InputSyncronizedBase {
|
||||
@Override
|
||||
protected final void showMessage() {
|
||||
// could add "Reset Blockers" button
|
||||
Localizer localizer = Localizer.getInstance();
|
||||
getController().getGui().updateButtons(getOwner(), true, false, true);
|
||||
|
||||
if (currentAttacker == null) {
|
||||
showMessage("Select another attacker to declare blockers for.");
|
||||
showMessage(localizer.getMessage("lblSelectBlockTarget"));
|
||||
}
|
||||
else {
|
||||
String attackerName = currentAttacker.isFaceDown() ? "Morph" : currentAttacker.getName() + " (" + currentAttacker.getId() + ")";
|
||||
String message = "Select creatures to block " + attackerName + " or select another attacker to declare blockers for.";
|
||||
String attackerName = currentAttacker.isFaceDown() ? localizer.getMessage("lblMorph") : currentAttacker.getName() + " (" + currentAttacker.getId() + ")";
|
||||
String message = localizer.getMessage("lblSelectBlocker") + attackerName + localizer.getMessage("lblOrSelectBlockTarget");
|
||||
showMessage(message);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import forge.game.spellability.SpellAbility;
|
||||
import forge.model.FModel;
|
||||
import forge.player.PlayerControllerHuman;
|
||||
import forge.properties.ForgePreferences;
|
||||
import forge.util.Localizer;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -49,7 +50,7 @@ public class InputConfirm extends InputSyncronizedBase {
|
||||
private CardView card;
|
||||
|
||||
// simple interface to hide ugliness deciding how to confirm
|
||||
protected static ImmutableList<String> defaultOptions = ImmutableList.of("Yes", "No");
|
||||
protected static ImmutableList<String> defaultOptions = ImmutableList.of(Localizer.getInstance().getMessage("lblYes"), Localizer.getInstance().getMessage("lblNo"));
|
||||
public static boolean confirm(final PlayerControllerHuman controller, final CardView card, final String message) {
|
||||
return InputConfirm.confirm(controller, card, message, true, defaultOptions);
|
||||
}
|
||||
@@ -86,7 +87,7 @@ public class InputConfirm extends InputSyncronizedBase {
|
||||
}
|
||||
|
||||
public InputConfirm(final PlayerControllerHuman controller, String message0) {
|
||||
this(controller, message0, "Yes", "No", true);
|
||||
this(controller, message0, Localizer.getInstance().getMessage("lblYes"), Localizer.getInstance().getMessage("lblNo"), true);
|
||||
}
|
||||
|
||||
public InputConfirm(final PlayerControllerHuman controller, String message0, String yesButtonText0, String noButtonText0) {
|
||||
@@ -105,7 +106,7 @@ public class InputConfirm extends InputSyncronizedBase {
|
||||
}
|
||||
|
||||
public InputConfirm(final PlayerControllerHuman controller, String message0, SpellAbility sa0) {
|
||||
this(controller, message0, "Yes", "No", true, sa0);
|
||||
this(controller, message0, Localizer.getInstance().getMessage("lblYes"), Localizer.getInstance().getMessage("lblNo"), true, sa0);
|
||||
}
|
||||
|
||||
public InputConfirm(final PlayerControllerHuman controller, String message0, String yesButtonText0, String noButtonText0, SpellAbility sa0) {
|
||||
@@ -124,7 +125,7 @@ public class InputConfirm extends InputSyncronizedBase {
|
||||
}
|
||||
|
||||
public InputConfirm(final PlayerControllerHuman controller, String message0, CardView card0) {
|
||||
this(controller, message0, "Yes", "No", true, card0);
|
||||
this(controller, message0, Localizer.getInstance().getMessage("lblYes"), Localizer.getInstance().getMessage("lblNo"), true, card0);
|
||||
}
|
||||
|
||||
public InputConfirm(final PlayerControllerHuman controller, String message0, String yesButtonText0, String noButtonText0, CardView card0) {
|
||||
|
||||
@@ -30,6 +30,7 @@ import forge.player.HumanPlay;
|
||||
import forge.player.PlayerControllerHuman;
|
||||
import forge.util.Evaluator;
|
||||
import forge.util.ITriggerEvent;
|
||||
import forge.util.Localizer;
|
||||
|
||||
public abstract class InputPayMana extends InputSyncronizedBase {
|
||||
private static final long serialVersionUID = 718128600948280315L;
|
||||
@@ -310,7 +311,7 @@ public abstract class InputPayMana extends InputSyncronizedBase {
|
||||
final SpellAbility chosen;
|
||||
if (chosenAbility == null) {
|
||||
ArrayList<SpellAbilityView> choices = new ArrayList<>(abilitiesMap.keySet());
|
||||
chosen = abilitiesMap.size() > 1 && choice ? abilitiesMap.get(getController().getGui().one("Choose mana ability", choices)) : abilitiesMap.get(choices.get(0));
|
||||
chosen = abilitiesMap.size() > 1 && choice ? abilitiesMap.get(getController().getGui().one(Localizer.getInstance().getMessage("lblChooseManaAbility"), choices)) : abilitiesMap.get(choices.get(0));
|
||||
} else {
|
||||
chosen = chosenAbility;
|
||||
}
|
||||
@@ -438,9 +439,9 @@ public abstract class InputPayMana extends InputSyncronizedBase {
|
||||
|
||||
protected void updateButtons() {
|
||||
if (supportAutoPay()) {
|
||||
getController().getGui().updateButtons(getOwner(), "Auto", "Cancel", false, true, false);
|
||||
getController().getGui().updateButtons(getOwner(), Localizer.getInstance().getMessage("lblAuto"), Localizer.getInstance().getMessage("lblCancel"), false, true, false);
|
||||
} else {
|
||||
getController().getGui().updateButtons(getOwner(), "", "Cancel", false, true, false);
|
||||
getController().getGui().updateButtons(getOwner(), "", Localizer.getInstance().getMessage("lblCancel"), false, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -462,7 +463,7 @@ public abstract class InputPayMana extends InputSyncronizedBase {
|
||||
canPayManaCost = proc.getResult();
|
||||
}
|
||||
if (canPayManaCost) { //enabled Auto button if mana cost can be paid
|
||||
getController().getGui().updateButtons(getOwner(), "Auto", "Cancel", true, true, true);
|
||||
getController().getGui().updateButtons(getOwner(), Localizer.getInstance().getMessage("lblAuto"), Localizer.getInstance().getMessage("lblCancel"), true, true, true);
|
||||
}
|
||||
}
|
||||
showMessage(getMessage(), saPaidFor.getView());
|
||||
|
||||
@@ -57,6 +57,7 @@ import forge.util.storage.StorageBase;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* The default Model implementation for Forge.
|
||||
@@ -259,31 +260,31 @@ public final class FModel {
|
||||
if (!CardType.Constant.LOADED.isSet()) {
|
||||
final List<String> typeListFile = FileUtil.readFile(ForgeConstants.TYPE_LIST_FILE);
|
||||
|
||||
List<String> tList = null;
|
||||
Set<String> addTo = null;
|
||||
|
||||
for (final String s : typeListFile) {
|
||||
if (s.equals("[BasicTypes]")) {
|
||||
tList = CardType.Constant.BASIC_TYPES;
|
||||
addTo = CardType.Constant.BASIC_TYPES;
|
||||
} else if (s.equals("[LandTypes]")) {
|
||||
tList = CardType.Constant.LAND_TYPES;
|
||||
addTo = CardType.Constant.LAND_TYPES;
|
||||
} else if (s.equals("[CreatureTypes]")) {
|
||||
tList = CardType.Constant.CREATURE_TYPES;
|
||||
addTo = CardType.Constant.CREATURE_TYPES;
|
||||
} else if (s.equals("[SpellTypes]")) {
|
||||
tList = CardType.Constant.SPELL_TYPES;
|
||||
addTo = CardType.Constant.SPELL_TYPES;
|
||||
} else if (s.equals("[EnchantmentTypes]")) {
|
||||
tList = CardType.Constant.ENCHANTMENT_TYPES;
|
||||
addTo = CardType.Constant.ENCHANTMENT_TYPES;
|
||||
} else if (s.equals("[ArtifactTypes]")) {
|
||||
tList = CardType.Constant.ARTIFACT_TYPES;
|
||||
addTo = CardType.Constant.ARTIFACT_TYPES;
|
||||
} else if (s.equals("[WalkerTypes]")) {
|
||||
tList = CardType.Constant.WALKER_TYPES;
|
||||
addTo = CardType.Constant.WALKER_TYPES;
|
||||
} else if (s.length() > 1) {
|
||||
if (tList != null) {
|
||||
if (addTo != null) {
|
||||
if (s.contains(":")) {
|
||||
String[] k = s.split(":");
|
||||
tList.add(k[0]);
|
||||
addTo.add(k[0]);
|
||||
CardType.Constant.pluralTypes.put(k[0], k[1]);
|
||||
} else {
|
||||
tList.add(s);
|
||||
addTo.add(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import forge.quest.QuestEventDuel;
|
||||
import forge.quest.QuestEventDuelManager;
|
||||
import forge.quest.QuestWorld;
|
||||
import forge.util.Aggregates;
|
||||
import forge.util.Localizer;
|
||||
|
||||
public class ConquestChaosBattle extends ConquestBattle {
|
||||
private final QuestWorld world;
|
||||
@@ -122,20 +123,20 @@ public class ConquestChaosBattle extends ConquestBattle {
|
||||
if (game.isMatchOver()) {
|
||||
view.getBtnContinue().setVisible(false);
|
||||
if (game.isMatchWonBy(humanPlayer)) {
|
||||
view.getBtnQuit().setText("Great!");
|
||||
view.getBtnQuit().setText(Localizer.getInstance().getMessage("lblGreat") + "!");
|
||||
model.getChaosBattleRecord().addWin();
|
||||
setConquered(true);
|
||||
}
|
||||
else {
|
||||
view.getBtnQuit().setText("OK");
|
||||
view.getBtnQuit().setText(Localizer.getInstance().getMessage("lblOK"));
|
||||
model.getChaosBattleRecord().addLoss();
|
||||
}
|
||||
model.saveData();
|
||||
}
|
||||
else {
|
||||
view.getBtnContinue().setVisible(true);
|
||||
view.getBtnContinue().setText("Continue");
|
||||
view.getBtnQuit().setText("Quit");
|
||||
view.getBtnContinue().setText(Localizer.getInstance().getMessage("btnContinue"));
|
||||
view.getBtnQuit().setText(Localizer.getInstance().getMessage("btnQuit"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,8 @@ import forge.util.FileUtil;
|
||||
import forge.util.XmlReader;
|
||||
import forge.util.XmlWriter;
|
||||
import forge.util.gui.SOptionPane;
|
||||
import forge.util.Localizer;
|
||||
import forge.util.CardTranslation;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
@@ -265,15 +267,15 @@ public final class ConquestData {
|
||||
int count = cards.size();
|
||||
if (count == 0) { return false; }
|
||||
|
||||
String title = count == 1 ? "Exile Card" : "Exile " + count + " Cards";
|
||||
String cardStr = (count == 1 ? "card" : "cards");
|
||||
String title = count == 1 ? Localizer.getInstance().getMessage("lblExileCard") : Localizer.getInstance().getMessage("lblExileNCard", String.valueOf(count));
|
||||
String cardStr = (count == 1 ? Localizer.getInstance().getMessage("lblCard") : Localizer.getInstance().getMessage("lblCards"));
|
||||
|
||||
List<ConquestCommander> commandersBeingExiled = null;
|
||||
|
||||
StringBuilder message = new StringBuilder("Exile the following " + cardStr + " to receive {AE}" + value + "?\n");
|
||||
StringBuilder message = new StringBuilder(Localizer.getInstance().getMessage("lblExileFollowCardsToReceiveNAE", cardStr, "{AE}", String.valueOf(value)));
|
||||
for (PaperCard card : cards) {
|
||||
if (planeswalker == card) {
|
||||
SOptionPane.showMessageDialog("Current planeswalker cannot be exiled.", title, SOptionPane.INFORMATION_ICON);
|
||||
SOptionPane.showMessageDialog(Localizer.getInstance().getMessage("lblCurrentPlaneswalkerCannotBeExiled"), title, SOptionPane.INFORMATION_ICON);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -281,7 +283,7 @@ public final class ConquestData {
|
||||
for (ConquestCommander commander : commanders) {
|
||||
if (commander.getCard() == card) {
|
||||
if (!commander.getDeck().getMain().isEmpty()) {
|
||||
SOptionPane.showMessageDialog("Cannot exile a commander with a defined deck.", title, SOptionPane.INFORMATION_ICON);
|
||||
SOptionPane.showMessageDialog(Localizer.getInstance().getMessage("lblCannotCommanderWithDefinedDeck"), title, SOptionPane.INFORMATION_ICON);
|
||||
return false;
|
||||
}
|
||||
if (commandersBeingExiled == null) {
|
||||
@@ -290,19 +292,19 @@ public final class ConquestData {
|
||||
commandersBeingExiled.add(commander); //cache commander to make it easier to remove later
|
||||
}
|
||||
if (commander.getDeck().getMain().contains(card)) {
|
||||
commandersUsingCard.append("\n").append(commander.getName());
|
||||
commandersUsingCard.append("\n").append(CardTranslation.getTranslatedName(commander.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
if (commandersUsingCard.length() > 0) {
|
||||
SOptionPane.showMessageDialog(card.getName() + " is in use by the following commanders and cannot be exiled:\n" + commandersUsingCard, title, SOptionPane.INFORMATION_ICON);
|
||||
SOptionPane.showMessageDialog(Localizer.getInstance().getMessage("lblCommandersCardCannotBeExiledByCard", CardTranslation.getTranslatedName(card.getName()), commandersUsingCard), title, SOptionPane.INFORMATION_ICON);
|
||||
return false;
|
||||
}
|
||||
|
||||
message.append("\n").append(card.getName());
|
||||
message.append("\n").append(CardTranslation.getTranslatedName(card.getName()));
|
||||
}
|
||||
|
||||
if (SOptionPane.showConfirmDialog(message.toString(), title, "OK", "Cancel")) {
|
||||
if (SOptionPane.showConfirmDialog(message.toString(), title, Localizer.getInstance().getMessage("lblOK"), Localizer.getInstance().getMessage("lblCancel"))) {
|
||||
if (exiledCards.addAll(cards)) {
|
||||
if (commandersBeingExiled != null) {
|
||||
commanders.removeAll(commandersBeingExiled);
|
||||
@@ -319,18 +321,18 @@ public final class ConquestData {
|
||||
int count = cards.size();
|
||||
if (count == 0) { return false; }
|
||||
|
||||
String title = count == 1 ? "Retrieve Card" : "Retrieve " + count + " Cards";
|
||||
String cardStr = (count == 1 ? "card" : "cards");
|
||||
String title = count == 1 ? Localizer.getInstance().getMessage("lblRetrieveCard") : Localizer.getInstance().getMessage("lblRetrieveNCard", String.valueOf(count));
|
||||
String cardStr = (count == 1 ? Localizer.getInstance().getMessage("lblCard") : Localizer.getInstance().getMessage("lblCards"));
|
||||
if (aetherShards < cost) {
|
||||
SOptionPane.showMessageDialog("Not enough shards to retrieve " + cardStr + ".", title, SOptionPane.INFORMATION_ICON);
|
||||
SOptionPane.showMessageDialog(Localizer.getInstance().getMessage("lblNotEnoughShardsToRetrieveCards", cardStr), title, SOptionPane.INFORMATION_ICON);
|
||||
return false;
|
||||
}
|
||||
|
||||
StringBuilder message = new StringBuilder("Spend {AE}" + cost + " to retrieve the following " + cardStr + " from exile?\n");
|
||||
StringBuilder message = new StringBuilder(Localizer.getInstance().getMessage("lblSpendAECostToRetrieveCardsFromExile", "{AE}", String.valueOf(cost), cardStr));
|
||||
for (PaperCard card : cards) {
|
||||
message.append("\n").append(card.getName());
|
||||
}
|
||||
if (SOptionPane.showConfirmDialog(message.toString(), title, "OK", "Cancel")) {
|
||||
if (SOptionPane.showConfirmDialog(message.toString(), title, Localizer.getInstance().getMessage("lblOK"), Localizer.getInstance().getMessage("lblCancel"))) {
|
||||
if (exiledCards.removeAll(cards)) {
|
||||
for (PaperCard card : cards) {
|
||||
if (card.getRules().canBeCommander()) { //add back commander for card if needed
|
||||
@@ -492,14 +494,14 @@ public final class ConquestData {
|
||||
commanderCount = commanders.size();
|
||||
}
|
||||
|
||||
view.getLblAEtherShards().setText("Aether Shards: " + aetherShards);
|
||||
view.getLblPlaneswalkEmblems().setText("Planeswalk Emblems: " + planeswalkEmblems);
|
||||
view.getLblTotalWins().setText("Total Wins: " + wins);
|
||||
view.getLblTotalLosses().setText("Total Losses: " + losses);
|
||||
view.getLblConqueredEvents().setText("Conquered Events: " + formatRatio(conqueredCount, totalEventCount));
|
||||
view.getLblUnlockedCards().setText("Unlocked Cards: " + formatRatio(unlockedCardCount, totalCardCount));
|
||||
view.getLblCommanders().setText("Commanders: " + formatRatio(commanderCount, totalCommanderCount));
|
||||
view.getLblPlaneswalkers().setText("Planeswalkers: " + formatRatio(planeswalkerCount, totalPlaneswalkerCount));
|
||||
view.getLblAEtherShards().setText(Localizer.getInstance().getMessage("lblAetherShards") + ": " + aetherShards);
|
||||
view.getLblPlaneswalkEmblems().setText(Localizer.getInstance().getMessage("lblPlaneswalkEmblems") + ": " + planeswalkEmblems);
|
||||
view.getLblTotalWins().setText(Localizer.getInstance().getMessage("lblTotalWins") + ": " + wins);
|
||||
view.getLblTotalLosses().setText(Localizer.getInstance().getMessage("lblTotalLosses") + ": " + losses);
|
||||
view.getLblConqueredEvents().setText(Localizer.getInstance().getMessage("lblConqueredEvents") + ": " + formatRatio(conqueredCount, totalEventCount));
|
||||
view.getLblUnlockedCards().setText(Localizer.getInstance().getMessage("lblUnlockedCards") + ": " + formatRatio(unlockedCardCount, totalCardCount));
|
||||
view.getLblCommanders().setText(Localizer.getInstance().getMessage("lblCommanders") + ": " + formatRatio(commanderCount, totalCommanderCount));
|
||||
view.getLblPlaneswalkers().setText(Localizer.getInstance().getMessage("lblPlaneswalkers") + ": " + formatRatio(planeswalkerCount, totalPlaneswalkerCount));
|
||||
}
|
||||
|
||||
private String formatRatio(int numerator, int denominator) {
|
||||
|
||||
@@ -811,7 +811,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
|
||||
InputSelectCardsFromList inp = null;
|
||||
if (cost.getType().equals("SameColor")) {
|
||||
final Integer num = cost.convertAmount();
|
||||
CardCollectionView hand = player.getCardsIn(ZoneType.Hand);
|
||||
CardCollectionView hand = player.getCardsIn(cost.getRevealFrom());
|
||||
final CardCollectionView hand2 = hand;
|
||||
hand = CardLists.filter(hand, new Predicate<Card>() {
|
||||
@Override
|
||||
@@ -844,7 +844,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
|
||||
else {
|
||||
Integer num = cost.convertAmount();
|
||||
|
||||
CardCollectionView hand = player.getCardsIn(ZoneType.Hand);
|
||||
CardCollectionView hand = player.getCardsIn(cost.getRevealFrom());
|
||||
hand = CardLists.getValidCards(hand, cost.getType().split(";"), player, source, ability);
|
||||
|
||||
if (num == null) {
|
||||
@@ -861,6 +861,9 @@ public class HumanCostDecision extends CostDecisionMakerBase {
|
||||
if (num == 0) {
|
||||
return PaymentDecision.number(0);
|
||||
}
|
||||
if (hand.size() == num) {
|
||||
return PaymentDecision.card(hand);
|
||||
}
|
||||
|
||||
inp = new InputSelectCardsFromList(controller, num, num, hand, ability);
|
||||
inp.setMessage("Select %d more " + cost.getDescriptiveType() + " card(s) to reveal.");
|
||||
|
||||
@@ -25,10 +25,11 @@ import forge.match.input.InputPayMana;
|
||||
import forge.match.input.InputPayManaOfCostPayment;
|
||||
import forge.match.input.InputPayManaSimple;
|
||||
import forge.match.input.InputSelectCardsFromList;
|
||||
import forge.util.Lang;
|
||||
import forge.util.TextUtil;
|
||||
import forge.util.collect.FCollectionView;
|
||||
import forge.util.gui.SGuiChoose;
|
||||
import forge.util.Localizer;
|
||||
import forge.util.CardTranslation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -87,7 +88,7 @@ public class HumanPlay {
|
||||
|
||||
sa = AbilityUtils.addSpliceEffects(sa);
|
||||
|
||||
if (sa.hasParam("Bestow")) {
|
||||
if (sa.isBestow()) {
|
||||
source.animateBestow();
|
||||
}
|
||||
|
||||
@@ -282,19 +283,19 @@ public class HumanPlay {
|
||||
String orString = prompt == null ? sourceAbility.getStackDescription().trim() : "";
|
||||
if (!orString.isEmpty()) {
|
||||
if (sourceAbility.hasParam("UnlessSwitched")) {
|
||||
orString = TextUtil.concatWithSpace(" (if you do:", orString, ")");
|
||||
orString = TextUtil.concatWithSpace(" (" + Localizer.getInstance().getMessage("lblIfYouDo") + ":", orString, ")");
|
||||
} else {
|
||||
orString = TextUtil.concatWithSpace(" (or:", orString, ")");
|
||||
orString = TextUtil.concatWithSpace(" (" + Localizer.getInstance().getMessage("lblOr") + ":", orString, ")");
|
||||
}
|
||||
}
|
||||
|
||||
if (parts.isEmpty() || (costPart.getAmount().equals("0") && parts.size() < 2)) {
|
||||
return p.getController().confirmPayment(costPart, "Do you want to pay {0}?" + orString, sourceAbility);
|
||||
return p.getController().confirmPayment(costPart, Localizer.getInstance().getMessage("lblDoYouWantPay") + " {0}?" + orString, sourceAbility);
|
||||
}
|
||||
// 0 mana costs were slipping through because CostPart.getAmount returns 1
|
||||
else if (costPart instanceof CostPartMana && parts.size() < 2) {
|
||||
if (((CostPartMana) costPart).getManaToPay().isZero()) {
|
||||
return p.getController().confirmPayment(costPart, "Do you want to pay {0}?" + orString, sourceAbility);
|
||||
return p.getController().confirmPayment(costPart, Localizer.getInstance().getMessage("lblDoYouWantPay") + " {0}?" + orString, sourceAbility);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,7 +312,7 @@ public class HumanPlay {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!p.getController().confirmPayment(part, "Do you want to pay " + amount + " life?" + orString, sourceAbility)) {
|
||||
if (!p.getController().confirmPayment(part, Localizer.getInstance().getMessage("lblDoYouWantPayNLife", String.valueOf(amount)) + orString, sourceAbility)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -331,11 +332,15 @@ public class HumanPlay {
|
||||
return false;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder("Do you want to ");
|
||||
sb.append(res.contains(p) ? "" : "let that player ");
|
||||
sb.append("draw ").append(Lang.nounWithAmount(amount, " card")).append("?").append(orString);
|
||||
String message = null;
|
||||
if (res.contains(p)) {
|
||||
message = Localizer.getInstance().getMessage("lblDoYouWantLetThatPlayerDrawNCardOrDoAction", String.valueOf(amount), orString);
|
||||
}
|
||||
else {
|
||||
message = Localizer.getInstance().getMessage("lblDoYouWantDrawNCardOrDoAction", String.valueOf(amount), orString);
|
||||
}
|
||||
|
||||
if (!p.getController().confirmPayment(part, sb.toString(), sourceAbility)) {
|
||||
if (!p.getController().confirmPayment(part, message, sourceAbility)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -355,7 +360,7 @@ public class HumanPlay {
|
||||
String desc = part.toString();
|
||||
desc = desc.substring(0, 1).toLowerCase() + desc.substring(1);
|
||||
|
||||
if (!p.getController().confirmPayment(part, "Do you want to "+ desc + "?" + orString, sourceAbility)) {
|
||||
if (!p.getController().confirmPayment(part, Localizer.getInstance().getMessage("lblDoyouWantTo") + " " + desc + "?" + orString, sourceAbility)) {
|
||||
return false;
|
||||
}
|
||||
PaymentDecision pd = part.accept(hcd);
|
||||
@@ -369,7 +374,7 @@ public class HumanPlay {
|
||||
final int amount = getAmountFromPart(part, source, sourceAbility);
|
||||
final CardCollectionView list = p.getCardsIn(ZoneType.Library);
|
||||
if (list.size() < amount) { return false; }
|
||||
if (!p.getController().confirmPayment(part, "Do you want to mill " + amount + " card" + (amount == 1 ? "" : "s") + "?" + orString, sourceAbility)) {
|
||||
if (!p.getController().confirmPayment(part, Localizer.getInstance().getMessage("lblDoYouWantMillNCardsOrDoAction", String.valueOf(amount), orString), sourceAbility)) {
|
||||
return false;
|
||||
}
|
||||
CardCollectionView listmill = p.getCardsIn(ZoneType.Library, amount);
|
||||
@@ -377,7 +382,7 @@ public class HumanPlay {
|
||||
}
|
||||
else if (part instanceof CostFlipCoin) {
|
||||
final int amount = getAmountFromPart(part, source, sourceAbility);
|
||||
if (!p.getController().confirmPayment(part, "Do you want to flip " + amount + " coin" + (amount == 1 ? "" : "s") + "?" + orString, sourceAbility)) {
|
||||
if (!p.getController().confirmPayment(part, Localizer.getInstance().getMessage("lblDoYouWantFlipNCoinOrDoAction", String.valueOf(amount), orString), sourceAbility)) {
|
||||
return false;
|
||||
}
|
||||
final int n = FlipCoinEffect.getFilpMultiplier(p);
|
||||
@@ -411,7 +416,7 @@ public class HumanPlay {
|
||||
}
|
||||
|
||||
if (!mandatory) {
|
||||
if (!p.getController().confirmPayment(part, "Do you want to remove " + Lang.nounWithAmount(amount, counterType.getName() + " counter") + " from " + source + "?",sourceAbility)) {
|
||||
if (!p.getController().confirmPayment(part, Localizer.getInstance().getMessage("lblDoYouWantRemoveNTargetTypeCounterFromCard", String.valueOf(amount), counterType.getName(), CardTranslation.getTranslatedName(source.getName())), sourceAbility)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -431,7 +436,7 @@ public class HumanPlay {
|
||||
if (allCounters < amount) { return false; }
|
||||
|
||||
if (!mandatory) {
|
||||
if (!p.getController().confirmPayment(part, "Do you want to remove counters from " + part.getDescriptiveType() + " ?",sourceAbility)) {
|
||||
if (!p.getController().confirmPayment(part, Localizer.getInstance().getMessage("lblDoYouWantRemoveCountersFromCard", part.getDescriptiveType()), sourceAbility)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -447,7 +452,7 @@ public class HumanPlay {
|
||||
});
|
||||
if (list.isEmpty()) { return false; }
|
||||
InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, 1, 1, list, sourceAbility);
|
||||
inp.setMessage("Select a card to remove a counter");
|
||||
inp.setMessage(Localizer.getInstance().getMessage("lblSelectRemoveCounterCard"));
|
||||
inp.setCancelAllowed(true);
|
||||
inp.showAndWait();
|
||||
if (inp.hasCancelled()) {
|
||||
@@ -462,7 +467,7 @@ public class HumanPlay {
|
||||
}
|
||||
}
|
||||
if (typeChoices.size() > 1) {
|
||||
String cprompt = "Select type counters to remove";
|
||||
String cprompt = Localizer.getInstance().getMessage("lblSelectRemoveCounterType");
|
||||
counterType = controller.getGui().one(cprompt, typeChoices);
|
||||
}
|
||||
else {
|
||||
@@ -477,7 +482,7 @@ public class HumanPlay {
|
||||
|
||||
ZoneType from = ZoneType.Graveyard;
|
||||
if ("All".equals(part.getType())) {
|
||||
if (!p.getController().confirmPayment(part, "Do you want to exile all cards in your graveyard?", sourceAbility)) {
|
||||
if (!p.getController().confirmPayment(part, Localizer.getInstance().getMessage("lblDoYouWantExileAllCardYouGraveyard"), sourceAbility)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -491,8 +496,7 @@ public class HumanPlay {
|
||||
return false;
|
||||
}
|
||||
if (from == ZoneType.Library) {
|
||||
if (!p.getController().confirmPayment(part, "Do you want to exile " + nNeeded +
|
||||
" card" + (nNeeded == 1 ? "" : "s") + " from your library?", sourceAbility)) {
|
||||
if (!p.getController().confirmPayment(part, Localizer.getInstance().getMessage("lblDoYouWantExileNCardsFromYourLibrary", String.valueOf(nNeeded)), sourceAbility)) {
|
||||
return false;
|
||||
}
|
||||
list = list.subList(0, nNeeded);
|
||||
@@ -501,7 +505,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("Exile from " + from, 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;
|
||||
}
|
||||
@@ -537,7 +541,7 @@ public class HumanPlay {
|
||||
payableZone.add(player);
|
||||
}
|
||||
}
|
||||
Player chosen = controller.getGame().getPlayer(SGuiChoose.oneOrNone(TextUtil.concatNoSpace("Put cards from whose ", 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;
|
||||
}
|
||||
@@ -549,7 +553,7 @@ public class HumanPlay {
|
||||
return false;
|
||||
}
|
||||
|
||||
final Card c = p.getGame().getCard(SGuiChoose.oneOrNone("Put cards to Library", CardView.getCollection(typeList)));
|
||||
final Card c = p.getGame().getCard(SGuiChoose.oneOrNone(Localizer.getInstance().getMessage("lblPutCardToLibrary"), CardView.getCollection(typeList)));
|
||||
|
||||
if (c != null) {
|
||||
typeList.remove(c);
|
||||
@@ -561,7 +565,7 @@ public class HumanPlay {
|
||||
}
|
||||
}
|
||||
else { // Tainted Specter, Gurzigost, etc.
|
||||
boolean hasPaid = payCostPart(controller, sourceAbility, (CostPartWithList)part, amount, list, "put into library." + orString);
|
||||
boolean hasPaid = payCostPart(controller, sourceAbility, (CostPartWithList)part, amount, list, Localizer.getInstance().getMessage("lblPutIntoLibrary") + orString);
|
||||
if (!hasPaid) {
|
||||
return false;
|
||||
}
|
||||
@@ -578,18 +582,18 @@ public class HumanPlay {
|
||||
else if (part instanceof CostGainControl) {
|
||||
int amount = Integer.parseInt(part.getAmount());
|
||||
CardCollectionView list = CardLists.getValidCards(p.getGame().getCardsIn(ZoneType.Battlefield), part.getType(), p, source);
|
||||
boolean hasPaid = payCostPart(controller, sourceAbility, (CostPartWithList)part, amount, list, "gain control." + orString);
|
||||
boolean hasPaid = payCostPart(controller, sourceAbility, (CostPartWithList)part, amount, list, Localizer.getInstance().getMessage("lblGainControl") + orString);
|
||||
if (!hasPaid) { return false; }
|
||||
}
|
||||
else if (part instanceof CostReturn) {
|
||||
CardCollectionView list = CardLists.getValidCards(p.getCardsIn(ZoneType.Battlefield), part.getType(), p, source);
|
||||
int amount = getAmountFromPartX(part, source, sourceAbility);
|
||||
boolean hasPaid = payCostPart(controller, sourceAbility, (CostPartWithList)part, amount, list, "return to hand." + orString);
|
||||
boolean hasPaid = payCostPart(controller, sourceAbility, (CostPartWithList)part, amount, list, Localizer.getInstance().getMessage("lblReturnToHand") + orString);
|
||||
if (!hasPaid) { return false; }
|
||||
}
|
||||
else if (part instanceof CostDiscard) {
|
||||
if ("Hand".equals(part.getType())) {
|
||||
if (!p.getController().confirmPayment(part, "Do you want to discard your hand?", sourceAbility)) {
|
||||
if (!p.getController().confirmPayment(part, Localizer.getInstance().getMessage("lblDoYouWantDiscardYourHand"), sourceAbility)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -597,21 +601,22 @@ public class HumanPlay {
|
||||
} else {
|
||||
CardCollectionView list = CardLists.getValidCards(p.getCardsIn(ZoneType.Hand), part.getType(), p, source);
|
||||
int amount = getAmountFromPartX(part, source, sourceAbility);
|
||||
boolean hasPaid = payCostPart(controller, sourceAbility, (CostPartWithList)part, amount, list, "discard." + orString);
|
||||
boolean hasPaid = payCostPart(controller, sourceAbility, (CostPartWithList)part, amount, list, Localizer.getInstance().getMessage("lbldiscard") + orString);
|
||||
if (!hasPaid) { return false; }
|
||||
}
|
||||
}
|
||||
else if (part instanceof CostReveal) {
|
||||
CardCollectionView list = CardLists.getValidCards(p.getCardsIn(ZoneType.Hand), part.getType(), p, source);
|
||||
CostReveal costReveal = (CostReveal) part;
|
||||
CardCollectionView list = CardLists.getValidCards(p.getCardsIn(costReveal.getRevealFrom()), part.getType(), p, source);
|
||||
int amount = getAmountFromPartX(part, source, sourceAbility);
|
||||
boolean hasPaid = payCostPart(controller, sourceAbility, (CostPartWithList)part, amount, list, "reveal." + orString);
|
||||
boolean hasPaid = payCostPart(controller, sourceAbility, (CostPartWithList)part, amount, list, Localizer.getInstance().getMessage("lblReveal") + orString);
|
||||
if (!hasPaid) { return false; }
|
||||
}
|
||||
else if (part instanceof CostTapType) {
|
||||
CardCollectionView list = CardLists.getValidCards(p.getCardsIn(ZoneType.Battlefield), part.getType(), p, source);
|
||||
list = CardLists.filter(list, Presets.UNTAPPED);
|
||||
int amount = getAmountFromPartX(part, source, sourceAbility);
|
||||
boolean hasPaid = payCostPart(controller, sourceAbility, (CostPartWithList)part, amount, list, "tap." + orString);
|
||||
boolean hasPaid = payCostPart(controller, sourceAbility, (CostPartWithList)part, amount, list, Localizer.getInstance().getMessage("lblTap") + orString);
|
||||
if (!hasPaid) { return false; }
|
||||
}
|
||||
else if (part instanceof CostPartMana) {
|
||||
@@ -628,7 +633,7 @@ public class HumanPlay {
|
||||
}
|
||||
|
||||
if (!mandatory) {
|
||||
if (!p.getController().confirmPayment(part, "Do you want to spend " + Lang.nounWithAmount(amount, counterType.getName() + " counter") + "?",sourceAbility)) {
|
||||
if (!p.getController().confirmPayment(part, Localizer.getInstance().getMessage("lblDoYouWantSpendNTargetTypeCounter", String.valueOf(amount), counterType.getName()), sourceAbility)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -658,7 +663,7 @@ public class HumanPlay {
|
||||
}
|
||||
|
||||
if (prompt == null) {
|
||||
String promptCurrent = current == null ? "" : "Current Card: " + current;
|
||||
String promptCurrent = current == null ? "" : Localizer.getInstance().getMessage("lblCurrentCard") + ": " + current;
|
||||
prompt = source + "\n" + promptCurrent;
|
||||
}
|
||||
|
||||
@@ -674,7 +679,7 @@ public class HumanPlay {
|
||||
if (list.size() < amount) { return false; } // unable to pay (not enough cards)
|
||||
|
||||
InputSelectCardsFromList inp = new InputSelectCardsFromList(controller, amount, amount, list, sourceAbility);
|
||||
inp.setMessage("Select %d " + cpl.getDescriptiveType() + " card(s) to " + actionName);
|
||||
inp.setMessage(Localizer.getInstance().getMessage("lblSelectNSpecifyTypeCardsToAction", cpl.getDescriptiveType(), actionName));
|
||||
inp.setCancelAllowed(true);
|
||||
|
||||
inp.showAndWait();
|
||||
|
||||
@@ -159,7 +159,7 @@ public class HumanPlaySpellAbility {
|
||||
|
||||
if (!prerequisitesMet) {
|
||||
if (!ability.isTrigger()) {
|
||||
rollbackAbility(fromZone, fromState, zonePosition, payment);
|
||||
rollbackAbility(fromZone, zonePosition, payment);
|
||||
if (ability.getHostCard().isMadness()) {
|
||||
// if a player failed to play madness cost, move the card to graveyard
|
||||
Card newCard = game.getAction().moveToGraveyard(c, null);
|
||||
@@ -244,14 +244,13 @@ public class HumanPlaySpellAbility {
|
||||
}
|
||||
}
|
||||
|
||||
private void rollbackAbility(final Zone fromZone, final CardStateName fromState, final int zonePosition, CostPayment payment) {
|
||||
private void rollbackAbility(final Zone fromZone, final int zonePosition, CostPayment payment) {
|
||||
// cancel ability during target choosing
|
||||
final Game game = ability.getActivatingPlayer().getGame();
|
||||
|
||||
if (fromZone != null) { // and not a copy
|
||||
// add back to where it came from
|
||||
game.getAction().moveTo(fromZone, ability.getHostCard(), zonePosition >= 0 ? Integer.valueOf(zonePosition) : null, null);
|
||||
ability.getHostCard().setState(fromState, true);
|
||||
}
|
||||
|
||||
clearTargets(ability);
|
||||
|
||||
@@ -59,6 +59,7 @@ import forge.trackable.TrackableObject;
|
||||
import forge.util.ITriggerEvent;
|
||||
import forge.util.Lang;
|
||||
import forge.util.Localizer;
|
||||
import forge.util.CardTranslation;
|
||||
import forge.util.MessageUtil;
|
||||
import forge.util.TextUtil;
|
||||
import forge.util.collect.FCollection;
|
||||
@@ -246,10 +247,10 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
if (newMain != null) {
|
||||
String errMsg;
|
||||
if (newMain.size() < deckMinSize) {
|
||||
errMsg = TextUtil.concatNoSpace(localizer.getMessage("lblTooFewCardsMainDeck").replace("%s", String.valueOf(deckMinSize)));
|
||||
errMsg = TextUtil.concatNoSpace(localizer.getMessage("lblTooFewCardsMainDeck", String.valueOf(deckMinSize)));
|
||||
|
||||
} else {
|
||||
errMsg = TextUtil.concatNoSpace(localizer.getMessage("lblTooManyCardsSideboard").replace("%s", String.valueOf(sbMax)));
|
||||
errMsg = TextUtil.concatNoSpace(localizer.getMessage("lblTooManyCardsSideboard", String.valueOf(sbMax)));
|
||||
}
|
||||
getGui().showErrorDialog(errMsg, localizer.getMessage("lblInvalidDeck"));
|
||||
}
|
||||
@@ -313,20 +314,20 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
public Integer announceRequirements(final SpellAbility ability, final String announce,
|
||||
final boolean canChooseZero) {
|
||||
final int min = canChooseZero ? 0 : 1;
|
||||
return getGui().getInteger("Choose " + announce + " for " + ability.getHostCard().getName(), min,
|
||||
return getGui().getInteger(localizer.getMessage("lblChooseAnnounceForCard", announce, CardTranslation.getTranslatedName(ability.getHostCard().getName())) , min,
|
||||
Integer.MAX_VALUE, min + 9);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CardCollectionView choosePermanentsToSacrifice(final SpellAbility sa, final int min, final int max,
|
||||
final CardCollectionView valid, final String message) {
|
||||
return choosePermanentsTo(min, max, valid, message, "sacrifice", sa);
|
||||
return choosePermanentsTo(min, max, valid, message, localizer.getMessage("lblSacrifice"), sa);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CardCollectionView choosePermanentsToDestroy(final SpellAbility sa, final int min, final int max,
|
||||
final CardCollectionView valid, final String message) {
|
||||
return choosePermanentsTo(min, max, valid, message, "destroy", sa);
|
||||
return choosePermanentsTo(min, max, valid, message, localizer.getMessage("lblDestroy"), sa);
|
||||
}
|
||||
|
||||
private CardCollectionView choosePermanentsTo(final int min, int max, final CardCollectionView valid,
|
||||
@@ -336,14 +337,16 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
return CardCollection.EMPTY;
|
||||
}
|
||||
|
||||
final StringBuilder builder = new StringBuilder("Select ");
|
||||
String inpMessage = null;
|
||||
if (min == 0) {
|
||||
builder.append("up to ");
|
||||
inpMessage = localizer.getMessage("lblSelectUpToNumTargetToAction", message, action);
|
||||
}
|
||||
else {
|
||||
inpMessage = localizer.getMessage("lblSelectNumTargetToAction", message, action);
|
||||
}
|
||||
builder.append("%d ").append(message).append("(s) to ").append(action).append(".");
|
||||
|
||||
final InputSelectCardsFromList inp = new InputSelectCardsFromList(this, min, max, valid, sa);
|
||||
inp.setMessage(builder.toString());
|
||||
inp.setMessage(inpMessage);
|
||||
inp.setCancelAllowed(min == 0);
|
||||
inp.showAndWait();
|
||||
return new CardCollection(inp.getSelected());
|
||||
@@ -396,12 +399,12 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
getGui().setPanelSelection(CardView.get(sa.getHostCard()));
|
||||
|
||||
if (useSelectCardsInput(sourceList)) {
|
||||
tempShowCards(sourceList);
|
||||
tempShowCards(sourceList);
|
||||
final InputSelectCardsFromList sc = new InputSelectCardsFromList(this, min, max, sourceList, sa);
|
||||
sc.setMessage(title);
|
||||
sc.setCancelAllowed(isOptional);
|
||||
sc.showAndWait();
|
||||
endTempShowCards();
|
||||
endTempShowCards();
|
||||
return new CardCollection(sc.getSelected());
|
||||
}
|
||||
|
||||
@@ -454,7 +457,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
input.setCancelAllowed(isOptional);
|
||||
input.setMessage(MessageUtil.formatMessage(title, player, targetedPlayer));
|
||||
input.showAndWait();
|
||||
endTempShowCards();
|
||||
endTempShowCards();
|
||||
return Iterables.getFirst(input.getSelected(), null);
|
||||
}
|
||||
|
||||
@@ -490,10 +493,10 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
if (useSelectCardsInput(optionList)) {
|
||||
final InputSelectEntitiesFromList<T> input = new InputSelectEntitiesFromList<>(this, min, max,
|
||||
optionList, sa);
|
||||
input.setCancelAllowed(true);
|
||||
input.setCancelAllowed(min == 0);
|
||||
input.setMessage(MessageUtil.formatMessage(title, player, targetedPlayer));
|
||||
input.showAndWait();
|
||||
endTempShowCards();
|
||||
endTempShowCards();
|
||||
return (List<T>) input.getSelected();
|
||||
}
|
||||
final List<GameEntityView> chosen = getGui().chooseEntitiesForEffect(title,
|
||||
@@ -597,7 +600,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
@Override
|
||||
public boolean confirmBidAction(final SpellAbility sa, final PlayerActionConfirmMode bidlife, final String string,
|
||||
final int bid, final Player winner) {
|
||||
return InputConfirm.confirm(this, sa, string + " Highest Bidder " + winner);
|
||||
return InputConfirm.confirm(this, sa, string + " " + localizer.getMessage("lblHighestBidder") + " " + winner);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -623,7 +626,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
return true;
|
||||
}
|
||||
|
||||
final StringBuilder buildQuestion = new StringBuilder("Use triggered ability of ");
|
||||
final StringBuilder buildQuestion = new StringBuilder(localizer.getMessage("lblUseTriggeredAbilityOf") + " ");
|
||||
buildQuestion.append(regtrig.getHostCard().toString()).append("?");
|
||||
if (!FModel.getPreferences().getPrefBoolean(FPref.UI_COMPACT_PROMPT)
|
||||
&& !FModel.getPreferences().getPrefBoolean(FPref.UI_DETAILED_SPELLDESC_IN_PROMPT)) {
|
||||
@@ -654,17 +657,25 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
@Override
|
||||
public Player chooseStartingPlayer(final boolean isFirstGame) {
|
||||
if (game.getPlayers().size() == 2) {
|
||||
String prompt = String.format(
|
||||
isFirstGame ? localizer.getMessage("lblYouHaveWonTheCoinToss") : localizer.getMessage("lblYouLostTheLastGame"),
|
||||
player.getName());
|
||||
String prompt = null;
|
||||
if (isFirstGame) {
|
||||
prompt = localizer.getMessage("lblYouHaveWonTheCoinToss", player.getName());
|
||||
}
|
||||
else {
|
||||
prompt = localizer.getMessage("lblYouLostTheLastGame", player.getName());
|
||||
}
|
||||
prompt += "\n\n" + localizer.getMessage("lblWouldYouLiketoPlayorDraw");
|
||||
final InputConfirm inp = new InputConfirm(this, prompt, localizer.getMessage("lblPlay"), localizer.getMessage("lblDraw"));
|
||||
inp.showAndWait();
|
||||
return inp.getResult() ? this.player : this.player.getOpponents().get(0);
|
||||
} else {
|
||||
String prompt = String.format(
|
||||
isFirstGame ? localizer.getMessage("lblYouHaveWonTheCoinToss") : localizer.getMessage("lblYouLostTheLastGame"),
|
||||
player.getName());
|
||||
String prompt = null;
|
||||
if (isFirstGame) {
|
||||
prompt = localizer.getMessage("lblYouHaveWonTheCoinToss", player.getName());
|
||||
}
|
||||
else {
|
||||
prompt = localizer.getMessage("lblYouLostTheLastGame", player.getName());
|
||||
}
|
||||
prompt += "\n\n" + localizer.getMessage("lblWhoWouldYouLiketoStartthisGame");
|
||||
final InputSelectEntitiesFromList<Player> input = new InputSelectEntitiesFromList<>(this, 1, 1,
|
||||
new FCollection<>(game.getPlayersInTurnOrder()));
|
||||
@@ -678,7 +689,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
public CardCollection orderBlockers(final Card attacker, final CardCollection blockers) {
|
||||
final CardView vAttacker = CardView.get(attacker);
|
||||
getGui().setPanelSelection(vAttacker);
|
||||
return game.getCardList(getGui().order(localizer.getMessage("lblChooseDamageOrderFor").replace("%s", vAttacker.toString()), localizer.getMessage("lblDamagedFirst"),
|
||||
return game.getCardList(getGui().order(localizer.getMessage("lblChooseDamageOrderFor", CardTranslation.getTranslatedName(vAttacker.getName())), localizer.getMessage("lblDamagedFirst"),
|
||||
CardView.getCollection(blockers), vAttacker));
|
||||
}
|
||||
|
||||
@@ -690,7 +701,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
}
|
||||
List<CardView> chosen;
|
||||
List<CardView> choices = new ArrayList<>(mapCVtoC.keySet());
|
||||
chosen = getGui().order("Exert Attackers?", "Exerted", 0, choices.size(), choices, null, null, false);
|
||||
chosen = getGui().order(localizer.getMessage("lblExertAttackersConfirm"), localizer.getMessage("lblExerted"), 0, choices.size(), choices, null, null, false);
|
||||
List<Card> chosenCards = new ArrayList<>();
|
||||
for (CardView cardView : chosen) {
|
||||
chosenCards.add(mapCVtoC.get(cardView));
|
||||
@@ -703,7 +714,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
final CardView vAttacker = CardView.get(attacker);
|
||||
getGui().setPanelSelection(vAttacker);
|
||||
return game.getCardList(getGui().insertInList(
|
||||
localizer.getMessage("lblChooseBlockerAfterWhichToPlaceAttackert").replace("%s", vAttacker.toString()),
|
||||
localizer.getMessage("lblChooseBlockerAfterWhichToPlaceAttackert", CardTranslation.getTranslatedName(vAttacker.getName())),
|
||||
CardView.get(blocker), CardView.getCollection(oldBlockers)));
|
||||
}
|
||||
|
||||
@@ -711,7 +722,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
public CardCollection orderAttackers(final Card blocker, final CardCollection attackers) {
|
||||
final CardView vBlocker = CardView.get(blocker);
|
||||
getGui().setPanelSelection(vBlocker);
|
||||
return game.getCardList(getGui().order(localizer.getMessage("lblChooseDamageOrderFor").replace("%s", vBlocker.toString()), localizer.getMessage("lblDamagedFirst"),
|
||||
return game.getCardList(getGui().order(localizer.getMessage("lblChooseDamageOrderFor", CardTranslation.getTranslatedName(vBlocker.getName())), localizer.getMessage("lblDamagedFirst"),
|
||||
CardView.getCollection(attackers), vBlocker));
|
||||
}
|
||||
|
||||
@@ -723,9 +734,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 = "Looking at cards in {player's} " + zone.name().toLowerCase();
|
||||
message = localizer.getMessage("lblLookCardInPlayerZone", "{player's}", zone.getTranslatedName().toLowerCase());
|
||||
} else {
|
||||
message += "{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()) {
|
||||
@@ -733,7 +744,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
getGui().reveal(fm, cards);
|
||||
endTempShowCards();
|
||||
} else {
|
||||
getGui().message(MessageUtil.formatMessage("There are no cards in {player's} " + zone.name().toLowerCase(),
|
||||
getGui().message(MessageUtil.formatMessage(localizer.getMessage("lblThereNoCardInPlayerZone", "{player's}", zone.getTranslatedName().toLowerCase()),
|
||||
player, owner), fm);
|
||||
}
|
||||
}
|
||||
@@ -748,12 +759,12 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
CardCollection toBottom = new CardCollection();
|
||||
CardCollection toTop = new CardCollection();
|
||||
for (int i = 0; i<cards.size() && manipulable.contains(result.get(i)) ; i++ ) {
|
||||
toTop.add(result.get(i));
|
||||
toTop.add(result.get(i));
|
||||
}
|
||||
if (toTop.size() < cards.size()) { // the top isn't everything
|
||||
for (int i = result.size()-1; i>=0 && manipulable.contains(result.get(i)); i-- ) {
|
||||
for (int i = result.size()-1; i>=0 && manipulable.contains(result.get(i)); i-- ) {
|
||||
toBottom.add(result.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
return ImmutablePair.of(toTop,toBottom);
|
||||
}
|
||||
@@ -764,34 +775,34 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
CardCollection toTop = null;
|
||||
|
||||
tempShowCards(topN);
|
||||
if ( FModel.getPreferences().getPrefBoolean(FPref.UI_SELECT_FROM_CARD_DISPLAYS) &&
|
||||
(!GuiBase.getInterface().isLibgdxPort()) ) {
|
||||
CardCollectionView cardList = player.getCardsIn(ZoneType.Library);
|
||||
ImmutablePair<CardCollection, CardCollection> result =
|
||||
arrangeForMove(localizer.getMessage("lblMoveCardstoToporBbottomofLibrary"), cardList, topN, true, true);
|
||||
toTop = result.getLeft();
|
||||
toBottom = result.getRight();
|
||||
} else {
|
||||
if (topN.size() == 1) {
|
||||
if (willPutCardOnTop(topN.get(0))) {
|
||||
toTop = topN;
|
||||
} else {
|
||||
toBottom = topN;
|
||||
}
|
||||
} else {
|
||||
toBottom = game.getCardList(getGui().many(localizer.getMessage("lblSelectCardsToBeOutOnTheBottomOfYourLibrary"),
|
||||
localizer.getMessage("lblCardsToPutOnTheBottom"), -1, CardView.getCollection(topN), null));
|
||||
topN.removeAll(toBottom);
|
||||
if (topN.isEmpty()) {
|
||||
toTop = null;
|
||||
} else if (topN.size() == 1) {
|
||||
toTop = topN;
|
||||
} else {
|
||||
toTop = game.getCardList(getGui().order(localizer.getMessage("lblArrangeCardsToBePutOnTopOfYourLibrary"),
|
||||
localizer.getMessage("lblTopOfLibrary"), CardView.getCollection(topN), null));
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( FModel.getPreferences().getPrefBoolean(FPref.UI_SELECT_FROM_CARD_DISPLAYS) &&
|
||||
(!GuiBase.getInterface().isLibgdxPort()) ) {
|
||||
CardCollectionView cardList = player.getCardsIn(ZoneType.Library);
|
||||
ImmutablePair<CardCollection, CardCollection> result =
|
||||
arrangeForMove(localizer.getMessage("lblMoveCardstoToporBbottomofLibrary"), cardList, topN, true, true);
|
||||
toTop = result.getLeft();
|
||||
toBottom = result.getRight();
|
||||
} else {
|
||||
if (topN.size() == 1) {
|
||||
if (willPutCardOnTop(topN.get(0))) {
|
||||
toTop = topN;
|
||||
} else {
|
||||
toBottom = topN;
|
||||
}
|
||||
} else {
|
||||
toBottom = game.getCardList(getGui().many(localizer.getMessage("lblSelectCardsToBeOutOnTheBottomOfYourLibrary"),
|
||||
localizer.getMessage("lblCardsToPutOnTheBottom"), -1, CardView.getCollection(topN), null));
|
||||
topN.removeAll(toBottom);
|
||||
if (topN.isEmpty()) {
|
||||
toTop = null;
|
||||
} else if (topN.size() == 1) {
|
||||
toTop = topN;
|
||||
} else {
|
||||
toTop = game.getCardList(getGui().order(localizer.getMessage("lblArrangeCardsToBePutOnTopOfYourLibrary"),
|
||||
localizer.getMessage("lblTopOfLibrary"), CardView.getCollection(topN), null));
|
||||
}
|
||||
}
|
||||
}
|
||||
endTempShowCards();
|
||||
return ImmutablePair.of(toTop, toBottom);
|
||||
}
|
||||
@@ -809,8 +820,8 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
tempShowCard(c);
|
||||
getGui().setCard(view);
|
||||
boolean result = false;
|
||||
result = InputConfirm.confirm(this, view, TextUtil.concatNoSpace("Put ", view.toString(), " on the top of library or graveyard?"),
|
||||
true, ImmutableList.of("Library", "Graveyard"));
|
||||
result = InputConfirm.confirm(this, view, localizer.getMessage("lblPutCardsOnTheTopLibraryOrGraveyard", CardTranslation.getTranslatedName(view.getName())),
|
||||
true, ImmutableList.of(localizer.getMessage("lblLibrary"), localizer.getMessage("lblGraveyard")));
|
||||
if (result) {
|
||||
toTop = topN;
|
||||
} else {
|
||||
@@ -841,8 +852,8 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
getGui().setCard(c.getView());
|
||||
|
||||
boolean result = false;
|
||||
result = InputConfirm.confirm(this, view, localizer.getMessage("lblPutCardOnTopOrBottomLibrary").replace("%s", view.toString()),
|
||||
true, ImmutableList.of("Top", "Bottom"));
|
||||
result = InputConfirm.confirm(this, view, localizer.getMessage("lblPutCardOnTopOrBottomLibrary", CardTranslation.getTranslatedName(view.getName())),
|
||||
true, ImmutableList.of(localizer.getMessage("lblTop"), localizer.getMessage("lblBottom")));
|
||||
|
||||
endTempShowCards();
|
||||
return result;
|
||||
@@ -1003,7 +1014,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
return super.hasAllTargets();
|
||||
}
|
||||
};
|
||||
target.setMessage(localizer.getMessage("lblSelectNCardsToDiscardUnlessDiscarduType").replace("%s", uType));
|
||||
target.setMessage(localizer.getMessage("lblSelectNCardsToDiscardUnlessDiscarduType", uType));
|
||||
target.showAndWait();
|
||||
return new CardCollection(target.getSelected());
|
||||
}
|
||||
@@ -1019,10 +1030,9 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
final List<String> options = Lists.newArrayList();
|
||||
for (int i = 0; i < manaChoices.size(); i++) {
|
||||
final Mana m = manaChoices.get(i);
|
||||
options.add(TextUtil.concatNoSpace(String.valueOf(1 + i), ". ", MagicColor.toLongString(m.getColor()),
|
||||
" mana from ", m.getSourceCard().toString()));
|
||||
options.add(localizer.getMessage("lblNColorManaFromCard", String.valueOf(1 + i), MagicColor.toLongString(m.getColor()), CardTranslation.getTranslatedName(m.getSourceCard().getName())));
|
||||
}
|
||||
final String chosen = getGui().one("Pay Mana from Mana Pool", options);
|
||||
final String chosen = getGui().one(localizer.getMessage("lblPayManaFromManaPool"), options);
|
||||
final String idx = TextUtil.split(chosen, '.')[0];
|
||||
return manaChoices.get(Integer.parseInt(idx) - 1);
|
||||
}
|
||||
@@ -1034,7 +1044,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
* java.lang.String, java.util.List, java.util.List, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public String chooseSomeType(final String kindOfType, final SpellAbility sa, final List<String> validTypes,
|
||||
public String chooseSomeType(final String kindOfType, final SpellAbility sa, final Collection<String> validTypes,
|
||||
final List<String> invalidTypes, final boolean isOptional) {
|
||||
final List<String> types = Lists.newArrayList(validTypes);
|
||||
if (invalidTypes != null && !invalidTypes.isEmpty()) {
|
||||
@@ -1044,9 +1054,9 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
sortCreatureTypes(types);
|
||||
}
|
||||
if (isOptional) {
|
||||
return getGui().oneOrNone("Choose a " + kindOfType.toLowerCase() + " type", types);
|
||||
return getGui().oneOrNone(localizer.getMessage("lblChooseATargetType", kindOfType.toLowerCase()), types);
|
||||
}
|
||||
return getGui().one("Choose a " + kindOfType.toLowerCase() + " type", types);
|
||||
return getGui().one(localizer.getMessage("lblChooseATargetType", kindOfType.toLowerCase()), types);
|
||||
}
|
||||
|
||||
// sort creature types such that those most prevalent in player's deck are
|
||||
@@ -1317,7 +1327,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
}
|
||||
};
|
||||
final String message = localizer.getMessage("lblCleanupPhase") + "\n"
|
||||
+ localizer.getMessage("lblSelectCardsToDiscardHandDownMaximum").replace("%d", String.valueOf(nDiscard)).replace("%max", String.valueOf(max));
|
||||
+ localizer.getMessage("lblSelectCardsToDiscardHandDownMaximum", String.valueOf(nDiscard), String.valueOf(max));
|
||||
inp.setMessage(message);
|
||||
inp.setCancelAllowed(false);
|
||||
inp.showAndWait();
|
||||
@@ -1374,28 +1384,28 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
final List<String> labels;
|
||||
switch (kindOfChoice) {
|
||||
case HeadsOrTails:
|
||||
labels = ImmutableList.of("Heads", "Tails");
|
||||
labels = ImmutableList.of(localizer.getMessage("lblHeads"), localizer.getMessage("lblTails"));
|
||||
break;
|
||||
case TapOrUntap:
|
||||
labels = ImmutableList.of("Tap", "Untap");
|
||||
labels = ImmutableList.of(localizer.getMessage("lblTap"), localizer.getMessage("lblUntap"));
|
||||
break;
|
||||
case OddsOrEvens:
|
||||
labels = ImmutableList.of("Odds", "Evens");
|
||||
labels = ImmutableList.of(localizer.getMessage("lblOdds"), localizer.getMessage("lblEvens"));
|
||||
break;
|
||||
case UntapOrLeaveTapped:
|
||||
labels = ImmutableList.of("Untap", "Leave tapped");
|
||||
labels = ImmutableList.of(localizer.getMessage("lblUntap"), localizer.getMessage("lblLeaveTapped"));
|
||||
break;
|
||||
case UntapTimeVault:
|
||||
labels = ImmutableList.of("Untap (and skip this turn)", "Leave tapped");
|
||||
labels = ImmutableList.of(localizer.getMessage("lblUntapAndSkipThisTurn"), localizer.getMessage("lblLeaveTapped"));
|
||||
break;
|
||||
case PlayOrDraw:
|
||||
labels = ImmutableList.of("Play", "Draw");
|
||||
labels = ImmutableList.of(localizer.getMessage("lblPlay"), localizer.getMessage("lblDraw"));
|
||||
break;
|
||||
case LeftOrRight:
|
||||
labels = ImmutableList.of("Left", "Right");
|
||||
labels = ImmutableList.of(localizer.getMessage("lblLeft"), localizer.getMessage("lblRight"));
|
||||
break;
|
||||
case AddOrRemove:
|
||||
labels = ImmutableList.of("Add Counter", "Remove Counter");
|
||||
labels = ImmutableList.of(localizer.getMessage("lblAddCounter"), localizer.getMessage("lblRemoveCounter"));
|
||||
break;
|
||||
default:
|
||||
labels = ImmutableList.copyOf(kindOfChoice.toString().split("Or"));
|
||||
@@ -1407,19 +1417,24 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
@Override
|
||||
public boolean chooseFlipResult(final SpellAbility sa, final Player flipper, final boolean[] results,
|
||||
final boolean call) {
|
||||
final String[] labelsSrc = call ? new String[] { "heads", "tails" }
|
||||
: new String[] { "win the flip", "lose the flip" };
|
||||
final ImmutableList.Builder<String> strResults = ImmutableList.builder();
|
||||
for (int i = 0; i < results.length; i++) {
|
||||
strResults.add(labelsSrc[results[i] ? 0 : 1]);
|
||||
final String[] labelsSrc = call ? new String[] { localizer.getMessage("lblHeads"), localizer.getMessage("lblTails") }
|
||||
: new String[] { localizer.getMessage("lblWinTheFlip"), localizer.getMessage("lblLoseTheFlip") };
|
||||
final List<String> sortedResults = new ArrayList<String>();
|
||||
for (boolean result : results) {
|
||||
sortedResults.add(labelsSrc[result ? 0 : 1]);
|
||||
}
|
||||
return getGui().one(sa.getHostCard().getName() + " - Choose a result", strResults.build()).equals(labelsSrc[0]);
|
||||
|
||||
Collections.sort(sortedResults);
|
||||
if (!call) {
|
||||
Collections.reverse(sortedResults);
|
||||
}
|
||||
return getGui().one(sa.getHostCard().getName() + " - " + localizer.getMessage("lblChooseAResult"), sortedResults).equals(labelsSrc[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Card chooseProtectionShield(final GameEntity entityBeingDamaged, final List<String> options,
|
||||
final Map<String, Card> choiceMap) {
|
||||
final String title = entityBeingDamaged + " - select which prevention shield to use";
|
||||
final String title = entityBeingDamaged + " - " + localizer.getMessage("lblSelectPreventionShieldToUse");
|
||||
return choiceMap.get(getGui().one(title, options));
|
||||
}
|
||||
|
||||
@@ -1481,8 +1496,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
game.getTracker().freeze(); // refreeze if the tracker was frozen prior to this update
|
||||
}
|
||||
final List<SpellAbilityView> choices = new ArrayList<>(spellViewCache.keySet());
|
||||
final String modeTitle = TextUtil.concatNoSpace(sa.getActivatingPlayer().toString(), " activated ",
|
||||
sa.getHostCard().toString(), " - Choose a mode");
|
||||
final String modeTitle = localizer.getMessage("lblPlayerActivatedCardChooseMode", sa.getActivatingPlayer().toString(), CardTranslation.getTranslatedName(sa.getHostCard().getName()));
|
||||
final List<AbilitySub> chosen = Lists.newArrayListWithCapacity(num);
|
||||
for (int i = 0; i < num; i++) {
|
||||
SpellAbilityView a;
|
||||
@@ -1765,7 +1779,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
@Override
|
||||
public void revealAnte(final String message, final Multimap<Player, PaperCard> removedAnteCards) {
|
||||
for (final Player p : removedAnteCards.keySet()) {
|
||||
getGui().reveal(message + " from " + Lang.getPossessedObject(MessageUtil.mayBeYou(player, p), "deck"),
|
||||
getGui().reveal(localizer.getMessage("lblActionFromPlayerDeck", message, Lang.getPossessedObject(MessageUtil.mayBeYou(player, p), "")),
|
||||
ImmutableList.copyOf(removedAnteCards.get(p)));
|
||||
}
|
||||
}
|
||||
@@ -2003,7 +2017,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
public void generateMana() {
|
||||
final Player pPriority = game.getPhaseHandler().getPriorityPlayer();
|
||||
if (pPriority == null) {
|
||||
getGui().message("No player has priority at the moment, so mana cannot be added to their pool.");
|
||||
getGui().message(localizer.getMessage("lblNoPlayerHasPriorityCannotAddedManaToPool"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2041,7 +2055,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
state.initFromGame(game);
|
||||
final File f = GuiBase.getInterface().getSaveFile(new File(ForgeConstants.USER_GAMES_DIR, "state.txt"));
|
||||
if (f != null
|
||||
&& (!f.exists() || getGui().showConfirmDialog("Overwrite existing file?", "File exists!"))) {
|
||||
&& (!f.exists() || getGui().showConfirmDialog(localizer.getMessage("lblOverwriteExistFileConfirm"), localizer.getMessage("lblFileExists")))) {
|
||||
try (BufferedWriter bw = new BufferedWriter(new FileWriter(f))) {
|
||||
bw.write(state.toString());
|
||||
}
|
||||
@@ -2069,7 +2083,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
gamesDir.mkdir();
|
||||
}
|
||||
|
||||
final String filename = GuiBase.getInterface().showFileDialog("Select Game State File",
|
||||
final String filename = GuiBase.getInterface().showFileDialog(localizer.getMessage("lblSelectGameStateFile"),
|
||||
ForgeConstants.USER_GAMES_DIR);
|
||||
if (filename == null) {
|
||||
return;
|
||||
@@ -2081,7 +2095,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
state.parse(fstream);
|
||||
fstream.close();
|
||||
} catch (final FileNotFoundException fnfe) {
|
||||
SOptionPane.showErrorDialog("File not found: " + filename);
|
||||
SOptionPane.showErrorDialog(localizer.getMessage("lblFileNotFound") + ": " + filename);
|
||||
return;
|
||||
} catch (final Exception e) {
|
||||
SOptionPane.showErrorDialog(localizer.getMessage("lblErrorLoadingBattleSetupFile"));
|
||||
@@ -2351,11 +2365,21 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
|
||||
private void addCardToZone(ZoneType zone, final boolean repeatLast, final boolean noTriggers) {
|
||||
final ZoneType targetZone = repeatLast ? lastAddedZone : zone;
|
||||
String zoneStr = targetZone != ZoneType.Battlefield ? "in " + targetZone.name().toLowerCase()
|
||||
: noTriggers ? "on the battlefield" : "on the stack / in play";
|
||||
String message = null;
|
||||
if (targetZone != ZoneType.Battlefield) {
|
||||
message = localizer.getMessage("lblPutCardInWhichPlayerZone", targetZone.getTranslatedName().toLowerCase());
|
||||
}
|
||||
else {
|
||||
if (noTriggers) {
|
||||
message = localizer.getMessage("lblPutCardInWhichPlayerBattlefield");
|
||||
}
|
||||
else {
|
||||
message = localizer.getMessage("lblPutCardInWhichPlayerPlayOrStack");
|
||||
}
|
||||
}
|
||||
|
||||
final Player p = repeatLast ? lastAddedPlayer
|
||||
: game.getPlayer(getGui().oneOrNone("Put card " + zoneStr + " for which player?",
|
||||
: game.getPlayer(getGui().oneOrNone(message,
|
||||
PlayerView.getCollection(game.getPlayers())));
|
||||
if (p == null) {
|
||||
return;
|
||||
@@ -2392,7 +2416,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
lastSummoningSickness = true;
|
||||
} else {
|
||||
lastSummoningSickness = getGui().confirm(forgeCard.getView(),
|
||||
TextUtil.concatWithSpace("Should", forgeCard.toString(), "be affected with Summoning Sickness?"));
|
||||
localizer.getMessage("lblCardShouldBeSummoningSicknessConfirm", CardTranslation.getTranslatedName(forgeCard.getName())));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2421,7 +2445,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
if (choices.size() == 1) {
|
||||
sa = choices.iterator().next();
|
||||
} else {
|
||||
sa = repeatLast ? lastAddedSA : getGui().oneOrNone("Choose", (FCollection<SpellAbility>) choices);
|
||||
sa = repeatLast ? lastAddedSA : getGui().oneOrNone(localizer.getMessage("lblChoose"), (FCollection<SpellAbility>) choices);
|
||||
}
|
||||
if (sa == null) {
|
||||
return; // happens if cancelled
|
||||
@@ -2441,8 +2465,8 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
}
|
||||
} else if (targetZone == ZoneType.Library) {
|
||||
if (!repeatLast) {
|
||||
lastTopOfTheLibrary = getGui().confirm(forgeCard.getView(),
|
||||
TextUtil.concatWithSpace("Should", forgeCard.toString(), "be added to the top or to the bottom of the library?"), true, Arrays.asList("Top", "Bottom"));
|
||||
lastTopOfTheLibrary = getGui().confirm(forgeCard.getView(), localizer.getMessage("lblCardShouldBeAddedToLibraryTopOrBottom", CardTranslation.getTranslatedName(forgeCard.getName())),
|
||||
true, Arrays.asList(localizer.getMessage("lblTop"), localizer.getMessage("lblBottom")));
|
||||
}
|
||||
if (lastTopOfTheLibrary) {
|
||||
game.getAction().moveToLibrary(forgeCard, null);
|
||||
@@ -2468,7 +2492,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
*/
|
||||
@Override
|
||||
public void exileCardsFromHand() {
|
||||
final Player p = game.getPlayer(getGui().oneOrNone("Exile card(s) from which player's hand?",
|
||||
final Player p = game.getPlayer(getGui().oneOrNone(localizer.getMessage("lblExileCardsFromPlayerHandConfirm"),
|
||||
PlayerView.getCollection(game.getPlayers())));
|
||||
if (p == null) {
|
||||
return;
|
||||
@@ -2477,7 +2501,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
final CardCollection selection;
|
||||
|
||||
CardCollectionView cardsInHand = p.getCardsIn(ZoneType.Hand);
|
||||
selection = game.getCardList(getGui().many("Choose cards to exile", "Discarded", 0, -1,
|
||||
selection = game.getCardList(getGui().many(localizer.getMessage("lblChooseCardsExile"), localizer.getMessage("lblDiscarded"), 0, -1,
|
||||
CardView.getCollection(cardsInHand), null));
|
||||
|
||||
if (selection != null && selection.size() > 0) {
|
||||
@@ -2503,7 +2527,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
*/
|
||||
@Override
|
||||
public void exileCardsFromBattlefield() {
|
||||
final Player p = game.getPlayer(getGui().oneOrNone("Exile card(s) from which player's battlefield?",
|
||||
final Player p = game.getPlayer(getGui().oneOrNone(localizer.getMessage("lblExileCardsFromPlayerBattlefieldConfirm"),
|
||||
PlayerView.getCollection(game.getPlayers())));
|
||||
if (p == null) {
|
||||
return;
|
||||
@@ -2512,7 +2536,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
final CardCollection selection;
|
||||
|
||||
CardCollectionView cardsInPlay = p.getCardsIn(ZoneType.Battlefield);
|
||||
selection = game.getCardList(getGui().many("Choose cards to exile", "Discarded", 0, -1,
|
||||
selection = game.getCardList(getGui().many(localizer.getMessage("lblChooseCardsExile"), localizer.getMessage("lblDiscarded"), 0, -1,
|
||||
CardView.getCollection(cardsInPlay), null));
|
||||
|
||||
if (selection != null && selection.size() > 0) {
|
||||
@@ -2538,19 +2562,19 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
*/
|
||||
@Override
|
||||
public void removeCardsFromGame() {
|
||||
final Player p = game.getPlayer(getGui().oneOrNone("Remove card(s) belonging to which player?",
|
||||
final Player p = game.getPlayer(getGui().oneOrNone(localizer.getMessage("lblRemoveCardBelongingWitchPlayer"),
|
||||
PlayerView.getCollection(game.getPlayers())));
|
||||
if (p == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final String zone = getGui().one("Remove card(s) from which zone?",
|
||||
final String zone = getGui().one(localizer.getMessage("lblRemoveCardFromWhichZone"),
|
||||
Arrays.asList("Hand", "Battlefield", "Library", "Graveyard", "Exile"));
|
||||
|
||||
final CardCollection selection;
|
||||
|
||||
CardCollectionView cards = p.getCardsIn(ZoneType.smartValueOf(zone));
|
||||
selection = game.getCardList(getGui().many("Choose cards to remove from game", "Removed", 0, -1,
|
||||
selection = game.getCardList(getGui().many(localizer.getMessage("lblChooseCardsRemoveFromGame"), localizer.getMessage("lblRemoved"), 0, -1,
|
||||
CardView.getCollection(cards), null));
|
||||
|
||||
if (selection != null && selection.size() > 0) {
|
||||
@@ -2688,14 +2712,14 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
// A more informative prompt would be useful, but the dialog seems
|
||||
// to
|
||||
// like to clip text in long messages...
|
||||
final String prompt = "Enter a sequence (card IDs and/or \"opponent\"/\"me\"). (e.g. 7, opponent, 18)";
|
||||
final String prompt = localizer.getMessage("lblEnterASequence");
|
||||
String textSequence = getGui().showInputDialog(prompt, dialogTitle, FSkinProp.ICO_QUEST_NOTES,
|
||||
rememberedSequenceText);
|
||||
if (textSequence == null || textSequence.trim().isEmpty()) {
|
||||
rememberedActions.clear();
|
||||
if (!rememberedSequenceText.isEmpty()) {
|
||||
rememberedSequenceText = "";
|
||||
getGui().message("Action sequence cleared.", dialogTitle);
|
||||
getGui().message(localizer.getMessage("lblActionSequenceCleared"), dialogTitle);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -2704,7 +2728,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
// but don't change rememberedActions.
|
||||
if (textSequence.equals(rememberedSequenceText)) {
|
||||
if (currentIndex > 0 && currentIndex < rememberedActions.size()) {
|
||||
getGui().message("Restarting action sequence.", dialogTitle);
|
||||
getGui().message(localizer.getMessage("lblRestartingActionSequence"), dialogTitle);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -2732,7 +2756,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
}
|
||||
}
|
||||
if (entityInfo.isEmpty()) {
|
||||
getGui().message("Error: Check IDs and ensure they're separated by spaces and/or commas.", dialogTitle);
|
||||
getGui().message(localizer.getMessage("lblErrorPleaseCheckID"), dialogTitle);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2763,7 +2787,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
getGui().message("Error: Entity with ID " + entity.getKey() + " not found.", dialogTitle);
|
||||
getGui().message(localizer.getMessage("lblErrorEntityWithId") + " " + entity.getKey() + " " + localizer.getMessage("lblNotFound") + ".", dialogTitle);
|
||||
rememberedActions.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -214,6 +214,7 @@ public final class ForgeConstants {
|
||||
public static final String USER_PREFS_DIR = USER_DIR + "preferences" + PATH_SEPARATOR;
|
||||
public static final String USER_GAMES_DIR = USER_DIR + "games" + PATH_SEPARATOR;
|
||||
public static final String USER_FORMATS_DIR = USER_DIR + "customformats" + PATH_SEPARATOR;
|
||||
public static final String USER_PUZZLE_DIR = USER_DIR + "puzzle" + PATH_SEPARATOR;
|
||||
public static final String LOG_FILE = USER_DIR + "forge.log";
|
||||
public static final String ACHIEVEMENTS_DIR = USER_DIR + "achievements" + PATH_SEPARATOR;
|
||||
public static final String DECK_DRAFT_DIR = DECK_BASE_DIR + "draft" + PATH_SEPARATOR;
|
||||
|
||||
@@ -133,7 +133,7 @@ public class ForgeProfileProperties {
|
||||
|
||||
private static Map<String, String> getMap(final Properties props, final String propertyKey) {
|
||||
final String strMap = props.getProperty(propertyKey, "").trim();
|
||||
return FileSection.parseToMap(strMap, "->", "|");
|
||||
return FileSection.parseToMap(strMap, FileSection.ARROW_KV_SEPARATOR);
|
||||
}
|
||||
|
||||
private static int getInt(final Properties props, final String propertyKey, final int defaultValue) {
|
||||
|
||||
@@ -14,12 +14,16 @@ import forge.game.zone.ZoneType;
|
||||
import forge.item.IPaperCard;
|
||||
import forge.item.InventoryItem;
|
||||
import forge.model.FModel;
|
||||
import forge.properties.ForgeConstants;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class Puzzle extends GameState implements InventoryItem, Comparable<Puzzle> {
|
||||
String name;
|
||||
String filename;
|
||||
String goal;
|
||||
String url;
|
||||
String difficulty;
|
||||
@@ -27,16 +31,23 @@ public class Puzzle extends GameState implements InventoryItem, Comparable<Puzzl
|
||||
String targets;
|
||||
int targetCount = 1;
|
||||
int turns;
|
||||
boolean completed;
|
||||
|
||||
public Puzzle(Map<String, List<String>> puzzleLines) {
|
||||
this(puzzleLines, "", false);
|
||||
}
|
||||
|
||||
public Puzzle(Map<String, List<String>> puzzleLines, String filename, boolean completed) {
|
||||
loadMetaData(puzzleLines.get("metadata"));
|
||||
loadGameState(puzzleLines.get("state"));
|
||||
// Generate goal enforcement
|
||||
this.filename = filename;
|
||||
this.completed = completed;
|
||||
}
|
||||
|
||||
private void loadMetaData(List<String> metadataLines) {
|
||||
for(String line : metadataLines) {
|
||||
String[] split = line.split(":");
|
||||
String[] split = line.split(":", 2);
|
||||
if ("Name".equalsIgnoreCase(split[0])) {
|
||||
this.name = split[1].trim();
|
||||
} else if ("Goal".equalsIgnoreCase(split[0])) {
|
||||
@@ -215,13 +226,50 @@ public class Puzzle extends GameState implements InventoryItem, Comparable<Puzzl
|
||||
return name;
|
||||
}
|
||||
|
||||
public String toString() { return name; }
|
||||
public boolean getCompleted() { return completed; }
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (this.completed) {
|
||||
sb.append("[COMPLETED] ");
|
||||
}
|
||||
sb.append(name);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public int compareTo(Puzzle pzl) throws ClassCastException {
|
||||
if (!(pzl instanceof Puzzle)) {
|
||||
throw new ClassCastException("Tried to compare a Puzzle object to a non-Puzzle object.");
|
||||
}
|
||||
|
||||
return getName().compareTo(pzl.getName());
|
||||
|
||||
if (this.completed == pzl.getCompleted()) {
|
||||
return getName().compareTo(pzl.getName());
|
||||
} else if (this.completed) {
|
||||
return 1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean savePuzzleSolve(final boolean completed) {
|
||||
if (!completed) {
|
||||
return false;
|
||||
}
|
||||
|
||||
File directory = new File(ForgeConstants.USER_PUZZLE_DIR);
|
||||
if (!directory.exists()) {
|
||||
directory.mkdirs();
|
||||
}
|
||||
|
||||
File store = new File(ForgeConstants.USER_PUZZLE_DIR, filename + PuzzleIO.SUFFIX_COMPLETE);
|
||||
if (!store.exists()) {
|
||||
try {
|
||||
store.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
this.completed = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ public class PuzzleIO {
|
||||
|
||||
public static final String TXF_PROMPT = "[New Puzzle]";
|
||||
public static final String SUFFIX_DATA = ".pzl";
|
||||
public static final String SUFFIX_COMPLETE = ".complete";
|
||||
|
||||
public static ArrayList<Puzzle> loadPuzzles() {
|
||||
String[] pList;
|
||||
@@ -33,13 +34,18 @@ public class PuzzleIO {
|
||||
for (final String element : pList) {
|
||||
if (element.endsWith(SUFFIX_DATA)) {
|
||||
final List<String> pfData = FileUtil.readFile(ForgeConstants.PUZZLE_DIR + element);
|
||||
puzzles.add(new Puzzle(parsePuzzleSections(pfData)));
|
||||
|
||||
String filename = element.replace(SUFFIX_DATA, "");
|
||||
boolean completed = FileUtil.doesFileExist(ForgeConstants.USER_PUZZLE_DIR + element.replace(SUFFIX_DATA, SUFFIX_COMPLETE));
|
||||
|
||||
// Pass file name into Puzzle so it can save the completed name to match
|
||||
puzzles.add(new Puzzle(parsePuzzleSections(pfData), filename, completed));
|
||||
}
|
||||
}
|
||||
return puzzles;
|
||||
}
|
||||
|
||||
public static final Map<String, List<String>> parsePuzzleSections(List<String> pfData) {
|
||||
public static Map<String, List<String>> parsePuzzleSections(List<String> pfData) {
|
||||
return FileSection.parseSections(pfData);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,9 +27,11 @@ import forge.util.TextUtil;
|
||||
import forge.util.gui.SGuiChoose;
|
||||
import forge.util.gui.SOptionPane;
|
||||
import forge.util.storage.IStorage;
|
||||
import forge.util.Localizer;
|
||||
|
||||
public class QuestTournamentController {
|
||||
private final IQuestTournamentView view;
|
||||
private final Localizer localizer = Localizer.getInstance();
|
||||
private boolean drafting = false;
|
||||
private IGuiGame gui = null;
|
||||
|
||||
@@ -68,18 +70,14 @@ public class QuestTournamentController {
|
||||
final QuestEventDraft draft = FModel.getQuest().getAchievements().getCurrentDraft();
|
||||
|
||||
if (!draft.isStarted()) {
|
||||
final boolean shouldQuit = SOptionPane.showOptionDialog("If you leave now, this tournament will be forever gone."
|
||||
+ "\nYou will keep the cards you drafted, but will receive no other prizes."
|
||||
+ "\n\nWould you still like to quit the tournament?", "Really Quit?", SOptionPane.WARNING_ICON, ImmutableList.of("Yes", "No"), 1) == 0;
|
||||
final boolean shouldQuit = SOptionPane.showOptionDialog(localizer.getMessage("lblLeaveTournamentDraftWarning1"), localizer.getMessage("lblReallyQuit"), SOptionPane.WARNING_ICON, ImmutableList.of(localizer.getMessage("lblYes"), localizer.getMessage("lblNo")), 1) == 0;
|
||||
if (!shouldQuit) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (draft.playerHasMatchesLeft()) {
|
||||
final boolean shouldQuit = SOptionPane.showOptionDialog("You have matches left to play!\nLeaving the tournament early will forfeit your potential future winnings."
|
||||
+ "\nYou will still receive winnings as if you conceded your next match and you will keep the cards you drafted."
|
||||
+ "\n\nWould you still like to quit the tournament?", "Really Quit?", SOptionPane.WARNING_ICON, ImmutableList.of("Yes", "No"), 1) == 0;
|
||||
final boolean shouldQuit = SOptionPane.showOptionDialog(localizer.getMessage("lblLeaveTournamentDraftWarning2"), localizer.getMessage("lblReallyQuit"), SOptionPane.WARNING_ICON, ImmutableList.of(localizer.getMessage("lblYes"), localizer.getMessage("lblNo")), 1) == 0;
|
||||
if (!shouldQuit) {
|
||||
return;
|
||||
}
|
||||
@@ -90,17 +88,17 @@ public class QuestTournamentController {
|
||||
final QuestEventDraft.QuestDraftPrizes prizes = draft.collectPrizes();
|
||||
|
||||
if (prizes.hasCredits()) {
|
||||
SOptionPane.showMessageDialog("For placing " + placement + ", you have been awarded " + QuestUtil.formatCredits(prizes.credits) + " credits!", "Credits Awarded", FSkinProp.ICO_QUEST_GOLD);
|
||||
SOptionPane.showMessageDialog(localizer.getMessage("lblForPlacing") + placement + localizer.getMessage("lblHaveBeAward") + QuestUtil.formatCredits(prizes.credits) + " " + localizer.getMessage("lblCredits") + "!", localizer.getMessage("lblCreditsAwarded"), FSkinProp.ICO_QUEST_GOLD);
|
||||
}
|
||||
|
||||
if (prizes.hasIndividualCards()) {
|
||||
GuiBase.getInterface().showCardList("Tournament Reward", "For participating in the tournament, you have been awarded the following promotional card:", prizes.individualCards);
|
||||
GuiBase.getInterface().showCardList(localizer.getMessage("lblTournamentReward"), localizer.getMessage("lblParticipateingTournamentReward"), prizes.individualCards);
|
||||
}
|
||||
|
||||
if (prizes.hasBoosterPacks()) {
|
||||
final String packPlural = (prizes.boosterPacks.size() == 1) ? "" : "s";
|
||||
|
||||
SOptionPane.showMessageDialog("For placing " + placement + ", you have been awarded " + prizes.boosterPacks.size() + " booster pack" + packPlural + "!", "Booster Pack" + packPlural + " Awarded", FSkinProp.ICO_QUEST_BOX);
|
||||
SOptionPane.showMessageDialog(localizer.getMessage("lblForPlacing") + placement + localizer.getMessage("lblHaveBeAward") + prizes.boosterPacks.size() + " " + localizer.getMessage("lblBoosterPack") + packPlural + "!", localizer.getMessage("lblBoosterPack") + packPlural + " " + localizer.getMessage("lblAwarded"), FSkinProp.ICO_QUEST_BOX);
|
||||
|
||||
if (FModel.getPreferences().getPrefBoolean(FPref.UI_OPEN_PACKS_INDIV) && prizes.boosterPacks.size() > 1) {
|
||||
boolean skipTheRest = false;
|
||||
@@ -118,11 +116,11 @@ public class QuestTournamentController {
|
||||
continue;
|
||||
}
|
||||
|
||||
skipTheRest = GuiBase.getInterface().showBoxedProduct(pack.getName(), "You have found the following cards inside (Booster Pack " + currentPack + " of " + totalPacks + "):", pack.getCards());
|
||||
skipTheRest = GuiBase.getInterface().showBoxedProduct(pack.getName(), localizer.getMessage("lblFoundCards") + " (" + localizer.getMessage("lblBoosterPack") + " " + currentPack + " / " + totalPacks + "):", pack.getCards());
|
||||
}
|
||||
|
||||
if (skipTheRest && !remainingCards.isEmpty()) {
|
||||
GuiBase.getInterface().showCardList("Tournament Reward", "You have found the following cards inside:", remainingCards);
|
||||
GuiBase.getInterface().showCardList(localizer.getMessage("lblTournamentReward"), localizer.getMessage("lblFoundCards") + ":", remainingCards);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -133,27 +131,27 @@ public class QuestTournamentController {
|
||||
cards.addAll(pack.getCards());
|
||||
}
|
||||
|
||||
GuiBase.getInterface().showCardList("Tournament Reward", "You have found the following cards inside:", cards);
|
||||
GuiBase.getInterface().showCardList(localizer.getMessage("lblTournamentReward"), localizer.getMessage("lblFoundCards") + ":", cards);
|
||||
}
|
||||
}
|
||||
|
||||
if (prizes.selectRareFromSets()) {
|
||||
SOptionPane.showMessageDialog("For placing " + placement + ", you may select a rare or mythic rare card from the drafted block.", "Rare Awarded", FSkinProp.ICO_QUEST_STAKES);
|
||||
SOptionPane.showMessageDialog(localizer.getMessage("lblForPlacing") + placement + localizer.getMessage("lblSelectRareAwarded"), localizer.getMessage("lblRareAwarded"), FSkinProp.ICO_QUEST_STAKES);
|
||||
|
||||
final PaperCard card = GuiBase.getInterface().chooseCard("Select a Card", "Select a card to keep:", prizes.selectRareCards);
|
||||
final PaperCard card = GuiBase.getInterface().chooseCard(localizer.getMessage("lblSelectACard"), localizer.getMessage("lblSelectKeepCard"), prizes.selectRareCards);
|
||||
prizes.addSelectedCard(card);
|
||||
|
||||
SOptionPane.showMessageDialog("'" + card.getName() + "' has been added to your collection!", "Card Added", FSkinProp.ICO_QUEST_STAKES);
|
||||
SOptionPane.showMessageDialog("'" + card.getName() + "' " + localizer.getMessage("lblAddToCollection"), localizer.getMessage("lblCardAdded"), FSkinProp.ICO_QUEST_STAKES);
|
||||
}
|
||||
|
||||
if (draft.getPlayerPlacement() == 1) {
|
||||
SOptionPane.showMessageDialog("For placing " + placement + ", you have been awarded a token!\nUse tokens to create new drafts to play.", "Bonus Token", FSkinProp.ICO_QUEST_NOTES);
|
||||
SOptionPane.showMessageDialog(localizer.getMessage("lblForPlacing") + placement + localizer.getMessage("lblHaveBeAwardToken"), localizer.getMessage("lblBonusToken"), FSkinProp.ICO_QUEST_NOTES);
|
||||
FModel.getQuest().getAchievements().addDraftToken();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
final boolean saveDraft = SOptionPane.showOptionDialog("Would you like to save this draft to the regular draft mode?", "Save Draft?", SOptionPane.QUESTION_ICON, ImmutableList.of("Yes", "No"), 0) == 0;
|
||||
final boolean saveDraft = SOptionPane.showOptionDialog(localizer.getMessage("lblWouldLikeSaveDraft"), localizer.getMessage("lblSaveDraft") + "?", SOptionPane.QUESTION_ICON, ImmutableList.of(localizer.getMessage("lblYes"), localizer.getMessage("lblNo")), 0) == 0;
|
||||
if (saveDraft) {
|
||||
draft.saveToRegularDraft();
|
||||
}
|
||||
@@ -170,26 +168,23 @@ public class QuestTournamentController {
|
||||
List<QuestDraftFormat> formats = QuestEventDraft.getAvailableFormats(FModel.getQuest());
|
||||
|
||||
if (formats.isEmpty()) {
|
||||
SOptionPane.showErrorDialog(
|
||||
"You do not have any draft-able sets unlocked!\n" +
|
||||
"Come back later when you've unlocked more sets.",
|
||||
"No Available Drafts");
|
||||
SOptionPane.showErrorDialog(localizer.getMessage("lblNoAvailableDraftsMessage"),localizer.getMessage("lblNoAvailableDrafts"));
|
||||
return;
|
||||
}
|
||||
|
||||
final QuestDraftFormat format = SGuiChoose.oneOrNone("Choose Draft Format", formats);
|
||||
final QuestDraftFormat format = SGuiChoose.oneOrNone(localizer.getMessage("lblChooseDraftFormat"), formats);
|
||||
if (format != null) {
|
||||
QuestEventDraft evt = QuestEventDraft.getDraftOrNull(FModel.getQuest(), format);
|
||||
if (evt != null) {
|
||||
String fee = TextUtil.concatNoSpace("The entry fee for this booster draft tournament is ", String.valueOf(evt.getEntryFee()), " credits.\nWould you like to spend a token and create this tournament?");
|
||||
if (SOptionPane.showConfirmDialog(fee, "Creating a Booster Draft Tournament")) {
|
||||
String fee = TextUtil.concatNoSpace(localizer.getMessage("lblEntryFeeOfDraftTournament"), String.valueOf(evt.getEntryFee()), localizer.getMessage("lblWouldLikeCreateTournament"));
|
||||
if (SOptionPane.showConfirmDialog(fee, localizer.getMessage("lblCreatingDraftTournament"))) {
|
||||
achievements.spendDraftToken(format);
|
||||
|
||||
update();
|
||||
view.populate();
|
||||
}
|
||||
} else {
|
||||
SOptionPane.showErrorDialog("Unexpected error when creating a draft tournament " + format.getName() + ". Please report this as a bug.");
|
||||
SOptionPane.showErrorDialog(localizer.getMessage("lblUnexpectedCreatingDraftTournament") + format.getName() + localizer.getMessage("lblPleaseReportBug"));
|
||||
System.err.println("Error creating booster draft tournament (QuestEventDraft object was null): " + format.getName());
|
||||
}
|
||||
}
|
||||
@@ -241,7 +236,7 @@ public class QuestTournamentController {
|
||||
}
|
||||
|
||||
private void updateSelectTournament() {
|
||||
view.getLblCredits().setText("Credits: " + QuestUtil.formatCredits(FModel.getQuest().getAssets().getCredits()));
|
||||
view.getLblCredits().setText(localizer.getMessage("lblCredits") + ": " + QuestUtil.formatCredits(FModel.getQuest().getAssets().getCredits()));
|
||||
|
||||
final QuestAchievements achievements = FModel.getQuest().getAchievements();
|
||||
achievements.generateDrafts();
|
||||
@@ -258,12 +253,12 @@ public class QuestTournamentController {
|
||||
view.updateEventList(null);
|
||||
}
|
||||
|
||||
view.getLblFirst().setText("1st Place: " + achievements.getWinsForPlace(1) + " time" + (achievements.getWinsForPlace(1) == 1 ? "" : "s"));
|
||||
view.getLblSecond().setText("2nd Place: " + achievements.getWinsForPlace(2) + " time" + (achievements.getWinsForPlace(2) == 1 ? "" : "s"));
|
||||
view.getLblThird().setText("3rd Place: " + achievements.getWinsForPlace(3) + " time" + (achievements.getWinsForPlace(3) == 1 ? "" : "s"));
|
||||
view.getLblFourth().setText("4th Place: " + achievements.getWinsForPlace(4) + " time" + (achievements.getWinsForPlace(4) == 1 ? "" : "s"));
|
||||
view.getLblFirst().setText(localizer.getMessage("lbl1stPlace") + achievements.getWinsForPlace(1) + localizer.getMessage("lblTime") + (achievements.getWinsForPlace(1) == 1 ? "" : "s"));
|
||||
view.getLblSecond().setText(localizer.getMessage("lbl2ndPlace") + achievements.getWinsForPlace(2) + localizer.getMessage("lblTime") + (achievements.getWinsForPlace(2) == 1 ? "" : "s"));
|
||||
view.getLblThird().setText(localizer.getMessage("lbl3rdPlace") + achievements.getWinsForPlace(3) + localizer.getMessage("lblTime") + (achievements.getWinsForPlace(3) == 1 ? "" : "s"));
|
||||
view.getLblFourth().setText(localizer.getMessage("lbl4thPlace") + achievements.getWinsForPlace(4) + localizer.getMessage("lblTime") + (achievements.getWinsForPlace(4) == 1 ? "" : "s"));
|
||||
|
||||
view.getBtnSpendToken().setText("Spend Token (" + achievements.getDraftTokens() + ")");
|
||||
view.getBtnSpendToken().setText(localizer.getMessage("btnSpendToken") + " (" + achievements.getDraftTokens() + ")");
|
||||
view.getBtnSpendToken().setEnabled(achievements.getDraftTokens() > 0);
|
||||
}
|
||||
|
||||
@@ -308,10 +303,10 @@ public class QuestTournamentController {
|
||||
}
|
||||
|
||||
if (FModel.getQuest().getAchievements().getCurrentDraft().playerHasMatchesLeft()) {
|
||||
view.getBtnLeaveTournament().setText("Leave Tournament");
|
||||
view.getBtnLeaveTournament().setText(localizer.getMessage("btnLeaveTournament"));
|
||||
}
|
||||
else {
|
||||
view.getBtnLeaveTournament().setText("Collect Prizes");
|
||||
view.getBtnLeaveTournament().setText(localizer.getMessage("lblCollectPrizes"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -367,10 +362,10 @@ public class QuestTournamentController {
|
||||
}
|
||||
|
||||
if (draft.playerHasMatchesLeft()) {
|
||||
view.getBtnLeaveTournament().setText("Leave Tournament");
|
||||
view.getBtnLeaveTournament().setText(localizer.getMessage("btnLeaveTournament"));
|
||||
}
|
||||
else {
|
||||
view.getBtnLeaveTournament().setText("Collect Prizes");
|
||||
view.getBtnLeaveTournament().setText(localizer.getMessage("lblCollectPrizes"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -387,8 +382,7 @@ public class QuestTournamentController {
|
||||
|
||||
public void startDraft() {
|
||||
if (drafting) {
|
||||
SOptionPane.showErrorDialog("You are currently in a draft.\n" +
|
||||
"You should leave or finish that draft before starting another.");
|
||||
SOptionPane.showErrorDialog(localizer.getMessage("lblCurrentlyInDraft"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -396,11 +390,11 @@ public class QuestTournamentController {
|
||||
|
||||
final long creditsAvailable = FModel.getQuest().getAssets().getCredits();
|
||||
if (draftEvent.canEnter()) {
|
||||
SOptionPane.showMessageDialog("You need " + QuestUtil.formatCredits(draftEvent.getEntryFee() - creditsAvailable) + " more credits to enter this tournament.", "Not Enough Credits", SOptionPane.WARNING_ICON);
|
||||
SOptionPane.showMessageDialog(localizer.getMessage("lblYouNeed") + QuestUtil.formatCredits(draftEvent.getEntryFee() - creditsAvailable) + " " + localizer.getMessage("lblMoreCredits"), localizer.getMessage("lblNotEnoughCredits"), SOptionPane.WARNING_ICON);
|
||||
return;
|
||||
}
|
||||
|
||||
final boolean okayToEnter = SOptionPane.showOptionDialog("This tournament costs " + QuestUtil.formatCredits(draftEvent.getEntryFee()) + " credits to enter.\nAre you sure you wish to enter?", "Enter Draft Tournament?", FSkinProp.ICO_QUEST_GOLD, ImmutableList.of("Yes", "No"), 1) == 0;
|
||||
final boolean okayToEnter = SOptionPane.showOptionDialog(localizer.getMessage("lblTournamentCosts") + QuestUtil.formatCredits(draftEvent.getEntryFee()) + localizer.getMessage("lblSureEnterTournament"), localizer.getMessage("lblEnterDraftTournament"), FSkinProp.ICO_QUEST_GOLD, ImmutableList.of(localizer.getMessage("lblYes"), localizer.getMessage("lblNo")), 1) == 0;
|
||||
|
||||
if (!okayToEnter) {
|
||||
return;
|
||||
@@ -413,8 +407,7 @@ public class QuestTournamentController {
|
||||
}
|
||||
|
||||
public boolean cancelDraft() {
|
||||
if (SOptionPane.showConfirmDialog("This will end the current draft and you will not be able to join this tournament again.\nYour credits will be refunded and the draft will be removed.\n\n" +
|
||||
"Leave anyway?", "Leave Draft?", "Leave", "Cancel", false)) {
|
||||
if (SOptionPane.showConfirmDialog(localizer.getMessage("lblLeaveDraftConfirm"), localizer.getMessage("lblLeaveDraft") + "?", localizer.getMessage("lblLeave"), localizer.getMessage("lblCancel"), false)) {
|
||||
drafting = false;
|
||||
|
||||
QuestController quest = FModel.getQuest();
|
||||
@@ -433,7 +426,7 @@ public class QuestTournamentController {
|
||||
|
||||
final String message = GameType.QuestDraft.getDeckFormat().getDeckConformanceProblem(FModel.getQuest().getAssets().getDraftDeckStorage().get(QuestEventDraft.DECK_NAME).getHumanDeck());
|
||||
if (message != null && FModel.getPreferences().getPrefBoolean(FPref.ENFORCE_DECK_LEGALITY)) {
|
||||
SOptionPane.showMessageDialog("Deck " + message, "Deck Invalid");
|
||||
SOptionPane.showMessageDialog(localizer.getMessage("lblDeck") + " " + message, localizer.getMessage("lblDeckInvalid"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -449,13 +442,12 @@ public class QuestTournamentController {
|
||||
final String message = QuestDraftUtils.getDeckLegality();
|
||||
|
||||
if (message != null) {
|
||||
SOptionPane.showMessageDialog(message, "Deck Invalid");
|
||||
SOptionPane.showMessageDialog(message, localizer.getMessage("lblDeckInvalid"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (QuestDraftUtils.matchInProgress) {
|
||||
SOptionPane.showErrorDialog("There is already a match in progress.\n" +
|
||||
"Please wait for the current round to end before attempting to continue.");
|
||||
SOptionPane.showErrorDialog(localizer.getMessage("lblAlreadyMatchPleaseWait"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import forge.quest.bazaar.QuestItemType;
|
||||
import forge.quest.data.QuestPreferences;
|
||||
import forge.quest.data.QuestPreferences.DifficultyPrefs;
|
||||
import forge.quest.data.QuestPreferences.QPref;
|
||||
import forge.util.Localizer;
|
||||
import forge.util.MyRandom;
|
||||
import forge.util.TextUtil;
|
||||
import forge.util.gui.SGuiChoose;
|
||||
@@ -72,15 +73,15 @@ public class QuestWinLoseController {
|
||||
|
||||
final boolean matchIsNotOver = !lastGame.isMatchOver();
|
||||
if (matchIsNotOver) {
|
||||
view.getBtnQuit().setText("Quit (-15 Credits)");
|
||||
view.getBtnQuit().setText(Localizer.getInstance().getMessage("lblQuitByPayCredits"));
|
||||
}
|
||||
else {
|
||||
view.getBtnContinue().setVisible(false);
|
||||
if (wonMatch) {
|
||||
view.getBtnQuit().setText("Great!");
|
||||
view.getBtnQuit().setText(Localizer.getInstance().getMessage("lblGreat") + "!");
|
||||
}
|
||||
else {
|
||||
view.getBtnQuit().setText("OK");
|
||||
view.getBtnQuit().setText(Localizer.getInstance().getMessage("lblOK"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,10 +161,10 @@ public class QuestWinLoseController {
|
||||
private void anteReport(final List<PaperCard> cardsWon, final List<PaperCard> cardsLost) {
|
||||
// Generate Swing components and attach.
|
||||
if (cardsWon != null && !cardsWon.isEmpty()) {
|
||||
view.showCards("Spoils! Cards won from ante", cardsWon);
|
||||
view.showCards(Localizer.getInstance().getMessage("lblSpoilsWonAnteCard"), cardsWon);
|
||||
}
|
||||
if (cardsLost != null && !cardsLost.isEmpty()) {
|
||||
view.showCards("Looted! Cards lost to ante", cardsLost);
|
||||
view.showCards(Localizer.getInstance().getMessage("lblLootedLostAnteCard"), cardsLost);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -385,7 +386,7 @@ public class QuestWinLoseController {
|
||||
sb.append(TextUtil.concatWithSpace(String.valueOf(credTotal), "credits in total."));
|
||||
qData.getAssets().addCredits(credTotal);
|
||||
|
||||
view.showMessage(sb.toString(), "Gameplay Results", FSkinProp.ICO_QUEST_GOLD);
|
||||
view.showMessage(sb.toString(), Localizer.getInstance().getMessage("lblGameplayResults"), FSkinProp.ICO_QUEST_GOLD);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -468,12 +469,12 @@ public class QuestWinLoseController {
|
||||
}
|
||||
|
||||
if (addDraftToken) {
|
||||
view.showMessage("For achieving a 25 win streak, you have been awarded a draft token!\nUse these tokens to generate new tournaments.", "Bonus Draft Token Reward", FSkinProp.ICO_QUEST_COIN);
|
||||
view.showMessage(Localizer.getInstance().getMessage("lblAchieving25WinStreakAwarded"), Localizer.getInstance().getMessage("lblBonusDraftTokenReward"), FSkinProp.ICO_QUEST_COIN);
|
||||
qData.getAchievements().addDraftToken();
|
||||
}
|
||||
|
||||
if (!cardsWon.isEmpty()) {
|
||||
view.showCards("You have achieved a " + (currentStreak == 0 ? "50" : currentStreak) + " win streak and won " + cardsWon.size() + " " + typeWon + " card" + ((cardsWon.size() != 1) ? "s" : "") + "!", cardsWon);
|
||||
view.showCards(Localizer.getInstance().getMessage("lblAchievedNWinStreakWinMTypeCards", (currentStreak == 0 ? "50" : String.valueOf(currentStreak)), String.valueOf(cardsWon.size()), typeWon), cardsWon);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -486,7 +487,7 @@ public class QuestWinLoseController {
|
||||
*/
|
||||
private void awardJackpot() {
|
||||
final List<PaperCard> cardsWon = qData.getCards().addRandomRare(10);
|
||||
view.showCards("You just won 10 random rares!", cardsWon);
|
||||
view.showCards(Localizer.getInstance().getMessage("lblJustWonTenRandomRares"), cardsWon);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -515,13 +516,13 @@ public class QuestWinLoseController {
|
||||
|
||||
Collections.sort(formats);
|
||||
|
||||
final GameFormat selected = SGuiChoose.getChoices("Choose bonus booster format", 1, 1, formats, pref, null).get(0);
|
||||
final GameFormat selected = SGuiChoose.getChoices(Localizer.getInstance().getMessage("lblChooseBonusBoosterFormat"), 1, 1, formats, pref, null).get(0);
|
||||
FModel.getQuestPreferences().setPref(QPref.BOOSTER_FORMAT, selected.toString());
|
||||
|
||||
cardsWon = qData.getCards().generateQuestBooster(selected.getFilterPrinted());
|
||||
qData.getCards().addAllCards(cardsWon);
|
||||
|
||||
title = "Bonus booster pack from the \"" + selected.getName() + "\" format!";
|
||||
title = Localizer.getInstance().getMessage("lblBonusFormatBoosterPack", selected.getName());
|
||||
|
||||
} else {
|
||||
|
||||
@@ -566,7 +567,7 @@ public class QuestWinLoseController {
|
||||
maxChoices--;
|
||||
}
|
||||
|
||||
final CardEdition chooseEd = SGuiChoose.one("Choose bonus booster set", options);
|
||||
final CardEdition chooseEd = SGuiChoose.one(Localizer.getInstance().getMessage("lblChooseBonusBoosterSet"), options);
|
||||
|
||||
if (customBooster) {
|
||||
List<PaperCard> cards = FModel.getMagicDb().getCommonCards().getAllCards(Predicates.printedInSet(chooseEd.getCode()));
|
||||
@@ -578,7 +579,7 @@ public class QuestWinLoseController {
|
||||
}
|
||||
|
||||
qData.getCards().addAllCards(cardsWon);
|
||||
title = "Bonus " + chooseEd.getName() + " Booster Pack!";
|
||||
title = Localizer.getInstance().getMessage("lblBonusSetBoosterPack", chooseEd.getName());
|
||||
|
||||
}
|
||||
|
||||
@@ -606,18 +607,14 @@ public class QuestWinLoseController {
|
||||
private void awardChallengeWin() {
|
||||
final long questRewardCredits = ((QuestEventChallenge) qEvent).getCreditsReward();
|
||||
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append("Challenge completed.\n\n");
|
||||
sb.append("Challenge bounty: ").append(questRewardCredits).append(" credits.");
|
||||
|
||||
String winMessage = ((QuestEventChallenge)qEvent).getWinMessage();
|
||||
if (!winMessage.isEmpty()) {
|
||||
view.showMessage(winMessage.replace("\\n", "\n"), "Congratulations", FSkinProp.ICO_QUEST_NOTES);
|
||||
view.showMessage(winMessage.replace("\\n", "\n"), Localizer.getInstance().getMessage("lblCongratulations"), FSkinProp.ICO_QUEST_NOTES);
|
||||
}
|
||||
|
||||
qData.getAssets().addCredits(questRewardCredits);
|
||||
|
||||
view.showMessage(sb.toString(), "Challenge Rewards for \"" + qEvent.getTitle() + "\"", FSkinProp.ICO_QUEST_BOX);
|
||||
view.showMessage(Localizer.getInstance().getMessage("lblChallengeCompletedBountyIS", String.valueOf(questRewardCredits)), Localizer.getInstance().getMessage("lblChallengeRewardsForEvent", qEvent.getTitle()), FSkinProp.ICO_QUEST_BOX);
|
||||
|
||||
awardSpecialReward(null);
|
||||
}
|
||||
@@ -676,7 +673,7 @@ public class QuestWinLoseController {
|
||||
|
||||
private void penalizeLoss() {
|
||||
final int x = FModel.getQuestPreferences().getPrefInt(QPref.PENALTY_LOSS);
|
||||
view.showMessage("You lose! You have lost " + x + " credits.", "Gameplay Results", FSkinProp.ICO_QUEST_HEART);
|
||||
view.showMessage(Localizer.getInstance().getMessage("lblYouHaveLostNCredits", String.valueOf(x)), Localizer.getInstance().getMessage("lblGameplayResults"), FSkinProp.ICO_QUEST_HEART);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,7 +43,7 @@ public class SellRules {
|
||||
return;
|
||||
}
|
||||
|
||||
FileSection section = FileSection.parse(questShop, "=");
|
||||
FileSection section = FileSection.parse(questShop, FileSection.EQUALS_KV_SEPARATOR);
|
||||
minWins = section.getInt("WinsToUnlock");
|
||||
cost = section.getInt("Credits", 250);
|
||||
maxDifficulty = section.getInt("MaxDifficulty", 5);
|
||||
|
||||
@@ -28,7 +28,7 @@ public class QuestChallengeReader extends StorageReaderFolder<QuestEventChalleng
|
||||
final QuestEventChallenge qc = new QuestEventChallenge();
|
||||
|
||||
// Unique properties
|
||||
FileSection sectionQuest = FileSection.parse(contents.get("quest"), "=");
|
||||
FileSection sectionQuest = FileSection.parse(contents.get("quest"), FileSection.EQUALS_KV_SEPARATOR);
|
||||
qc.setId(sectionQuest.get("ID", "-1"));
|
||||
qc.setOpponentName(sectionQuest.get("OpponentName"));
|
||||
qc.setRepeatable(sectionQuest.getBoolean("Repeat", false));
|
||||
@@ -60,7 +60,7 @@ public class QuestChallengeReader extends StorageReaderFolder<QuestEventChalleng
|
||||
}
|
||||
|
||||
// Common properties
|
||||
FileSection sectionMeta = FileSection.parse(contents.get("metadata"), "=");
|
||||
FileSection sectionMeta = FileSection.parse(contents.get("metadata"), FileSection.EQUALS_KV_SEPARATOR);
|
||||
qc.setTitle(sectionMeta.get("Title"));
|
||||
qc.setName(qc.getTitle()); // Challenges have unique titles
|
||||
qc.setDifficulty(QuestEventDifficulty.fromString(sectionMeta.get("Difficulty")));
|
||||
|
||||
@@ -27,7 +27,7 @@ public class QuestDuelReader extends StorageReaderFolder<QuestEventDuel> {
|
||||
final QuestEventDuel qc = new QuestEventDuel();
|
||||
|
||||
// Common properties
|
||||
FileSection sectionMeta = FileSection.parse(contents.get("metadata"), "=");
|
||||
FileSection sectionMeta = FileSection.parse(contents.get("metadata"), FileSection.EQUALS_KV_SEPARATOR);
|
||||
qc.setTitle(sectionMeta.get("Title"));
|
||||
qc.setName(sectionMeta.get("Name")); // Challenges have unique titles
|
||||
qc.setDifficulty(QuestEventDifficulty.fromString(sectionMeta.get("Difficulty")));
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.google.common.collect.ImmutableList;
|
||||
|
||||
import forge.GuiBase;
|
||||
import forge.assets.FSkinProp;
|
||||
import forge.util.Localizer;
|
||||
|
||||
public class SOptionPane {
|
||||
public static final FSkinProp QUESTION_ICON = FSkinProp.ICO_QUESTION;
|
||||
@@ -30,7 +31,7 @@ public class SOptionPane {
|
||||
}
|
||||
|
||||
public static void showMessageDialog(final String message, final String title, final FSkinProp icon) {
|
||||
showOptionDialog(message, title, icon, ImmutableList.of("OK"), 0);
|
||||
showOptionDialog(message, title, icon, ImmutableList.of(Localizer.getInstance().getMessage("lblOK")), 0);
|
||||
}
|
||||
|
||||
public static boolean showConfirmDialog(final String message) {
|
||||
@@ -38,11 +39,11 @@ public class SOptionPane {
|
||||
}
|
||||
|
||||
public static boolean showConfirmDialog(final String message, final String title) {
|
||||
return showConfirmDialog(message, title, "Yes", "No", true);
|
||||
return showConfirmDialog(message, title, Localizer.getInstance().getMessage("lblYes"), Localizer.getInstance().getMessage("lblNo"), true);
|
||||
}
|
||||
|
||||
public static boolean showConfirmDialog(final String message, final String title, final boolean defaultYes) {
|
||||
return showConfirmDialog(message, title, "Yes", "No", defaultYes);
|
||||
return showConfirmDialog(message, title, Localizer.getInstance().getMessage("lblYes"), Localizer.getInstance().getMessage("lblNo"), defaultYes);
|
||||
}
|
||||
|
||||
public static boolean showConfirmDialog(final String message, final String title, final String yesButtonText, final String noButtonText) {
|
||||
|
||||
Reference in New Issue
Block a user