mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
- CheckStyle.
This commit is contained in:
@@ -189,7 +189,7 @@ public enum VDev implements IVDoc<CDev> {
|
|||||||
public DevLabel getLblCardToHand() {
|
public DevLabel getLblCardToHand() {
|
||||||
return this.lblCardToHand;
|
return this.lblCardToHand;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return {@link forge.gui.match.views.VDev.DevLabel} */
|
/** @return {@link forge.gui.match.views.VDev.DevLabel} */
|
||||||
public final DevLabel getLblCardToBattlefield() {
|
public final DevLabel getLblCardToBattlefield() {
|
||||||
return lblCardToBattlefield;
|
return lblCardToBattlefield;
|
||||||
|
|||||||
@@ -45,26 +45,26 @@ public class FDeckChooser extends JPanel {
|
|||||||
CUSTOM, /** */
|
CUSTOM, /** */
|
||||||
QUESTEVENTS
|
QUESTEVENTS
|
||||||
}
|
}
|
||||||
|
|
||||||
private final QuestController quest = Singletons.getModel().getQuest();
|
private final QuestController quest = Singletons.getModel().getQuest();
|
||||||
|
|
||||||
private final JRadioButton radColors = new FRadioButton("Fully random color deck");
|
private final JRadioButton radColors = new FRadioButton("Fully random color deck");
|
||||||
private final JRadioButton radThemes = new FRadioButton("Semi-random theme deck");
|
private final JRadioButton radThemes = new FRadioButton("Semi-random theme deck");
|
||||||
private final JRadioButton radCustom = new FRadioButton("Custom user deck");
|
private final JRadioButton radCustom = new FRadioButton("Custom user deck");
|
||||||
private final JRadioButton radQuests = new FRadioButton("Quest opponent deck");
|
private final JRadioButton radQuests = new FRadioButton("Quest opponent deck");
|
||||||
|
|
||||||
private final JList lstDecks = new FList();
|
private final JList lstDecks = new FList();
|
||||||
private final ExperimentalLabel btnRandom = new ExperimentalLabel("Random");
|
private final ExperimentalLabel btnRandom = new ExperimentalLabel("Random");
|
||||||
|
|
||||||
private final JScrollPane scrDecks = new FScrollPane(lstDecks, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
private final JScrollPane scrDecks = new FScrollPane(lstDecks, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||||
|
|
||||||
private final FLabel lblDecklist = new FLabel.Builder()
|
private final FLabel lblDecklist = new FLabel.Builder()
|
||||||
.text("Double click a non-random deck for its decklist.")
|
.text("Double click a non-random deck for its decklist.")
|
||||||
.fontSize(12).build();
|
.fontSize(12).build();
|
||||||
|
|
||||||
private final JPanel pnlRadios = new JPanel(new MigLayout("insets 0, gap 0, wrap"));
|
private final JPanel pnlRadios = new JPanel(new MigLayout("insets 0, gap 0, wrap"));
|
||||||
private final PlayerType playerType;
|
private final PlayerType playerType;
|
||||||
|
|
||||||
|
|
||||||
private final MouseAdapter madDecklist = new MouseAdapter() {
|
private final MouseAdapter madDecklist = new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
@@ -76,24 +76,24 @@ public class FDeckChooser extends JPanel {
|
|||||||
DeckgenUtil.showDecklist(src);
|
DeckgenUtil.showDecklist(src);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public FDeckChooser(String titleText, PlayerType pt)
|
public FDeckChooser(String titleText, PlayerType pt) {
|
||||||
{
|
|
||||||
playerType = pt;
|
playerType = pt;
|
||||||
|
|
||||||
// Radio button panels: Human and AI
|
// Radio button panels: Human and AI
|
||||||
final String strRadioConstraints = "w 100%!, h 30px!";
|
final String strRadioConstraints = "w 100%!, h 30px!";
|
||||||
|
|
||||||
this.setOpaque(false);
|
this.setOpaque(false);
|
||||||
|
|
||||||
// Radio button group: Human
|
// Radio button group: Human
|
||||||
final ButtonGroup grpRadios = new ButtonGroup();
|
final ButtonGroup grpRadios = new ButtonGroup();
|
||||||
grpRadios.add(radCustom);
|
grpRadios.add(radCustom);
|
||||||
grpRadios.add(radQuests);
|
grpRadios.add(radQuests);
|
||||||
grpRadios.add(radColors);
|
grpRadios.add(radColors);
|
||||||
grpRadios.add(radThemes);
|
grpRadios.add(radThemes);
|
||||||
|
|
||||||
pnlRadios.setOpaque(false);
|
pnlRadios.setOpaque(false);
|
||||||
pnlRadios.add(new FLabel.Builder().text(titleText)
|
pnlRadios.add(new FLabel.Builder().text(titleText)
|
||||||
.fontStyle(Font.BOLD).fontSize(16)
|
.fontStyle(Font.BOLD).fontSize(16)
|
||||||
@@ -103,10 +103,10 @@ public class FDeckChooser extends JPanel {
|
|||||||
pnlRadios.add(radQuests, strRadioConstraints);
|
pnlRadios.add(radQuests, strRadioConstraints);
|
||||||
pnlRadios.add(radColors, strRadioConstraints);
|
pnlRadios.add(radColors, strRadioConstraints);
|
||||||
pnlRadios.add(radThemes, strRadioConstraints);
|
pnlRadios.add(radThemes, strRadioConstraints);
|
||||||
pnlRadios.add(btnRandom, "w 200px!, h 30px!, gap 0 0 10px 0, ax center");
|
pnlRadios.add(btnRandom, "w 200px!, h 30px!, gap 0 0 10px 0, ax center");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
// Radio button event handling
|
// Radio button event handling
|
||||||
getRadColors().addActionListener(new ActionListener() { @Override
|
getRadColors().addActionListener(new ActionListener() { @Override
|
||||||
@@ -124,13 +124,13 @@ public class FDeckChooser extends JPanel {
|
|||||||
getRadQuests().addActionListener(new ActionListener() { @Override
|
getRadQuests().addActionListener(new ActionListener() { @Override
|
||||||
public void actionPerformed(final ActionEvent arg0) {
|
public void actionPerformed(final ActionEvent arg0) {
|
||||||
updateQuestEvents(); } });
|
updateQuestEvents(); } });
|
||||||
|
|
||||||
// First run: colors
|
// First run: colors
|
||||||
getRadColors().setSelected(true);
|
getRadColors().setSelected(true);
|
||||||
updateColors();
|
updateColors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** @return {@link javax.swing.JList} */
|
/** @return {@link javax.swing.JList} */
|
||||||
public JList getLstDecks() {
|
public JList getLstDecks() {
|
||||||
return this.lstDecks;
|
return this.lstDecks;
|
||||||
@@ -173,7 +173,7 @@ public class FDeckChooser extends JPanel {
|
|||||||
|
|
||||||
final ExperimentalLabel btn = getBtnRandom();
|
final ExperimentalLabel btn = getBtnRandom();
|
||||||
|
|
||||||
btn.setCommand(new Command() { @Override public void execute() { lst.setSelectedIndices( DeckgenUtil.randomSelectColors()); } });
|
btn.setCommand(new Command() { @Override public void execute() { lst.setSelectedIndices(DeckgenUtil.randomSelectColors()); } });
|
||||||
|
|
||||||
// Init basic two color deck
|
// Init basic two color deck
|
||||||
lst.setSelectedIndices(new int[]{0, 1});
|
lst.setSelectedIndices(new int[]{0, 1});
|
||||||
@@ -249,8 +249,8 @@ public class FDeckChooser extends JPanel {
|
|||||||
|
|
||||||
// Init first in list
|
// Init first in list
|
||||||
lst.setSelectedIndex(0);
|
lst.setSelectedIndex(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Generates deck from current list selection(s). */
|
/** Generates deck from current list selection(s). */
|
||||||
public Deck getDeck() {
|
public Deck getDeck() {
|
||||||
JList lst0 = getLstDecks();
|
JList lst0 = getLstDecks();
|
||||||
@@ -293,12 +293,12 @@ public class FDeckChooser extends JPanel {
|
|||||||
* TODO: Write javadoc for this method.
|
* TODO: Write javadoc for this method.
|
||||||
*/
|
*/
|
||||||
public void populate() {
|
public void populate() {
|
||||||
|
|
||||||
this.setLayout(new MigLayout("insets 0, gap 0, flowy, ax right"));
|
this.setLayout(new MigLayout("insets 0, gap 0, flowy, ax right"));
|
||||||
|
|
||||||
this.add(pnlRadios, "w 100%!, gap 0 0 20px 20px");
|
this.add(pnlRadios, "w 100%!, gap 0 0 20px 20px");
|
||||||
this.add(scrDecks, "w 100%!, growy, pushy");
|
this.add(scrDecks, "w 100%!, growy, pushy");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ public final class CardDb {
|
|||||||
private final Map<String, Map<String, CardPrinted[]>> allCardsBySet = new Hashtable<String, Map<String, CardPrinted[]>>();
|
private final Map<String, Map<String, CardPrinted[]>> allCardsBySet = new Hashtable<String, Map<String, CardPrinted[]>>();
|
||||||
// this is the same list in flat storage
|
// this is the same list in flat storage
|
||||||
private final List<CardPrinted> allTraditionalCardsFlat = new ArrayList<CardPrinted>();
|
private final List<CardPrinted> allTraditionalCardsFlat = new ArrayList<CardPrinted>();
|
||||||
|
|
||||||
private final List<CardPrinted> allNonTraditionalCardsFlat = new ArrayList<CardPrinted>();
|
private final List<CardPrinted> allNonTraditionalCardsFlat = new ArrayList<CardPrinted>();
|
||||||
|
|
||||||
// Lambda to get rules for selects from list of printed cards
|
// Lambda to get rules for selects from list of printed cards
|
||||||
@@ -169,7 +169,7 @@ public final class CardDb {
|
|||||||
setMap.put(cardName, cardCopies);
|
setMap.put(cardName, cardCopies);
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
lastAdded = CardPrinted.build(card, set, s.getValue().getRarity(), i);
|
lastAdded = CardPrinted.build(card, set, s.getValue().getRarity(), i);
|
||||||
if(lastAdded.isTraditional()) {
|
if (lastAdded.isTraditional()) {
|
||||||
this.allTraditionalCardsFlat.add(lastAdded);
|
this.allTraditionalCardsFlat.add(lastAdded);
|
||||||
} else {
|
} else {
|
||||||
this.allNonTraditionalCardsFlat.add(lastAdded);
|
this.allNonTraditionalCardsFlat.add(lastAdded);
|
||||||
@@ -220,8 +220,10 @@ public final class CardDb {
|
|||||||
* @return true, if is card supported
|
* @return true, if is card supported
|
||||||
*/
|
*/
|
||||||
public boolean isCardSupported(final String cardName0) {
|
public boolean isCardSupported(final String cardName0) {
|
||||||
if ( null == cardName0 ) return false; // obviously
|
if (null == cardName0) {
|
||||||
|
return false; // obviously
|
||||||
|
}
|
||||||
|
|
||||||
final boolean isFoil = this.isFoil(cardName0);
|
final boolean isFoil = this.isFoil(cardName0);
|
||||||
final String cardName = isFoil ? this.removeFoilSuffix(cardName0) : cardName0;
|
final String cardName = isFoil ? this.removeFoilSuffix(cardName0) : cardName0;
|
||||||
final ImmutablePair<String, String> nameWithSet = CardDb.splitCardName(cardName);
|
final ImmutablePair<String, String> nameWithSet = CardDb.splitCardName(cardName);
|
||||||
@@ -230,8 +232,8 @@ public final class CardDb {
|
|||||||
}
|
}
|
||||||
return isCardSupported(nameWithSet.left, nameWithSet.right);
|
return isCardSupported(nameWithSet.left, nameWithSet.right);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCardSupported(final String cardName, String setName) {
|
public boolean isCardSupported(final String cardName, String setName) {
|
||||||
// Set exists?
|
// Set exists?
|
||||||
final Map<String, CardPrinted[]> cardsFromset = this.allCardsBySet.get(setName.toUpperCase());
|
final Map<String, CardPrinted[]> cardsFromset = this.allCardsBySet.get(setName.toUpperCase());
|
||||||
if (cardsFromset == null) {
|
if (cardsFromset == null) {
|
||||||
@@ -371,7 +373,7 @@ public final class CardDb {
|
|||||||
public Iterable<CardPrinted> getAllTraditionalCards() {
|
public Iterable<CardPrinted> getAllTraditionalCards() {
|
||||||
return this.allTraditionalCardsFlat;
|
return this.allTraditionalCardsFlat;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Iterable<CardPrinted> getAllNonTraditionalCards() {
|
public Iterable<CardPrinted> getAllNonTraditionalCards() {
|
||||||
return this.allNonTraditionalCardsFlat;
|
return this.allNonTraditionalCardsFlat;
|
||||||
}
|
}
|
||||||
@@ -409,7 +411,7 @@ public final class CardDb {
|
|||||||
if (null == result) {
|
if (null == result) {
|
||||||
throw new NoSuchElementException(String.format("Card '%s' not found in our database.", name));
|
throw new NoSuchElementException(String.format("Card '%s' not found in our database.", name));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isFoil) {
|
if (isFoil) {
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ public final class CardPrinted implements Comparable<CardPrinted>, InventoryItem
|
|||||||
public boolean isFoil() {
|
public boolean isFoil() {
|
||||||
return this.foiled;
|
return this.foiled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isTraditional() {
|
public boolean isTraditional() {
|
||||||
return !getCard().getType().isVanguard();
|
return !getCard().getType().isVanguard();
|
||||||
}
|
}
|
||||||
@@ -182,8 +182,8 @@ public final class CardPrinted implements Comparable<CardPrinted>, InventoryItem
|
|||||||
public Integer apply(final CardPrinted from) {
|
public Integer apply(final CardPrinted from) {
|
||||||
return Integer.valueOf(Singletons.getModel().getEditions().get(from.getEdition()).getIndex());
|
return Integer.valueOf(Singletons.getModel().getEditions().get(from.getEdition()).getIndex());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Constructor is private. All non-foiled instances are stored in CardDb
|
// Constructor is private. All non-foiled instances are stored in CardDb
|
||||||
private CardPrinted(final CardRules c, final String edition0, final CardRarity rare, final int index, final boolean foil) {
|
private CardPrinted(final CardRules c, final String edition0, final CardRarity rare, final int index, final boolean foil) {
|
||||||
this.card = c;
|
this.card = c;
|
||||||
@@ -322,7 +322,7 @@ public final class CardPrinted implements Comparable<CardPrinted>, InventoryItem
|
|||||||
* Number of filters based on CardPrinted values.
|
* Number of filters based on CardPrinted values.
|
||||||
*/
|
*/
|
||||||
public abstract static class Predicates {
|
public abstract static class Predicates {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type.
|
* Type.
|
||||||
* @param t
|
* @param t
|
||||||
@@ -440,20 +440,20 @@ public final class CardPrinted implements Comparable<CardPrinted>, InventoryItem
|
|||||||
this.mustContain = shouldContain;
|
this.mustContain = shouldContain;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class PredicateType implements Predicate<CardPrinted> {
|
private static class PredicateType implements Predicate<CardPrinted> {
|
||||||
private final String operand;
|
private final String operand;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(final CardPrinted card) {
|
public boolean apply(final CardPrinted card) {
|
||||||
return card.getType().contains(operand);
|
return card.getType().contains(operand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public PredicateType(final String op) {
|
public PredicateType(final String op) {
|
||||||
operand = op;
|
operand = op;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class PredicateName extends PredicateString<CardPrinted> {
|
private static class PredicateName extends PredicateString<CardPrinted> {
|
||||||
@@ -518,9 +518,9 @@ public final class CardPrinted implements Comparable<CardPrinted>, InventoryItem
|
|||||||
|
|
||||||
/** The Constant exceptLands. */
|
/** The Constant exceptLands. */
|
||||||
public static final Predicate<CardPrinted> EXCEPT_LANDS = Predicates.rarity(false, CardRarity.BasicLand);
|
public static final Predicate<CardPrinted> EXCEPT_LANDS = Predicates.rarity(false, CardRarity.BasicLand);
|
||||||
|
|
||||||
public static final Predicate<CardPrinted> NONTRADITIONAL = com.google.common.base.Predicates.or(Predicates.type("Vanguard"),Predicates.type("Scheme"),Predicates.type("Plane"));
|
public static final Predicate<CardPrinted> NONTRADITIONAL = com.google.common.base.Predicates.or(Predicates.type("Vanguard"), Predicates.type("Scheme"), Predicates.type("Plane"));
|
||||||
|
|
||||||
public static final Predicate<CardPrinted> TRADITIONAL = com.google.common.base.Predicates.not(Presets.NONTRADITIONAL);
|
public static final Predicate<CardPrinted> TRADITIONAL = com.google.common.base.Predicates.not(Presets.NONTRADITIONAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public abstract class ItemPredicate {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(final InventoryItem card) {
|
public boolean apply(final InventoryItem card) {
|
||||||
return card instanceof TournamentPack && !((TournamentPack)card).isStarterDeck();
|
return card instanceof TournamentPack && !((TournamentPack) card).isStarterDeck();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ public abstract class ItemPredicate {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(final InventoryItem card) {
|
public boolean apply(final InventoryItem card) {
|
||||||
return card instanceof TournamentPack && ((TournamentPack)card).isStarterDeck();
|
return card instanceof TournamentPack && ((TournamentPack) card).isStarterDeck();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public class TournamentPack extends OpenablePack {
|
|||||||
public final boolean isStarterDeck() {
|
public final boolean isStarterDeck() {
|
||||||
return contents.getCommon() < 30;
|
return contents.getCommon() < 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final String getType() {
|
public final String getType() {
|
||||||
|
|||||||
Reference in New Issue
Block a user