- CheckStyle.

This commit is contained in:
Chris
2012-12-18 18:23:21 +00:00
parent a0c8e7a50c
commit c5e2ff4847
17 changed files with 73 additions and 73 deletions

View File

@@ -514,7 +514,7 @@ public class ComputerUtil {
extraManaNeeded += Integer.parseInt(snem); extraManaNeeded += Integer.parseInt(snem);
} catch (final NumberFormatException e) { } catch (final NumberFormatException e) {
System.out.println("wrong SpellsNeedExtraMana SVar format on " + c); System.out.println("wrong SpellsNeedExtraMana SVar format on " + c);
} }
} }
} }
} }

View File

@@ -142,7 +142,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
private final Map<ZoneType, PlayerZone> zones = new EnumMap<ZoneType, PlayerZone>(ZoneType.class); private final Map<ZoneType, PlayerZone> zones = new EnumMap<ZoneType, PlayerZone>(ZoneType.class);
private PlayerStatistics stats = new PlayerStatistics(); private PlayerStatistics stats = new PlayerStatistics();
private final List<Card> schemeDeck = new ArrayList<Card>(); private final List<Card> schemeDeck = new ArrayList<Card>();
private Card activeScheme = null; private Card activeScheme = null;
@@ -209,31 +209,31 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
//@Deprecated //@Deprecated
public abstract boolean isComputer(); public abstract boolean isComputer();
public abstract PlayerType getType(); public abstract PlayerType getType();
public List<Card> getSchemeDeck() public List<Card> getSchemeDeck() {
{
return schemeDeck; return schemeDeck;
} }
public void setSchemeDeck(Iterable<Card> sd) public void setSchemeDeck(Iterable<Card> sd) {
{
schemeDeck.clear(); schemeDeck.clear();
for(Card c : sd) for (Card c : sd) {
{
schemeDeck.add(c); schemeDeck.add(c);
c.setOwner(this); c.setOwner(this);
} }
CardLists.shuffle(schemeDeck); CardLists.shuffle(schemeDeck);
} }
public boolean isArchenemy() public boolean isArchenemy() {
{
//Only the archenemy has schemes. //Only the archenemy has schemes.
return schemeDeck.size() > 0; return schemeDeck.size() > 0;
} }
public void setSchemeInMotion() public void setSchemeInMotion() {
{
// Replacement effects // Replacement effects
final HashMap<String, Object> repRunParams = new HashMap<String, Object>(); final HashMap<String, Object> repRunParams = new HashMap<String, Object>();
repRunParams.put("Event", "SetInMotion"); repRunParams.put("Event", "SetInMotion");
@@ -242,17 +242,17 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
if (game.getReplacementHandler().run(repRunParams) != ReplacementResult.NotReplaced) { if (game.getReplacementHandler().run(repRunParams) != ReplacementResult.NotReplaced) {
return; return;
} }
game.getTriggerHandler().suppressMode(TriggerType.ChangesZone); game.getTriggerHandler().suppressMode(TriggerType.ChangesZone);
activeScheme = schemeDeck.get(0); activeScheme = schemeDeck.get(0);
schemeDeck.remove(0); schemeDeck.remove(0);
this.getZone(ZoneType.Command).add(activeScheme); this.getZone(ZoneType.Command).add(activeScheme);
game.getTriggerHandler().clearSuppression(TriggerType.ChangesZone); game.getTriggerHandler().clearSuppression(TriggerType.ChangesZone);
// Run triggers // Run triggers
final HashMap<String, Object> runParams = new HashMap<String, Object>(); final HashMap<String, Object> runParams = new HashMap<String, Object>();
runParams.put("Scheme", activeScheme); runParams.put("Scheme", activeScheme);
@@ -601,7 +601,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
} else { } else {
// Worship does not reduce the damage dealt but changes the effect // Worship does not reduce the damage dealt but changes the effect
// of the damage // of the damage
if (this.hasKeyword("Damage that would reduce your life total to less than 1 reduces it to 1 instead.") if (this.hasKeyword("Damage that would reduce your life total to less than 1 reduces it to 1 instead.")
&& this.life <= damageToDo) { && this.life <= damageToDo) {
this.loseLife(Math.min(damageToDo, this.life - 1)); this.loseLife(Math.min(damageToDo, this.life - 1));
} else { } else {

View File

@@ -237,9 +237,9 @@ public class GuiChoose {
if (sideboardingMode) { if (sideboardingMode) {
persistentDeck.getMain().clear(); persistentDeck.getMain().clear();
persistentDeck.getMain().add((List<Card>)dual.getOrderedList()); persistentDeck.getMain().add((List<Card>) dual.getOrderedList());
persistentDeck.getSideboard().clear(); persistentDeck.getSideboard().clear();
persistentDeck.getSideboard().add((List<Card>)dual.getRemainingSourceList()); persistentDeck.getSideboard().add((List<Card>) dual.getRemainingSourceList());
} }
dialog.dispose(); dialog.dispose();

View File

@@ -796,12 +796,12 @@ public final class GuiDisplayUtil {
if (choices.isEmpty()) { if (choices.isEmpty()) {
return; // when would it happen? return; // when would it happen?
} }
final SpellAbility sa = choices.size() == 1 ? choices.get(0) : GuiChoose.oneOrNone("Choose", choices); final SpellAbility sa = choices.size() == 1 ? choices.get(0) : GuiChoose.oneOrNone("Choose", choices);
if (sa == null) { if (sa == null) {
return; // happens if cancelled return; // happens if cancelled
} }
sa.setActivatingPlayer(p); sa.setActivatingPlayer(p);
game.getAction().moveToHand(forgeCard); // this is really needed game.getAction().moveToHand(forgeCard); // this is really needed
game.getAction().playSpellAbilityForFree(sa); game.getAction().playSpellAbilityForFree(sa);

View File

@@ -108,7 +108,7 @@ public class SEditorIO {
* Saves the current deck, with various prompts depending on the * Saves the current deck, with various prompts depending on the
* current save environment. * current save environment.
* *
* @param limitedDeckMode if true, the editor is in limited deck mode, * @param limitedDeckMode if true, the editor is in limited deck mode,
* so the overwrite prompt should be adjusted accordingly. * so the overwrite prompt should be adjusted accordingly.
* *
* @return boolean, true if success * @return boolean, true if success
@@ -129,8 +129,8 @@ public class SEditorIO {
// Confirm if overwrite // Confirm if overwrite
else if (controller.fileExists(name)) { else if (controller.fileExists(name)) {
final int m = JOptionPane.showConfirmDialog(null, final int m = JOptionPane.showConfirmDialog(null,
limitedDeckMode ? "Would you like to save changes to your deck?" : limitedDeckMode ? "Would you like to save changes to your deck?"
"There is already a deck named '" + name + "'. Overwrite?", : "There is already a deck named '" + name + "'. Overwrite?",
limitedDeckMode ? "Save changes?" : "Overwrite Deck?", limitedDeckMode ? "Save changes?" : "Overwrite Deck?",
JOptionPane.YES_NO_OPTION, JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE); JOptionPane.QUESTION_MESSAGE);

View File

@@ -66,7 +66,7 @@ public final class CEditorConstructed extends ACEditorBase<CardPrinted, Deck> {
super(); super();
boolean wantUnique = SEditorIO.getPref(EditorPreference.display_unique_only); boolean wantUnique = SEditorIO.getPref(EditorPreference.display_unique_only);
final EditorTableView<CardPrinted> tblCatalog = new EditorTableView<CardPrinted>(wantUnique, CardPrinted.class); final EditorTableView<CardPrinted> tblCatalog = new EditorTableView<CardPrinted>(wantUnique, CardPrinted.class);
final EditorTableView<CardPrinted> tblDeck = new EditorTableView<CardPrinted>(wantUnique, CardPrinted.class); final EditorTableView<CardPrinted> tblDeck = new EditorTableView<CardPrinted>(wantUnique, CardPrinted.class);
@@ -154,7 +154,7 @@ public final class CEditorConstructed extends ACEditorBase<CardPrinted, Deck> {
final List<TableColumnInfo<InventoryItem>> lstCatalogCols = SColumnUtil.getCatalogDefaultColumns(); final List<TableColumnInfo<InventoryItem>> lstCatalogCols = SColumnUtil.getCatalogDefaultColumns();
if (isSideboarding) { if (isSideboarding) {
this.getTableCatalog().setAvailableColumns(lstCatalogCols); this.getTableCatalog().setAvailableColumns(lstCatalogCols);
this.getTableCatalog().setDeck(this.controller.getModel().getMain()); this.getTableCatalog().setDeck(this.controller.getModel().getMain());
this.getTableDeck().setDeck(this.controller.getModel().getSideboard()); this.getTableDeck().setDeck(this.controller.getModel().getSideboard());

View File

@@ -275,7 +275,7 @@ public class CEditorDraftingProcess extends ACEditorBase<CardPrinted, DeckGroup>
VCardCatalog.SINGLETON_INSTANCE.getBtnAdd4().setVisible(false); VCardCatalog.SINGLETON_INSTANCE.getBtnAdd4().setVisible(false);
VCurrentDeck.SINGLETON_INSTANCE.getBtnDoSideboard().setVisible(false); VCurrentDeck.SINGLETON_INSTANCE.getBtnDoSideboard().setVisible(false);
VCurrentDeck.SINGLETON_INSTANCE.getPnlHeader().setVisible(false); VCurrentDeck.SINGLETON_INSTANCE.getPnlHeader().setVisible(false);
if (VDeckgen.SINGLETON_INSTANCE.getParentCell() != null) { if (VDeckgen.SINGLETON_INSTANCE.getParentCell() != null) {

View File

@@ -95,7 +95,7 @@ public enum CEditorPreferences implements ICDoc {
if (!SEditorIO.getPref(EditorPreference.stats_catalog)) { if (!SEditorIO.getPref(EditorPreference.stats_catalog)) {
VCardCatalog.SINGLETON_INSTANCE.getPnlStats().setVisible(false); VCardCatalog.SINGLETON_INSTANCE.getPnlStats().setVisible(false);
} }
boolean wantUnique = SEditorIO.getPref(EditorPreference.display_unique_only); boolean wantUnique = SEditorIO.getPref(EditorPreference.display_unique_only);
ACEditorBase<?, ?> curEditor = CDeckEditorUI.SINGLETON_INSTANCE.getCurrentEditorController(); ACEditorBase<?, ?> curEditor = CDeckEditorUI.SINGLETON_INSTANCE.getCurrentEditorController();
if (curEditor != null) { if (curEditor != null) {

View File

@@ -121,7 +121,7 @@ public final class CEditorScheme extends ACEditorBase<CardPrinted, Deck> {
*/ */
@Override @Override
public void resetTables() { public void resetTables() {
this.getTableCatalog().setDeck(ItemPool.createFrom(Iterables.filter(CardDb.instance().getAllNonTraditionalCards(),CardPrinted.Predicates.type("Scheme")), CardPrinted.class)); this.getTableCatalog().setDeck(ItemPool.createFrom(Iterables.filter(CardDb.instance().getAllNonTraditionalCards(), CardPrinted.Predicates.type("Scheme")), CardPrinted.class));
this.getTableDeck().setDeck(this.controller.getModel().getSchemes()); this.getTableDeck().setDeck(this.controller.getModel().getSchemes());
} }

View File

@@ -326,7 +326,7 @@ public final class EditorTableView<T extends InventoryItem> {
/** /**
* *
* setWantUnique * setWantUnique.
* *
* @param unique if true, the editor will be set to the "unique card names only" mode. * @param unique if true, the editor will be set to the "unique card names only" mode.
*/ */
@@ -336,7 +336,7 @@ public final class EditorTableView<T extends InventoryItem> {
/** /**
* *
* getAlwaysNonUnique * getAlwaysNonUnique.
* *
* @return if ture, this editor must always show non-unique cards (e.g. quest editor). * @return if ture, this editor must always show non-unique cards (e.g. quest editor).
*/ */
@@ -346,9 +346,9 @@ public final class EditorTableView<T extends InventoryItem> {
/** /**
* *
* setAlwaysNonUnique * setAlwaysNonUnique.
* *
* @param nonUniqueOnly if true, this editor must always show non-unique cards (e.g. quest editor). * @param nonUniqueOnly if true, this editor must always show non-unique cards (e.g. quest editor).
*/ */
public void setAlwaysNonUnique(boolean nonUniqueOnly) { public void setAlwaysNonUnique(boolean nonUniqueOnly) {
this.alwaysNonUnique = nonUniqueOnly; this.alwaysNonUnique = nonUniqueOnly;

View File

@@ -77,15 +77,15 @@ public class ManaCostRenderer extends DefaultTableCellRenderer {
: elemtWidth + elemtGap; : elemtWidth + elemtGap;
final float offset = Math.min(elemtWidth + elemtGap, offsetIfNoSpace); final float offset = Math.min(elemtWidth + elemtGap, offsetIfNoSpace);
// Display X Mana before any other type of mana // Display X Mana before any other type of mana
if (xManaCosts > 0) { if (xManaCosts > 0) {
for(int i = 0; i < xManaCosts; i++) { for (int i = 0; i < xManaCosts; i++) {
CardFaceSymbols.drawSymbol(ManaCostShard.X.getImageKey(), g, (int) xpos, 1); CardFaceSymbols.drawSymbol(ManaCostShard.X.getImageKey(), g, (int) xpos, 1);
xpos += offset; xpos += offset;
} }
} }
// Display colorless mana before colored mana // Display colorless mana before colored mana
if (hasGeneric) { if (hasGeneric) {
final String sGeneric = Integer.toString(genericManaCost); final String sGeneric = Integer.toString(genericManaCost);
CardFaceSymbols.drawSymbol(sGeneric, g, (int) xpos, 1); CardFaceSymbols.drawSymbol(sGeneric, g, (int) xpos, 1);
@@ -94,7 +94,7 @@ public class ManaCostRenderer extends DefaultTableCellRenderer {
for (final ManaCostShard s : shards) { for (final ManaCostShard s : shards) {
if (s.equals(ManaCostShard.X)) { if (s.equals(ManaCostShard.X)) {
// X costs already drawn up above // X costs already drawn up above
continue; continue;
} }
CardFaceSymbols.drawSymbol(s.getImageKey(), g, (int) xpos, 1); CardFaceSymbols.drawSymbol(s.getImageKey(), g, (int) xpos, 1);

View File

@@ -65,7 +65,7 @@ public enum VEditorPreferences implements IVDoc<CEditorPreferences> {
private JCheckBox chbCatalogStats = new FCheckBox("Show stats in card catalog"); private JCheckBox chbCatalogStats = new FCheckBox("Show stats in card catalog");
private JCheckBox chbCardDisplayUnique = new FCheckBox("Show unique cards only (only affects Constructed)"); private JCheckBox chbCardDisplayUnique = new FCheckBox("Show unique cards only (only affects Constructed)");
private JPanel pnl = new JPanel(new MigLayout("insets 0, gap 0, wrap 2, ax center")); private JPanel pnl = new JPanel(new MigLayout("insets 0, gap 0, wrap 2, ax center"));
private JScrollPane scroller = new JScrollPane(pnl); private JScrollPane scroller = new JScrollPane(pnl);
@@ -122,7 +122,7 @@ public enum VEditorPreferences implements IVDoc<CEditorPreferences> {
pnl.add(chbDeckPower, constraints); pnl.add(chbDeckPower, constraints);
pnl.add(chbDeckToughness, constraints); pnl.add(chbDeckToughness, constraints);
pnl.add(chbDeckAI, constraints + ", wrap"); pnl.add(chbDeckAI, constraints + ", wrap");
pnl.add(lblDisplay, constraints + ", span 2 1"); pnl.add(lblDisplay, constraints + ", span 2 1");
pnl.add(chbCardDisplayUnique, "h 25px!, gap 5px 5px 5px 5px, ax center, span 2 1"); pnl.add(chbCardDisplayUnique, "h 25px!, gap 5px 5px 5px 5px, ax center, span 2 1");

View File

@@ -57,7 +57,7 @@ public enum CSubmenuArchenemy implements ICDoc {
*/ */
@Override @Override
public void initialize() { public void initialize() {
VSubmenuArchenemy.SINGLETON_INSTANCE.getLblEditor().setCommand(new Command() { VSubmenuArchenemy.SINGLETON_INSTANCE.getLblEditor().setCommand(new Command() {
@Override @Override
public void execute() { public void execute() {
@@ -65,7 +65,7 @@ public enum CSubmenuArchenemy implements ICDoc {
FControl.SINGLETON_INSTANCE.changeState(FControl.DECK_EDITOR_CONSTRUCTED); FControl.SINGLETON_INSTANCE.changeState(FControl.DECK_EDITOR_CONSTRUCTED);
} }
}); });
final ForgePreferences prefs = Singletons.getModel().getPreferences(); final ForgePreferences prefs = Singletons.getModel().getPreferences();
for (FDeckChooser fdc : view.getDeckChoosers()) { for (FDeckChooser fdc : view.getDeckChoosers()) {
fdc.initialize(); fdc.initialize();
@@ -155,22 +155,21 @@ public enum CSubmenuArchenemy implements ICDoc {
schemes = playerDecks.get(0).getSchemes().toFlatList(); schemes = playerDecks.get(0).getSchemes().toFlatList();
System.out.println(schemes.toString()); System.out.println(schemes.toString());
usedDefaults = true; usedDefaults = true;
} else { } else {
if (obj instanceof String) { if (obj instanceof String) {
String sel = (String)obj; String sel = (String) obj;
if(sel.equals("Random")) if (sel.equals("Random")) {
{
schemes = Iterables.get(view.getAllSchemeDecks(), rnd.nextInt(Iterables.size(view.getAllSchemeDecks()))).getSchemes().toFlatList(); schemes = Iterables.get(view.getAllSchemeDecks(), rnd.nextInt(Iterables.size(view.getAllSchemeDecks()))).getSchemes().toFlatList();
} } else {
else
{
//Generate //Generate
schemes = DeckgenUtil.generateSchemeDeck().getSchemes().toFlatList(); schemes = DeckgenUtil.generateSchemeDeck().getSchemes().toFlatList();
} }
} else { } else {
schemes = ((Deck)obj).getSchemes().toFlatList(); schemes = ((Deck) obj).getSchemes().toFlatList();
} }
} }
if (schemes == null) { if (schemes == null) {
@@ -189,13 +188,12 @@ public enum CSubmenuArchenemy implements ICDoc {
for (int i = 0; i < view.getNumPlayers(); i++) { for (int i = 0; i < view.getNumPlayers(); i++) {
LobbyPlayer player = lobby.findLocalPlayer(i == 0 ? PlayerType.HUMAN : PlayerType.COMPUTER); LobbyPlayer player = lobby.findLocalPlayer(i == 0 ? PlayerType.HUMAN : PlayerType.COMPUTER);
if(i == 0) if (i == 0) {
{
helper.addArchenemy(player, playerDecks.get(i), schemes); helper.addArchenemy(player, playerDecks.get(i), schemes);
helper.getPlayerMap().get(player).setStartingLife(10 + (10*(view.getNumPlayers()-1))); helper.getPlayerMap().get(player).setStartingLife(10 + (10 * (view.getNumPlayers() - 1)));
} } else {
else
{
helper.addPlayer(player, playerDecks.get(i)); helper.addPlayer(player, playerDecks.get(i));
} }
} }

View File

@@ -133,21 +133,21 @@ public enum VSubmenuArchenemy implements IVSubmenu<CSubmenuArchenemy> {
deckChoosers.add(tempChooser); deckChoosers.add(tempChooser);
tempPanel.add(tempChooser, "span 1 2, w 44%!, gap 0 0 20px 20px, growy, pushy, wrap"); tempPanel.add(tempChooser, "span 1 2, w 44%!, gap 0 0 20px 20px, growy, pushy, wrap");
if(i == 0) if (i == 0) {
{
tempPanel.add(new FLabel.Builder().text("Select Scheme deck:").build(), "flowy"); tempPanel.add(new FLabel.Builder().text("Select Scheme deck:").build(), "flowy");
Vector<Object> listData = new Vector<Object>(); Vector<Object> listData = new Vector<Object>();
listData.add("Random"); listData.add("Random");
listData.add("Generate"); listData.add("Generate");
for(Deck schemeDeck : Singletons.getModel().getDecks().getScheme()) { for (Deck schemeDeck : Singletons.getModel().getDecks().getScheme()) {
listData.add(schemeDeck); listData.add(schemeDeck);
} }
archenemySchemes.setListData(listData); archenemySchemes.setListData(listData);
archenemySchemes.setSelectedIndex(0); archenemySchemes.setSelectedIndex(0);
archenemySchemes.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); archenemySchemes.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
JScrollPane scrSchemes = new FScrollPane(archenemySchemes, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); JScrollPane scrSchemes = new FScrollPane(archenemySchemes, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
tempPanel.add(scrSchemes, "h 90%!,wrap"); tempPanel.add(scrSchemes, "h 90%!,wrap");
} }

View File

@@ -122,7 +122,7 @@ public enum VLog implements IVDoc<CLog> {
pnl.removeAll(); pnl.removeAll();
for (int i = size-1; i >= 0; i--) { for (int i = size - 1; i >= 0; i--) {
JTextArea tar = new JTextArea(data.get(i).getMessage()); JTextArea tar = new JTextArea(data.get(i).getMessage());
if (i % 2 == 1) { tar.setOpaque(false); } if (i % 2 == 1) { tar.setOpaque(false); }

View File

@@ -112,7 +112,7 @@ public final class CardPrinted implements Comparable<CardPrinted>, InventoryItem
} }
public boolean isTraditional() { public boolean isTraditional() {
return !(getCard().getType().isVanguard() return !(getCard().getType().isVanguard()
|| getCard().getType().isScheme()); || getCard().getType().isScheme());
} }

View File

@@ -112,8 +112,9 @@ public class EventVisualizer {
if (sa.isSpell()) { if (sa.isSpell()) {
// if there's a specific effect for this particular card, play it and // if there's a specific effect for this particular card, play it and
// we're done. // we're done.
if (getSpecificCardEffect(source)) if (getSpecificCardEffect(source)) {
return SoundEffectType.ScriptedEffect; return SoundEffectType.ScriptedEffect;
}
if (source.isCreature() && source.isArtifact()) { if (source.isCreature() && source.isArtifact()) {
return SoundEffectType.ArtifactCreature; return SoundEffectType.ArtifactCreature;
@@ -159,8 +160,9 @@ public class EventVisualizer {
// if there's a specific effect for this particular card, play it and // if there's a specific effect for this particular card, play it and
// we're done. // we're done.
if (getSpecificCardEffect(land)) if (getSpecificCardEffect(land)) {
return SoundEffectType.ScriptedEffect; return SoundEffectType.ScriptedEffect;
}
final List<SpellAbility> manaProduced = land.getManaAbility(); final List<SpellAbility> manaProduced = land.getManaAbility();
@@ -214,7 +216,7 @@ public class EventVisualizer {
*/ */
public String getScriptedSoundEffectName(Event evt) { public String getScriptedSoundEffectName(Event evt) {
Card c = null; Card c = null;
if (evt instanceof SpellResolvedEvent) { if (evt instanceof SpellResolvedEvent) {
c = ((SpellResolvedEvent) evt).Source; c = ((SpellResolvedEvent) evt).Source;
} else if (evt instanceof LandPlayedEvent) { } else if (evt instanceof LandPlayedEvent) {