- 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(
new Command() { @Override
public void execute() { SSubmenuQuestUtil.chooseAndUnlockEdition(); CSubmenuDuels.this.update();} });
public void execute() { SSubmenuQuestUtil.chooseAndUnlockEdition(); CSubmenuDuels.this.update(); } });
view.getBtnStart().addActionListener(
new ActionListener() { @Override

View File

@@ -59,13 +59,13 @@ public enum CSubmenuQuestData implements ICDoc {
view.getBtnEmbark().setCommand(
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);
}});
} });
view.getBtnPrizeCustomFormat().setCommand( new Command() { @Override public void execute() {
view.getBtnPrizeCustomFormat().setCommand(new Command() { @Override public void execute() {
new DialogCustomFormat(customPrizeFormatCodes);
}});
} });
}
/* (non-Javadoc)
@@ -145,19 +145,20 @@ public enum CSubmenuQuestData implements ICDoc {
break;
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?");
if ( JOptionPane.YES_OPTION != answer )
if (JOptionPane.YES_OPTION != answer) {
return;
}
}
fmtStartPool = customFormatCodes.isEmpty() ? null : new GameFormatQuest("Custom", customFormatCodes, null); // chosen sets and no banend cards
break;
case SealedDeck:
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);
return;
}
@@ -165,8 +166,8 @@ public enum CSubmenuQuestData implements ICDoc {
case DraftDeck:
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);
return;
}
@@ -184,33 +185,36 @@ public enum CSubmenuQuestData implements ICDoc {
GameFormat fmtPrizes = null;
StartingPoolType prizedPoolType = view.getPrizedPoolType();
if ( null == prizedPoolType ) {
if (null == prizedPoolType) {
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>();
for(Entry<CardPrinted, Integer> c : dckStartPool.getMain()) {
for (Entry<CardPrinted, Integer> c : dckStartPool.getMain()) {
String edition = c.getKey().getEdition();
if ( !sets.contains(edition) )
if (!sets.contains(edition)) {
sets.add(edition);
}
}
for(Entry<CardPrinted, Integer> c : dckStartPool.getSideboard()) {
for (Entry<CardPrinted, Integer> c : dckStartPool.getSideboard()) {
String edition = c.getKey().getEdition();
if ( !sets.contains(edition) )
if (!sets.contains(edition)) {
sets.add(edition);
}
}
fmtPrizes = new GameFormat("From deck", sets, null);
}
} else
} else {
switch(prizedPoolType) {
case Complete:
fmtPrizes = null;
break;
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?");
if ( JOptionPane.YES_OPTION != answer )
if (JOptionPane.YES_OPTION != answer) {
return;
}
}
fmtPrizes = customPrizeFormatCodes.isEmpty() ? null : new GameFormat("Custom Prizes", customPrizeFormatCodes, null); // chosen sets and no banend cards
break;
@@ -220,6 +224,7 @@ public enum CSubmenuQuestData implements ICDoc {
default:
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);

View File

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

View File

@@ -328,11 +328,11 @@ public class SSubmenuQuestUtil {
} // End isFantasy
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());
aiPlayer.setPicture(event.getIconFilename());
msh.addPlayer( aiPlayer, aiStart );
msh.addPlayer(aiPlayer, aiStart);
Singletons.getModel().getMatch().initMatch(GameType.Quest, msh.getPlayerMap());
Singletons.getModel().getMatch().startRound();