mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
GuiUtils: choice methods moved to GuiChoose.java
GuiUtils: rarely used methods moved closer to usage
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -12654,6 +12654,7 @@ src/main/java/forge/gui/CardPicturePanel.java svneol=native#text/plain
|
|||||||
src/main/java/forge/gui/DualListBox.java -text
|
src/main/java/forge/gui/DualListBox.java -text
|
||||||
src/main/java/forge/gui/ForgeAction.java svneol=native#text/plain
|
src/main/java/forge/gui/ForgeAction.java svneol=native#text/plain
|
||||||
src/main/java/forge/gui/GuiAssignDamageFrame.java svneol=native#text/plain
|
src/main/java/forge/gui/GuiAssignDamageFrame.java svneol=native#text/plain
|
||||||
|
src/main/java/forge/gui/GuiChoose.java -text
|
||||||
src/main/java/forge/gui/GuiDisplayUtil.java svneol=native#text/plain
|
src/main/java/forge/gui/GuiDisplayUtil.java svneol=native#text/plain
|
||||||
src/main/java/forge/gui/GuiImportPicture.java svneol=native#text/plain
|
src/main/java/forge/gui/GuiImportPicture.java svneol=native#text/plain
|
||||||
src/main/java/forge/gui/GuiInput.java svneol=native#text/plain
|
src/main/java/forge/gui/GuiInput.java svneol=native#text/plain
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ import forge.game.player.Player;
|
|||||||
import forge.game.zone.PlayerZone;
|
import forge.game.zone.PlayerZone;
|
||||||
import forge.game.zone.PlayerZoneComesIntoPlay;
|
import forge.game.zone.PlayerZoneComesIntoPlay;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.gui.match.ViewWinLose;
|
import forge.gui.match.ViewWinLose;
|
||||||
|
|
||||||
|
|
||||||
@@ -1334,7 +1334,7 @@ public class GameAction {
|
|||||||
crd = list.get(0);
|
crd = list.get(0);
|
||||||
} else {
|
} else {
|
||||||
if (c.getController().isHuman()) {
|
if (c.getController().isHuman()) {
|
||||||
crd = GuiUtils.chooseOneOrNone("Select totem armor to destroy", list);
|
crd = GuiChoose.oneOrNone("Select totem armor to destroy", list);
|
||||||
} else {
|
} else {
|
||||||
crd = list.get(0);
|
crd = list.get(0);
|
||||||
}
|
}
|
||||||
@@ -1517,7 +1517,7 @@ public class GameAction {
|
|||||||
crd = list.get(0);
|
crd = list.get(0);
|
||||||
} else {
|
} else {
|
||||||
if (c.getController().isHuman()) {
|
if (c.getController().isHuman()) {
|
||||||
crd = GuiUtils.chooseOneOrNone("Select totem armor to destroy", list);
|
crd = GuiChoose.oneOrNone("Select totem armor to destroy", list);
|
||||||
} else {
|
} else {
|
||||||
crd = list.get(0);
|
crd = list.get(0);
|
||||||
}
|
}
|
||||||
@@ -1581,7 +1581,7 @@ public class GameAction {
|
|||||||
} else if (choices.size() == 1) {
|
} else if (choices.size() == 1) {
|
||||||
choice = choices.get(0);
|
choice = choices.get(0);
|
||||||
} else {
|
} else {
|
||||||
choice = (String) GuiUtils.chooseOneOrNone("Choose", choices);
|
choice = (String) GuiChoose.oneOrNone("Choose", choices);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (choice == null) {
|
if (choice == null) {
|
||||||
@@ -1619,7 +1619,7 @@ public class GameAction {
|
|||||||
} else if (choices.size() == 1) {
|
} else if (choices.size() == 1) {
|
||||||
sa = choices.get(0);
|
sa = choices.get(0);
|
||||||
} else {
|
} else {
|
||||||
sa = (SpellAbility) GuiUtils.chooseOneOrNone("Choose", choices);
|
sa = (SpellAbility) GuiChoose.oneOrNone("Choose", choices);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sa == null) {
|
if (sa == null) {
|
||||||
@@ -1708,12 +1708,12 @@ public class GameAction {
|
|||||||
cntChoice[i] = Integer.valueOf(i);
|
cntChoice[i] = Integer.valueOf(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Integer chosenAmount = (Integer) GuiUtils.chooseOne("Exile how many cards?", cntChoice);
|
final Integer chosenAmount = (Integer) GuiChoose.one("Exile how many cards?", cntChoice);
|
||||||
System.out.println("Delve for " + chosenAmount);
|
System.out.println("Delve for " + chosenAmount);
|
||||||
final CardList choices = AllZone.getHumanPlayer().getCardsIn(ZoneType.Graveyard);
|
final CardList choices = AllZone.getHumanPlayer().getCardsIn(ZoneType.Graveyard);
|
||||||
final CardList chosen = new CardList();
|
final CardList chosen = new CardList();
|
||||||
for (int i = 0; i < chosenAmount; i++) {
|
for (int i = 0; i < chosenAmount; i++) {
|
||||||
final Card nowChosen = GuiUtils.chooseOneOrNone("Exile which card?", choices);
|
final Card nowChosen = GuiChoose.oneOrNone("Exile which card?", choices);
|
||||||
|
|
||||||
if (nowChosen == null) {
|
if (nowChosen == null) {
|
||||||
// User canceled,abort delving.
|
// User canceled,abort delving.
|
||||||
@@ -1790,7 +1790,7 @@ public class GameAction {
|
|||||||
ManaCost newCost = new ManaCost(originalCost.toString());
|
ManaCost newCost = new ManaCost(originalCost.toString());
|
||||||
Object tapForConvoke = null;
|
Object tapForConvoke = null;
|
||||||
if (sa.getActivatingPlayer().isHuman()) {
|
if (sa.getActivatingPlayer().isHuman()) {
|
||||||
tapForConvoke = GuiUtils.chooseOneOrNone("Tap for Convoke? " + newCost.toString(),
|
tapForConvoke = GuiChoose.oneOrNone("Tap for Convoke? " + newCost.toString(),
|
||||||
choices);
|
choices);
|
||||||
} else {
|
} else {
|
||||||
// TODO: AI to choose a creature to tap would go here
|
// TODO: AI to choose a creature to tap would go here
|
||||||
@@ -1805,7 +1805,7 @@ public class GameAction {
|
|||||||
String chosenColor = usableColors.get(0);
|
String chosenColor = usableColors.get(0);
|
||||||
if (usableColors.size() > 1) {
|
if (usableColors.size() > 1) {
|
||||||
if (sa.getActivatingPlayer().isHuman()) {
|
if (sa.getActivatingPlayer().isHuman()) {
|
||||||
chosenColor = (String) GuiUtils.chooseOne("Convoke for which color?",
|
chosenColor = (String) GuiChoose.one("Convoke for which color?",
|
||||||
usableColors);
|
usableColors);
|
||||||
} else {
|
} else {
|
||||||
// TODO: AI for choosing which color to
|
// TODO: AI for choosing which color to
|
||||||
@@ -1833,7 +1833,7 @@ public class GameAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sa.getActivatingPlayer().isHuman()) {
|
if (sa.getActivatingPlayer().isHuman()) {
|
||||||
tapForConvoke = GuiUtils.chooseOneOrNone("Tap for Convoke? " + newCost.toString(), choices);
|
tapForConvoke = GuiChoose.oneOrNone("Tap for Convoke? " + newCost.toString(), choices);
|
||||||
} else {
|
} else {
|
||||||
// TODO: AI to choose a creature to tap would go
|
// TODO: AI to choose a creature to tap would go
|
||||||
// here
|
// here
|
||||||
@@ -1929,7 +1929,7 @@ public class GameAction {
|
|||||||
} else if (choices.size() == 1) {
|
} else if (choices.size() == 1) {
|
||||||
choice = choices.get(0);
|
choice = choices.get(0);
|
||||||
} else {
|
} else {
|
||||||
choice = (String) GuiUtils.chooseOneOrNone("Choose", choices);
|
choice = (String) GuiChoose.oneOrNone("Choose", choices);
|
||||||
}
|
}
|
||||||
final SpellAbility ability = map.get(choice);
|
final SpellAbility ability = map.get(choice);
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ import forge.game.GameLossReason;
|
|||||||
import forge.game.player.ComputerUtil;
|
import forge.game.player.ComputerUtil;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.gui.match.CMatchUI;
|
import forge.gui.match.CMatchUI;
|
||||||
import forge.util.MyRandom;
|
import forge.util.MyRandom;
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ public final class GameActionUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // while
|
} // while
|
||||||
GuiUtils.chooseOneOrNone("Revealed cards:", revealed);
|
GuiChoose.oneOrNone("Revealed cards:", revealed);
|
||||||
|
|
||||||
if (cascadedCard != null) {
|
if (cascadedCard != null) {
|
||||||
|
|
||||||
@@ -287,7 +287,7 @@ public final class GameActionUtil {
|
|||||||
rippledCards[i] = crd;
|
rippledCards[i] = crd;
|
||||||
}
|
}
|
||||||
} // for
|
} // for
|
||||||
GuiUtils.chooseOneOrNone("Revealed cards:", revealed);
|
GuiChoose.oneOrNone("Revealed cards:", revealed);
|
||||||
for (int i = 0; i < rippleMax; i++) {
|
for (int i = 0; i < rippleMax; i++) {
|
||||||
if (rippledCards[i] != null) {
|
if (rippledCards[i] != null) {
|
||||||
|
|
||||||
@@ -628,7 +628,7 @@ public final class GameActionUtil {
|
|||||||
|
|
||||||
final boolean flip = MyRandom.getRandom().nextBoolean();
|
final boolean flip = MyRandom.getRandom().nextBoolean();
|
||||||
if (caller.isHuman()) {
|
if (caller.isHuman()) {
|
||||||
choice = GuiUtils.chooseOne(source.getName() + " - Call coin flip", choices);
|
choice = GuiChoose.one(source.getName() + " - Call coin flip", choices);
|
||||||
} else {
|
} else {
|
||||||
choice = choices[MyRandom.getRandom().nextInt(2)];
|
choice = choices[MyRandom.getRandom().nextInt(2)];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -505,8 +505,7 @@ public final class CardRulesPredicates {
|
|||||||
public static final Predicate<CardRules> IS_NON_LAND = CardRulesPredicates.coreType(false, CardCoreType.Land);
|
public static final Predicate<CardRules> IS_NON_LAND = CardRulesPredicates.coreType(false, CardCoreType.Land);
|
||||||
|
|
||||||
/** The Constant isNonCreatureSpell. */
|
/** The Constant isNonCreatureSpell. */
|
||||||
public static final Predicate<CardRules> IS_CREATURE_OR_LAND = Predicates.or(Presets.IS_CREATURE,Presets.IS_LAND);
|
public static final Predicate<CardRules> IS_NON_CREATURE_SPELL = Predicates.not(Predicates.or(Presets.IS_CREATURE,Presets.IS_LAND));
|
||||||
public static final Predicate<CardRules> IS_NON_CREATURE_SPELL = Predicates.not(IS_CREATURE_OR_LAND);
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static final Predicate<CardRules> IS_NONCREATURE_SPELL_FOR_GENERATOR =
|
public static final Predicate<CardRules> IS_NONCREATURE_SPELL_FOR_GENERATOR =
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import java.util.List;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.item.CardPrinted;
|
import forge.item.CardPrinted;
|
||||||
import forge.util.MyRandom;
|
import forge.util.MyRandom;
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ public class UnOpenedMeta extends UnOpenedProduct {
|
|||||||
for (MetaSet meta : metaSets) {
|
for (MetaSet meta : metaSets) {
|
||||||
choices.add(meta.getCode());
|
choices.add(meta.getCode());
|
||||||
}
|
}
|
||||||
final Object o = GuiUtils.chooseOne("Choose booster:", choices);
|
final Object o = GuiChoose.one("Choose booster:", choices);
|
||||||
|
|
||||||
for (int i = 0; i < metaSets.size(); i++) {
|
for (int i = 0; i < metaSets.size(); i++) {
|
||||||
if (o.toString().equals(metaSets.get(i).getCode())) {
|
if (o.toString().equals(metaSets.get(i).getCode())) {
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ import forge.game.phase.PhaseType;
|
|||||||
import forge.game.player.ComputerUtil;
|
import forge.game.player.ComputerUtil;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.util.MyRandom;
|
import forge.util.MyRandom;
|
||||||
|
|
||||||
|
|
||||||
@@ -1408,7 +1408,7 @@ public class AbilityFactoryAttach {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final Player p = GuiUtils.chooseOne(source + " - Select a player to attach to.", players);
|
final Player p = GuiChoose.one(source + " - Select a player to attach to.", players);
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
AbilityFactoryAttach.handleAura(source, p, false);
|
AbilityFactoryAttach.handleAura(source, p, false);
|
||||||
//source.enchantEntity((Player) o);
|
//source.enchantEntity((Player) o);
|
||||||
@@ -1418,7 +1418,7 @@ public class AbilityFactoryAttach {
|
|||||||
CardList list = AllZoneUtil.getCardsIn(tgt.getZone());
|
CardList list = AllZoneUtil.getCardsIn(tgt.getZone());
|
||||||
list = list.getValidCards(tgt.getValidTgts(), aura.getActivatingPlayer(), source);
|
list = list.getValidCards(tgt.getValidTgts(), aura.getActivatingPlayer(), source);
|
||||||
|
|
||||||
final Object o = GuiUtils.chooseOne(source + " - Select a card to attach to.", list);
|
final Object o = GuiChoose.one(source + " - Select a card to attach to.", list);
|
||||||
if (o instanceof Card) {
|
if (o instanceof Card) {
|
||||||
AbilityFactoryAttach.handleAura(source, (Card) o, gainControl);
|
AbilityFactoryAttach.handleAura(source, (Card) o, gainControl);
|
||||||
//source.enchantEntity((Card) o);
|
//source.enchantEntity((Card) o);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import forge.card.cardfactory.CardFactoryUtil;
|
|||||||
import forge.card.cost.Cost;
|
import forge.card.cost.Cost;
|
||||||
import forge.game.player.ComputerUtil;
|
import forge.game.player.ComputerUtil;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -333,7 +333,7 @@ public final class AbilityFactoryBond {
|
|||||||
if (cards.size() == 1) {
|
if (cards.size() == 1) {
|
||||||
partner = cards.get(0);
|
partner = cards.get(0);
|
||||||
} else if (sa.getActivatingPlayer().isHuman()) {
|
} else if (sa.getActivatingPlayer().isHuman()) {
|
||||||
Object o = GuiUtils.chooseOne("Select a card to pair with", cards);
|
Object o = GuiChoose.one("Select a card to pair with", cards);
|
||||||
|
|
||||||
if (o != null) {
|
if (o != null) {
|
||||||
partner = (Card) o;
|
partner = (Card) o;
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ import forge.game.player.ComputerUtilBlock;
|
|||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.PlayerZone;
|
import forge.game.zone.PlayerZone;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.util.MyRandom;
|
import forge.util.MyRandom;
|
||||||
|
|
||||||
|
|
||||||
@@ -965,13 +965,13 @@ public final class AbilityFactoryChangeZone {
|
|||||||
if (!defined) {
|
if (!defined) {
|
||||||
if (origin.contains(ZoneType.Library) && !defined && !params.containsKey("NoLooking")) {
|
if (origin.contains(ZoneType.Library) && !defined && !params.containsKey("NoLooking")) {
|
||||||
// Look at whole library before moving onto choosing a card
|
// Look at whole library before moving onto choosing a card
|
||||||
GuiUtils.chooseOneOrNone(sa.getSourceCard().getName() + " - Looking at Library",
|
GuiChoose.oneOrNone(sa.getSourceCard().getName() + " - Looking at Library",
|
||||||
player.getCardsIn(ZoneType.Library));
|
player.getCardsIn(ZoneType.Library));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look at opponents hand before moving onto choosing a card
|
// Look at opponents hand before moving onto choosing a card
|
||||||
if (origin.contains(ZoneType.Hand) && player.isComputer()) {
|
if (origin.contains(ZoneType.Hand) && player.isComputer()) {
|
||||||
GuiUtils.chooseOneOrNone(sa.getSourceCard().getName() + " - Looking at Opponent's Hand", player
|
GuiChoose.oneOrNone(sa.getSourceCard().getName() + " - Looking at Opponent's Hand", player
|
||||||
.getCardsIn(ZoneType.Hand));
|
.getCardsIn(ZoneType.Hand));
|
||||||
}
|
}
|
||||||
fetchList = AbilityFactory.filterListByType(fetchList, params.get("ChangeType"), sa);
|
fetchList = AbilityFactory.filterListByType(fetchList, params.get("ChangeType"), sa);
|
||||||
@@ -995,11 +995,11 @@ public final class AbilityFactoryChangeZone {
|
|||||||
if (params.containsKey("AtRandom")) {
|
if (params.containsKey("AtRandom")) {
|
||||||
o = CardUtil.getRandom(fetchList);
|
o = CardUtil.getRandom(fetchList);
|
||||||
} else if (params.containsKey("Mandatory")) {
|
} else if (params.containsKey("Mandatory")) {
|
||||||
o = GuiUtils.chooseOne(selectPrompt, fetchList);
|
o = GuiChoose.one(selectPrompt, fetchList);
|
||||||
} else if (params.containsKey("Defined")) {
|
} else if (params.containsKey("Defined")) {
|
||||||
o = fetchList.get(0);
|
o = fetchList.get(0);
|
||||||
} else {
|
} else {
|
||||||
o = GuiUtils.chooseOneOrNone(selectPrompt, fetchList);
|
o = GuiChoose.oneOrNone(selectPrompt, fetchList);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (o != null) {
|
if (o != null) {
|
||||||
@@ -1083,7 +1083,7 @@ public final class AbilityFactoryChangeZone {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (params.containsKey("Reveal") && !reveal.isEmpty()) {
|
if (params.containsKey("Reveal") && !reveal.isEmpty()) {
|
||||||
GuiUtils.chooseOne(card + " - Revealed card: ", reveal.toArray());
|
GuiChoose.one(card + " - Revealed card: ", reveal.toArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((origin.contains(ZoneType.Library) && !destination.equals(ZoneType.Library) && !defined)
|
if ((origin.contains(ZoneType.Library) && !destination.equals(ZoneType.Library) && !defined)
|
||||||
@@ -1337,9 +1337,9 @@ public final class AbilityFactoryChangeZone {
|
|||||||
if (!ZoneType.Battlefield.equals(destination) && !"Card".equals(type) && !defined) {
|
if (!ZoneType.Battlefield.equals(destination) && !"Card".equals(type) && !defined) {
|
||||||
final String picked = sa.getSourceCard().getName() + " - Computer picked:";
|
final String picked = sa.getSourceCard().getName() + " - Computer picked:";
|
||||||
if (fetched.size() > 0) {
|
if (fetched.size() > 0) {
|
||||||
GuiUtils.chooseOne(picked, fetched);
|
GuiChoose.one(picked, fetched);
|
||||||
} else {
|
} else {
|
||||||
GuiUtils.chooseOne(picked, new String[] { "<Nothing>" });
|
GuiChoose.one(picked, new String[] { "<Nothing>" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // end changeHiddenOriginResolveAI
|
} // end changeHiddenOriginResolveAI
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import forge.card.spellability.SpellAbility;
|
|||||||
import forge.card.spellability.Target;
|
import forge.card.spellability.Target;
|
||||||
import forge.card.cardfactory.CardFactoryUtil;
|
import forge.card.cardfactory.CardFactoryUtil;
|
||||||
import forge.card.cost.Cost;
|
import forge.card.cost.Cost;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.util.MyRandom;
|
import forge.util.MyRandom;
|
||||||
|
|
||||||
// Charm specific params:
|
// Charm specific params:
|
||||||
@@ -246,9 +246,9 @@ public final class AbilityFactoryCharm {
|
|||||||
for (int i = 0; i < num; i++) {
|
for (int i = 0; i < num; i++) {
|
||||||
Object o;
|
Object o;
|
||||||
if (i < min) {
|
if (i < min) {
|
||||||
o = GuiUtils.chooseOne("Choose a mode", choices);
|
o = GuiChoose.one("Choose a mode", choices);
|
||||||
} else {
|
} else {
|
||||||
o = GuiUtils.chooseOneOrNone("Choose a mode", choices);
|
o = GuiChoose.oneOrNone("Choose a mode", choices);
|
||||||
}
|
}
|
||||||
if (null == o) {
|
if (null == o) {
|
||||||
return sa;
|
return sa;
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ import forge.card.cost.Cost;
|
|||||||
import forge.game.player.ComputerUtil;
|
import forge.game.player.ComputerUtil;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.gui.ListChooser;
|
import forge.gui.ListChooser;
|
||||||
import forge.item.CardDb;
|
import forge.item.CardDb;
|
||||||
import forge.item.CardPrinted;
|
import forge.item.CardPrinted;
|
||||||
@@ -338,7 +338,7 @@ public final class AbilityFactoryChoose {
|
|||||||
boolean valid = false;
|
boolean valid = false;
|
||||||
while (!valid) {
|
while (!valid) {
|
||||||
if (sa.getActivatingPlayer().isHuman()) {
|
if (sa.getActivatingPlayer().isHuman()) {
|
||||||
final Object o = GuiUtils.chooseOne("Choose a card type", Constant.CardTypes.CARD_TYPES);
|
final Object o = GuiChoose.one("Choose a card type", Constant.CardTypes.CARD_TYPES);
|
||||||
if (null == o) {
|
if (null == o) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -364,7 +364,7 @@ public final class AbilityFactoryChoose {
|
|||||||
for (final String s : invalidTypes) {
|
for (final String s : invalidTypes) {
|
||||||
validChoices.remove(s);
|
validChoices.remove(s);
|
||||||
}
|
}
|
||||||
final Object o = GuiUtils.chooseOne("Choose a creature type", validChoices);
|
final Object o = GuiChoose.one("Choose a creature type", validChoices);
|
||||||
if (null == o) {
|
if (null == o) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -405,7 +405,7 @@ public final class AbilityFactoryChoose {
|
|||||||
if (!CardUtil.isACreatureType(chosen) || invalidTypes.contains(chosen)) {
|
if (!CardUtil.isACreatureType(chosen) || invalidTypes.contains(chosen)) {
|
||||||
chosen = "Sliver";
|
chosen = "Sliver";
|
||||||
}
|
}
|
||||||
GuiUtils.chooseOne("Computer picked: ", new String[]{chosen});
|
GuiChoose.one("Computer picked: ", new String[]{chosen});
|
||||||
chosenType = chosen;
|
chosenType = chosen;
|
||||||
}
|
}
|
||||||
if (CardUtil.isACreatureType(chosenType) && !invalidTypes.contains(chosenType)) {
|
if (CardUtil.isACreatureType(chosenType) && !invalidTypes.contains(chosenType)) {
|
||||||
@@ -417,7 +417,7 @@ public final class AbilityFactoryChoose {
|
|||||||
boolean valid = false;
|
boolean valid = false;
|
||||||
while (!valid) {
|
while (!valid) {
|
||||||
if (sa.getActivatingPlayer().isHuman()) {
|
if (sa.getActivatingPlayer().isHuman()) {
|
||||||
final String choice = GuiUtils.chooseOne("Choose a basic land type", CardUtil.getBasicTypes());
|
final String choice = GuiChoose.one("Choose a basic land type", CardUtil.getBasicTypes());
|
||||||
if (null == choice) {
|
if (null == choice) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -434,8 +434,8 @@ public final class AbilityFactoryChoose {
|
|||||||
boolean valid = false;
|
boolean valid = false;
|
||||||
while (!valid) {
|
while (!valid) {
|
||||||
if (sa.getActivatingPlayer().isHuman()) {
|
if (sa.getActivatingPlayer().isHuman()) {
|
||||||
final String choice = GuiUtils
|
final String choice = GuiChoose
|
||||||
.chooseOne("Choose a land type", CardUtil.getLandTypes());
|
.one("Choose a land type", CardUtil.getLandTypes());
|
||||||
if (null == choice) {
|
if (null == choice) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -708,11 +708,11 @@ public final class AbilityFactoryChoose {
|
|||||||
if ((tgt == null) || p.canBeTargetedBy(sa)) {
|
if ((tgt == null) || p.canBeTargetedBy(sa)) {
|
||||||
if (sa.getActivatingPlayer().isHuman()) {
|
if (sa.getActivatingPlayer().isHuman()) {
|
||||||
if (params.containsKey("OrColors")) {
|
if (params.containsKey("OrColors")) {
|
||||||
final List<String> o = GuiUtils.chooseOneOrMany("Choose a color or colors",
|
final List<String> o = GuiChoose.oneOrMany("Choose a color or colors",
|
||||||
Constant.Color.ONLY_COLORS);
|
Constant.Color.ONLY_COLORS);
|
||||||
card.setChosenColor(new ArrayList<String>(o));
|
card.setChosenColor(new ArrayList<String>(o));
|
||||||
} else {
|
} else {
|
||||||
final Object o = GuiUtils.chooseOne("Choose a color", Constant.Color.ONLY_COLORS);
|
final Object o = GuiChoose.one("Choose a color", Constant.Color.ONLY_COLORS);
|
||||||
if (null == o) {
|
if (null == o) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -759,7 +759,7 @@ public final class AbilityFactoryChoose {
|
|||||||
if (chosen.equals("")) {
|
if (chosen.equals("")) {
|
||||||
chosen = Constant.Color.GREEN;
|
chosen = Constant.Color.GREEN;
|
||||||
}
|
}
|
||||||
GuiUtils.chooseOne("Computer picked: ", new String[]{chosen});
|
GuiChoose.one("Computer picked: ", new String[]{chosen});
|
||||||
final ArrayList<String> colorTemp = new ArrayList<String>();
|
final ArrayList<String> colorTemp = new ArrayList<String>();
|
||||||
colorTemp.add(chosen);
|
colorTemp.add(chosen);
|
||||||
card.setChosenColor(colorTemp);
|
card.setChosenColor(colorTemp);
|
||||||
@@ -1043,13 +1043,13 @@ public final class AbilityFactoryChoose {
|
|||||||
final String message = "Randomly chosen number: " + chosen;
|
final String message = "Randomly chosen number: " + chosen;
|
||||||
JOptionPane.showMessageDialog(null, message, "" + card, JOptionPane.PLAIN_MESSAGE);
|
JOptionPane.showMessageDialog(null, message, "" + card, JOptionPane.PLAIN_MESSAGE);
|
||||||
} else if (params.containsKey("ListTitle")) {
|
} else if (params.containsKey("ListTitle")) {
|
||||||
final Object o = GuiUtils.chooseOne(params.get("ListTitle"), choices);
|
final Object o = GuiChoose.one(params.get("ListTitle"), choices);
|
||||||
if (null == o) {
|
if (null == o) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
chosen = Integer.parseInt((String) o);
|
chosen = Integer.parseInt((String) o);
|
||||||
} else {
|
} else {
|
||||||
final Object o = GuiUtils.chooseOne("Choose a number", choices);
|
final Object o = GuiChoose.one("Choose a number", choices);
|
||||||
if (null == o) {
|
if (null == o) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1312,7 +1312,7 @@ public final class AbilityFactoryChoose {
|
|||||||
// Was if (sa.getActivatingPlayer().isHuman()) but defined player was being
|
// Was if (sa.getActivatingPlayer().isHuman()) but defined player was being
|
||||||
// overwritten by activatingPlayer (or controller if no activator was set).
|
// overwritten by activatingPlayer (or controller if no activator was set).
|
||||||
// Revert if it causes issues and remove Goblin Festival from card database.
|
// Revert if it causes issues and remove Goblin Festival from card database.
|
||||||
final Object o = GuiUtils.chooseOne(choiceDesc, choices);
|
final Object o = GuiChoose.one(choiceDesc, choices);
|
||||||
if (null == o) {
|
if (null == o) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1653,7 +1653,7 @@ public final class AbilityFactoryChoose {
|
|||||||
if (chosen.equals("")) {
|
if (chosen.equals("")) {
|
||||||
chosen = "Morphling";
|
chosen = "Morphling";
|
||||||
}
|
}
|
||||||
GuiUtils.chooseOne("Computer picked: ", new String[]{chosen});
|
GuiChoose.one("Computer picked: ", new String[]{chosen});
|
||||||
host.setNamedCard(chosen);
|
host.setNamedCard(chosen);
|
||||||
ok = true;
|
ok = true;
|
||||||
}
|
}
|
||||||
@@ -1953,7 +1953,7 @@ public final class AbilityFactoryChoose {
|
|||||||
final CardList cl = land.getType(type);
|
final CardList cl = land.getType(type);
|
||||||
if (cl.size() > 0) {
|
if (cl.size() > 0) {
|
||||||
final String prompt = "Choose a" + (type.equals("Island") ? "n " : " ") + type;
|
final String prompt = "Choose a" + (type.equals("Island") ? "n " : " ") + type;
|
||||||
final Object o = GuiUtils.chooseOne(prompt, cl);
|
final Object o = GuiChoose.one(prompt, cl);
|
||||||
if (null != o) {
|
if (null != o) {
|
||||||
final Card c = (Card) o;
|
final Card c = (Card) o;
|
||||||
chosen.add(c);
|
chosen.add(c);
|
||||||
@@ -1969,7 +1969,7 @@ public final class AbilityFactoryChoose {
|
|||||||
for (int i = 0; i < validAmount; i++) {
|
for (int i = 0; i < validAmount; i++) {
|
||||||
if (p.isHuman()) {
|
if (p.isHuman()) {
|
||||||
final String choiceTitle = params.containsKey("ChoiceTitle") ? params.get("ChoiceTitle") : "Choose a card ";
|
final String choiceTitle = params.containsKey("ChoiceTitle") ? params.get("ChoiceTitle") : "Choose a card ";
|
||||||
final Card o = GuiUtils.chooseOneOrNone(choiceTitle, choices);
|
final Card o = GuiChoose.oneOrNone(choiceTitle, choices);
|
||||||
if (o != null) {
|
if (o != null) {
|
||||||
chosen.add((Card) o);
|
chosen.add((Card) o);
|
||||||
choices.remove((Card) o);
|
choices.remove((Card) o);
|
||||||
@@ -2231,7 +2231,7 @@ public final class AbilityFactoryChoose {
|
|||||||
SpellAbility chosenSA = null;
|
SpellAbility chosenSA = null;
|
||||||
AbilityFactory afChoice = new AbilityFactory();
|
AbilityFactory afChoice = new AbilityFactory();
|
||||||
if (p.isHuman()) {
|
if (p.isHuman()) {
|
||||||
String choice = (String) GuiUtils.chooseOne("Choose one", choices.values());
|
String choice = (String) GuiChoose.one("Choose one", choices.values());
|
||||||
chosenSA = afChoice.getAbility(host.getSVar(choices.inverse().get(choice)), host);
|
chosenSA = afChoice.getAbility(host.getSVar(choices.inverse().get(choice)), host);
|
||||||
} else { //Computer AI
|
} else { //Computer AI
|
||||||
chosenSA = afChoice.getAbility(host.getSVar(params.get("Choices").split(",")[0]), host);
|
chosenSA = afChoice.getAbility(host.getSVar(params.get("Choices").split(",")[0]), host);
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ import forge.card.cost.Cost;
|
|||||||
import forge.card.trigger.TriggerType;
|
import forge.card.trigger.TriggerType;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -766,7 +766,7 @@ public final class AbilityFactoryClash {
|
|||||||
|
|
||||||
// first, separate the cards into piles
|
// first, separate the cards into piles
|
||||||
if (separator.isHuman()) {
|
if (separator.isHuman()) {
|
||||||
final List<Object> firstPile = GuiUtils.getOrderChoices("Place into two piles", "Pile 1", -1, pool.toArray(), null);
|
final List<Object> firstPile = GuiChoose.getOrderChoices("Place into two piles", "Pile 1", -1, pool.toArray(), null);
|
||||||
for (final Object o : firstPile) {
|
for (final Object o : firstPile) {
|
||||||
pile1.add((Card)o);
|
pile1.add((Card)o);
|
||||||
}
|
}
|
||||||
@@ -886,7 +886,7 @@ public final class AbilityFactoryClash {
|
|||||||
|
|
||||||
// make sure Pile 1 or Pile 2 is clicked on
|
// make sure Pile 1 or Pile 2 is clicked on
|
||||||
while (true) {
|
while (true) {
|
||||||
final Object o = GuiUtils.chooseOne("Choose a pile", disp);
|
final Object o = GuiChoose.one("Choose a pile", disp);
|
||||||
final Card c = (Card) o;
|
final Card c = (Card) o;
|
||||||
String name = c.getName();
|
String name = c.getName();
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ import forge.game.phase.PhaseType;
|
|||||||
import forge.game.player.ComputerUtil;
|
import forge.game.player.ComputerUtil;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.item.CardDb;
|
import forge.item.CardDb;
|
||||||
import forge.util.MyRandom;
|
import forge.util.MyRandom;
|
||||||
|
|
||||||
@@ -816,7 +816,7 @@ public final class AbilityFactoryCopy {
|
|||||||
} else {
|
} else {
|
||||||
num = Integer.toString(multi - 1) + "th";
|
num = Integer.toString(multi - 1) + "th";
|
||||||
}
|
}
|
||||||
chosenSAtmp = GuiUtils.chooseOne("Select " + num + " spell to copy to stack", tgtSpells);
|
chosenSAtmp = GuiChoose.one("Select " + num + " spell to copy to stack", tgtSpells);
|
||||||
chosenSAs.add(chosenSAtmp);
|
chosenSAs.add(chosenSAtmp);
|
||||||
tgtSpells.remove(chosenSAtmp);
|
tgtSpells.remove(chosenSAtmp);
|
||||||
} else {
|
} else {
|
||||||
@@ -836,7 +836,7 @@ public final class AbilityFactoryCopy {
|
|||||||
if (tgtSpells.size() == 1) {
|
if (tgtSpells.size() == 1) {
|
||||||
chosenSA = tgtSpells.get(0);
|
chosenSA = tgtSpells.get(0);
|
||||||
} else if (sa.getActivatingPlayer().isHuman()) {
|
} else if (sa.getActivatingPlayer().isHuman()) {
|
||||||
chosenSA = (SpellAbility) GuiUtils.chooseOne("Select a spell to copy", tgtSpells);
|
chosenSA = (SpellAbility) GuiChoose.one("Select a spell to copy", tgtSpells);
|
||||||
} else {
|
} else {
|
||||||
chosenSA = tgtSpells.get(0);
|
chosenSA = tgtSpells.get(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ import forge.game.player.ComputerUtil;
|
|||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.PlayerZone;
|
import forge.game.zone.PlayerZone;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.gui.match.CMatchUI;
|
import forge.gui.match.CMatchUI;
|
||||||
import forge.util.MyRandom;
|
import forge.util.MyRandom;
|
||||||
|
|
||||||
@@ -731,7 +731,7 @@ public class AbilityFactoryCounters {
|
|||||||
for (int j = 0; j <= counterAmount; j++) {
|
for (int j = 0; j <= counterAmount; j++) {
|
||||||
integers[j] = Integer.valueOf(j);
|
integers[j] = Integer.valueOf(j);
|
||||||
}
|
}
|
||||||
final Integer i = GuiUtils.chooseOneOrNone("How many counters?", integers);
|
final Integer i = GuiChoose.oneOrNone("How many counters?", integers);
|
||||||
if (null == i) {
|
if (null == i) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@@ -1194,7 +1194,7 @@ public class AbilityFactoryCounters {
|
|||||||
}
|
}
|
||||||
if (typeChoices.size() > 1) {
|
if (typeChoices.size() > 1) {
|
||||||
String prompt = "Select type counters to remove";
|
String prompt = "Select type counters to remove";
|
||||||
chosenType = GuiUtils.chooseOne(prompt, typeChoices);
|
chosenType = GuiChoose.one(prompt, typeChoices);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
chosenType = typeChoices.get(0);
|
chosenType = typeChoices.get(0);
|
||||||
@@ -1211,7 +1211,7 @@ public class AbilityFactoryCounters {
|
|||||||
choices.add(Integer.valueOf(i));
|
choices.add(Integer.valueOf(i));
|
||||||
}
|
}
|
||||||
String prompt = "Select the number of " + chosenType.getName() + " counters to remove";
|
String prompt = "Select the number of " + chosenType.getName() + " counters to remove";
|
||||||
chosenAmount = GuiUtils.chooseOne(prompt, choices);
|
chosenAmount = GuiChoose.one(prompt, choices);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -1246,7 +1246,7 @@ public class AbilityFactoryCounters {
|
|||||||
choices.add("" + i);
|
choices.add("" + i);
|
||||||
}
|
}
|
||||||
final String prompt = "Select the number of " + type + " counters to remove";
|
final String prompt = "Select the number of " + type + " counters to remove";
|
||||||
final String o = GuiUtils.chooseOne(prompt, choices);
|
final String o = GuiChoose.one(prompt, choices);
|
||||||
counterAmount = Integer.parseInt((String) o);
|
counterAmount = Integer.parseInt((String) o);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1550,7 +1550,7 @@ public class AbilityFactoryCounters {
|
|||||||
}
|
}
|
||||||
if (choices.size() > 0) {
|
if (choices.size() > 0) {
|
||||||
card.addCounter(
|
card.addCounter(
|
||||||
Counters.getType((choices.size() == 1 ? choices.get(0) : GuiUtils.chooseOne(
|
Counters.getType((choices.size() == 1 ? choices.get(0) : GuiChoose.one(
|
||||||
"Select counter type", choices).toString())), 1);
|
"Select counter type", choices).toString())), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ import forge.control.input.InputPayManaCostUtil;
|
|||||||
import forge.game.player.ComputerUtil;
|
import forge.game.player.ComputerUtil;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.util.MyRandom;
|
import forge.util.MyRandom;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -351,7 +351,7 @@ public class AbilityFactoryMana {
|
|||||||
}
|
}
|
||||||
for (int nMana = 1; nMana <= amount; nMana++) {
|
for (int nMana = 1; nMana <= amount; nMana++) {
|
||||||
String choice = "";
|
String choice = "";
|
||||||
Object o = GuiUtils.chooseOne("Select Mana to Produce", colorMenu);
|
Object o = GuiChoose.one("Select Mana to Produce", colorMenu);
|
||||||
if (o == null) {
|
if (o == null) {
|
||||||
final StringBuilder sb = new StringBuilder();
|
final StringBuilder sb = new StringBuilder();
|
||||||
sb.append("AbilityFactoryMana::manaResolve() - Human color mana choice is empty for ");
|
sb.append("AbilityFactoryMana::manaResolve() - Human color mana choice is empty for ");
|
||||||
@@ -376,7 +376,7 @@ public class AbilityFactoryMana {
|
|||||||
chosen = CardFactoryUtil.getMostProminentColor(AllZone.getComputerPlayer().getCardsIn(
|
chosen = CardFactoryUtil.getMostProminentColor(AllZone.getComputerPlayer().getCardsIn(
|
||||||
ZoneType.Hand));
|
ZoneType.Hand));
|
||||||
}
|
}
|
||||||
GuiUtils.chooseOne("Computer picked: ", new String[]{chosen});
|
GuiChoose.one("Computer picked: ", new String[]{chosen});
|
||||||
abMana.setExpressChoice(InputPayManaCostUtil.getShortColorString(chosen));
|
abMana.setExpressChoice(InputPayManaCostUtil.getShortColorString(chosen));
|
||||||
}
|
}
|
||||||
if (abMana.getExpressChoice().isEmpty()) {
|
if (abMana.getExpressChoice().isEmpty()) {
|
||||||
@@ -411,7 +411,7 @@ public class AbilityFactoryMana {
|
|||||||
else {
|
else {
|
||||||
colorMenu = Constant.Color.ONLY_COLORS;
|
colorMenu = Constant.Color.ONLY_COLORS;
|
||||||
}
|
}
|
||||||
String s = GuiUtils.chooseOne("Select Mana to Produce", colorMenu);
|
String s = GuiChoose.one("Select Mana to Produce", colorMenu);
|
||||||
if (s == null) {
|
if (s == null) {
|
||||||
final StringBuilder sb = new StringBuilder();
|
final StringBuilder sb = new StringBuilder();
|
||||||
sb.append("AbilityFactoryMana::manaResolve() - Human color mana choice is empty for ");
|
sb.append("AbilityFactoryMana::manaResolve() - Human color mana choice is empty for ");
|
||||||
@@ -431,7 +431,7 @@ public class AbilityFactoryMana {
|
|||||||
chosen = CardFactoryUtil.getMostProminentColor(AllZone.getComputerPlayer().getCardsIn(
|
chosen = CardFactoryUtil.getMostProminentColor(AllZone.getComputerPlayer().getCardsIn(
|
||||||
ZoneType.Hand));
|
ZoneType.Hand));
|
||||||
}
|
}
|
||||||
GuiUtils.chooseOne("Computer picked: ", new String[]{chosen});
|
GuiChoose.one("Computer picked: ", new String[]{chosen});
|
||||||
abMana.setExpressChoice(InputPayManaCostUtil.getShortColorString(chosen));
|
abMana.setExpressChoice(InputPayManaCostUtil.getShortColorString(chosen));
|
||||||
}
|
}
|
||||||
if (abMana.getExpressChoice().isEmpty()) {
|
if (abMana.getExpressChoice().isEmpty()) {
|
||||||
@@ -925,7 +925,7 @@ public class AbilityFactoryMana {
|
|||||||
baseMana = InputPayManaCostUtil.getShortColorString(colors.get(0));
|
baseMana = InputPayManaCostUtil.getShortColorString(colors.get(0));
|
||||||
} else {
|
} else {
|
||||||
if (player.isHuman()) {
|
if (player.isHuman()) {
|
||||||
final Object o = GuiUtils.chooseOneOrNone("Select Mana to Produce", colors);
|
final Object o = GuiChoose.oneOrNone("Select Mana to Produce", colors);
|
||||||
if (o == null) {
|
if (o == null) {
|
||||||
// User hit cancel
|
// User hit cancel
|
||||||
abMana.setCanceled(true);
|
abMana.setCanceled(true);
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ import forge.game.phase.PhaseType;
|
|||||||
import forge.game.player.ComputerUtil;
|
import forge.game.player.ComputerUtil;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.util.MyRandom;
|
import forge.util.MyRandom;
|
||||||
|
|
||||||
|
|
||||||
@@ -2244,7 +2244,7 @@ public class AbilityFactoryPermanentState {
|
|||||||
if (AllZoneUtil.isCardInPlay(tgtC) && ((tgt == null) || tgtC.canBeTargetedBy(sa))) {
|
if (AllZoneUtil.isCardInPlay(tgtC) && ((tgt == null) || tgtC.canBeTargetedBy(sa))) {
|
||||||
if (sa.getActivatingPlayer().isHuman()) {
|
if (sa.getActivatingPlayer().isHuman()) {
|
||||||
final String[] tapOrUntap = new String[] { "Tap", "Untap" };
|
final String[] tapOrUntap = new String[] { "Tap", "Untap" };
|
||||||
final Object z = GuiUtils.chooseOneOrNone("Tap or Untap " + tgtC + "?", tapOrUntap);
|
final Object z = GuiChoose.oneOrNone("Tap or Untap " + tgtC + "?", tapOrUntap);
|
||||||
if (null == z) {
|
if (null == z) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ import forge.card.spellability.Target;
|
|||||||
import forge.game.player.ComputerUtil;
|
import forge.game.player.ComputerUtil;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.util.MyRandom;
|
import forge.util.MyRandom;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -392,7 +392,7 @@ public final class AbilityFactoryPlay {
|
|||||||
Card tgtCard = tgtCards.get(0);
|
Card tgtCard = tgtCards.get(0);
|
||||||
if (tgtCards.size() > 1) {
|
if (tgtCards.size() > 1) {
|
||||||
if (controller.isHuman()) {
|
if (controller.isHuman()) {
|
||||||
tgtCard = GuiUtils.chooseOne("Select a card to play", tgtCards);
|
tgtCard = GuiChoose.one("Select a card to play", tgtCards);
|
||||||
} else {
|
} else {
|
||||||
// AI
|
// AI
|
||||||
tgtCards = tgtCards.filter(new Predicate<Card>() {
|
tgtCards = tgtCards.filter(new Predicate<Card>() {
|
||||||
@@ -468,7 +468,7 @@ public final class AbilityFactoryPlay {
|
|||||||
if (sas.size() == 1) {
|
if (sas.size() == 1) {
|
||||||
tgtSA = sas.get(0);
|
tgtSA = sas.get(0);
|
||||||
} else if (sa.getActivatingPlayer().isHuman()) {
|
} else if (sa.getActivatingPlayer().isHuman()) {
|
||||||
tgtSA = GuiUtils.chooseOne("Select a spell to cast", sas);
|
tgtSA = GuiChoose.one("Select a spell to cast", sas);
|
||||||
} else {
|
} else {
|
||||||
tgtSA = sas.get(0);
|
tgtSA = sas.get(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ import forge.game.phase.PhaseType;
|
|||||||
import forge.game.player.ComputerUtil;
|
import forge.game.player.ComputerUtil;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -731,7 +731,7 @@ public final class AbilityFactoryProtection {
|
|||||||
final ArrayList<String> gains = new ArrayList<String>();
|
final ArrayList<String> gains = new ArrayList<String>();
|
||||||
if (isChoice) {
|
if (isChoice) {
|
||||||
if (sa.getActivatingPlayer().isHuman()) {
|
if (sa.getActivatingPlayer().isHuman()) {
|
||||||
final String choice = GuiUtils.chooseOne("Choose a protection", choices);
|
final String choice = GuiChoose.one("Choose a protection", choices);
|
||||||
if (null == choice) {
|
if (null == choice) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1161,7 +1161,7 @@ public final class AbilityFactoryProtection {
|
|||||||
final ArrayList<String> gains = new ArrayList<String>();
|
final ArrayList<String> gains = new ArrayList<String>();
|
||||||
if (isChoice) {
|
if (isChoice) {
|
||||||
if (sa.getActivatingPlayer().isHuman()) {
|
if (sa.getActivatingPlayer().isHuman()) {
|
||||||
final String choice = GuiUtils.chooseOne("Choose a protection", choices);
|
final String choice = GuiChoose.one("Choose a protection", choices);
|
||||||
if (null == choice) {
|
if (null == choice) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ import forge.game.player.ComputerUtil;
|
|||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.PlayerZone;
|
import forge.game.zone.PlayerZone;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.util.MyRandom;
|
import forge.util.MyRandom;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -438,7 +438,7 @@ public final class AbilityFactoryReveal {
|
|||||||
boolean cardsRevealed = false;
|
boolean cardsRevealed = false;
|
||||||
|
|
||||||
if (params.containsKey("Reveal")) {
|
if (params.containsKey("Reveal")) {
|
||||||
GuiUtils.chooseOne("Revealing cards from library", top);
|
GuiChoose.one("Revealing cards from library", top);
|
||||||
cardsRevealed = true;
|
cardsRevealed = true;
|
||||||
// Singletons.getModel().getGameAction().revealToCopmuter(top.toArray());
|
// Singletons.getModel().getGameAction().revealToCopmuter(top.toArray());
|
||||||
// - for when it exists
|
// - for when it exists
|
||||||
@@ -448,18 +448,18 @@ public final class AbilityFactoryReveal {
|
|||||||
question += c + " ";
|
question += c + " ";
|
||||||
}
|
}
|
||||||
if (p.isHuman() && GameActionUtil.showYesNoDialog(host, question)) {
|
if (p.isHuman() && GameActionUtil.showYesNoDialog(host, question)) {
|
||||||
GuiUtils.chooseOne(host + "Revealing cards from library", top);
|
GuiChoose.one(host + "Revealing cards from library", top);
|
||||||
// Singletons.getModel().getGameAction().revealToCopmuter(top.toArray());
|
// Singletons.getModel().getGameAction().revealToCopmuter(top.toArray());
|
||||||
cardsRevealed = true;
|
cardsRevealed = true;
|
||||||
} else if (p.isComputer() && (top.get(0).isInstant() || top.get(0).isSorcery())) {
|
} else if (p.isComputer() && (top.get(0).isInstant() || top.get(0).isSorcery())) {
|
||||||
GuiUtils.chooseOne(host + "Revealing cards from library", top);
|
GuiChoose.one(host + "Revealing cards from library", top);
|
||||||
cardsRevealed = true;
|
cardsRevealed = true;
|
||||||
}
|
}
|
||||||
} else if (params.containsKey("RevealValid")) {
|
} else if (params.containsKey("RevealValid")) {
|
||||||
final String revealValid = params.get("RevealValid");
|
final String revealValid = params.get("RevealValid");
|
||||||
final CardList toReveal = top.getValidCards(revealValid, host.getController(), host);
|
final CardList toReveal = top.getValidCards(revealValid, host.getController(), host);
|
||||||
if (!toReveal.isEmpty()) {
|
if (!toReveal.isEmpty()) {
|
||||||
GuiUtils.chooseOne("Revealing cards from library", toReveal);
|
GuiChoose.one("Revealing cards from library", toReveal);
|
||||||
if (params.containsKey("RememberRevealed")) {
|
if (params.containsKey("RememberRevealed")) {
|
||||||
for (final Card one : toReveal) {
|
for (final Card one : toReveal) {
|
||||||
host.addRemembered(one);
|
host.addRemembered(one);
|
||||||
@@ -470,7 +470,7 @@ public final class AbilityFactoryReveal {
|
|||||||
// - for when it exists
|
// - for when it exists
|
||||||
} else if (choser.isHuman()) {
|
} else if (choser.isHuman()) {
|
||||||
// show the user the revealed cards
|
// show the user the revealed cards
|
||||||
GuiUtils.chooseOne("Looking at cards from library", top);
|
GuiChoose.one("Looking at cards from library", top);
|
||||||
cardsRevealed = true;
|
cardsRevealed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -527,9 +527,9 @@ public final class AbilityFactoryReveal {
|
|||||||
prompt = "Chose a card to put on top of the ";
|
prompt = "Chose a card to put on top of the ";
|
||||||
}
|
}
|
||||||
if (anyNumber || optional) {
|
if (anyNumber || optional) {
|
||||||
chosen = GuiUtils.chooseOneOrNone(prompt + destZone1, valid);
|
chosen = GuiChoose.oneOrNone(prompt + destZone1, valid);
|
||||||
} else {
|
} else {
|
||||||
chosen = GuiUtils.chooseOne(prompt + destZone1, valid);
|
chosen = GuiChoose.one(prompt + destZone1, valid);
|
||||||
}
|
}
|
||||||
if ((chosen == null) || chosen.getName().equals("[No valid cards]")) {
|
if ((chosen == null) || chosen.getName().equals("[No valid cards]")) {
|
||||||
break;
|
break;
|
||||||
@@ -563,7 +563,7 @@ public final class AbilityFactoryReveal {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (changeValid.length() > 0) {
|
if (changeValid.length() > 0) {
|
||||||
GuiUtils.chooseOne("Computer picked: ", chosen);
|
GuiChoose.one("Computer picked: ", chosen);
|
||||||
}
|
}
|
||||||
movedCards.add(chosen);
|
movedCards.add(chosen);
|
||||||
valid.remove(chosen);
|
valid.remove(chosen);
|
||||||
@@ -629,7 +629,7 @@ public final class AbilityFactoryReveal {
|
|||||||
if (libraryPosition2 == -1) {
|
if (libraryPosition2 == -1) {
|
||||||
prompt = "Put the rest on the bottom of the library in any order";
|
prompt = "Put the rest on the bottom of the library in any order";
|
||||||
}
|
}
|
||||||
chosen = GuiUtils.chooseOne(prompt, rest);
|
chosen = GuiChoose.one(prompt, rest);
|
||||||
} else {
|
} else {
|
||||||
chosen = rest.get(0);
|
chosen = rest.get(0);
|
||||||
}
|
}
|
||||||
@@ -1050,7 +1050,7 @@ public final class AbilityFactoryReveal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (revealed.size() > 0) {
|
if (revealed.size() > 0) {
|
||||||
GuiUtils.chooseOne(p + " revealed: ", revealed);
|
GuiChoose.one(p + " revealed: ", revealed);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Allow Human to choose the order
|
// TODO Allow Human to choose the order
|
||||||
@@ -1428,7 +1428,7 @@ public final class AbilityFactoryReveal {
|
|||||||
final CardList hand = p.getCardsIn(ZoneType.Hand);
|
final CardList hand = p.getCardsIn(ZoneType.Hand);
|
||||||
if (sa.getActivatingPlayer().isHuman()) {
|
if (sa.getActivatingPlayer().isHuman()) {
|
||||||
if (hand.size() > 0) {
|
if (hand.size() > 0) {
|
||||||
GuiUtils.chooseOne(p + "'s hand", hand);
|
GuiChoose.one(p + "'s hand", hand);
|
||||||
} else {
|
} else {
|
||||||
final StringBuilder sb = new StringBuilder();
|
final StringBuilder sb = new StringBuilder();
|
||||||
sb.append(p).append("'s hand is empty!");
|
sb.append(p).append("'s hand is empty!");
|
||||||
@@ -2054,7 +2054,7 @@ public final class AbilityFactoryReveal {
|
|||||||
topCards.add(lib.get(j));
|
topCards.add(lib.get(j));
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Object> orderedCards = GuiUtils.getOrderChoices("Select order to Rearrange", "Top of Library", 0, topCards.toArray(), null);
|
List<Object> orderedCards = GuiChoose.getOrderChoices("Select order to Rearrange", "Top of Library", 0, topCards.toArray(), null);
|
||||||
for (int i = maxCards - 1; i >= 0; i--) {
|
for (int i = maxCards - 1; i >= 0; i--) {
|
||||||
Card next = (Card) orderedCards.get(i);
|
Card next = (Card) orderedCards.get(i);
|
||||||
Singletons.getModel().getGameAction().moveToLibrary(next, 0);
|
Singletons.getModel().getGameAction().moveToLibrary(next, 0);
|
||||||
@@ -2377,7 +2377,7 @@ public final class AbilityFactoryReveal {
|
|||||||
final CardList revealed = new CardList();
|
final CardList revealed = new CardList();
|
||||||
if (params.containsKey("Random")) {
|
if (params.containsKey("Random")) {
|
||||||
revealed.add(CardUtil.getRandom(handChoices));
|
revealed.add(CardUtil.getRandom(handChoices));
|
||||||
GuiUtils.chooseOneOrNone("Revealed card(s)", revealed);
|
GuiChoose.oneOrNone("Revealed card(s)", revealed);
|
||||||
} else {
|
} else {
|
||||||
CardList valid = new CardList(handChoices);
|
CardList valid = new CardList(handChoices);
|
||||||
int max = 1;
|
int max = 1;
|
||||||
@@ -2389,7 +2389,7 @@ public final class AbilityFactoryReveal {
|
|||||||
}
|
}
|
||||||
revealed.addAll(AbilityFactoryReveal.getRevealedList(sa.getActivatingPlayer(), valid, max, anyNumber));
|
revealed.addAll(AbilityFactoryReveal.getRevealedList(sa.getActivatingPlayer(), valid, max, anyNumber));
|
||||||
if (sa.getActivatingPlayer().isComputer()) {
|
if (sa.getActivatingPlayer().isComputer()) {
|
||||||
GuiUtils.chooseOneOrNone("Revealed card(s)", revealed);
|
GuiChoose.oneOrNone("Revealed card(s)", revealed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2418,7 +2418,7 @@ public final class AbilityFactoryReveal {
|
|||||||
final int validamount = Math.min(valid.size(), max);
|
final int validamount = Math.min(valid.size(), max);
|
||||||
|
|
||||||
if (anyNumber && player.isHuman() && validamount > 0) {
|
if (anyNumber && player.isHuman() && validamount > 0) {
|
||||||
final List<Object> selection = GuiUtils.getOrderChoices("Choose Which Cards to Reveal", "Revealed", -1, valid.toArray(), null);
|
final List<Object> selection = GuiChoose.getOrderChoices("Choose Which Cards to Reveal", "Revealed", -1, valid.toArray(), null);
|
||||||
for (final Object o : selection) {
|
for (final Object o : selection) {
|
||||||
if (o != null && o instanceof Card) {
|
if (o != null && o instanceof Card) {
|
||||||
chosen.add((Card) o);
|
chosen.add((Card) o);
|
||||||
@@ -2427,7 +2427,7 @@ public final class AbilityFactoryReveal {
|
|||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < validamount; i++) {
|
for (int i = 0; i < validamount; i++) {
|
||||||
if (player.isHuman()) {
|
if (player.isHuman()) {
|
||||||
final Card o = GuiUtils.chooseOne("Choose card(s) to reveal", valid);
|
final Card o = GuiChoose.one("Choose card(s) to reveal", valid);
|
||||||
if (o != null) {
|
if (o != null) {
|
||||||
chosen.add(o);
|
chosen.add(o);
|
||||||
valid.remove(o);
|
valid.remove(o);
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ import forge.card.spellability.Target;
|
|||||||
import forge.game.player.ComputerUtil;
|
import forge.game.player.ComputerUtil;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.util.MyRandom;
|
import forge.util.MyRandom;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -566,9 +566,9 @@ public class AbilityFactorySacrifice {
|
|||||||
}
|
}
|
||||||
Object o;
|
Object o;
|
||||||
if (optional) {
|
if (optional) {
|
||||||
o = GuiUtils.chooseOneOrNone("Select a card to sacrifice", list);
|
o = GuiChoose.oneOrNone("Select a card to sacrifice", list);
|
||||||
} else {
|
} else {
|
||||||
o = GuiUtils.chooseOne("Select a card to sacrifice", list);
|
o = GuiChoose.one("Select a card to sacrifice", list);
|
||||||
}
|
}
|
||||||
if (o != null) {
|
if (o != null) {
|
||||||
final Card c = (Card) o;
|
final Card c = (Card) o;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ import forge.game.phase.PhaseType;
|
|||||||
import forge.game.player.ComputerUtil;
|
import forge.game.player.ComputerUtil;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.util.MyRandom;
|
import forge.util.MyRandom;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -623,7 +623,7 @@ public class AbilityFactoryZoneAffecting {
|
|||||||
} else {
|
} else {
|
||||||
final CardList drawn = p.drawCards(numCards);
|
final CardList drawn = p.drawCards(numCards);
|
||||||
if (params.containsKey("Reveal")) {
|
if (params.containsKey("Reveal")) {
|
||||||
GuiUtils.chooseOne("Revealing drawn cards", drawn);
|
GuiChoose.one("Revealing drawn cards", drawn);
|
||||||
}
|
}
|
||||||
if (params.containsKey("RememberDrawn")) {
|
if (params.containsKey("RememberDrawn")) {
|
||||||
for (final Card c : drawn) {
|
for (final Card c : drawn) {
|
||||||
@@ -1345,7 +1345,7 @@ public class AbilityFactoryZoneAffecting {
|
|||||||
if (p.isHuman()) {
|
if (p.isHuman()) {
|
||||||
// "reveal to computer" for information gathering
|
// "reveal to computer" for information gathering
|
||||||
} else {
|
} else {
|
||||||
GuiUtils.chooseOneOrNone("Revealed computer hand", dPHand);
|
GuiChoose.oneOrNone("Revealed computer hand", dPHand);
|
||||||
}
|
}
|
||||||
|
|
||||||
String valid = params.get("DiscardValid");
|
String valid = params.get("DiscardValid");
|
||||||
@@ -1394,7 +1394,7 @@ public class AbilityFactoryZoneAffecting {
|
|||||||
max = Math.min(max, numCards);
|
max = Math.min(max, numCards);
|
||||||
CardList list = ComputerUtil.discardNumTypeAI(max, dValid, sa);
|
CardList list = ComputerUtil.discardNumTypeAI(max, dValid, sa);
|
||||||
if (mode.startsWith("Reveal")) {
|
if (mode.startsWith("Reveal")) {
|
||||||
GuiUtils.chooseOneOrNone("Computer has chosen", list);
|
GuiChoose.oneOrNone("Computer has chosen", list);
|
||||||
}
|
}
|
||||||
discarded.addAll(list);
|
discarded.addAll(list);
|
||||||
for (Card card : list) {
|
for (Card card : list) {
|
||||||
@@ -1427,7 +1427,7 @@ public class AbilityFactoryZoneAffecting {
|
|||||||
if (mode.startsWith("Reveal")) {
|
if (mode.startsWith("Reveal")) {
|
||||||
final CardList dCs = new CardList();
|
final CardList dCs = new CardList();
|
||||||
dCs.add(dC);
|
dCs.add(dC);
|
||||||
GuiUtils.chooseOneOrNone("Computer has chosen", dCs);
|
GuiChoose.oneOrNone("Computer has chosen", dCs);
|
||||||
}
|
}
|
||||||
discarded.add(dC);
|
discarded.add(dC);
|
||||||
p.discard(dC, sa);
|
p.discard(dC, sa);
|
||||||
@@ -1436,16 +1436,16 @@ public class AbilityFactoryZoneAffecting {
|
|||||||
} else {
|
} else {
|
||||||
// human
|
// human
|
||||||
if (mode.startsWith("Reveal")) {
|
if (mode.startsWith("Reveal")) {
|
||||||
GuiUtils.chooseOneOrNone("Revealed " + p + " hand", dPHand);
|
GuiChoose.oneOrNone("Revealed " + p + " hand", dPHand);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < numCards; i++) {
|
for (int i = 0; i < numCards; i++) {
|
||||||
if (dPChHand.size() > 0) {
|
if (dPChHand.size() > 0) {
|
||||||
Card dC = null;
|
Card dC = null;
|
||||||
if (params.containsKey("Optional")) {
|
if (params.containsKey("Optional")) {
|
||||||
dC = GuiUtils.chooseOneOrNone("Choose a card to be discarded", dPChHand);
|
dC = GuiChoose.oneOrNone("Choose a card to be discarded", dPChHand);
|
||||||
} else {
|
} else {
|
||||||
dC = GuiUtils.chooseOne("Choose a card to be discarded", dPChHand);
|
dC = GuiChoose.one("Choose a card to be discarded", dPChHand);
|
||||||
} if (dC != null) {
|
} if (dC != null) {
|
||||||
dPChHand.remove(dC);
|
dPChHand.remove(dC);
|
||||||
discarded.add(dC);
|
discarded.add(dC);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import forge.control.input.Input;
|
|||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.PlayerZone;
|
import forge.game.zone.PlayerZone;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.gui.match.CMatchUI;
|
import forge.gui.match.CMatchUI;
|
||||||
|
|
||||||
import forge.view.ButtonUtil;
|
import forge.view.ButtonUtil;
|
||||||
@@ -59,7 +59,7 @@ class CardFactoryArtifacts {
|
|||||||
imageName = "B 1 1 Thrull";
|
imageName = "B 1 1 Thrull";
|
||||||
color = "B";
|
color = "B";
|
||||||
} else if (player.isHuman()) {
|
} else if (player.isHuman()) {
|
||||||
final Object q = GuiUtils.chooseOneOrNone("Select type of creature", choices);
|
final Object q = GuiChoose.oneOrNone("Select type of creature", choices);
|
||||||
if (q != null) {
|
if (q != null) {
|
||||||
if (q.equals("Citizen")) {
|
if (q.equals("Citizen")) {
|
||||||
type = "Citizen";
|
type = "Citizen";
|
||||||
@@ -272,7 +272,7 @@ class CardFactoryArtifacts {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // while
|
} // while
|
||||||
GuiUtils.chooseOneOrNone("Revealed cards:", revealed);
|
GuiChoose.oneOrNone("Revealed cards:", revealed);
|
||||||
for (final Card revealedCard : revealed) {
|
for (final Card revealedCard : revealed) {
|
||||||
Singletons.getModel().getGameAction().moveToBottomOfLibrary(revealedCard);
|
Singletons.getModel().getGameAction().moveToBottomOfLibrary(revealedCard);
|
||||||
}
|
}
|
||||||
@@ -361,7 +361,7 @@ class CardFactoryArtifacts {
|
|||||||
if (i == 4) {
|
if (i == 4) {
|
||||||
title = "Put fourth from top of library: ";
|
title = "Put fourth from top of library: ";
|
||||||
}
|
}
|
||||||
final Object o = GuiUtils.chooseOneOrNone(title, lands);
|
final Object o = GuiChoose.oneOrNone(title, lands);
|
||||||
if (o == null) {
|
if (o == null) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -505,7 +505,7 @@ class CardFactoryArtifacts {
|
|||||||
for (int j = 0; j <= num; j++) {
|
for (int j = 0; j <= num; j++) {
|
||||||
choices[j] = "" + j;
|
choices[j] = "" + j;
|
||||||
}
|
}
|
||||||
final String answer = (GuiUtils.chooseOneOrNone("Life to pay:", choices));
|
final String answer = (GuiChoose.oneOrNone("Life to pay:", choices));
|
||||||
lifeToPay = Integer.parseInt(answer);
|
lifeToPay = Integer.parseInt(answer);
|
||||||
} else {
|
} else {
|
||||||
// not implemented for Compy
|
// not implemented for Compy
|
||||||
@@ -590,7 +590,7 @@ class CardFactoryArtifacts {
|
|||||||
// Then look at the exiled cards and put them on
|
// Then look at the exiled cards and put them on
|
||||||
// top of your library in any order.
|
// top of your library in any order.
|
||||||
while (this.exiled.size() > 0) {
|
while (this.exiled.size() > 0) {
|
||||||
final Card c1 = GuiUtils.chooseOne("Put a card on top of your library.", this.exiled);
|
final Card c1 = GuiChoose.one("Put a card on top of your library.", this.exiled);
|
||||||
Singletons.getModel().getGameAction().moveToLibrary(c1);
|
Singletons.getModel().getGameAction().moveToLibrary(c1);
|
||||||
this.exiled.remove(c1);
|
this.exiled.remove(c1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ import forge.card.spellability.Target;
|
|||||||
import forge.control.input.Input;
|
import forge.control.input.Input;
|
||||||
import forge.game.zone.PlayerZone;
|
import forge.game.zone.PlayerZone;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -126,7 +126,7 @@ class CardFactoryAuras {
|
|||||||
public void resolve() {
|
public void resolve() {
|
||||||
// Only query player, AI will have decided already.
|
// Only query player, AI will have decided already.
|
||||||
if (card.getController().isHuman()) {
|
if (card.getController().isHuman()) {
|
||||||
newType[0] = GuiUtils.chooseOne("Select land type.", CardUtil.getLandTypes());
|
newType[0] = GuiChoose.one("Select land type.", CardUtil.getLandTypes());
|
||||||
}
|
}
|
||||||
Singletons.getModel().getGameAction().moveToPlay(card);
|
Singletons.getModel().getGameAction().moveToPlay(card);
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ import forge.control.input.Input;
|
|||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.PlayerZone;
|
import forge.game.zone.PlayerZone;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.gui.match.CMatchUI;
|
import forge.gui.match.CMatchUI;
|
||||||
import forge.util.Aggregates;
|
import forge.util.Aggregates;
|
||||||
import forge.view.ButtonUtil;
|
import forge.view.ButtonUtil;
|
||||||
@@ -218,7 +218,7 @@ public class CardFactoryCreatures {
|
|||||||
.filter(CardPredicates.Presets.ARTIFACTS);
|
.filter(CardPredicates.Presets.ARTIFACTS);
|
||||||
|
|
||||||
if (artifacts.size() != 0) {
|
if (artifacts.size() != 0) {
|
||||||
final Card c = GuiUtils.chooseOne("Select an artifact put a phylactery counter on", artifacts);
|
final Card c = GuiChoose.one("Select an artifact put a phylactery counter on", artifacts);
|
||||||
if (c != null) {
|
if (c != null) {
|
||||||
c.addCounter(Counters.PHYLACTERY, 1);
|
c.addCounter(Counters.PHYLACTERY, 1);
|
||||||
}
|
}
|
||||||
@@ -310,7 +310,7 @@ public class CardFactoryCreatures {
|
|||||||
if (card.getController().isHuman()) {
|
if (card.getController().isHuman()) {
|
||||||
final String[] colors = Constant.Color.ONLY_COLORS;
|
final String[] colors = Constant.Color.ONLY_COLORS;
|
||||||
|
|
||||||
final Object o = GuiUtils.chooseOne("Choose color", colors);
|
final Object o = GuiChoose.one("Choose color", colors);
|
||||||
color[0] = (String) o;
|
color[0] = (String) o;
|
||||||
} else {
|
} else {
|
||||||
// AI chooses the color that appears in the keywords of
|
// AI chooses the color that appears in the keywords of
|
||||||
@@ -465,7 +465,7 @@ public class CardFactoryCreatures {
|
|||||||
int lifeGain = 0;
|
int lifeGain = 0;
|
||||||
if (card.getController().isHuman()) {
|
if (card.getController().isHuman()) {
|
||||||
final String[] choices = { "white", "blue", "black", "red", "green" };
|
final String[] choices = { "white", "blue", "black", "red", "green" };
|
||||||
final Object o = GuiUtils.chooseOneOrNone("Select Color: ", choices);
|
final Object o = GuiChoose.oneOrNone("Select Color: ", choices);
|
||||||
Log.debug("Treva, the Renewer", "Color:" + o);
|
Log.debug("Treva, the Renewer", "Color:" + o);
|
||||||
lifeGain = CardFactoryUtil.getNumberOfPermanentsByColor((String) o);
|
lifeGain = CardFactoryUtil.getNumberOfPermanentsByColor((String) o);
|
||||||
|
|
||||||
@@ -509,7 +509,7 @@ public class CardFactoryCreatures {
|
|||||||
final CardList cl = new CardList();
|
final CardList cl = new CardList();
|
||||||
cl.add(lib.get(0));
|
cl.add(lib.get(0));
|
||||||
|
|
||||||
GuiUtils.chooseOneOrNone("Top card", cl);
|
GuiChoose.oneOrNone("Top card", cl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -985,7 +985,7 @@ public class CardFactoryCreatures {
|
|||||||
|
|
||||||
if (card.getController().isHuman()) {
|
if (card.getController().isHuman()) {
|
||||||
if (creats.size() > 0) {
|
if (creats.size() > 0) {
|
||||||
final List<Card> selection = GuiUtils.chooseNoneOrMany("Select creatures to sacrifice", creats);
|
final List<Card> selection = GuiChoose.noneOrMany("Select creatures to sacrifice", creats);
|
||||||
|
|
||||||
numCreatures[0] = selection.size();
|
numCreatures[0] = selection.size();
|
||||||
for (int m = 0; m < selection.size(); m++) {
|
for (int m = 0; m < selection.size(); m++) {
|
||||||
@@ -1063,7 +1063,7 @@ public class CardFactoryCreatures {
|
|||||||
life[i] = String.valueOf(i);
|
life[i] = String.valueOf(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Object o = GuiUtils.chooseOne("Nameless Race - pay X life", life);
|
final Object o = GuiChoose.one("Nameless Race - pay X life", life);
|
||||||
final String answer = (String) o;
|
final String answer = (String) o;
|
||||||
int loseLife = 0;
|
int loseLife = 0;
|
||||||
try {
|
try {
|
||||||
@@ -1334,9 +1334,9 @@ public class CardFactoryCreatures {
|
|||||||
hand.remove(random);
|
hand.remove(random);
|
||||||
}
|
}
|
||||||
if (!revealed.isEmpty()) {
|
if (!revealed.isEmpty()) {
|
||||||
GuiUtils.chooseOne("Revealed at random", revealed);
|
GuiChoose.one("Revealed at random", revealed);
|
||||||
} else {
|
} else {
|
||||||
GuiUtils.chooseOne("Revealed at random", new String[] { "Nothing to reveal" });
|
GuiChoose.one("Revealed at random", new String[] { "Nothing to reveal" });
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final Card c : revealed) {
|
for (final Card c : revealed) {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import forge.game.GameLossReason;
|
|||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.PlayerZone;
|
import forge.game.zone.PlayerZone;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.gui.match.CMatchUI;
|
import forge.gui.match.CMatchUI;
|
||||||
import forge.view.ButtonUtil;
|
import forge.view.ButtonUtil;
|
||||||
import forge.CardPredicates;
|
import forge.CardPredicates;
|
||||||
@@ -99,12 +99,12 @@ class CardFactoryEnchantments {
|
|||||||
chooseGrave.addAll(grave);
|
chooseGrave.addAll(grave);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Card c = GuiUtils.chooseOne("Choose first creature to exile", chooseGrave);
|
final Card c = GuiChoose.one("Choose first creature to exile", chooseGrave);
|
||||||
if (c != null) {
|
if (c != null) {
|
||||||
CardList newGrave = c.getOwner().getCardsIn(ZoneType.Graveyard).filter(CardPredicates.Presets.CREATURES);
|
CardList newGrave = c.getOwner().getCardsIn(ZoneType.Graveyard).filter(CardPredicates.Presets.CREATURES);
|
||||||
newGrave.remove(c);
|
newGrave.remove(c);
|
||||||
|
|
||||||
final Object o2 = GuiUtils.chooseOne("Choose second creature to exile", newGrave);
|
final Object o2 = GuiChoose.one("Choose second creature to exile", newGrave);
|
||||||
if (o2 != null) {
|
if (o2 != null) {
|
||||||
final Card c2 = (Card) o2;
|
final Card c2 = (Card) o2;
|
||||||
newGrave.remove(c2);
|
newGrave.remove(c2);
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ import forge.game.player.ComputerUtil;
|
|||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.PlayerZone;
|
import forge.game.zone.PlayerZone;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.util.MyRandom;
|
import forge.util.MyRandom;
|
||||||
|
|
||||||
|
|
||||||
@@ -130,7 +130,7 @@ public class CardFactoryInstants {
|
|||||||
final CardList libraryList = AllZone.getHumanPlayer().getCardsIn(ZoneType.Library);
|
final CardList libraryList = AllZone.getHumanPlayer().getCardsIn(ZoneType.Library);
|
||||||
final CardList selectedCards = new CardList();
|
final CardList selectedCards = new CardList();
|
||||||
|
|
||||||
Object o = GuiUtils.chooseOneOrNone("Select first card", libraryList);
|
Object o = GuiChoose.oneOrNone("Select first card", libraryList);
|
||||||
if (o != null) {
|
if (o != null) {
|
||||||
final Card c1 = (Card) o;
|
final Card c1 = (Card) o;
|
||||||
libraryList.remove(c1);
|
libraryList.remove(c1);
|
||||||
@@ -138,7 +138,7 @@ public class CardFactoryInstants {
|
|||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
o = GuiUtils.chooseOneOrNone("Select second card", libraryList);
|
o = GuiChoose.oneOrNone("Select second card", libraryList);
|
||||||
if (o != null) {
|
if (o != null) {
|
||||||
final Card c2 = (Card) o;
|
final Card c2 = (Card) o;
|
||||||
libraryList.remove(c2);
|
libraryList.remove(c2);
|
||||||
@@ -146,7 +146,7 @@ public class CardFactoryInstants {
|
|||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
o = GuiUtils.chooseOneOrNone("Select third card", libraryList);
|
o = GuiChoose.oneOrNone("Select third card", libraryList);
|
||||||
if (o != null) {
|
if (o != null) {
|
||||||
final Card c3 = (Card) o;
|
final Card c3 = (Card) o;
|
||||||
libraryList.remove(c3);
|
libraryList.remove(c3);
|
||||||
@@ -194,7 +194,7 @@ public class CardFactoryInstants {
|
|||||||
|
|
||||||
// NOTE: Using getChoiceOptional() results in a null error
|
// NOTE: Using getChoiceOptional() results in a null error
|
||||||
// when you click on Cancel.
|
// when you click on Cancel.
|
||||||
final Card choice = GuiUtils.chooseOne("Select card to give to computer", selectedCards);
|
final Card choice = GuiChoose.one("Select card to give to computer", selectedCards);
|
||||||
|
|
||||||
selectedCards.remove(choice);
|
selectedCards.remove(choice);
|
||||||
Singletons.getModel().getGameAction().moveToHand(choice);
|
Singletons.getModel().getGameAction().moveToHand(choice);
|
||||||
@@ -238,7 +238,7 @@ public class CardFactoryInstants {
|
|||||||
|
|
||||||
if (player.isHuman()) {
|
if (player.isHuman()) {
|
||||||
for (int i = 0; i < x; i++) {
|
for (int i = 0; i < x; i++) {
|
||||||
final Object o = GuiUtils.chooseOne("Remove from game", graveList);
|
final Object o = GuiChoose.one("Remove from game", graveList);
|
||||||
if (o == null) {
|
if (o == null) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -390,7 +390,7 @@ public class CardFactoryInstants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; (i < 3) && !choices.isEmpty(); i++) {
|
for (int i = 0; (i < 3) && !choices.isEmpty(); i++) {
|
||||||
final Object o = GuiUtils.chooseOne(this.prompt[i], choices);
|
final Object o = GuiChoose.one(this.prompt[i], choices);
|
||||||
final Card c1 = (Card) o;
|
final Card c1 = (Card) o;
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
Singletons.getModel().getGameAction().moveToHand(c1);
|
Singletons.getModel().getGameAction().moveToHand(c1);
|
||||||
@@ -477,12 +477,12 @@ public class CardFactoryInstants {
|
|||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
final String[] choices = new String[] { "Artifact", "Creature", "Land" };
|
final String[] choices = new String[] { "Artifact", "Creature", "Land" };
|
||||||
final Object o = GuiUtils.chooseOne("Select permanent type", choices);
|
final Object o = GuiChoose.one("Select permanent type", choices);
|
||||||
final String cardType = (String) o;
|
final String cardType = (String) o;
|
||||||
final CardList list = this.getTargetPlayer().getCardsIn(ZoneType.Battlefield).getType(cardType);
|
final CardList list = this.getTargetPlayer().getCardsIn(ZoneType.Battlefield).getType(cardType);
|
||||||
|
|
||||||
final String[] tapOrUntap = new String[] { "Tap", "Untap" };
|
final String[] tapOrUntap = new String[] { "Tap", "Untap" };
|
||||||
final Object z = GuiUtils.chooseOne("Tap or Untap?", tapOrUntap);
|
final Object z = GuiChoose.one("Tap or Untap?", tapOrUntap);
|
||||||
final boolean tap = (z.equals("Tap")) ? true : false;
|
final boolean tap = (z.equals("Tap")) ? true : false;
|
||||||
|
|
||||||
for (final Card c : list) {
|
for (final Card c : list) {
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ import forge.game.player.Player;
|
|||||||
import forge.game.player.PlayerUtil;
|
import forge.game.player.PlayerUtil;
|
||||||
import forge.game.zone.PlayerZone;
|
import forge.game.zone.PlayerZone;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.gui.match.CMatchUI;
|
import forge.gui.match.CMatchUI;
|
||||||
|
|
||||||
import forge.view.ButtonUtil;
|
import forge.view.ButtonUtil;
|
||||||
@@ -120,12 +120,12 @@ public class CardFactorySorceries {
|
|||||||
|
|
||||||
final StringBuilder msg = new StringBuilder();
|
final StringBuilder msg = new StringBuilder();
|
||||||
msg.append("Revealing top ").append(count).append(" cards of library: ");
|
msg.append("Revealing top ").append(count).append(" cards of library: ");
|
||||||
GuiUtils.chooseOne(msg.toString(), cards);
|
GuiChoose.one(msg.toString(), cards);
|
||||||
// Human chooses
|
// Human chooses
|
||||||
if (card.getController().isComputer()) {
|
if (card.getController().isComputer()) {
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
if (!stop) {
|
if (!stop) {
|
||||||
choice = GuiUtils.chooseOneOrNone("Choose cards to put into the first pile: ",
|
choice = GuiChoose.oneOrNone("Choose cards to put into the first pile: ",
|
||||||
cards);
|
cards);
|
||||||
if (choice != null) {
|
if (choice != null) {
|
||||||
pile1.add(choice);
|
pile1.add(choice);
|
||||||
@@ -234,7 +234,7 @@ public class CardFactorySorceries {
|
|||||||
|
|
||||||
final int numChosen = chosen.size();
|
final int numChosen = chosen.size();
|
||||||
for (int i = 0; i < numChosen; i++) {
|
for (int i = 0; i < numChosen; i++) {
|
||||||
final Card check = GuiUtils.chooseOneOrNone("Select spells to play in reverse order: ", chosen);
|
final Card check = GuiChoose.oneOrNone("Select spells to play in reverse order: ", chosen);
|
||||||
if (check == null) {
|
if (check == null) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1145,7 +1145,7 @@ public class CardFactorySorceries {
|
|||||||
final int num = CardFactoryUtil.getNumberOfManaSymbolsByColor("U", topCards);
|
final int num = CardFactoryUtil.getNumberOfManaSymbolsByColor("U", topCards);
|
||||||
final StringBuilder sb = new StringBuilder();
|
final StringBuilder sb = new StringBuilder();
|
||||||
sb.append("Revealed cards - ").append(num).append(" U mana symbols");
|
sb.append("Revealed cards - ").append(num).append(" U mana symbols");
|
||||||
GuiUtils.chooseOneOrNone(sb.toString(), topCards);
|
GuiChoose.oneOrNone(sb.toString(), topCards);
|
||||||
|
|
||||||
// opponent moves this many cards to graveyard
|
// opponent moves this many cards to graveyard
|
||||||
opp.mill(num);
|
opp.mill(num);
|
||||||
@@ -1397,7 +1397,7 @@ public class CardFactorySorceries {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
final Card check = GuiUtils.chooseOneOrNone("Select target creature with CMC < X", grave);
|
final Card check = GuiChoose.oneOrNone("Select target creature with CMC < X", grave);
|
||||||
if (check != null) {
|
if (check != null) {
|
||||||
final Card c = (Card) check;
|
final Card c = (Card) check;
|
||||||
if (c.canBeTargetedBy(spell)) {
|
if (c.canBeTargetedBy(spell)) {
|
||||||
@@ -1482,7 +1482,7 @@ public class CardFactorySorceries {
|
|||||||
for (int i = 0; i <= max; i++) {
|
for (int i = 0; i <= max; i++) {
|
||||||
choices[i] = Integer.valueOf(i);
|
choices[i] = Integer.valueOf(i);
|
||||||
}
|
}
|
||||||
final Integer answer = GuiUtils.chooseOne("Choose X", choices);
|
final Integer answer = GuiChoose.one("Choose X", choices);
|
||||||
// everything stops here if user cancelled
|
// everything stops here if user cancelled
|
||||||
if (answer == null) {
|
if (answer == null) {
|
||||||
this.stop();
|
this.stop();
|
||||||
@@ -1567,14 +1567,14 @@ public class CardFactorySorceries {
|
|||||||
|
|
||||||
private ArrayList<String> chooseTwo(final ArrayList<String> choices) {
|
private ArrayList<String> chooseTwo(final ArrayList<String> choices) {
|
||||||
final ArrayList<String> out = new ArrayList<String>();
|
final ArrayList<String> out = new ArrayList<String>();
|
||||||
Object o = GuiUtils.chooseOneOrNone("Choose Two", choices);
|
Object o = GuiChoose.oneOrNone("Choose Two", choices);
|
||||||
if (o == null) {
|
if (o == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
out.add((String) o);
|
out.add((String) o);
|
||||||
choices.remove(out.get(0));
|
choices.remove(out.get(0));
|
||||||
o = GuiUtils.chooseOneOrNone("Choose Two", choices);
|
o = GuiChoose.oneOrNone("Choose Two", choices);
|
||||||
if (o == null) {
|
if (o == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -1620,7 +1620,7 @@ public class CardFactorySorceries {
|
|||||||
// Sacrifice an artifact
|
// Sacrifice an artifact
|
||||||
CardList arts = p.getCardsIn(ZoneType.Battlefield);
|
CardList arts = p.getCardsIn(ZoneType.Battlefield);
|
||||||
arts = arts.filter(Presets.ARTIFACTS);
|
arts = arts.filter(Presets.ARTIFACTS);
|
||||||
final Object toSac = GuiUtils.chooseOneOrNone("Sacrifice an artifact", arts);
|
final Object toSac = GuiChoose.oneOrNone("Sacrifice an artifact", arts);
|
||||||
if (toSac != null) {
|
if (toSac != null) {
|
||||||
final Card c = (Card) toSac;
|
final Card c = (Card) toSac;
|
||||||
baseCMC = CardUtil.getConvertedManaCost(c);
|
baseCMC = CardUtil.getConvertedManaCost(c);
|
||||||
@@ -1631,9 +1631,9 @@ public class CardFactorySorceries {
|
|||||||
|
|
||||||
// Search your library for an artifact
|
// Search your library for an artifact
|
||||||
final CardList lib = p.getCardsIn(ZoneType.Library);
|
final CardList lib = p.getCardsIn(ZoneType.Library);
|
||||||
GuiUtils.chooseOneOrNone("Looking at Library", lib);
|
GuiChoose.oneOrNone("Looking at Library", lib);
|
||||||
final CardList libArts = lib.filter(Presets.ARTIFACTS);
|
final CardList libArts = lib.filter(Presets.ARTIFACTS);
|
||||||
final Object o = GuiUtils.chooseOneOrNone("Search for artifact", libArts);
|
final Object o = GuiChoose.oneOrNone("Search for artifact", libArts);
|
||||||
if (o != null) {
|
if (o != null) {
|
||||||
newArtifact[0] = (Card) o;
|
newArtifact[0] = (Card) o;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ import forge.game.player.ComputerUtil;
|
|||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.PlayerZone;
|
import forge.game.zone.PlayerZone;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.gui.match.CMatchUI;
|
import forge.gui.match.CMatchUI;
|
||||||
import forge.util.Aggregates;
|
import forge.util.Aggregates;
|
||||||
import forge.util.MyRandom;
|
import forge.util.MyRandom;
|
||||||
@@ -1059,7 +1059,7 @@ public class CardFactoryUtil {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Card o = GuiUtils.chooseOneOrNone("Select a card", sameCost);
|
final Card o = GuiChoose.oneOrNone("Select a card", sameCost);
|
||||||
if (o != null) {
|
if (o != null) {
|
||||||
// ability.setTargetCard((Card)o);
|
// ability.setTargetCard((Card)o);
|
||||||
|
|
||||||
@@ -1267,7 +1267,7 @@ public class CardFactoryUtil {
|
|||||||
question.append(manacost).append(" or less from your graveyard to your hand?");
|
question.append(manacost).append(" or less from your graveyard to your hand?");
|
||||||
|
|
||||||
if (GameActionUtil.showYesNoDialog(sourceCard, question.toString())) {
|
if (GameActionUtil.showYesNoDialog(sourceCard, question.toString())) {
|
||||||
final Card o = GuiUtils.chooseOneOrNone("Select a card", sameCost);
|
final Card o = GuiChoose.oneOrNone("Select a card", sameCost);
|
||||||
if (o != null) {
|
if (o != null) {
|
||||||
|
|
||||||
final Card c1 = (Card) o;
|
final Card c1 = (Card) o;
|
||||||
@@ -4914,7 +4914,7 @@ public class CardFactoryUtil {
|
|||||||
card.clearDevoured();
|
card.clearDevoured();
|
||||||
if (card.getController().isHuman()) {
|
if (card.getController().isHuman()) {
|
||||||
if (creats.size() > 0) {
|
if (creats.size() > 0) {
|
||||||
final List<Object> selection = GuiUtils.getOrderChoices("Devour", "Devouring", -1, creats.toArray(), null);
|
final List<Object> selection = GuiChoose.getOrderChoices("Devour", "Devouring", -1, creats.toArray(), null);
|
||||||
numCreatures[0] = selection.size();
|
numCreatures[0] = selection.size();
|
||||||
|
|
||||||
for (Object o : selection) {
|
for (Object o : selection) {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ import forge.game.player.ComputerUtil;
|
|||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.PlayerZone;
|
import forge.game.zone.PlayerZone;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.gui.match.CMatchUI;
|
import forge.gui.match.CMatchUI;
|
||||||
import forge.view.ButtonUtil;
|
import forge.view.ButtonUtil;
|
||||||
|
|
||||||
@@ -345,8 +345,8 @@ public class CostExile extends CostPartWithList {
|
|||||||
this.cancel();
|
this.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
final Card o = GuiUtils
|
final Card o = GuiChoose
|
||||||
.chooseOneOrNone("Exile from " + part.getFrom(), this.typeList);
|
.oneOrNone("Exile from " + part.getFrom(), this.typeList);
|
||||||
|
|
||||||
if (o != null) {
|
if (o != null) {
|
||||||
final Card c = (Card) o;
|
final Card c = (Card) o;
|
||||||
@@ -432,8 +432,7 @@ public class CostExile extends CostPartWithList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Have to use the stack descriptions here because some copied spells have no description otherwise
|
//Have to use the stack descriptions here because some copied spells have no description otherwise
|
||||||
final String o = GuiUtils
|
final String o = GuiChoose.oneOrNone("Exile from " + part.getFrom(), this.descList);
|
||||||
.chooseOneOrNone("Exile from " + part.getFrom(), this.descList);
|
|
||||||
|
|
||||||
if (o != null) {
|
if (o != null) {
|
||||||
final SpellAbility toExile = this.saList.get(descList.indexOf(o));
|
final SpellAbility toExile = this.saList.get(descList.indexOf(o));
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import forge.control.input.Input;
|
|||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.PlayerZone;
|
import forge.game.zone.PlayerZone;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.gui.match.CMatchUI;
|
import forge.gui.match.CMatchUI;
|
||||||
import forge.view.ButtonUtil;
|
import forge.view.ButtonUtil;
|
||||||
|
|
||||||
@@ -418,8 +418,8 @@ public class CostRemoveCounter extends CostPartWithList {
|
|||||||
this.cancel();
|
this.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
final Card o = GuiUtils
|
final Card o = GuiChoose
|
||||||
.chooseOneOrNone("Remove counter(s) from a card in " + costRemoveCounter.getZone(), this.typeList);
|
.oneOrNone("Remove counter(s) from a card in " + costRemoveCounter.getZone(), this.typeList);
|
||||||
|
|
||||||
if (o != null) {
|
if (o != null) {
|
||||||
final Card card = (Card) o;
|
final Card card = (Card) o;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import forge.game.player.ComputerUtil;
|
|||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.PlayerZone;
|
import forge.game.zone.PlayerZone;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.gui.match.CMatchUI;
|
import forge.gui.match.CMatchUI;
|
||||||
import forge.view.ButtonUtil;
|
import forge.view.ButtonUtil;
|
||||||
|
|
||||||
@@ -133,7 +133,7 @@ public class CostReveal extends CostPartWithList {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public final void payAI(final SpellAbility ability, final Card source, final CostPayment payment) {
|
public final void payAI(final SpellAbility ability, final Card source, final CostPayment payment) {
|
||||||
GuiUtils.chooseOneOrNone("Revealed cards:", this.getList());
|
GuiChoose.oneOrNone("Revealed cards:", this.getList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import forge.control.input.Input;
|
|||||||
import forge.game.player.ComputerUtil;
|
import forge.game.player.ComputerUtil;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class CostUtil.
|
* The Class CostUtil.
|
||||||
@@ -410,7 +410,7 @@ public class CostUtil {
|
|||||||
for (int i = 0; i < choiceArray.length; i++) {
|
for (int i = 0; i < choiceArray.length; i++) {
|
||||||
choiceArray[i] = i;
|
choiceArray[i] = i;
|
||||||
}
|
}
|
||||||
final Integer chosenX = GuiUtils.chooseOne(card.toString() + " - Choose a Value for X", choiceArray);
|
final Integer chosenX = GuiChoose.one(card.toString() + " - Choose a Value for X", choiceArray);
|
||||||
sa.setSVar("ChosenX", "Number$" + Integer.toString(chosenX));
|
sa.setSVar("ChosenX", "Number$" + Integer.toString(chosenX));
|
||||||
card.setSVar("ChosenX", "Number$" + Integer.toString(chosenX));
|
card.setSVar("ChosenX", "Number$" + Integer.toString(chosenX));
|
||||||
|
|
||||||
@@ -438,7 +438,7 @@ public class CostUtil {
|
|||||||
for (int i = 0; i < choiceArray.length; i++) {
|
for (int i = 0; i < choiceArray.length; i++) {
|
||||||
choiceArray[i] = Integer.valueOf(i);
|
choiceArray[i] = Integer.valueOf(i);
|
||||||
}
|
}
|
||||||
final Integer chosenY = GuiUtils.chooseOne(card.toString() + " - Choose a Value for Y", choiceArray);
|
final Integer chosenY = GuiChoose.one(card.toString() + " - Choose a Value for Y", choiceArray);
|
||||||
sa.setSVar("ChosenY", "Number$" + Integer.toString(chosenY));
|
sa.setSVar("ChosenY", "Number$" + Integer.toString(chosenY));
|
||||||
card.setSVar("ChosenY", "Number$" + Integer.toString(chosenY));
|
card.setSVar("ChosenY", "Number$" + Integer.toString(chosenY));
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import forge.card.spellability.AbilityMana;
|
|||||||
import forge.card.spellability.SpellAbility;
|
import forge.card.spellability.SpellAbility;
|
||||||
import forge.control.input.InputPayManaCostUtil;
|
import forge.control.input.InputPayManaCostUtil;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -331,7 +331,7 @@ public class ManaPool {
|
|||||||
Object o;
|
Object o;
|
||||||
|
|
||||||
if (this.owner.isHuman()) {
|
if (this.owner.isHuman()) {
|
||||||
o = GuiUtils.chooseOneOrNone("Pay Mana from Mana Pool", alChoice);
|
o = GuiChoose.oneOrNone("Pay Mana from Mana Pool", alChoice);
|
||||||
} else {
|
} else {
|
||||||
o = alChoice.get(0); // owner is computer
|
o = alChoice.get(0); // owner is computer
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ import forge.card.spellability.SpellAbility;
|
|||||||
import forge.game.player.ComputerUtil;
|
import forge.game.player.ComputerUtil;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: Write javadoc for this type.
|
* TODO: Write javadoc for this type.
|
||||||
@@ -127,7 +127,7 @@ public class ReplacementHandler {
|
|||||||
|
|
||||||
if (possibleReplacers.size() > 1) {
|
if (possibleReplacers.size() > 1) {
|
||||||
if (decider.isHuman()) {
|
if (decider.isHuman()) {
|
||||||
chosenRE = GuiUtils.chooseOne("Choose which replacement effect to apply.",
|
chosenRE = GuiChoose.one("Choose which replacement effect to apply.",
|
||||||
possibleReplacers);
|
possibleReplacers);
|
||||||
} else {
|
} else {
|
||||||
// AI logic for choosing which replacement effect to apply
|
// AI logic for choosing which replacement effect to apply
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import forge.control.input.Input;
|
|||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.PlayerZone;
|
import forge.game.zone.PlayerZone;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.gui.match.CMatchUI;
|
import forge.gui.match.CMatchUI;
|
||||||
|
|
||||||
import forge.view.ButtonUtil;
|
import forge.view.ButtonUtil;
|
||||||
@@ -509,7 +509,7 @@ public class TargetSelection {
|
|||||||
choicesWithDone.add(dummy);
|
choicesWithDone.add(dummy);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Card check = GuiUtils.chooseOneOrNone(message, choicesWithDone);
|
final Card check = GuiChoose.oneOrNone(message, choicesWithDone);
|
||||||
if (check != null) {
|
if (check != null) {
|
||||||
final Card c = (Card) check;
|
final Card c = (Card) check;
|
||||||
if (!c.equals(divBattlefield) && !c.equals(divExile) && !c.equals(divGrave)
|
if (!c.equals(divBattlefield) && !c.equals(divExile) && !c.equals(divGrave)
|
||||||
@@ -562,7 +562,7 @@ public class TargetSelection {
|
|||||||
if (choices.length == 0) {
|
if (choices.length == 0) {
|
||||||
select.setCancel(true);
|
select.setCancel(true);
|
||||||
} else {
|
} else {
|
||||||
final String madeChoice = GuiUtils.chooseOneOrNone(message, choices);
|
final String madeChoice = GuiChoose.oneOrNone(message, choices);
|
||||||
|
|
||||||
if (madeChoice != null) {
|
if (madeChoice != null) {
|
||||||
if (madeChoice.equals(doneDummy)) {
|
if (madeChoice.equals(doneDummy)) {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import forge.card.mana.ManaCost;
|
|||||||
import forge.card.mana.ManaPool;
|
import forge.card.mana.ManaPool;
|
||||||
import forge.card.spellability.AbilityMana;
|
import forge.card.spellability.AbilityMana;
|
||||||
import forge.card.spellability.SpellAbility;
|
import forge.card.spellability.SpellAbility;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -189,7 +189,7 @@ public class InputPayManaCostUtil {
|
|||||||
for (final AbilityMana am : abilities) {
|
for (final AbilityMana am : abilities) {
|
||||||
ability.put(am.toString(), am);
|
ability.put(am.toString(), am);
|
||||||
}
|
}
|
||||||
chosen = GuiUtils.chooseOne("Choose mana ability", abilities);
|
chosen = GuiChoose.one("Choose mana ability", abilities);
|
||||||
}
|
}
|
||||||
|
|
||||||
// save off color needed for use by any mana and reflected mana
|
// save off color needed for use by any mana and reflected mana
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ import forge.card.CardBlock;
|
|||||||
import forge.card.CardEdition;
|
import forge.card.CardEdition;
|
||||||
import forge.card.UnOpenedProduct;
|
import forge.card.UnOpenedProduct;
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.item.CardDb;
|
import forge.item.CardDb;
|
||||||
import forge.item.CardPrinted;
|
import forge.item.CardPrinted;
|
||||||
import forge.item.ItemPool;
|
import forge.item.ItemPool;
|
||||||
@@ -110,7 +110,7 @@ public final class BoosterDraft implements IBoosterDraft {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final CardBlock block = GuiUtils.chooseOne("Choose Block", blocks);
|
final CardBlock block = GuiChoose.one("Choose Block", blocks);
|
||||||
|
|
||||||
final CardEdition[] cardSets = block.getSets();
|
final CardEdition[] cardSets = block.getSets();
|
||||||
final String[] sets = new String[cardSets.length + block.getNumberMetaSets()];
|
final String[] sets = new String[cardSets.length + block.getNumberMetaSets()];
|
||||||
@@ -135,7 +135,7 @@ public final class BoosterDraft implements IBoosterDraft {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sets.length > 1) {
|
if (sets.length > 1) {
|
||||||
final Object p = GuiUtils.chooseOne("Choose Set Combination", setCombos);
|
final Object p = GuiChoose.one("Choose Set Combination", setCombos);
|
||||||
final String[] pp = p.toString().split("/");
|
final String[] pp = p.toString().split("/");
|
||||||
for (int i = 0; i < nPacks; i++) {
|
for (int i = 0; i < nPacks; i++) {
|
||||||
if (pp[i].charAt(0) == '*') {
|
if (pp[i].charAt(0) == '*') {
|
||||||
@@ -168,7 +168,7 @@ public final class BoosterDraft implements IBoosterDraft {
|
|||||||
JOptionPane
|
JOptionPane
|
||||||
.showMessageDialog(null, "No custom draft files found.", "", JOptionPane.INFORMATION_MESSAGE);
|
.showMessageDialog(null, "No custom draft files found.", "", JOptionPane.INFORMATION_MESSAGE);
|
||||||
} else {
|
} else {
|
||||||
final CustomLimited draft = (CustomLimited) GuiUtils.chooseOne("Choose Custom Draft",
|
final CustomLimited draft = (CustomLimited) GuiChoose.one("Choose Custom Draft",
|
||||||
myDrafts);
|
myDrafts);
|
||||||
this.setupCustomDraft(draft);
|
this.setupCustomDraft(draft);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import forge.card.BoosterGenerator;
|
|||||||
import forge.card.CardBlock;
|
import forge.card.CardBlock;
|
||||||
import forge.card.CardEdition;
|
import forge.card.CardEdition;
|
||||||
import forge.card.UnOpenedProduct;
|
import forge.card.UnOpenedProduct;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.item.CardDb;
|
import forge.item.CardDb;
|
||||||
import forge.item.CardPrinted;
|
import forge.item.CardPrinted;
|
||||||
import forge.item.ItemPool;
|
import forge.item.ItemPool;
|
||||||
@@ -75,7 +75,7 @@ public class SealedDeckFormat {
|
|||||||
integers[i] = Integer.valueOf(i + 3);
|
integers[i] = Integer.valueOf(i + 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
Integer nrBoosters = GuiUtils.chooseOne("How many booster packs?", integers);
|
Integer nrBoosters = GuiChoose.one("How many booster packs?", integers);
|
||||||
|
|
||||||
for (int i = 0; i < nrBoosters; i++) {
|
for (int i = 0; i < nrBoosters; i++) {
|
||||||
this.product.add(new UnOpenedProduct(BoosterGenerator.IDENTITY_PICK, bpFull));
|
this.product.add(new UnOpenedProduct(BoosterGenerator.IDENTITY_PICK, bpFull));
|
||||||
@@ -97,7 +97,7 @@ public class SealedDeckFormat {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final CardBlock block = GuiUtils.chooseOne("Choose Block", blocks);
|
final CardBlock block = GuiChoose.one("Choose Block", blocks);
|
||||||
|
|
||||||
final CardEdition[] cardSets = block.getSets();
|
final CardEdition[] cardSets = block.getSets();
|
||||||
final String[] sets = new String[cardSets.length + block.getNumberMetaSets()];
|
final String[] sets = new String[cardSets.length + block.getNumberMetaSets()];
|
||||||
@@ -123,7 +123,7 @@ public class SealedDeckFormat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sets.length > 1) {
|
if (sets.length > 1) {
|
||||||
final Object p = GuiUtils.chooseOne("Choose Set Combination", setCombos);
|
final Object p = GuiChoose.one("Choose Set Combination", setCombos);
|
||||||
|
|
||||||
final String[] pp = p.toString().split("/");
|
final String[] pp = p.toString().split("/");
|
||||||
|
|
||||||
@@ -179,7 +179,7 @@ public class SealedDeckFormat {
|
|||||||
starterPacks.add(String.format("Two packs (%s, %s)", pp[starter1idx], pp[starter2idx]));
|
starterPacks.add(String.format("Two packs (%s, %s)", pp[starter1idx], pp[starter2idx]));
|
||||||
}
|
}
|
||||||
|
|
||||||
final Object starterResult = GuiUtils.chooseOne("Choose starter pack(s):", starterPacks);
|
final Object starterResult = GuiChoose.one("Choose starter pack(s):", starterPacks);
|
||||||
|
|
||||||
// Analyze the choice
|
// Analyze the choice
|
||||||
final String starters = starterResult.toString();
|
final String starters = starterResult.toString();
|
||||||
@@ -229,7 +229,7 @@ public class SealedDeckFormat {
|
|||||||
integers[i] = Integer.valueOf(i + 3);
|
integers[i] = Integer.valueOf(i + 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
Integer nrBoosters = GuiUtils.chooseOne("How many booster packs?", integers);
|
Integer nrBoosters = GuiChoose.one("How many booster packs?", integers);
|
||||||
|
|
||||||
for (int i = 0; i < nrBoosters; i++) {
|
for (int i = 0; i < nrBoosters; i++) {
|
||||||
this.product.add(product1);
|
this.product.add(product1);
|
||||||
@@ -268,7 +268,7 @@ public class SealedDeckFormat {
|
|||||||
JOptionPane.showMessageDialog(null, "No custom sealed files found.", "",
|
JOptionPane.showMessageDialog(null, "No custom sealed files found.", "",
|
||||||
JOptionPane.INFORMATION_MESSAGE);
|
JOptionPane.INFORMATION_MESSAGE);
|
||||||
} else {
|
} else {
|
||||||
final CustomLimited draft = (CustomLimited) GuiUtils.chooseOne("Choose Custom Sealed Pool",
|
final CustomLimited draft = (CustomLimited) GuiChoose.one("Choose Custom Sealed Pool",
|
||||||
customs);
|
customs);
|
||||||
|
|
||||||
final BoosterGenerator bpCustom = new BoosterGenerator(draft.getCardPool());
|
final BoosterGenerator bpCustom = new BoosterGenerator(draft.getCardPool());
|
||||||
@@ -293,7 +293,7 @@ public class SealedDeckFormat {
|
|||||||
integers[i] = Integer.valueOf(i + 3);
|
integers[i] = Integer.valueOf(i + 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
Integer nrBoosters = GuiUtils.chooseOne("How many booster packs?", integers);
|
Integer nrBoosters = GuiChoose.one("How many booster packs?", integers);
|
||||||
|
|
||||||
for (int i = 0; i < nrBoosters; i++) {
|
for (int i = 0; i < nrBoosters; i++) {
|
||||||
this.product.add(new UnOpenedProduct(fnPick, bpCustom));
|
this.product.add(new UnOpenedProduct(fnPick, bpCustom));
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ import forge.game.player.ComputerUtilBlock;
|
|||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.PlayerZone;
|
import forge.game.zone.PlayerZone;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.gui.framework.EDocID;
|
import forge.gui.framework.EDocID;
|
||||||
import forge.gui.framework.SDisplayUtil;
|
import forge.gui.framework.SDisplayUtil;
|
||||||
import forge.gui.match.views.VCombat;
|
import forge.gui.match.views.VCombat;
|
||||||
@@ -443,7 +443,7 @@ public class CombatUtil {
|
|||||||
|
|
||||||
CardList orderedBlockers = null;
|
CardList orderedBlockers = null;
|
||||||
if (player.isHuman()) {
|
if (player.isHuman()) {
|
||||||
List<Object> ordered = GuiUtils.getOrderChoices("Choose Blocking Order", "Damaged First", 0, blockers.toArray(), null);
|
List<Object> ordered = GuiChoose.getOrderChoices("Choose Blocking Order", "Damaged First", 0, blockers.toArray(), null);
|
||||||
|
|
||||||
orderedBlockers = new CardList();
|
orderedBlockers = new CardList();
|
||||||
for(Object o : ordered) {
|
for(Object o : ordered) {
|
||||||
@@ -471,7 +471,7 @@ public class CombatUtil {
|
|||||||
|
|
||||||
CardList orderedAttacker = null;
|
CardList orderedAttacker = null;
|
||||||
if (player.isHuman()) {
|
if (player.isHuman()) {
|
||||||
List<Object> ordered = GuiUtils.getOrderChoices("Choose Blocking Order", "Damaged First", 0, attackers.toArray(), null);
|
List<Object> ordered = GuiChoose.getOrderChoices("Choose Blocking Order", "Damaged First", 0, attackers.toArray(), null);
|
||||||
|
|
||||||
orderedAttacker = new CardList();
|
orderedAttacker = new CardList();
|
||||||
for(Object o : ordered) {
|
for(Object o : ordered) {
|
||||||
@@ -2836,7 +2836,7 @@ public class CombatUtil {
|
|||||||
if (lib.size() > 0) {
|
if (lib.size() > 0) {
|
||||||
final CardList cl = new CardList();
|
final CardList cl = new CardList();
|
||||||
cl.add(lib.get(0));
|
cl.add(lib.get(0));
|
||||||
GuiUtils.chooseOneOrNone("Top card", cl);
|
GuiChoose.oneOrNone("Top card", cl);
|
||||||
final Card top = lib.get(0);
|
final Card top = lib.get(0);
|
||||||
if (top.isCreature()) {
|
if (top.isCreature()) {
|
||||||
player.gainLife(top.getBaseDefense(), c);
|
player.gainLife(top.getBaseDefense(), c);
|
||||||
@@ -3103,7 +3103,7 @@ public class CombatUtil {
|
|||||||
final Card crd = enchantments.get(j);
|
final Card crd = enchantments.get(j);
|
||||||
target[j] = crd;
|
target[j] = crd;
|
||||||
}
|
}
|
||||||
final Object check = GuiUtils.chooseOneOrNone(
|
final Object check = GuiChoose.oneOrNone(
|
||||||
"Select enchantment to enchant exalted creature", target);
|
"Select enchantment to enchant exalted creature", target);
|
||||||
if (check != null) {
|
if (check != null) {
|
||||||
enchantment = ((Card) check);
|
enchantment = ((Card) check);
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ import forge.game.player.Player;
|
|||||||
import forge.game.player.PlayerUtil;
|
import forge.game.player.PlayerUtil;
|
||||||
import forge.game.zone.PlayerZone;
|
import forge.game.zone.PlayerZone;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.gui.match.CMatchUI;
|
import forge.gui.match.CMatchUI;
|
||||||
|
|
||||||
import forge.view.ButtonUtil;
|
import forge.view.ButtonUtil;
|
||||||
@@ -778,7 +778,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
|||||||
|
|
||||||
private void revealTopCard(final String title) {
|
private void revealTopCard(final String title) {
|
||||||
if (peek[0] != prevCardShown[0]) {
|
if (peek[0] != prevCardShown[0]) {
|
||||||
GuiUtils.chooseOne(title, peek[0]);
|
GuiChoose.one(title, peek[0]);
|
||||||
prevCardShown[0] = peek[0];
|
prevCardShown[0] = peek[0];
|
||||||
}
|
}
|
||||||
} // revealTopCard()
|
} // revealTopCard()
|
||||||
@@ -880,7 +880,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
|||||||
|
|
||||||
private void revealTopCard(final String title) {
|
private void revealTopCard(final String title) {
|
||||||
if (peek[0] != prevCardShown[0]) {
|
if (peek[0] != prevCardShown[0]) {
|
||||||
GuiUtils.chooseOne(title, peek[0]);
|
GuiChoose.one(title, peek[0]);
|
||||||
prevCardShown[0] = peek[0];
|
prevCardShown[0] = peek[0];
|
||||||
}
|
}
|
||||||
} // revealTopCard()
|
} // revealTopCard()
|
||||||
@@ -980,7 +980,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
|||||||
|
|
||||||
private void revealTopCard(final String title) {
|
private void revealTopCard(final String title) {
|
||||||
if (peek[0] != prevCardShown[0]) {
|
if (peek[0] != prevCardShown[0]) {
|
||||||
GuiUtils.chooseOne(title, peek[0]);
|
GuiChoose.one(title, peek[0]);
|
||||||
prevCardShown[0] = peek[0];
|
prevCardShown[0] = peek[0];
|
||||||
}
|
}
|
||||||
} // revealTopCard()
|
} // revealTopCard()
|
||||||
@@ -1077,7 +1077,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
|||||||
|
|
||||||
private void revealTopCard(final String title) {
|
private void revealTopCard(final String title) {
|
||||||
if (peek[0] != prevCardShown[0]) {
|
if (peek[0] != prevCardShown[0]) {
|
||||||
GuiUtils.chooseOne(title, peek[0]);
|
GuiChoose.one(title, peek[0]);
|
||||||
prevCardShown[0] = peek[0];
|
prevCardShown[0] = peek[0];
|
||||||
}
|
}
|
||||||
} // revealTopCard()
|
} // revealTopCard()
|
||||||
@@ -1162,7 +1162,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
|||||||
|
|
||||||
private void revealTopCard(final String title) {
|
private void revealTopCard(final String title) {
|
||||||
if (peek[0] != prevCardShown[0]) {
|
if (peek[0] != prevCardShown[0]) {
|
||||||
GuiUtils.chooseOne(title, peek[0]);
|
GuiChoose.one(title, peek[0]);
|
||||||
prevCardShown[0] = peek[0];
|
prevCardShown[0] = peek[0];
|
||||||
}
|
}
|
||||||
} // revealTopCard()
|
} // revealTopCard()
|
||||||
@@ -1261,7 +1261,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
|||||||
|
|
||||||
private void revealTopCard(final String title) {
|
private void revealTopCard(final String title) {
|
||||||
if (peek[0] != prevCardShown[0]) {
|
if (peek[0] != prevCardShown[0]) {
|
||||||
GuiUtils.chooseOne(title, peek[0]);
|
GuiChoose.one(title, peek[0]);
|
||||||
prevCardShown[0] = peek[0];
|
prevCardShown[0] = peek[0];
|
||||||
}
|
}
|
||||||
} // revealTopCard()
|
} // revealTopCard()
|
||||||
@@ -1353,7 +1353,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
|||||||
|
|
||||||
private void revealTopCard(final String title) {
|
private void revealTopCard(final String title) {
|
||||||
if (peek[0] != prevCardShown[0]) {
|
if (peek[0] != prevCardShown[0]) {
|
||||||
GuiUtils.chooseOne(title, peek[0]);
|
GuiChoose.one(title, peek[0]);
|
||||||
prevCardShown[0] = peek[0];
|
prevCardShown[0] = peek[0];
|
||||||
}
|
}
|
||||||
} // revealTopCard()
|
} // revealTopCard()
|
||||||
@@ -1439,7 +1439,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
|||||||
|
|
||||||
private void revealTopCard(final String title) {
|
private void revealTopCard(final String title) {
|
||||||
if (peek[0] != prevCardShown[0]) {
|
if (peek[0] != prevCardShown[0]) {
|
||||||
GuiUtils.chooseOne(title, peek[0]);
|
GuiChoose.one(title, peek[0]);
|
||||||
prevCardShown[0] = peek[0];
|
prevCardShown[0] = peek[0];
|
||||||
}
|
}
|
||||||
} // revealTopCard()
|
} // revealTopCard()
|
||||||
@@ -1523,7 +1523,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
|||||||
|
|
||||||
private void revealTopCard(final String title) {
|
private void revealTopCard(final String title) {
|
||||||
if (peek[0] != prevCardShown[0]) {
|
if (peek[0] != prevCardShown[0]) {
|
||||||
GuiUtils.chooseOne(title, peek[0]);
|
GuiChoose.one(title, peek[0]);
|
||||||
prevCardShown[0] = peek[0];
|
prevCardShown[0] = peek[0];
|
||||||
}
|
}
|
||||||
} // revealTopCard()
|
} // revealTopCard()
|
||||||
@@ -1628,7 +1628,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
|||||||
|
|
||||||
private void revealTopCard(final String title) {
|
private void revealTopCard(final String title) {
|
||||||
if (peek[0] != prevCardShown[0]) {
|
if (peek[0] != prevCardShown[0]) {
|
||||||
GuiUtils.chooseOne(title, peek[0]);
|
GuiChoose.one(title, peek[0]);
|
||||||
prevCardShown[0] = peek[0];
|
prevCardShown[0] = peek[0];
|
||||||
}
|
}
|
||||||
} // revealTopCard()
|
} // revealTopCard()
|
||||||
@@ -1712,7 +1712,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
|||||||
|
|
||||||
private void revealTopCard(final String title) {
|
private void revealTopCard(final String title) {
|
||||||
if (peek[0] != prevCardShown[0]) {
|
if (peek[0] != prevCardShown[0]) {
|
||||||
GuiUtils.chooseOne(title, peek[0]);
|
GuiChoose.one(title, peek[0]);
|
||||||
prevCardShown[0] = peek[0];
|
prevCardShown[0] = peek[0];
|
||||||
}
|
}
|
||||||
} // revealTopCard()
|
} // revealTopCard()
|
||||||
@@ -1799,7 +1799,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
|||||||
|
|
||||||
private void revealTopCard(final String title) {
|
private void revealTopCard(final String title) {
|
||||||
if (peek[0] != prevCardShown[0]) {
|
if (peek[0] != prevCardShown[0]) {
|
||||||
GuiUtils.chooseOne(title, peek[0]);
|
GuiChoose.one(title, peek[0]);
|
||||||
prevCardShown[0] = peek[0];
|
prevCardShown[0] = peek[0];
|
||||||
}
|
}
|
||||||
} // revealTopCard()
|
} // revealTopCard()
|
||||||
@@ -1986,7 +1986,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
|||||||
}
|
}
|
||||||
} // for loop
|
} // for loop
|
||||||
if (cardsToReveal.size() > 0) {
|
if (cardsToReveal.size() > 0) {
|
||||||
GuiUtils.chooseOne("Revealed cards", cardsToReveal);
|
GuiChoose.one("Revealed cards", cardsToReveal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2030,7 +2030,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
|||||||
|
|
||||||
if (AllZoneUtil.compareTypeAmountInGraveyard(player, "Creature") > 0) {
|
if (AllZoneUtil.compareTypeAmountInGraveyard(player, "Creature") > 0) {
|
||||||
if (player.isHuman()) {
|
if (player.isHuman()) {
|
||||||
final Card o = GuiUtils.chooseOneOrNone("Pick a creature to return to hand", graveyardCreatures);
|
final Card o = GuiChoose.oneOrNone("Pick a creature to return to hand", graveyardCreatures);
|
||||||
if (o != null) {
|
if (o != null) {
|
||||||
final Card card = (Card) o;
|
final Card card = (Card) o;
|
||||||
|
|
||||||
@@ -2292,7 +2292,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
|||||||
final Card crd = enchantmentsInLibrary.get(j);
|
final Card crd = enchantmentsInLibrary.get(j);
|
||||||
target[j] = crd;
|
target[j] = crd;
|
||||||
}
|
}
|
||||||
final Object check = GuiUtils.chooseOneOrNone("Select Curse to attach", target);
|
final Object check = GuiChoose.oneOrNone("Select Curse to attach", target);
|
||||||
if (check != null) {
|
if (check != null) {
|
||||||
enchantment = ((Card) check);
|
enchantment = ((Card) check);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ import forge.game.phase.Combat;
|
|||||||
import forge.game.phase.CombatUtil;
|
import forge.game.phase.CombatUtil;
|
||||||
import forge.game.phase.PhaseType;
|
import forge.game.phase.PhaseType;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.util.Aggregates;
|
import forge.util.Aggregates;
|
||||||
|
|
||||||
|
|
||||||
@@ -182,7 +182,7 @@ public class ComputerUtil {
|
|||||||
if (pay.payComputerCosts()) {
|
if (pay.payComputerCosts()) {
|
||||||
AllZone.getStack().addAndUnfreeze(sa);
|
AllZone.getStack().addAndUnfreeze(sa);
|
||||||
if (sa.getSplicedCards() != null && !sa.getSplicedCards().isEmpty()) {
|
if (sa.getSplicedCards() != null && !sa.getSplicedCards().isEmpty()) {
|
||||||
GuiUtils.chooseOneOrNone("Computer reveals spliced cards:", sa.getSplicedCards());
|
GuiChoose.oneOrNone("Computer reveals spliced cards:", sa.getSplicedCards());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
// TODO: solve problems with TapsForMana triggers by adding
|
// TODO: solve problems with TapsForMana triggers by adding
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import forge.Singletons;
|
|||||||
import forge.card.spellability.SpellAbility;
|
import forge.card.spellability.SpellAbility;
|
||||||
import forge.control.input.Input;
|
import forge.control.input.Input;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.gui.match.CMatchUI;
|
import forge.gui.match.CMatchUI;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -124,9 +124,9 @@ public class HumanPlayer extends Player {
|
|||||||
public final boolean dredge() {
|
public final boolean dredge() {
|
||||||
boolean dredged = false;
|
boolean dredged = false;
|
||||||
final String[] choices = { "Yes", "No" };
|
final String[] choices = { "Yes", "No" };
|
||||||
final Object o = GuiUtils.chooseOne("Do you want to dredge?", choices);
|
final Object o = GuiChoose.one("Do you want to dredge?", choices);
|
||||||
if (o.equals("Yes")) {
|
if (o.equals("Yes")) {
|
||||||
final Card c = GuiUtils.chooseOne("Select card to dredge", this.getDredge());
|
final Card c = GuiChoose.one("Select card to dredge", this.getDredge());
|
||||||
// rule 702.49a
|
// rule 702.49a
|
||||||
if (this.getDredgeNumber(c) <= AllZone.getHumanPlayer().getZone(ZoneType.Library).size()) {
|
if (this.getDredgeNumber(c) <= AllZone.getHumanPlayer().getZone(ZoneType.Library).size()) {
|
||||||
|
|
||||||
@@ -181,7 +181,7 @@ public class HumanPlayer extends Player {
|
|||||||
protected final void doScry(final CardList topN, final int n) {
|
protected final void doScry(final CardList topN, final int n) {
|
||||||
int num = n;
|
int num = n;
|
||||||
for (int i = 0; i < num; i++) {
|
for (int i = 0; i < num; i++) {
|
||||||
final Card c = GuiUtils.chooseOneOrNone("Put on bottom of library.", topN);
|
final Card c = GuiChoose.oneOrNone("Put on bottom of library.", topN);
|
||||||
if (c != null) {
|
if (c != null) {
|
||||||
topN.remove(c);
|
topN.remove(c);
|
||||||
Singletons.getModel().getGameAction().moveToBottomOfLibrary(c);
|
Singletons.getModel().getGameAction().moveToBottomOfLibrary(c);
|
||||||
@@ -192,7 +192,7 @@ public class HumanPlayer extends Player {
|
|||||||
}
|
}
|
||||||
num = topN.size();
|
num = topN.size();
|
||||||
for (int i = 0; i < num; i++) {
|
for (int i = 0; i < num; i++) {
|
||||||
final Card c = GuiUtils.chooseOne("Put on top of library.", topN);
|
final Card c = GuiChoose.one("Put on top of library.", topN);
|
||||||
if (c != null) {
|
if (c != null) {
|
||||||
topN.remove(c);
|
topN.remove(c);
|
||||||
Singletons.getModel().getGameAction().moveToLibrary(c);
|
Singletons.getModel().getGameAction().moveToLibrary(c);
|
||||||
@@ -214,7 +214,7 @@ public class HumanPlayer extends Player {
|
|||||||
String choice = "";
|
String choice = "";
|
||||||
final String[] choices = { "top", "bottom" };
|
final String[] choices = { "top", "bottom" };
|
||||||
CMatchUI.SINGLETON_INSTANCE.setCard(c);
|
CMatchUI.SINGLETON_INSTANCE.setCard(c);
|
||||||
choice = GuiUtils.chooseOne(c.getName() + " - Top or bottom of Library", choices);
|
choice = GuiChoose.one(c.getName() + " - Top or bottom of Library", choices);
|
||||||
|
|
||||||
if (choice.equals("bottom")) {
|
if (choice.equals("bottom")) {
|
||||||
Singletons.getModel().getGameAction().moveToBottomOfLibrary(c);
|
Singletons.getModel().getGameAction().moveToBottomOfLibrary(c);
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ import forge.game.zone.DefaultPlayerZone;
|
|||||||
import forge.game.zone.PlayerZone;
|
import forge.game.zone.PlayerZone;
|
||||||
import forge.game.zone.PlayerZoneComesIntoPlay;
|
import forge.game.zone.PlayerZoneComesIntoPlay;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.properties.ForgePreferences.FPref;
|
import forge.properties.ForgePreferences.FPref;
|
||||||
import forge.util.MyRandom;
|
import forge.util.MyRandom;
|
||||||
|
|
||||||
@@ -1280,7 +1280,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (reveal) {
|
if (reveal) {
|
||||||
GuiUtils.chooseOne("Revealing the first card drawn", drawn);
|
GuiChoose.one("Revealing the first card drawn", drawn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ import forge.control.input.InputPayManaCostAbility;
|
|||||||
import forge.game.phase.PhaseType;
|
import forge.game.phase.PhaseType;
|
||||||
import forge.game.player.ComputerUtil;
|
import forge.game.player.ComputerUtil;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.gui.framework.EDocID;
|
import forge.gui.framework.EDocID;
|
||||||
import forge.gui.framework.SDisplayUtil;
|
import forge.gui.framework.SDisplayUtil;
|
||||||
import forge.gui.match.CMatchUI;
|
import forge.gui.match.CMatchUI;
|
||||||
@@ -1350,7 +1350,7 @@ public class MagicStack extends MyObservable {
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
// Otherwise, gave a dual list form to create instead of needing to do it one at a time
|
// Otherwise, gave a dual list form to create instead of needing to do it one at a time
|
||||||
List<Object> orderedSAs = GuiUtils.getOrderChoices("Select order for Simultaneous Spell Abilities", "Resolve first", 0, activePlayerSAs.toArray(), null);
|
List<Object> orderedSAs = GuiChoose.getOrderChoices("Select order for Simultaneous Spell Abilities", "Resolve first", 0, activePlayerSAs.toArray(), null);
|
||||||
int size = orderedSAs.size();
|
int size = orderedSAs.size();
|
||||||
for(int i = size-1; i >= 0; i--){
|
for(int i = size-1; i >= 0; i--){
|
||||||
SpellAbility next = (SpellAbility)orderedSAs.get(i);
|
SpellAbility next = (SpellAbility)orderedSAs.get(i);
|
||||||
|
|||||||
196
src/main/java/forge/gui/GuiChoose.java
Normal file
196
src/main/java/forge/gui/GuiChoose.java
Normal file
@@ -0,0 +1,196 @@
|
|||||||
|
package forge.gui;
|
||||||
|
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.swing.JDialog;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JList;
|
||||||
|
import javax.swing.WindowConstants;
|
||||||
|
import javax.swing.event.ListSelectionEvent;
|
||||||
|
import javax.swing.event.ListSelectionListener;
|
||||||
|
|
||||||
|
import forge.Card;
|
||||||
|
import forge.gui.match.CMatchUI;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: Write javadoc for this type.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class GuiChoose {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenience for getChoices(message, 0, 1, choices).
|
||||||
|
*
|
||||||
|
* @param <T>
|
||||||
|
* is automatically inferred.
|
||||||
|
* @param message
|
||||||
|
* a {@link java.lang.String} object.
|
||||||
|
* @param choices
|
||||||
|
* a T object.
|
||||||
|
* @return null if choices is missing, empty, or if the users' choices are
|
||||||
|
* empty; otherwise, returns the first item in the List returned by
|
||||||
|
* getChoices.
|
||||||
|
* @see #getChoices(String, int, int, Object...)
|
||||||
|
*/
|
||||||
|
public static <T> T oneOrNone(final String message, final T[] choices) {
|
||||||
|
if ((choices == null) || (choices.length == 0)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
final List<T> choice = GuiChoose.getChoices(message, 0, 1, choices);
|
||||||
|
return choice.isEmpty() ? null : choice.get(0);
|
||||||
|
} // getChoiceOptional(String,T...)
|
||||||
|
|
||||||
|
public static <T> T oneOrNone(final String message, final Collection<T> choices) {
|
||||||
|
if ((choices == null) || (choices.size() == 0)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
final List<T> choice = GuiChoose.getChoices(message, 0, 1, choices);
|
||||||
|
return choice.isEmpty() ? null : choice.get(0);
|
||||||
|
} // getChoiceOptional(String,T...)
|
||||||
|
|
||||||
|
// returned Object will never be null
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* getChoice.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param <T>
|
||||||
|
* a T object.
|
||||||
|
* @param message
|
||||||
|
* a {@link java.lang.String} object.
|
||||||
|
* @param choices
|
||||||
|
* a T object.
|
||||||
|
* @return a T object.
|
||||||
|
*/
|
||||||
|
public static <T> T one(final String message, final T[] choices) {
|
||||||
|
final List<T> choice = GuiChoose.getChoices(message, 1, 1, choices);
|
||||||
|
assert choice.size() == 1;
|
||||||
|
return choice.get(0);
|
||||||
|
} // getChoice()
|
||||||
|
|
||||||
|
// Nothing to choose here. Code uses this to just show a card.
|
||||||
|
public static Card one(final String message, final Card singleChoice) {
|
||||||
|
List<Card> choices = new ArrayList<Card>();
|
||||||
|
choices.add(singleChoice);
|
||||||
|
return one(message, choices);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> T one(final String message, final Collection<T> choices) {
|
||||||
|
final List<T> choice = GuiChoose.getChoices(message, 1, 1, choices);
|
||||||
|
assert choice.size() == 1;
|
||||||
|
return choice.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// returned Object will never be null
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* getChoicesOptional.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param <T>
|
||||||
|
* a T object.
|
||||||
|
* @param message
|
||||||
|
* a {@link java.lang.String} object.
|
||||||
|
* @param choices
|
||||||
|
* a T object.
|
||||||
|
* @return a {@link java.util.List} object.
|
||||||
|
*/
|
||||||
|
public static <T> List<T> noneOrMany(final String message, final T[] choices) {
|
||||||
|
return GuiChoose.getChoices(message, 0, choices.length, choices);
|
||||||
|
} // getChoice()
|
||||||
|
|
||||||
|
public static <T> List<T> noneOrMany(final String message, final List<T> choices) {
|
||||||
|
return GuiChoose.getChoices(message, 0, choices.size(), choices);
|
||||||
|
}
|
||||||
|
|
||||||
|
// returned Object will never be null
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* getChoices.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param <T>
|
||||||
|
* a T object.
|
||||||
|
* @param message
|
||||||
|
* a {@link java.lang.String} object.
|
||||||
|
* @param choices
|
||||||
|
* a T object.
|
||||||
|
* @return a {@link java.util.List} object.
|
||||||
|
*/
|
||||||
|
public static <T> List<T> oneOrMany(final String message, final T[] choices) {
|
||||||
|
return GuiChoose.getChoices(message, 1, choices.length, choices);
|
||||||
|
} // getChoice()
|
||||||
|
|
||||||
|
// returned Object will never be null
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* getChoices.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param <T>
|
||||||
|
* a T object.
|
||||||
|
* @param message
|
||||||
|
* a {@link java.lang.String} object.
|
||||||
|
* @param min
|
||||||
|
* a int.
|
||||||
|
* @param max
|
||||||
|
* a int.
|
||||||
|
* @param choices
|
||||||
|
* a T object.
|
||||||
|
* @return a {@link java.util.List} object.
|
||||||
|
*/
|
||||||
|
private static <T> List<T> getChoices(final String message, final int min, final int max, final T[] choices) {
|
||||||
|
final ListChooser<T> c = new ListChooser<T>(message, min, max, choices);
|
||||||
|
return getChoices(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T> List<T> getChoices(final String message, final int min, final int max, final Collection<T> choices) {
|
||||||
|
final ListChooser<T> c = new ListChooser<T>(message, min, max, choices);
|
||||||
|
return getChoices(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T> List<T> getChoices(final ListChooser<T> c) {
|
||||||
|
|
||||||
|
final JList list = c.getJList();
|
||||||
|
list.addListSelectionListener(new ListSelectionListener() {
|
||||||
|
@Override
|
||||||
|
public void valueChanged(final ListSelectionEvent ev) {
|
||||||
|
if (list.getSelectedValue() instanceof Card) {
|
||||||
|
CMatchUI.SINGLETON_INSTANCE.setCard((Card) list.getSelectedValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
c.show();
|
||||||
|
return c.getSelectedValues();
|
||||||
|
} // getChoice()
|
||||||
|
|
||||||
|
public static List<Object> getOrderChoices(final String title, final String top, int remainingObjects, final Object[] sourceChoices, Object[] destChoices) {
|
||||||
|
// An input box for handling the order of choices.
|
||||||
|
final JFrame frame = new JFrame();
|
||||||
|
DualListBox dual = new DualListBox(remainingObjects, top, sourceChoices, destChoices);
|
||||||
|
|
||||||
|
frame.setLayout(new BorderLayout());
|
||||||
|
frame.setSize(dual.getPreferredSize());
|
||||||
|
frame.add(dual);
|
||||||
|
frame.setTitle(title);
|
||||||
|
frame.setVisible(false);
|
||||||
|
|
||||||
|
final JDialog dialog = new JDialog(frame, true);
|
||||||
|
dialog.setTitle(title);
|
||||||
|
dialog.setContentPane(dual);
|
||||||
|
dialog.setSize(dual.getPreferredSize());
|
||||||
|
dialog.setLocationRelativeTo(null);
|
||||||
|
dialog.pack();
|
||||||
|
dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
|
||||||
|
dialog.setVisible(true);
|
||||||
|
|
||||||
|
List<Object> objects = dual.getOrderedList();
|
||||||
|
|
||||||
|
dialog.dispose();
|
||||||
|
return objects;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -620,7 +620,7 @@ public final class GuiDisplayUtil {
|
|||||||
*/
|
*/
|
||||||
public static void devModeTutor() {
|
public static void devModeTutor() {
|
||||||
final CardList lib = AllZone.getHumanPlayer().getCardsIn(ZoneType.Library);
|
final CardList lib = AllZone.getHumanPlayer().getCardsIn(ZoneType.Library);
|
||||||
final Object o = GuiUtils.chooseOneOrNone("Choose a card", lib);
|
final Object o = GuiChoose.oneOrNone("Choose a card", lib);
|
||||||
if (null == o) {
|
if (null == o) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@@ -685,12 +685,12 @@ public final class GuiDisplayUtil {
|
|||||||
* @since 1.0.15
|
* @since 1.0.15
|
||||||
*/
|
*/
|
||||||
public static void devModeAddCounter() {
|
public static void devModeAddCounter() {
|
||||||
final Card o = GuiUtils.chooseOneOrNone("Add counters to which card?", AllZoneUtil.getCardsIn(ZoneType.Battlefield));
|
final Card o = GuiChoose.oneOrNone("Add counters to which card?", AllZoneUtil.getCardsIn(ZoneType.Battlefield));
|
||||||
if (null == o) {
|
if (null == o) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
final Card c = (Card) o;
|
final Card c = (Card) o;
|
||||||
final Counters counter = GuiUtils.chooseOneOrNone("Which type of counter?", Counters.values());
|
final Counters counter = GuiChoose.oneOrNone("Which type of counter?", Counters.values());
|
||||||
if (null == counter) {
|
if (null == counter) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@@ -698,7 +698,7 @@ public final class GuiDisplayUtil {
|
|||||||
for (int j = 0; j < 99; j++) {
|
for (int j = 0; j < 99; j++) {
|
||||||
integers[j] = Integer.valueOf(j);
|
integers[j] = Integer.valueOf(j);
|
||||||
}
|
}
|
||||||
final Integer i = GuiUtils.chooseOneOrNone("How many counters?", integers);
|
final Integer i = GuiChoose.oneOrNone("How many counters?", integers);
|
||||||
if (null == i) {
|
if (null == i) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@@ -717,7 +717,7 @@ public final class GuiDisplayUtil {
|
|||||||
*/
|
*/
|
||||||
public static void devModeTapPerm() {
|
public static void devModeTapPerm() {
|
||||||
final CardList play = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
final CardList play = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||||
final Object o = GuiUtils.chooseOneOrNone("Choose a permanent", play);
|
final Object o = GuiChoose.oneOrNone("Choose a permanent", play);
|
||||||
if (null == o) {
|
if (null == o) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@@ -735,7 +735,7 @@ public final class GuiDisplayUtil {
|
|||||||
*/
|
*/
|
||||||
public static void devModeUntapPerm() {
|
public static void devModeUntapPerm() {
|
||||||
final CardList play = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
final CardList play = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||||
final Object o = GuiUtils.chooseOneOrNone("Choose a permanent", play);
|
final Object o = GuiChoose.oneOrNone("Choose a permanent", play);
|
||||||
if (null == o) {
|
if (null == o) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@@ -764,7 +764,7 @@ public final class GuiDisplayUtil {
|
|||||||
*/
|
*/
|
||||||
public static void devModeSetLife() {
|
public static void devModeSetLife() {
|
||||||
final List<Player> players = AllZone.getPlayersInGame();
|
final List<Player> players = AllZone.getPlayersInGame();
|
||||||
final Player o = GuiUtils.chooseOneOrNone("Set life for which player?", players);
|
final Player o = GuiChoose.oneOrNone("Set life for which player?", players);
|
||||||
if (null == o) {
|
if (null == o) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@@ -773,7 +773,7 @@ public final class GuiDisplayUtil {
|
|||||||
for (int j = 0; j < 99; j++) {
|
for (int j = 0; j < 99; j++) {
|
||||||
integers[j] = Integer.valueOf(j);
|
integers[j] = Integer.valueOf(j);
|
||||||
}
|
}
|
||||||
final Integer i = GuiUtils.chooseOneOrNone("Set life to what?", integers);
|
final Integer i = GuiChoose.oneOrNone("Set life to what?", integers);
|
||||||
if (null == i) {
|
if (null == i) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -17,36 +17,19 @@
|
|||||||
*/
|
*/
|
||||||
package forge.gui;
|
package forge.gui;
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.FontFormatException;
|
import java.awt.FontFormatException;
|
||||||
import java.awt.Image;
|
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import java.awt.Window;
|
import java.awt.Window;
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.swing.Box;
|
import javax.swing.Box;
|
||||||
import javax.swing.ImageIcon;
|
|
||||||
import javax.swing.JDialog;
|
|
||||||
import javax.swing.JFrame;
|
|
||||||
import javax.swing.JList;
|
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.WindowConstants;
|
|
||||||
import javax.swing.event.ListSelectionEvent;
|
|
||||||
import javax.swing.event.ListSelectionListener;
|
|
||||||
|
|
||||||
import forge.Card;
|
|
||||||
import forge.gui.match.CMatchUI;
|
|
||||||
import forge.properties.ForgeProps;
|
|
||||||
import forge.properties.NewConstants;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -140,264 +123,6 @@ public final class GuiUtils {
|
|||||||
component.setFont(oldFont.deriveFont((float) newSize));
|
component.setFont(oldFont.deriveFont((float) newSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* getIconFromFile.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param filename
|
|
||||||
* a {@link java.lang.String} object.
|
|
||||||
* @return a {@link javax.swing.ImageIcon} object.
|
|
||||||
*/
|
|
||||||
public static ImageIcon getIconFromFile(final String filename) {
|
|
||||||
final File base = ForgeProps.getFile(NewConstants.IMAGE_ICON);
|
|
||||||
final File file = new File(base, filename);
|
|
||||||
if (filename.equals("") || !file.exists()) {
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
return new ImageIcon(file.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* getResizedIcon.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param filename
|
|
||||||
* String.
|
|
||||||
* @param scale
|
|
||||||
* Double.
|
|
||||||
* @return {@link javax.swing.ImageIcon} object
|
|
||||||
*/
|
|
||||||
public static ImageIcon getResizedIcon(final String filename, final double scale) {
|
|
||||||
final ImageIcon icon = GuiUtils.getIconFromFile(filename);
|
|
||||||
|
|
||||||
final int w = (int) (icon.getIconWidth() * scale);
|
|
||||||
final int h = (int) (icon.getIconHeight() * scale);
|
|
||||||
|
|
||||||
return new ImageIcon(icon.getImage().getScaledInstance(w, h, Image.SCALE_SMOOTH));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* getResizedIcon.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param icon
|
|
||||||
* ImageIcon
|
|
||||||
* @param scale
|
|
||||||
* Double
|
|
||||||
* @return {@link javax.swing.ImageIcon} object
|
|
||||||
*/
|
|
||||||
public static ImageIcon getResizedIcon(final ImageIcon icon, final double scale) {
|
|
||||||
final int w = (int) (icon.getIconWidth() * scale);
|
|
||||||
final int h = (int) (icon.getIconHeight() * scale);
|
|
||||||
|
|
||||||
return new ImageIcon(icon.getImage().getScaledInstance(w, h, Image.SCALE_SMOOTH));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* getResizedIcon.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param icon
|
|
||||||
* a {@link javax.swing.ImageIcon} object.
|
|
||||||
* @param width
|
|
||||||
* a int.
|
|
||||||
* @param height
|
|
||||||
* a int.
|
|
||||||
* @return a {@link javax.swing.ImageIcon} object.
|
|
||||||
*/
|
|
||||||
public static ImageIcon getResizedIcon(final ImageIcon icon, final int width, final int height) {
|
|
||||||
return new ImageIcon(icon.getImage().getScaledInstance(width, height, Image.SCALE_SMOOTH));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* getEmptyIcon.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param width
|
|
||||||
* a int.
|
|
||||||
* @param height
|
|
||||||
* a int.
|
|
||||||
* @return a {@link javax.swing.ImageIcon} object.
|
|
||||||
*/
|
|
||||||
public static ImageIcon getEmptyIcon(final int width, final int height) {
|
|
||||||
return new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convenience for getChoices(message, 0, 1, choices).
|
|
||||||
*
|
|
||||||
* @param <T>
|
|
||||||
* is automatically inferred.
|
|
||||||
* @param message
|
|
||||||
* a {@link java.lang.String} object.
|
|
||||||
* @param choices
|
|
||||||
* a T object.
|
|
||||||
* @return null if choices is missing, empty, or if the users' choices are
|
|
||||||
* empty; otherwise, returns the first item in the List returned by
|
|
||||||
* getChoices.
|
|
||||||
* @see #getChoices(String, int, int, Object...)
|
|
||||||
*/
|
|
||||||
public static <T> T chooseOneOrNone(final String message, final T[] choices) {
|
|
||||||
if ((choices == null) || (choices.length == 0)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
final List<T> choice = GuiUtils.getChoices(message, 0, 1, choices);
|
|
||||||
return choice.isEmpty() ? null : choice.get(0);
|
|
||||||
} // getChoiceOptional(String,T...)
|
|
||||||
|
|
||||||
public static <T> T chooseOneOrNone(final String message, final Collection<T> choices) {
|
|
||||||
if ((choices == null) || (choices.size() == 0)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
final List<T> choice = GuiUtils.getChoices(message, 0, 1, choices);
|
|
||||||
return choice.isEmpty() ? null : choice.get(0);
|
|
||||||
} // getChoiceOptional(String,T...)
|
|
||||||
|
|
||||||
// returned Object will never be null
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* getChoice.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param <T>
|
|
||||||
* a T object.
|
|
||||||
* @param message
|
|
||||||
* a {@link java.lang.String} object.
|
|
||||||
* @param choices
|
|
||||||
* a T object.
|
|
||||||
* @return a T object.
|
|
||||||
*/
|
|
||||||
public static <T> T chooseOne(final String message, final T[] choices) {
|
|
||||||
final List<T> choice = GuiUtils.getChoices(message, 1, 1, choices);
|
|
||||||
assert choice.size() == 1;
|
|
||||||
return choice.get(0);
|
|
||||||
} // getChoice()
|
|
||||||
|
|
||||||
// Nothing to choose here. Code uses this to just show a card.
|
|
||||||
public static Card chooseOne(final String message, final Card singleChoice) {
|
|
||||||
List<Card> choices = new ArrayList<Card>();
|
|
||||||
choices.add(singleChoice);
|
|
||||||
return chooseOne(message, choices);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <T> T chooseOne(final String message, final Collection<T> choices) {
|
|
||||||
final List<T> choice = GuiUtils.getChoices(message, 1, 1, choices);
|
|
||||||
assert choice.size() == 1;
|
|
||||||
return choice.get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// returned Object will never be null
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* getChoicesOptional.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param <T>
|
|
||||||
* a T object.
|
|
||||||
* @param message
|
|
||||||
* a {@link java.lang.String} object.
|
|
||||||
* @param choices
|
|
||||||
* a T object.
|
|
||||||
* @return a {@link java.util.List} object.
|
|
||||||
*/
|
|
||||||
public static <T> List<T> chooseNoneOrMany(final String message, final T[] choices) {
|
|
||||||
return GuiUtils.getChoices(message, 0, choices.length, choices);
|
|
||||||
} // getChoice()
|
|
||||||
public static <T> List<T> chooseNoneOrMany(final String message, final List<T> choices) {
|
|
||||||
return GuiUtils.getChoices(message, 0, choices.size(), choices);
|
|
||||||
}
|
|
||||||
// returned Object will never be null
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* getChoices.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param <T>
|
|
||||||
* a T object.
|
|
||||||
* @param message
|
|
||||||
* a {@link java.lang.String} object.
|
|
||||||
* @param choices
|
|
||||||
* a T object.
|
|
||||||
* @return a {@link java.util.List} object.
|
|
||||||
*/
|
|
||||||
public static <T> List<T> chooseOneOrMany(final String message, final T[] choices) {
|
|
||||||
return GuiUtils.getChoices(message, 1, choices.length, choices);
|
|
||||||
} // getChoice()
|
|
||||||
|
|
||||||
// returned Object will never be null
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* getChoices.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param <T>
|
|
||||||
* a T object.
|
|
||||||
* @param message
|
|
||||||
* a {@link java.lang.String} object.
|
|
||||||
* @param min
|
|
||||||
* a int.
|
|
||||||
* @param max
|
|
||||||
* a int.
|
|
||||||
* @param choices
|
|
||||||
* a T object.
|
|
||||||
* @return a {@link java.util.List} object.
|
|
||||||
*/
|
|
||||||
private static <T> List<T> getChoices(final String message, final int min, final int max, final T[] choices) {
|
|
||||||
final ListChooser<T> c = new ListChooser<T>(message, min, max, choices);
|
|
||||||
return getChoices(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static <T> List<T> getChoices(final String message, final int min, final int max, final Collection<T> choices) {
|
|
||||||
final ListChooser<T> c = new ListChooser<T>(message, min, max, choices);
|
|
||||||
return getChoices(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static <T> List<T> getChoices(final ListChooser<T> c) {
|
|
||||||
|
|
||||||
final JList list = c.getJList();
|
|
||||||
list.addListSelectionListener(new ListSelectionListener() {
|
|
||||||
@Override
|
|
||||||
public void valueChanged(final ListSelectionEvent ev) {
|
|
||||||
if (list.getSelectedValue() instanceof Card) {
|
|
||||||
CMatchUI.SINGLETON_INSTANCE.setCard((Card) list.getSelectedValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
c.show();
|
|
||||||
return c.getSelectedValues();
|
|
||||||
} // getChoice()
|
|
||||||
|
|
||||||
public static List<Object> getOrderChoices(final String title, final String top, int remainingObjects, final Object[] sourceChoices, Object[] destChoices) {
|
|
||||||
// An input box for handling the order of choices.
|
|
||||||
final JFrame frame = new JFrame();
|
|
||||||
DualListBox dual = new DualListBox(remainingObjects, top, sourceChoices, destChoices);
|
|
||||||
|
|
||||||
frame.setLayout(new BorderLayout());
|
|
||||||
frame.setSize(dual.getPreferredSize());
|
|
||||||
frame.add(dual);
|
|
||||||
frame.setTitle(title);
|
|
||||||
frame.setVisible(false);
|
|
||||||
|
|
||||||
final JDialog dialog = new JDialog(frame, true);
|
|
||||||
dialog.setTitle(title);
|
|
||||||
dialog.setContentPane(dual);
|
|
||||||
dialog.setSize(dual.getPreferredSize());
|
|
||||||
dialog.setLocationRelativeTo(null);
|
|
||||||
dialog.pack();
|
|
||||||
dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
|
|
||||||
dialog.setVisible(true);
|
|
||||||
|
|
||||||
List<Object> objects = dual.getOrderedList();
|
|
||||||
|
|
||||||
dialog.dispose();
|
|
||||||
return objects;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Centers a frame on the screen based on its current size.
|
* Centers a frame on the screen based on its current size.
|
||||||
@@ -437,26 +162,6 @@ public final class GuiUtils {
|
|||||||
return ttf;
|
return ttf;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Duplicate in DeckEditorQuestMenu and
|
|
||||||
* probably elsewhere...can streamline at some point
|
|
||||||
* (probably shouldn't be here).
|
|
||||||
*
|
|
||||||
* @param in   {@link java.lang.String}
|
|
||||||
* @return {@link java.lang.String}
|
|
||||||
*/
|
|
||||||
public static String cleanString(final String in) {
|
|
||||||
final StringBuffer out = new StringBuffer();
|
|
||||||
final char[] c = in.toCharArray();
|
|
||||||
|
|
||||||
for (int i = 0; (i < c.length) && (i < 20); i++) {
|
|
||||||
if (Character.isLetterOrDigit(c[i]) || (c[i] == '-') || (c[i] == '_') || (c[i] == ' ')) {
|
|
||||||
out.append(c[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return out.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Checks if calling method uses event dispatch thread.
|
/** Checks if calling method uses event dispatch thread.
|
||||||
* Exception thrown if method is on "wrong" thread.
|
* Exception thrown if method is on "wrong" thread.
|
||||||
* A boolean is passed to indicate if the method must be EDT or not.
|
* A boolean is passed to indicate if the method must be EDT or not.
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import javax.swing.JOptionPane;
|
|||||||
import forge.AllZone;
|
import forge.AllZone;
|
||||||
import forge.Command;
|
import forge.Command;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.gui.GuiUtils;
|
|
||||||
import forge.gui.framework.ICDoc;
|
import forge.gui.framework.ICDoc;
|
||||||
import forge.properties.ForgeProps;
|
import forge.properties.ForgeProps;
|
||||||
import forge.properties.NewConstants;
|
import forge.properties.NewConstants;
|
||||||
@@ -151,7 +150,7 @@ public enum CSubmenuQuestData implements ICDoc {
|
|||||||
|
|
||||||
if (o == null) { return; }
|
if (o == null) { return; }
|
||||||
|
|
||||||
final String questName = GuiUtils.cleanString(o.toString());
|
final String questName = SSubmenuQuestUtil.cleanString(o.toString());
|
||||||
|
|
||||||
if (getAllQuests().get(questName) != null || questName.equals("")) {
|
if (getAllQuests().get(questName) != null || questName.equals("")) {
|
||||||
JOptionPane.showMessageDialog(null, "Please pick another quest name, a quest already has that name.");
|
JOptionPane.showMessageDialog(null, "Please pick another quest name, a quest already has that name.");
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import javax.swing.border.MatteBorder;
|
|||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import forge.Command;
|
import forge.Command;
|
||||||
import forge.gui.GuiUtils;
|
|
||||||
import forge.gui.toolbox.FLabel;
|
import forge.gui.toolbox.FLabel;
|
||||||
import forge.gui.toolbox.FSkin;
|
import forge.gui.toolbox.FSkin;
|
||||||
import forge.properties.ForgeProps;
|
import forge.properties.ForgeProps;
|
||||||
@@ -300,7 +299,7 @@ public class QuestFileLister extends JPanel {
|
|||||||
|
|
||||||
if (o == null) { return; }
|
if (o == null) { return; }
|
||||||
|
|
||||||
final String questName = GuiUtils.cleanString(o.toString());
|
final String questName = SSubmenuQuestUtil.cleanString(o.toString());
|
||||||
|
|
||||||
boolean exists = false;
|
boolean exists = false;
|
||||||
|
|
||||||
|
|||||||
@@ -349,5 +349,25 @@ public class SSubmenuQuestUtil {
|
|||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Duplicate in DeckEditorQuestMenu and
|
||||||
|
* probably elsewhere...can streamline at some point
|
||||||
|
* (probably shouldn't be here).
|
||||||
|
*
|
||||||
|
* @param in   {@link java.lang.String}
|
||||||
|
* @return {@link java.lang.String}
|
||||||
|
*/
|
||||||
|
public static String cleanString(final String in) {
|
||||||
|
final StringBuffer out = new StringBuffer();
|
||||||
|
final char[] c = in.toCharArray();
|
||||||
|
|
||||||
|
for (int i = 0; (i < c.length) && (i < 20); i++) {
|
||||||
|
if (Character.isLetterOrDigit(c[i]) || (c[i] == '-') || (c[i] == '_') || (c[i] == ' ')) {
|
||||||
|
out.append(c[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return out.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import forge.game.GameNew;
|
|||||||
import forge.game.GameType;
|
import forge.game.GameType;
|
||||||
import forge.game.limited.BoosterDraft;
|
import forge.game.limited.BoosterDraft;
|
||||||
import forge.game.limited.CardPoolLimitation;
|
import forge.game.limited.CardPoolLimitation;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.gui.SOverlayUtils;
|
import forge.gui.SOverlayUtils;
|
||||||
import forge.gui.deckeditor.CDeckEditorUI;
|
import forge.gui.deckeditor.CDeckEditorUI;
|
||||||
import forge.gui.deckeditor.controllers.CEditorDraftingProcess;
|
import forge.gui.deckeditor.controllers.CEditorDraftingProcess;
|
||||||
@@ -234,7 +234,7 @@ public enum CSubmenuDraft implements ICDoc {
|
|||||||
draftTypes.add("Custom");
|
draftTypes.add("Custom");
|
||||||
|
|
||||||
final String prompt = "Choose Draft Format:";
|
final String prompt = "Choose Draft Format:";
|
||||||
final Object o = GuiUtils.chooseOne(prompt, draftTypes);
|
final Object o = GuiChoose.one(prompt, draftTypes);
|
||||||
|
|
||||||
if (o.toString().equals(draftTypes.get(0))) {
|
if (o.toString().equals(draftTypes.get(0))) {
|
||||||
draft.showGui(new BoosterDraft(CardPoolLimitation.Full));
|
draft.showGui(new BoosterDraft(CardPoolLimitation.Full));
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import forge.deck.DeckGroup;
|
|||||||
import forge.game.GameType;
|
import forge.game.GameType;
|
||||||
import forge.game.limited.SealedDeck;
|
import forge.game.limited.SealedDeck;
|
||||||
import forge.game.limited.SealedDeckFormat;
|
import forge.game.limited.SealedDeckFormat;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.gui.deckeditor.CDeckEditorUI;
|
import forge.gui.deckeditor.CDeckEditorUI;
|
||||||
import forge.gui.deckeditor.controllers.ACEditorBase;
|
import forge.gui.deckeditor.controllers.ACEditorBase;
|
||||||
import forge.gui.deckeditor.controllers.CEditorLimited;
|
import forge.gui.deckeditor.controllers.CEditorLimited;
|
||||||
@@ -140,7 +140,7 @@ public enum CSubmenuSealed implements ICDoc {
|
|||||||
sealedTypes.add("Custom");
|
sealedTypes.add("Custom");
|
||||||
|
|
||||||
final String prompt = "Choose Sealed Deck Format:";
|
final String prompt = "Choose Sealed Deck Format:";
|
||||||
final Object o = GuiUtils.chooseOne(prompt, sealedTypes);
|
final Object o = GuiChoose.one(prompt, sealedTypes);
|
||||||
|
|
||||||
SealedDeckFormat sd = null;
|
SealedDeckFormat sd = null;
|
||||||
|
|
||||||
@@ -177,7 +177,7 @@ public enum CSubmenuSealed implements ICDoc {
|
|||||||
integers[i] = Integer.valueOf(i + 1);
|
integers[i] = Integer.valueOf(i + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Integer rounds = GuiUtils.chooseOne("How many rounds?", integers);
|
Integer rounds = GuiChoose.one("How many rounds?", integers);
|
||||||
|
|
||||||
// System.out.println("You selected " + rounds + " rounds.");
|
// System.out.println("You selected " + rounds + " rounds.");
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import forge.deck.Deck;
|
|||||||
import forge.game.GameNew;
|
import forge.game.GameNew;
|
||||||
import forge.game.GameType;
|
import forge.game.GameType;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiChoose;
|
||||||
import forge.gui.SOverlayUtils;
|
import forge.gui.SOverlayUtils;
|
||||||
import forge.item.CardDb;
|
import forge.item.CardDb;
|
||||||
import forge.item.CardPrinted;
|
import forge.item.CardPrinted;
|
||||||
@@ -106,7 +106,7 @@ public class ControlWinLose {
|
|||||||
|
|
||||||
Constant.Runtime.COMPUTER_DECK[0] = cDeck;
|
Constant.Runtime.COMPUTER_DECK[0] = cDeck;
|
||||||
|
|
||||||
List<Card> o = GuiUtils.chooseNoneOrMany("Select cards to add to your deck", compAntes);
|
List<Card> o = GuiChoose.noneOrMany("Select cards to add to your deck", compAntes);
|
||||||
if (null != o) {
|
if (null != o) {
|
||||||
for (Card c : o) {
|
for (Card c : o) {
|
||||||
hDeck.getMain().add(c);
|
hDeck.getMain().add(c);
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import forge.game.GamePlayerRating;
|
|||||||
import forge.game.GameSummary;
|
import forge.game.GameSummary;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiUtils;
|
|
||||||
import forge.gui.ListChooser;
|
import forge.gui.ListChooser;
|
||||||
import forge.gui.SOverlayUtils;
|
import forge.gui.SOverlayUtils;
|
||||||
import forge.gui.home.quest.CSubmenuChallenges;
|
import forge.gui.home.quest.CSubmenuChallenges;
|
||||||
@@ -51,6 +50,7 @@ import forge.util.MyRandom;
|
|||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Image;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -486,7 +486,7 @@ public class QuestWinLoseHandler extends ControlWinLose {
|
|||||||
qData.getAssets().addCredits(credTotal);
|
qData.getAssets().addCredits(credTotal);
|
||||||
|
|
||||||
// Generate Swing components and attach.
|
// Generate Swing components and attach.
|
||||||
this.icoTemp = GuiUtils.getResizedIcon(FSkin.getIcon(FSkin.QuestIcons.ICO_GOLD), 0.5);
|
this.icoTemp = QuestWinLoseHandler.getResizedIcon(FSkin.getIcon(FSkin.QuestIcons.ICO_GOLD), 0.5);
|
||||||
|
|
||||||
this.lblTemp1 = new TitleLabel("Gameplay Results");
|
this.lblTemp1 = new TitleLabel("Gameplay Results");
|
||||||
|
|
||||||
@@ -594,7 +594,7 @@ public class QuestWinLoseHandler extends ControlWinLose {
|
|||||||
qData.getAssets().addCredits(questRewardCredits);
|
qData.getAssets().addCredits(questRewardCredits);
|
||||||
|
|
||||||
// Generate Swing components and attach.
|
// Generate Swing components and attach.
|
||||||
this.icoTemp = GuiUtils.getResizedIcon(FSkin.getIcon(FSkin.QuestIcons.ICO_BOX), 0.5);
|
this.icoTemp = QuestWinLoseHandler.getResizedIcon(FSkin.getIcon(FSkin.QuestIcons.ICO_BOX), 0.5);
|
||||||
this.lblTemp1 = new TitleLabel("Challenge Rewards for \"" + ((QuestEventChallenge) qEvent).getTitle() + "\"");
|
this.lblTemp1 = new TitleLabel("Challenge Rewards for \"" + ((QuestEventChallenge) qEvent).getTitle() + "\"");
|
||||||
|
|
||||||
this.lblTemp2 = new JLabel(sb.toString());
|
this.lblTemp2 = new JLabel(sb.toString());
|
||||||
@@ -616,7 +616,7 @@ public class QuestWinLoseHandler extends ControlWinLose {
|
|||||||
|
|
||||||
private void penalizeLoss() {
|
private void penalizeLoss() {
|
||||||
final int x = Singletons.getModel().getQuestPreferences().getPreferenceInt(QPref.PENALTY_LOSS);
|
final int x = Singletons.getModel().getQuestPreferences().getPreferenceInt(QPref.PENALTY_LOSS);
|
||||||
this.icoTemp = GuiUtils.getResizedIcon(FSkin.getIcon(FSkin.QuestIcons.ICO_HEART), 0.5);
|
this.icoTemp = QuestWinLoseHandler.getResizedIcon(FSkin.getIcon(FSkin.QuestIcons.ICO_HEART), 0.5);
|
||||||
|
|
||||||
this.lblTemp1 = new TitleLabel("Gameplay Results");
|
this.lblTemp1 = new TitleLabel("Gameplay Results");
|
||||||
|
|
||||||
@@ -699,6 +699,24 @@ public class QuestWinLoseHandler extends ControlWinLose {
|
|||||||
return credits;
|
return credits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* getResizedIcon.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param icon
|
||||||
|
* ImageIcon
|
||||||
|
* @param scale
|
||||||
|
* Double
|
||||||
|
* @return {@link javax.swing.ImageIcon} object
|
||||||
|
*/
|
||||||
|
public static ImageIcon getResizedIcon(final ImageIcon icon, final double scale) {
|
||||||
|
final int w = (int) (icon.getIconWidth() * scale);
|
||||||
|
final int h = (int) (icon.getIconHeight() * scale);
|
||||||
|
|
||||||
|
return new ImageIcon(icon.getImage().getScaledInstance(w, h, Image.SCALE_SMOOTH));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JLabel header between reward sections.
|
* JLabel header between reward sections.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -49,8 +49,8 @@ import forge.game.player.Player;
|
|||||||
import forge.game.zone.PlayerZone;
|
import forge.game.zone.PlayerZone;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.ForgeAction;
|
import forge.gui.ForgeAction;
|
||||||
|
import forge.gui.GuiChoose;
|
||||||
import forge.gui.GuiDisplayUtil;
|
import forge.gui.GuiDisplayUtil;
|
||||||
import forge.gui.GuiUtils;
|
|
||||||
import forge.gui.framework.ICDoc;
|
import forge.gui.framework.ICDoc;
|
||||||
import forge.gui.match.CMatchUI;
|
import forge.gui.match.CMatchUI;
|
||||||
import forge.gui.match.controllers.CMessage;
|
import forge.gui.match.controllers.CMessage;
|
||||||
@@ -287,7 +287,7 @@ public class CField implements ICDoc {
|
|||||||
final ArrayList<Card> choices2 = new ArrayList<Card>();
|
final ArrayList<Card> choices2 = new ArrayList<Card>();
|
||||||
|
|
||||||
if (choices.isEmpty()) {
|
if (choices.isEmpty()) {
|
||||||
GuiUtils.chooseOneOrNone(this.title, new String[] { "no cards" });
|
GuiChoose.oneOrNone(this.title, new String[] { "no cards" });
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < choices.size(); i++) {
|
for (int i = 0; i < choices.size(); i++) {
|
||||||
final Card crd = choices.get(i);
|
final Card crd = choices.get(i);
|
||||||
@@ -306,7 +306,7 @@ public class CField implements ICDoc {
|
|||||||
choices2.add(crd);
|
choices2.add(crd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final Card choice = (Card) GuiUtils.chooseOneOrNone(this.title, choices2);
|
final Card choice = (Card) GuiChoose.oneOrNone(this.title, choices2);
|
||||||
if (choice != null) {
|
if (choice != null) {
|
||||||
this.doAction(choice);
|
this.doAction(choice);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user