- CheckStyle.

This commit is contained in:
Chris
2012-11-30 19:51:25 +00:00
parent 5551bcd55f
commit 647f4d91eb
10 changed files with 66 additions and 61 deletions

View File

@@ -43,7 +43,7 @@ public enum CSubmenuDuels implements ICDoc {
view.getBtnUnlock().setCommand( view.getBtnUnlock().setCommand(
new Command() { @Override new Command() { @Override
public void execute() { SSubmenuQuestUtil.chooseAndUnlockEdition(); CSubmenuDuels.this.update();} }); public void execute() { SSubmenuQuestUtil.chooseAndUnlockEdition(); CSubmenuDuels.this.update(); } });
view.getBtnStart().addActionListener( view.getBtnStart().addActionListener(
new ActionListener() { @Override new ActionListener() { @Override

View File

@@ -59,13 +59,13 @@ public enum CSubmenuQuestData implements ICDoc {
view.getBtnEmbark().setCommand( view.getBtnEmbark().setCommand(
new Command() { @Override public void execute() { newQuest(); } }); new Command() { @Override public void execute() { newQuest(); } });
view.getBtnCustomFormat().setCommand( new Command() { @Override public void execute() { view.getBtnCustomFormat().setCommand(new Command() { @Override public void execute() {
new DialogCustomFormat(customFormatCodes); new DialogCustomFormat(customFormatCodes);
}}); } });
view.getBtnPrizeCustomFormat().setCommand( new Command() { @Override public void execute() { view.getBtnPrizeCustomFormat().setCommand(new Command() { @Override public void execute() {
new DialogCustomFormat(customPrizeFormatCodes); new DialogCustomFormat(customPrizeFormatCodes);
}}); } });
} }
/* (non-Javadoc) /* (non-Javadoc)
@@ -145,19 +145,20 @@ public enum CSubmenuQuestData implements ICDoc {
break; break;
case CustomFormat: case CustomFormat:
if ( customFormatCodes.isEmpty() ) if (customFormatCodes.isEmpty()) {
{
int answer = JOptionPane.showConfirmDialog(null, "You have defined custom format as containing no sets.\nThis will start a game without restriction.\n\nContinue?"); int answer = JOptionPane.showConfirmDialog(null, "You have defined custom format as containing no sets.\nThis will start a game without restriction.\n\nContinue?");
if ( JOptionPane.YES_OPTION != answer ) if (JOptionPane.YES_OPTION != answer) {
return; return;
} }
}
fmtStartPool = customFormatCodes.isEmpty() ? null : new GameFormatQuest("Custom", customFormatCodes, null); // chosen sets and no banend cards fmtStartPool = customFormatCodes.isEmpty() ? null : new GameFormatQuest("Custom", customFormatCodes, null); // chosen sets and no banend cards
break; break;
case SealedDeck: case SealedDeck:
dckStartPool = view.getSelectedDeck(); dckStartPool = view.getSelectedDeck();
if ( null == dckStartPool ) if (null == dckStartPool) {
{
JOptionPane.showMessageDialog(null, "You have not selected a deck to start", "Cannot start a quest", JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(null, "You have not selected a deck to start", "Cannot start a quest", JOptionPane.ERROR_MESSAGE);
return; return;
} }
@@ -165,8 +166,8 @@ public enum CSubmenuQuestData implements ICDoc {
case DraftDeck: case DraftDeck:
dckStartPool = view.getSelectedDeck(); dckStartPool = view.getSelectedDeck();
if ( null == dckStartPool ) if (null == dckStartPool) {
{
JOptionPane.showMessageDialog(null, "You have not selected a deck to start", "Cannot start a quest", JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(null, "You have not selected a deck to start", "Cannot start a quest", JOptionPane.ERROR_MESSAGE);
return; return;
} }
@@ -184,34 +185,37 @@ public enum CSubmenuQuestData implements ICDoc {
GameFormat fmtPrizes = null; GameFormat fmtPrizes = null;
StartingPoolType prizedPoolType = view.getPrizedPoolType(); StartingPoolType prizedPoolType = view.getPrizedPoolType();
if ( null == prizedPoolType ) { if (null == prizedPoolType) {
fmtPrizes = fmtStartPool; fmtPrizes = fmtStartPool;
if ( null == fmtPrizes && dckStartPool != null) { // build it form deck if (null == fmtPrizes && dckStartPool != null) { // build it form deck
List<String> sets = new ArrayList<String>(); List<String> sets = new ArrayList<String>();
for(Entry<CardPrinted, Integer> c : dckStartPool.getMain()) { for (Entry<CardPrinted, Integer> c : dckStartPool.getMain()) {
String edition = c.getKey().getEdition(); String edition = c.getKey().getEdition();
if ( !sets.contains(edition) ) if (!sets.contains(edition)) {
sets.add(edition); sets.add(edition);
} }
for(Entry<CardPrinted, Integer> c : dckStartPool.getSideboard()) { }
for (Entry<CardPrinted, Integer> c : dckStartPool.getSideboard()) {
String edition = c.getKey().getEdition(); String edition = c.getKey().getEdition();
if ( !sets.contains(edition) ) if (!sets.contains(edition)) {
sets.add(edition); sets.add(edition);
} }
}
fmtPrizes = new GameFormat("From deck", sets, null); fmtPrizes = new GameFormat("From deck", sets, null);
} }
} else } else {
switch(prizedPoolType) { switch(prizedPoolType) {
case Complete: case Complete:
fmtPrizes = null; fmtPrizes = null;
break; break;
case CustomFormat: case CustomFormat:
if ( customPrizeFormatCodes.isEmpty() ) if (customPrizeFormatCodes.isEmpty()) {
{
int answer = JOptionPane.showConfirmDialog(null, "You have defined custom format as containing no sets.\nThis will choose all editions without restriction as prized.\n\nContinue?"); int answer = JOptionPane.showConfirmDialog(null, "You have defined custom format as containing no sets.\nThis will choose all editions without restriction as prized.\n\nContinue?");
if ( JOptionPane.YES_OPTION != answer ) if (JOptionPane.YES_OPTION != answer) {
return; return;
} }
}
fmtPrizes = customPrizeFormatCodes.isEmpty() ? null : new GameFormat("Custom Prizes", customPrizeFormatCodes, null); // chosen sets and no banend cards fmtPrizes = customPrizeFormatCodes.isEmpty() ? null : new GameFormat("Custom Prizes", customPrizeFormatCodes, null); // chosen sets and no banend cards
break; break;
case Rotating: case Rotating:
@@ -220,6 +224,7 @@ public enum CSubmenuQuestData implements ICDoc {
default: default:
throw new RuntimeException("Should not get this result"); throw new RuntimeException("Should not get this result");
} }
}
final Object o = JOptionPane.showInputDialog(null, "Poets will remember your quest as:", "Quest Name", JOptionPane.OK_CANCEL_OPTION); final Object o = JOptionPane.showInputDialog(null, "Poets will remember your quest as:", "Quest Name", JOptionPane.OK_CANCEL_OPTION);

View File

@@ -73,7 +73,7 @@ public class DialogCustomFormat extends JDialog {
for (int col = 0; col < columns; col++) { for (int col = 0; col < columns; col++) {
getIdx = row + (col * rows); getIdx = row + (col * rows);
JCheckBox box; JCheckBox box;
if ( getIdx < numEditions ) { if (getIdx < numEditions) {
CardEdition edition = getIdx < numEditions ? editions.get(getIdx) : null; CardEdition edition = getIdx < numEditions ? editions.get(getIdx) : null;
box = new JCheckBox(edition.getName()); box = new JCheckBox(edition.getName());
box.setName(edition.getCode()); box.setName(edition.getCode());
@@ -128,7 +128,7 @@ public class DialogCustomFormat extends JDialog {
* *
*/ */
private boolean canChoose(final String setCode) { private boolean canChoose(final String setCode) {
if (setCode == null ) { if (setCode == null) {
return true; return true;
} }
return !setCode.equals("LEA") && !setCode.equals("LEB") && !"MBP".equals(setCode); return !setCode.equals("LEA") && !setCode.equals("LEB") && !"MBP".equals(setCode);

View File

@@ -328,11 +328,11 @@ public class SSubmenuQuestUtil {
} // End isFantasy } // End isFantasy
MatchStartHelper msh = new MatchStartHelper(); MatchStartHelper msh = new MatchStartHelper();
msh.addPlayer( Singletons.getControl().getLobby().getQuestPlayer(), humanStart ); msh.addPlayer(Singletons.getControl().getLobby().getQuestPlayer(), humanStart);
LobbyPlayer aiPlayer = Singletons.getControl().getLobby().findLocalPlayer(PlayerType.COMPUTER, event.getName()); LobbyPlayer aiPlayer = Singletons.getControl().getLobby().findLocalPlayer(PlayerType.COMPUTER, event.getName());
aiPlayer.setPicture(event.getIconFilename()); aiPlayer.setPicture(event.getIconFilename());
msh.addPlayer( aiPlayer, aiStart ); msh.addPlayer(aiPlayer, aiStart);
Singletons.getModel().getMatch().initMatch(GameType.Quest, msh.getPlayerMap()); Singletons.getModel().getMatch().initMatch(GameType.Quest, msh.getPlayerMap());
Singletons.getModel().getMatch().startRound(); Singletons.getModel().getMatch().startRound();