many Checkstyle fixes

This commit is contained in:
slapshot5
2011-09-03 09:22:29 +00:00
parent dd31537034
commit b8b4f58805
15 changed files with 694 additions and 468 deletions

View File

@@ -18,36 +18,36 @@ public interface BoosterDraft {
* *
* @return a {@link forge.CardList} object. * @return a {@link forge.CardList} object.
*/ */
public CardPoolView nextChoice(); CardPoolView nextChoice();
/** /**
* <p>setChoice.</p> * <p>setChoice.</p>
* *
* @param c a {@link forge.Card} object. * @param c a {@link forge.Card} object.
*/ */
public void setChoice(CardPrinted c); void setChoice(CardPrinted c);
/** /**
* <p>hasNextChoice.</p> * <p>hasNextChoice.</p>
* *
* @return a boolean. * @return a boolean.
*/ */
public boolean hasNextChoice(); boolean hasNextChoice();
/** /**
* <p>getDecks.</p> * <p>getDecks.</p>
* *
* @return an array of {@link forge.deck.Deck} objects. * @return an array of {@link forge.deck.Deck} objects.
*/ */
public Deck[] getDecks(); //size 7, all the computers decks Deck[] getDecks(); //size 7, all the computers decks
/** Constant <code>LandSetCode="{}"</code> */ /** Constant <code>LandSetCode="{}"</code>. */
public String LandSetCode[] = {""}; public String LandSetCode[] = {""};
/** Constant <code>draftFormat="{}"</code> */ /** Constant <code>draftFormat="{}"</code>. */
public String draftFormat[] = {""}; public String draftFormat[] = {""};
/** Constant <code>draftPicks="{}"</code> */ /** Constant <code>draftPicks="{}"</code>. */
public Map<String,Float> draftPicks = new TreeMap<String,Float>(); public Map<String,Float> draftPicks = new TreeMap<String,Float>();
} }

View File

@@ -6,11 +6,17 @@ import forge.card.CardPrinted;
import forge.deck.Deck; import forge.deck.Deck;
import forge.gui.GuiUtils; import forge.gui.GuiUtils;
import javax.swing.*;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.swing.JOptionPane;
/**
*
* TODO Write javadoc for this type.
*
*/
public class BoosterDraft_1 implements BoosterDraft { public class BoosterDraft_1 implements BoosterDraft {
private final BoosterDraftAI draftAI = new BoosterDraftAI(); private final BoosterDraftAI draftAI = new BoosterDraftAI();
private static final int nPlayers = 8; private static final int nPlayers = 8;
@@ -26,7 +32,7 @@ public class BoosterDraft_1 implements BoosterDraft {
//helps the computer choose which booster packs to pick from //helps the computer choose which booster packs to pick from
//the first row says "pick from boosters 1-7, skip 0" since the players picks from 0 //the first row says "pick from boosters 1-7, skip 0" since the players picks from 0
//the second row says "pick from 0 and 2-7 boosters, skip 1" - player chooses from 1 //the second row says "pick from 0 and 2-7 boosters, skip 1" - player chooses from 1
private final int computerChoose[][] = { private final int[][] computerChoose = {
{1, 2, 3, 4, 5, 6, 7}, {1, 2, 3, 4, 5, 6, 7},
{0, 2, 3, 4, 5, 6, 7}, {0, 2, 3, 4, 5, 6, 7},
{0, 1, 3, 4, 5, 6, 7}, {0, 1, 3, 4, 5, 6, 7},
@@ -37,6 +43,10 @@ public class BoosterDraft_1 implements BoosterDraft {
{0, 1, 2, 3, 4, 5, 6} {0, 1, 2, 3, 4, 5, 6}
}; };
/**
*
* TODO Write javadoc for Constructor.
*/
BoosterDraft_1() { BoosterDraft_1() {
pack = get8BoosterPack(); pack = get8BoosterPack();
} }
@@ -52,19 +62,21 @@ public class BoosterDraft_1 implements BoosterDraft {
if (draftType.equals("Full")) { // Draft from all cards in Forge if (draftType.equals("Full")) { // Draft from all cards in Forge
BoosterGenerator bpFull = new BoosterGenerator(); BoosterGenerator bpFull = new BoosterGenerator();
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++) {
packs.add(bpFull); packs.add(bpFull);
}
LandSetCode[0] = AllZone.getCardFactory().getCard("Plains", AllZone.getHumanPlayer()).getMostRecentSet(); LandSetCode[0] = AllZone.getCardFactory().getCard("Plains", AllZone.getHumanPlayer()).getMostRecentSet();
} else if (draftType.equals("Block")) { // Draft from cards by block or set } else if (draftType.equals("Block")) { // Draft from cards by block or set
ArrayList<String> bNames = SetInfoUtil.getBlockNameList(); ArrayList<String> bNames = SetInfoUtil.getBlockNameList();
ArrayList<String> rbNames = new ArrayList<String>(); ArrayList<String> rbNames = new ArrayList<String>();
for (int i = bNames.size() - 1; i >= 0; i--) for (int i = bNames.size() - 1; i >= 0; i--) {
rbNames.add(bNames.get(i)); rbNames.add(bNames.get(i));
}
Object o = GuiUtils.getChoice("Choose Block", rbNames.toArray()); Object o = GuiUtils.getChoice("Choose Block", rbNames.toArray());
ArrayList<String> blockSets = SetInfoUtil.getSets_BlockName(o.toString()); ArrayList<String> blockSets = SetInfoUtil.getSetsBlockName(o.toString());
int nPacks = SetInfoUtil.getDraftPackCount(o.toString()); int nPacks = SetInfoUtil.getDraftPackCount(o.toString());
ArrayList<String> setCombos = new ArrayList<String>(); ArrayList<String> setCombos = new ArrayList<String>();
@@ -100,7 +112,7 @@ public class BoosterDraft_1 implements BoosterDraft {
Object p = GuiUtils.getChoice("Choose Set Combination", setCombos.toArray()); Object p = GuiUtils.getChoice("Choose Set Combination", setCombos.toArray());
String pp[] = p.toString().split("/"); String[] pp = p.toString().split("/");
int n = 0; int n = 0;
for (int i = 0; i < nPacks; i++) { for (int i = 0; i < nPacks; i++) {
BoosterGenerator bpMulti = new BoosterGenerator(pp[i]); BoosterGenerator bpMulti = new BoosterGenerator(pp[i]);
@@ -112,17 +124,19 @@ public class BoosterDraft_1 implements BoosterDraft {
LandSetCode[0] = SetInfoUtil.getLandCode(o.toString()); LandSetCode[0] = SetInfoUtil.getLandCode(o.toString());
} else if (draftType.equals("Custom")) { // Draft from user-defined cardpools } else if (draftType.equals("Custom")) { // Draft from user-defined cardpools
String dList[]; String[] dList;
ArrayList<CustomDraft> customs = new ArrayList<CustomDraft>(); ArrayList<CustomDraft> customs = new ArrayList<CustomDraft>();
ArrayList<String> customList = new ArrayList<String>(); ArrayList<String> customList = new ArrayList<String>();
// get list of custom draft files // get list of custom draft files
File dFolder = new File("res/draft/"); File dFolder = new File("res/draft/");
if (!dFolder.exists()) if (!dFolder.exists()) {
throw new RuntimeException("BoosterDraft : folder not found -- folder is " + dFolder.getAbsolutePath()); throw new RuntimeException("BoosterDraft : folder not found -- folder is " + dFolder.getAbsolutePath());
}
if (!dFolder.isDirectory()) if (!dFolder.isDirectory()) {
throw new RuntimeException("BoosterDraft : not a folder -- " + dFolder.getAbsolutePath()); throw new RuntimeException("BoosterDraft : not a folder -- " + dFolder.getAbsolutePath());
}
dList = dFolder.list(); dList = dFolder.list();
@@ -136,31 +150,43 @@ public class BoosterDraft_1 implements BoosterDraft {
String dfd = dfData.get(j); String dfd = dfData.get(j);
if (dfd.startsWith("Name:")) if (dfd.startsWith("Name:")) {
cd.Name = dfd.substring(5); cd.Name = dfd.substring(5);
if (dfd.startsWith("Type:")) }
if (dfd.startsWith("Type:")) {
cd.Type = dfd.substring(5); cd.Type = dfd.substring(5);
if (dfd.startsWith("DeckFile:")) }
if (dfd.startsWith("DeckFile:")) {
cd.DeckFile = dfd.substring(9); cd.DeckFile = dfd.substring(9);
if (dfd.startsWith("IgnoreRarity:")) }
if (dfd.startsWith("IgnoreRarity:")) {
cd.IgnoreRarity = dfd.substring(13).equals("True"); cd.IgnoreRarity = dfd.substring(13).equals("True");
if (dfd.startsWith("LandSetCode:")) }
if (dfd.startsWith("LandSetCode:")) {
cd.LandSetCode = dfd.substring(12); cd.LandSetCode = dfd.substring(12);
}
if (dfd.startsWith("NumCards:")) if (dfd.startsWith("NumCards:")) {
cd.NumCards = Integer.parseInt(dfd.substring(9)); cd.NumCards = Integer.parseInt(dfd.substring(9));
if (dfd.startsWith("NumSpecials:")) }
if (dfd.startsWith("NumSpecials:")) {
cd.NumSpecials = Integer.parseInt(dfd.substring(12)); cd.NumSpecials = Integer.parseInt(dfd.substring(12));
if (dfd.startsWith("NumMythics:")) }
if (dfd.startsWith("NumMythics:")) {
cd.NumMythics = Integer.parseInt(dfd.substring(11)); cd.NumMythics = Integer.parseInt(dfd.substring(11));
if (dfd.startsWith("NumRares:")) }
if (dfd.startsWith("NumRares:")) {
cd.NumRares = Integer.parseInt(dfd.substring(9)); cd.NumRares = Integer.parseInt(dfd.substring(9));
if (dfd.startsWith("NumUncommons:")) }
if (dfd.startsWith("NumUncommons:")) {
cd.NumUncommons = Integer.parseInt(dfd.substring(13)); cd.NumUncommons = Integer.parseInt(dfd.substring(13));
if (dfd.startsWith("NumCommons:")) }
if (dfd.startsWith("NumCommons:")) {
cd.NumCommons = Integer.parseInt(dfd.substring(11)); cd.NumCommons = Integer.parseInt(dfd.substring(11));
if (dfd.startsWith("NumPacks:")) }
if (dfd.startsWith("NumPacks:")) {
cd.NumPacks = Integer.parseInt(dfd.substring(9)); cd.NumPacks = Integer.parseInt(dfd.substring(9));
}
} }
@@ -173,23 +199,26 @@ public class BoosterDraft_1 implements BoosterDraft {
CustomDraft chosenDraft = null; CustomDraft chosenDraft = null;
// present list to user // present list to user
if (customs.size() < 1) if (customs.size() < 1) {
JOptionPane.showMessageDialog(null, "No custom draft files found.", "", JOptionPane.INFORMATION_MESSAGE); JOptionPane.showMessageDialog(null, "No custom draft files found.", "", JOptionPane.INFORMATION_MESSAGE);
} else {
else {
Object p = GuiUtils.getChoice("Choose Custom Draft", customList.toArray()); Object p = GuiUtils.getChoice("Choose Custom Draft", customList.toArray());
for (int i = 0; i < customs.size(); i++) { for (int i = 0; i < customs.size(); i++) {
CustomDraft cd = customs.get(i); CustomDraft cd = customs.get(i);
if (cd.Name.equals(p.toString())) if (cd.Name.equals(p.toString())) {
chosenDraft = cd; chosenDraft = cd;
} }
}
if (chosenDraft.IgnoreRarity) if (chosenDraft.IgnoreRarity) {
chosenDraft.NumCommons = chosenDraft.NumCards; chosenDraft.NumCommons = chosenDraft.NumCards;
}
BoosterGenerator bpCustom = new BoosterGenerator(chosenDraft.DeckFile, chosenDraft.NumCommons, chosenDraft.NumUncommons, chosenDraft.NumRares, chosenDraft.NumMythics, chosenDraft.NumSpecials, chosenDraft.IgnoreRarity); BoosterGenerator bpCustom = new BoosterGenerator(chosenDraft.DeckFile, chosenDraft.NumCommons,
chosenDraft.NumUncommons, chosenDraft.NumRares, chosenDraft.NumMythics, chosenDraft.NumSpecials,
chosenDraft.IgnoreRarity);
int n = 0; int n = 0;
for (int i = 0; i < chosenDraft.NumPacks; i++) { for (int i = 0; i < chosenDraft.NumPacks; i++) {
packs.add(bpCustom); packs.add(bpCustom);
@@ -210,9 +239,10 @@ public class BoosterDraft_1 implements BoosterDraft {
* *
* @return a {@link forge.CardList} object. * @return a {@link forge.CardList} object.
*/ */
public CardPoolView nextChoice() { public final CardPoolView nextChoice() {
if (pack.get(getCurrentBoosterIndex()).size() == 0) if (pack.get(getCurrentBoosterIndex()).size() == 0) {
pack = get8BoosterPack(); pack = get8BoosterPack();
}
computerChoose(); computerChoose();
return new CardPool(pack.get(getCurrentBoosterIndex())); return new CardPool(pack.get(getCurrentBoosterIndex()));
@@ -223,13 +253,14 @@ public class BoosterDraft_1 implements BoosterDraft {
* *
* @return an array of {@link forge.CardList} objects. * @return an array of {@link forge.CardList} objects.
*/ */
public List<List<CardPrinted>> get8BoosterPack() { public final List<List<CardPrinted>> get8BoosterPack() {
List<List<CardPrinted>> list = new ArrayList<List<CardPrinted>>(); List<List<CardPrinted>> list = new ArrayList<List<CardPrinted>>();
if (packNum < packs.size()) { if (packNum < packs.size()) {
for (int i = 0; i < 8; i++) for (int i = 0; i < 8; i++) {
list.add(packs.get(packNum).getBoosterPack()); list.add(packs.get(packNum).getBoosterPack());
} }
}
packNum++; packNum++;
@@ -243,12 +274,12 @@ public class BoosterDraft_1 implements BoosterDraft {
* *
* @return an array of {@link forge.deck.Deck} objects. * @return an array of {@link forge.deck.Deck} objects.
*/ */
public Deck[] getDecks() { public final Deck[] getDecks() {
return draftAI.getDecks(); return draftAI.getDecks();
} }
private void computerChoose() { private void computerChoose() {
int row[] = computerChoose[getCurrentBoosterIndex()]; int[] row = computerChoose[getCurrentBoosterIndex()];
for (int i = 0; i < row.length; i++) { for (int i = 0; i < row.length; i++) {
CardList forAi = new CardList(); CardList forAi = new CardList();
@@ -256,7 +287,7 @@ public class BoosterDraft_1 implements BoosterDraft {
for (CardPrinted cr : booster) { for (CardPrinted cr : booster) {
forAi.add(cr.toForgeCard()); forAi.add(cr.toForgeCard());
} }
// TODO: Please write this drafting code to work without heavy cards // TODO Please write this drafting code to work without heavy cards
Card aiPick = draftAI.choose(forAi, i); Card aiPick = draftAI.choose(forAi, i);
String pickedName = aiPick.getName(); String pickedName = aiPick.getName();
@@ -279,34 +310,36 @@ public class BoosterDraft_1 implements BoosterDraft {
* *
* @return a boolean. * @return a boolean.
*/ */
public boolean hasNextChoice() { public final boolean hasNextChoice() {
return currentCount < stopCount; return currentCount < stopCount;
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
public void setChoice(CardPrinted c) { public final void setChoice(final CardPrinted c) {
List<CardPrinted> thisBooster = pack.get(getCurrentBoosterIndex()); List<CardPrinted> thisBooster = pack.get(getCurrentBoosterIndex());
if (!thisBooster.contains(c)) if (!thisBooster.contains(c)) {
throw new RuntimeException("BoosterDraft : setChoice() error - card not found - " + c + " - booster pack = " + thisBooster); throw new RuntimeException("BoosterDraft : setChoice() error - card not found - " + c + " - booster pack = " + thisBooster);
}
if (Constant.Runtime.UpldDrft[0]) { if (Constant.Runtime.UpldDrft[0]) {
for (int i = 0; i < thisBooster.size(); i++) { for (int i = 0; i < thisBooster.size(); i++) {
CardPrinted cc = thisBooster.get(i); CardPrinted cc = thisBooster.get(i);
String CnBk = cc.getName() + "|" + cc.getSet(); String cnBk = cc.getName() + "|" + cc.getSet();
float pickValue = 0; float pickValue = 0;
if (cc.equals(c)) if (cc.equals(c)) {
pickValue = thisBooster.size() * (1f - ((float) currentCount) / stopCount) * 2f; pickValue = thisBooster.size() * (1f - ((float) currentCount) / stopCount) * 2f;
else
pickValue = 0;
if (!draftPicks.containsKey(CnBk)) {
draftPicks.put(CnBk, pickValue);
} else { } else {
float curValue = draftPicks.get(CnBk); pickValue = 0;
}
if (!draftPicks.containsKey(cnBk)) {
draftPicks.put(cnBk, pickValue);
} else {
float curValue = draftPicks.get(cnBk);
float newValue = (curValue + pickValue) / 2; float newValue = (curValue + pickValue) / 2;
draftPicks.put(CnBk, newValue); draftPicks.put(cnBk, newValue);
} }
} }
} }

View File

@@ -51,7 +51,6 @@ public class BoosterGenerator {
numMythics = 0; numMythics = 0;
numSpecials = 0; numSpecials = 0;
for (CardPrinted c : CardDb.instance().getAllUniqueCards()) { for (CardPrinted c : CardDb.instance().getAllUniqueCards()) {
addToRarity(c); addToRarity(c);
} }
@@ -59,7 +58,20 @@ public class BoosterGenerator {
shuffleAll(); shuffleAll();
} }
public BoosterGenerator(String DeckFile, int nCommons, int nUncommons, int nRares, int nMythics, int nSpecials, boolean ignoreRarity) { /**
*
* TODO Write javadoc for Constructor.
* @param deckFile a String
* @param nCommons an int
* @param nUncommons an int
* @param nRares an int
* @param nMythics an int
* @param nSpecials an int
* @param ignoreRarity a boolean
*/
public BoosterGenerator(final String deckFile, final int nCommons, final int nUncommons, final int nRares,
final int nMythics, final int nSpecials, final boolean ignoreRarity)
{
numCommons = nCommons; numCommons = nCommons;
numUncommons = nUncommons; numUncommons = nUncommons;
numRares = nRares; numRares = nRares;
@@ -68,9 +80,10 @@ public class BoosterGenerator {
//DeckManager dio = new DeckManager(ForgeProps.getFile(NewConstants.NEW_DECKS)); //DeckManager dio = new DeckManager(ForgeProps.getFile(NewConstants.NEW_DECKS));
DeckManager dio = AllZone.getDeckManager(); DeckManager dio = AllZone.getDeckManager();
Deck dPool = dio.getDeck(DeckFile); Deck dPool = dio.getDeck(deckFile);
if (dPool == null) if (dPool == null) {
throw new RuntimeException("BoosterGenerator : deck not found - " + DeckFile); throw new RuntimeException("BoosterGenerator : deck not found - " + deckFile);
}
CardPoolView tList = dPool.getMain(); CardPoolView tList = dPool.getMain();
for (Entry<CardPrinted, Integer> e : tList) { for (Entry<CardPrinted, Integer> e : tList) {
@@ -84,7 +97,7 @@ public class BoosterGenerator {
/** /**
* <p>Constructor for BoosterGenerator.</p> * <p>Constructor for BoosterGenerator.</p>
* *
* @param SetCode a {@link java.lang.String} object. * @param setCode a {@link java.lang.String} object.
*/ */
public BoosterGenerator(final String setCode) { public BoosterGenerator(final String setCode) {
numCommons = 0; numCommons = 0;
@@ -155,15 +168,16 @@ public class BoosterGenerator {
* *
* @return a {@link forge.CardList} object. * @return a {@link forge.CardList} object.
*/ */
public List<CardPrinted> getBoosterPack() { public final List<CardPrinted> getBoosterPack() {
List<CardPrinted> temp = new ArrayList<CardPrinted>(); List<CardPrinted> temp = new ArrayList<CardPrinted>();
int i = 0; int i = 0;
if (commons.size() > numCommons) { if (commons.size() > numCommons) {
for (i = 0; i < numCommons; i++) { for (i = 0; i < numCommons; i++) {
if (iCommons >= commons.size()) if (iCommons >= commons.size()) {
iCommons = 0; iCommons = 0;
}
temp.add(commons.get(iCommons++)); temp.add(commons.get(iCommons++));
} }
@@ -171,8 +185,9 @@ public class BoosterGenerator {
if (uncommons.size() > numUncommons) { if (uncommons.size() > numUncommons) {
for (i = 0; i < numUncommons; i++) { for (i = 0; i < numUncommons; i++) {
if (iUncommons >= uncommons.size()) if (iUncommons >= uncommons.size()) {
iUncommons = 0; iUncommons = 0;
}
temp.add(uncommons.get(iUncommons++)); temp.add(uncommons.get(iUncommons++));
} }
@@ -182,21 +197,24 @@ public class BoosterGenerator {
if (numMythics > 0) { if (numMythics > 0) {
if (mythics.size() > numMythics) { if (mythics.size() > numMythics) {
if (MyRandom.random.nextInt(8) <= 1) { if (MyRandom.random.nextInt(8) <= 1) {
if (iMythics >= mythics.size()) if (iMythics >= mythics.size()) {
iMythics = 0; iMythics = 0;
}
temp.add(mythics.get(iMythics++)); temp.add(mythics.get(iMythics++));
} else { } else {
if (iRares >= rares.size()) if (iRares >= rares.size()) {
iRares = 0; iRares = 0;
}
temp.add(rares.get(iRares++)); temp.add(rares.get(iRares++));
} }
} }
} else { } else {
if (rares.size() > numRares) { if (rares.size() > numRares) {
if (iRares >= rares.size()) if (iRares >= rares.size()) {
iRares = 0; iRares = 0;
}
temp.add(rares.get(iRares++)); temp.add(rares.get(iRares++));
} }
@@ -205,8 +223,9 @@ public class BoosterGenerator {
if (specials.size() > numSpecials) { if (specials.size() > numSpecials) {
for (i = 0; i < numSpecials; i++) { for (i = 0; i < numSpecials; i++) {
if (iSpecials >= specials.size()) if (iSpecials >= specials.size()) {
iSpecials = 0; iSpecials = 0;
}
temp.add(specials.get(iSpecials++)); temp.add(specials.get(iSpecials++));
} }
@@ -220,11 +239,11 @@ public class BoosterGenerator {
* *
* @return a int. * @return a int.
*/ */
public int getBoosterPackSize() { public final int getBoosterPackSize() {
return numCommons + numUncommons + numRares + numSpecials; return numCommons + numUncommons + numRares + numSpecials;
} }
private void addToRarity(CardPrinted c) { private void addToRarity(final CardPrinted c) {
switch(c.getRarity()) { switch(c.getRarity()) {
case Common: commons.add(c); break; case Common: commons.add(c); break;
case Uncommon: uncommons.add(c); break; case Uncommon: uncommons.add(c); break;

View File

@@ -1068,7 +1068,7 @@ public class GameAction {
card.setRandomSetCode(); card.setRandomSetCode();
if (!card.getCurSetCode().equals("")) { if (!card.getCurSetCode().equals("")) {
int n = SetInfoUtil.getSetInfo_Code(card.getSets(), card.getCurSetCode()).PicCount; int n = SetInfoUtil.getSetInfoCode(card.getSets(), card.getCurSetCode()).PicCount;
if (n > 1) if (n > 1)
card.setRandomPicture(generator.nextInt(n - 1) + 1); card.setRandomPicture(generator.nextInt(n - 1) + 1);
@@ -1119,7 +1119,7 @@ public class GameAction {
card.setRandomSetCode(); card.setRandomSetCode();
if (!card.getCurSetCode().equals("")) { if (!card.getCurSetCode().equals("")) {
int n = SetInfoUtil.getSetInfo_Code(card.getSets(), card.getCurSetCode()).PicCount; int n = SetInfoUtil.getSetInfoCode(card.getSets(), card.getCurSetCode()).PicCount;
if (n > 1) if (n > 1)
card.setRandomPicture(generator.nextInt(n - 1) + 1); card.setRandomPicture(generator.nextInt(n - 1) + 1);

View File

@@ -33,10 +33,10 @@ public class Quest_Assignment {
/** /**
* <p>Setter for the field <code>id</code>.</p> * <p>Setter for the field <code>id</code>.</p>
* *
* @param id a int. * @param idIn a int.
*/ */
public void setId(int id) { public final void setId(final int idIn) {
this.id = id; this.id = idIn;
} }
/** /**
@@ -44,17 +44,17 @@ public class Quest_Assignment {
* *
* @return a int. * @return a int.
*/ */
public int getId() { public final int getId() {
return id; return id;
} }
/** /**
* <p>Setter for the field <code>creditsReward</code>.</p> * <p>Setter for the field <code>creditsReward</code>.</p>
* *
* @param creditsReward a long. * @param creditsRewardIn a long.
*/ */
public void setCreditsReward(long creditsReward) { public final void setCreditsReward(final long creditsRewardIn) {
this.creditsReward = creditsReward; this.creditsReward = creditsRewardIn;
} }
/** /**
@@ -62,17 +62,17 @@ public class Quest_Assignment {
* *
* @return a long. * @return a long.
*/ */
public long getCreditsReward() { public final long getCreditsReward() {
return creditsReward; return creditsReward;
} }
/** /**
* <p>Setter for the field <code>name</code>.</p> * <p>Setter for the field <code>name</code>.</p>
* *
* @param name a {@link java.lang.String} object. * @param nameIn a {@link java.lang.String} object.
*/ */
public void setName(String name) { public final void setName(final String nameIn) {
this.name = name; this.name = nameIn;
} }
/** /**
@@ -80,17 +80,17 @@ public class Quest_Assignment {
* *
* @return a {@link java.lang.String} object. * @return a {@link java.lang.String} object.
*/ */
public String getName() { public final String getName() {
return name; return name;
} }
/** /**
* <p>Setter for the field <code>desc</code>.</p> * <p>Setter for the field <code>desc</code>.</p>
* *
* @param desc a {@link java.lang.String} object. * @param descIn a {@link java.lang.String} object.
*/ */
public void setDesc(String desc) { public final void setDesc(final String descIn) {
this.desc = desc; this.desc = descIn;
} }
/** /**
@@ -98,17 +98,17 @@ public class Quest_Assignment {
* *
* @return a {@link java.lang.String} object. * @return a {@link java.lang.String} object.
*/ */
public String getDesc() { public final String getDesc() {
return desc; return desc;
} }
/** /**
* <p>Setter for the field <code>difficulty</code>.</p> * <p>Setter for the field <code>difficulty</code>.</p>
* *
* @param difficulty a {@link java.lang.String} object. * @param difficultyIn a {@link java.lang.String} object.
*/ */
public void setDifficulty(String difficulty) { public final void setDifficulty(final String difficultyIn) {
this.difficulty = difficulty; this.difficulty = difficultyIn;
} }
/** /**
@@ -116,17 +116,17 @@ public class Quest_Assignment {
* *
* @return a {@link java.lang.String} object. * @return a {@link java.lang.String} object.
*/ */
public String getDifficulty() { public final String getDifficulty() {
return difficulty; return difficulty;
} }
/** /**
* <p>Setter for the field <code>repeatable</code>.</p> * <p>Setter for the field <code>repeatable</code>.</p>
* *
* @param repeatable a boolean. * @param repeatableIn a boolean.
*/ */
public void setRepeatable(boolean repeatable) { public final void setRepeatable(final boolean repeatableIn) {
this.repeatable = repeatable; this.repeatable = repeatableIn;
} }
/** /**
@@ -134,17 +134,17 @@ public class Quest_Assignment {
* *
* @return a boolean. * @return a boolean.
*/ */
public boolean isRepeatable() { public final boolean isRepeatable() {
return repeatable; return repeatable;
} }
/** /**
* <p>Setter for the field <code>requiredNumberWins</code>.</p> * <p>Setter for the field <code>requiredNumberWins</code>.</p>
* *
* @param requiredNumberWins a int. * @param requiredNumberWinsIn a int.
*/ */
public void setRequiredNumberWins(int requiredNumberWins) { public final void setRequiredNumberWins(final int requiredNumberWinsIn) {
this.requiredNumberWins = requiredNumberWins; this.requiredNumberWins = requiredNumberWinsIn;
} }
/** /**
@@ -152,17 +152,17 @@ public class Quest_Assignment {
* *
* @return a int. * @return a int.
*/ */
public int getRequiredNumberWins() { public final int getRequiredNumberWins() {
return requiredNumberWins; return requiredNumberWins;
} }
/** /**
* <p>Setter for the field <code>computerLife</code>.</p> * <p>Setter for the field <code>computerLife</code>.</p>
* *
* @param computerLife a int. * @param computerLifeIn a int.
*/ */
public void setComputerLife(int computerLife) { public final void setComputerLife(final int computerLifeIn) {
this.computerLife = computerLife; this.computerLife = computerLifeIn;
} }
/** /**
@@ -170,17 +170,17 @@ public class Quest_Assignment {
* *
* @return a int. * @return a int.
*/ */
public int getComputerLife() { public final int getComputerLife() {
return computerLife; return computerLife;
} }
/** /**
* <p>Setter for the field <code>cardReward</code>.</p> * <p>Setter for the field <code>cardReward</code>.</p>
* *
* @param cardReward a {@link java.lang.String} object. * @param cardRewardIn a {@link java.lang.String} object.
*/ */
public void setCardReward(String cardReward) { public final void setCardReward(final String cardRewardIn) {
this.cardReward = cardReward; this.cardReward = cardRewardIn;
} }
/** /**
@@ -188,7 +188,7 @@ public class Quest_Assignment {
* *
* @return a {@link java.lang.String} object. * @return a {@link java.lang.String} object.
*/ */
public String getCardReward() { public final String getCardReward() {
return cardReward; return cardReward;
} }
@@ -197,7 +197,7 @@ public class Quest_Assignment {
* *
* @param s a {@link java.lang.String} object. * @param s a {@link java.lang.String} object.
*/ */
public void setIconName(String s) { public final void setIconName(final String s) {
iconName = s; iconName = s;
} }
@@ -206,17 +206,17 @@ public class Quest_Assignment {
* *
* @return a {@link java.lang.String} object. * @return a {@link java.lang.String} object.
*/ */
public String getIconName() { public final String getIconName() {
return iconName; return iconName;
} }
/** /**
* <p>Setter for the field <code>human</code>.</p> * <p>Setter for the field <code>human</code>.</p>
* *
* @param human a {@link forge.CardList} object. * @param humanIn a {@link forge.CardList} object.
*/ */
public void setHuman(CardList human) { public final void setHuman(final CardList humanIn) {
this.human = human; this.human = humanIn;
} }
/** /**
@@ -224,7 +224,7 @@ public class Quest_Assignment {
* *
* @return a {@link forge.CardList} object. * @return a {@link forge.CardList} object.
*/ */
public CardList getHuman() { public final CardList getHuman() {
return human; return human;
} }
@@ -233,14 +233,14 @@ public class Quest_Assignment {
* *
* @param s a {@link java.lang.String} object. * @param s a {@link java.lang.String} object.
*/ */
public void addCompy(String s) { public final void addCompy(final String s) {
this.compy.add(s); this.compy.add(s);
} }
/** /**
* <p>clearCompy.</p> * <p>clearCompy.</p>
*/ */
public void clearCompy() { public final void clearCompy() {
this.compy.clear(); this.compy.clear();
} }
@@ -250,17 +250,17 @@ public class Quest_Assignment {
* *
* @return a {@link java.util.ArrayList} object. * @return a {@link java.util.ArrayList} object.
*/ */
public ArrayList<String> getCompy() { public final ArrayList<String> getCompy() {
return compy; return compy;
} }
/** /**
* <p>Setter for the field <code>cardRewardList</code>.</p> * <p>Setter for the field <code>cardRewardList</code>.</p>
* *
* @param cardRewardList a {@link java.util.ArrayList} object. * @param cardRewardListIn a {@link java.util.ArrayList} object.
*/ */
public void setCardRewardList(ArrayList<CardPrinted> cardRewardList) { public final void setCardRewardList(final ArrayList<CardPrinted> cardRewardListIn) {
this.cardRewardList = cardRewardList; this.cardRewardList = cardRewardListIn;
} }
/** /**
@@ -268,7 +268,7 @@ public class Quest_Assignment {
* *
* @return a {@link java.util.ArrayList} object. * @return a {@link java.util.ArrayList} object.
*/ */
public ArrayList<CardPrinted> getCardRewardList() { public final ArrayList<CardPrinted> getCardRewardList() {
return cardRewardList; return cardRewardList;
} }
} }

View File

@@ -41,7 +41,7 @@ public class SealedDeck {
Object o = GuiUtils.getChoice("Choose Block", rbNames.toArray()); Object o = GuiUtils.getChoice("Choose Block", rbNames.toArray());
ArrayList<String> blockSets = SetInfoUtil.getSets_BlockName(o.toString()); ArrayList<String> blockSets = SetInfoUtil.getSetsBlockName(o.toString());
int nPacks = SetInfoUtil.getSealedPackCount(o.toString()); int nPacks = SetInfoUtil.getSealedPackCount(o.toString());
ArrayList<String> setCombos = new ArrayList<String>(); ArrayList<String> setCombos = new ArrayList<String>();

View File

@@ -29,7 +29,7 @@ public class SetInfo {
* @param r a {@link java.lang.String} object. * @param r a {@link java.lang.String} object.
* @param u a {@link java.lang.String} object. * @param u a {@link java.lang.String} object.
*/ */
public SetInfo(String c, String r, String u) { public SetInfo(final String c, final String r, final String u) {
Code = c; Code = c;
Rarity = r; Rarity = r;
URL = u; URL = u;
@@ -44,7 +44,7 @@ public class SetInfo {
* @param u a {@link java.lang.String} object. * @param u a {@link java.lang.String} object.
* @param p a int. * @param p a int.
*/ */
public SetInfo(String c, String r, String u, int p) { public SetInfo(final String c, final String r, final String u, final int p) {
Code = c; Code = c;
Rarity = r; Rarity = r;
URL = u; URL = u;
@@ -56,32 +56,35 @@ public class SetInfo {
* *
* @param parse a {@link java.lang.String} object. * @param parse a {@link java.lang.String} object.
*/ */
public SetInfo(String parse) { public SetInfo(final String parse) {
String[] pp = parse.split("\\|"); String[] pp = parse.split("\\|");
Code = pp[0]; Code = pp[0];
Rarity = pp[1]; Rarity = pp[1];
URL = pp[2]; URL = pp[2];
if (pp.length > 3) if (pp.length > 3) {
PicCount = Integer.parseInt(pp[3]); PicCount = Integer.parseInt(pp[3]);
else } else {
PicCount = 0; PicCount = 0;
} }
}
/** /**
* <p>toString.</p> * <p>toString.</p>
* *
* @return a {@link java.lang.String} object. * @return a {@link java.lang.String} object.
*/ */
public String toString() { public final String toString() {
return Code; return Code;
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
public boolean equals(Object o) { public final boolean equals(final Object o) {
if (o instanceof SetInfo) { if (o instanceof SetInfo) {
SetInfo siO = (SetInfo) o; SetInfo siO = (SetInfo) o;
return Code.equals(siO.Code); return Code.equals(siO.Code);
} else return false; } else {
return false;
}
} }
} }

View File

@@ -16,8 +16,13 @@ import forge.card.CardSet;
* @author Forge * @author Forge
* @version $Id$ * @version $Id$
*/ */
public class SetInfoUtil { public final class SetInfoUtil {
/** Constant <code>setData</code> */
private SetInfoUtil() {
throw new AssertionError();
}
/** Constant <code>setData</code>. */
private static HashMap<String, CardSet> setsByCode = new HashMap<String, CardSet>(); private static HashMap<String, CardSet> setsByCode = new HashMap<String, CardSet>();
private static List<CardSet> allSets = new ArrayList<CardSet>(); private static List<CardSet> allSets = new ArrayList<CardSet>();
@@ -58,10 +63,23 @@ public class SetInfoUtil {
Collections.sort(allSets); Collections.sort(allSets);
} }
/**
*
* TODO Write javadoc for this method.
* @param code a String
* @return a CardSet
*/
public static CardSet getSetByCode(final String code) { public static CardSet getSetByCode(final String code) {
if (setsByCode.isEmpty()) { loadSetData(); } if (setsByCode.isEmpty()) { loadSetData(); }
return setsByCode.get(code); return setsByCode.get(code);
} }
/**
*
* TODO Write javadoc for this method.
* @param code a String
* @return a CardSet
*/
public static CardSet getSetByCodeOrThrow(final String code) { public static CardSet getSetByCodeOrThrow(final String code) {
if (setsByCode.isEmpty()) { loadSetData(); } if (setsByCode.isEmpty()) { loadSetData(); }
CardSet set = setsByCode.get(code); CardSet set = setsByCode.get(code);
@@ -69,6 +87,11 @@ public class SetInfoUtil {
return set; return set;
} }
/**
*
* TODO Write javadoc for this method.
* @return a List<String>
*/
public static List<String> getCodeList() { public static List<String> getCodeList() {
if (setsByCode.isEmpty()) { loadSetData(); } if (setsByCode.isEmpty()) { loadSetData(); }
return new ArrayList<String>(setsByCode.keySet()); return new ArrayList<String>(setsByCode.keySet());
@@ -85,6 +108,12 @@ public class SetInfoUtil {
return Predicate.getTrue(CardSet.class).select(allSets, CardSet.fn1, CardSet.fnGetName); return Predicate.getTrue(CardSet.class).select(allSets, CardSet.fn1, CardSet.fnGetName);
} }
/**
*
* TODO Write javadoc for this method.
* @param setName a String
* @return a String
*/
public static String getCode3ByName(final String setName) { public static String getCode3ByName(final String setName) {
if (setsByCode.isEmpty()) { loadSetData(); } if (setsByCode.isEmpty()) { loadSetData(); }
@@ -95,6 +124,12 @@ public class SetInfoUtil {
return ""; return "";
} }
/**
*
* TODO Write javadoc for this method.
* @param code a String
* @return a String
*/
public static String getCode2ByCode(final String code) { public static String getCode2ByCode(final String code) {
if (setsByCode.isEmpty()) { loadSetData(); } if (setsByCode.isEmpty()) { loadSetData(); }
CardSet set = setsByCode.get(code); CardSet set = setsByCode.get(code);
@@ -102,12 +137,12 @@ public class SetInfoUtil {
} }
/** /**
* <p>getSetName_SetCode3.</p> * <p>getNameByCode.</p>
* *
* @param SetCode3 a {@link java.lang.String} object. * @param code a {@link java.lang.String} object.
* @return a {@link java.lang.String} object. * @return a {@link java.lang.String} object.
*/ */
public static String getNameByCode(String code) { public static String getNameByCode(final String code) {
if (setsByCode.isEmpty()) { loadSetData(); } if (setsByCode.isEmpty()) { loadSetData(); }
CardSet set = setsByCode.get(code); CardSet set = setsByCode.get(code);
return set == null ? "" : set.getName(); return set == null ? "" : set.getName();
@@ -134,27 +169,27 @@ public class SetInfoUtil {
} }
/** /**
* <p>getSetInfo_Code.</p> * <p>getSetInfoCode.</p>
* *
* @param SetList a {@link java.util.ArrayList} object. * @param setList a {@link java.util.ArrayList} object.
* @param SetCode a {@link java.lang.String} object. * @param setCode a {@link java.lang.String} object.
* @return a {@link forge.SetInfo} object. * @return a {@link forge.SetInfo} object.
*/ */
public static SetInfo getSetInfo_Code(ArrayList<SetInfo> SetList, String SetCode) { public static SetInfo getSetInfoCode(final ArrayList<SetInfo> setList, final String setCode) {
SetInfo si; SetInfo si;
for (int i = 0; i < SetList.size(); i++) { for (int i = 0; i < setList.size(); i++) {
si = SetList.get(i); si = setList.get(i);
if (si.Code.equals(SetCode)) { return si; } if (si.Code.equals(setCode)) { return si; }
} }
return null; return null;
} }
/** /**
* <p>getSetIndex.</p> * <p>getIndexByCode.</p>
* *
* @param SetCode a {@link java.lang.String} object. * @param code a {@link java.lang.String} object.
* @return a int. * @return a int.
*/ */
public static int getIndexByCode(final String code) { public static int getIndexByCode(final String code) {
@@ -163,7 +198,7 @@ public class SetInfoUtil {
return set == null ? 0 : set.getIndex(); return set == null ? 0 : set.getIndex();
} }
/** Constant <code>blockData</code> */ /** Constant <code>blockData</code>. */
private static ArrayList<HashMap<String, String>> blockData = new ArrayList<HashMap<String, String>>(); private static ArrayList<HashMap<String, String>> blockData = new ArrayList<HashMap<String, String>>();
/** /**
@@ -178,9 +213,9 @@ public class SetInfoUtil {
if (s.length() > 5) { if (s.length() > 5) {
HashMap<String, String> sm = new HashMap<String, String>(); HashMap<String, String> sm = new HashMap<String, String>();
String ss[] = s.split("\\|"); String[] ss = s.split("\\|");
for (int j = 0; j < ss.length; j++) { for (int j = 0; j < ss.length; j++) {
String kv[] = ss[j].split(":"); String[] kv = ss[j].split(":");
sm.put(kv[0], kv[1]); sm.put(kv[0], kv[1]);
} }
@@ -199,39 +234,45 @@ public class SetInfoUtil {
public static ArrayList<String> getBlockNameList() { public static ArrayList<String> getBlockNameList() {
ArrayList<String> bnl = new ArrayList<String>(); ArrayList<String> bnl = new ArrayList<String>();
if (blockData.size() == 0) if (blockData.size() == 0) {
loadBlockData(); loadBlockData();
}
for (int i = 0; i < blockData.size(); i++) for (int i = 0; i < blockData.size(); i++) {
bnl.add(blockData.get(i).get("Name")); bnl.add(blockData.get(i).get("Name"));
}
return bnl; return bnl;
} }
/** /**
* <p>getSets_BlockName.</p> * <p>getSetsBlockName.</p>
* *
* @param blockName a {@link java.lang.String} object. * @param blockName a {@link java.lang.String} object.
* @return a {@link java.util.ArrayList} object. * @return a {@link java.util.ArrayList} object.
*/ */
public static ArrayList<String> getSets_BlockName(String blockName) { public static ArrayList<String> getSetsBlockName(final String blockName) {
ArrayList<String> sets = new ArrayList<String>(); ArrayList<String> sets = new ArrayList<String>();
if (blockData.size() == 0) if (blockData.size() == 0) {
loadBlockData(); loadBlockData();
}
for (int i = 0; i < blockData.size(); i++) { for (int i = 0; i < blockData.size(); i++) {
if (blockData.get(i).get("Name").equals(blockName)) { if (blockData.get(i).get("Name").equals(blockName)) {
if (blockData.get(i).containsKey("Set0")) if (blockData.get(i).containsKey("Set0")) {
sets.add(blockData.get(i).get("Set0")); sets.add(blockData.get(i).get("Set0"));
}
if (blockData.get(i).containsKey("Set1")) if (blockData.get(i).containsKey("Set1")) {
sets.add(blockData.get(i).get("Set1")); sets.add(blockData.get(i).get("Set1"));
}
if (blockData.get(i).containsKey("Set2")) if (blockData.get(i).containsKey("Set2")) {
sets.add(blockData.get(i).get("Set2")); sets.add(blockData.get(i).get("Set2"));
} }
} }
}
return sets; return sets;
} }
@@ -242,14 +283,16 @@ public class SetInfoUtil {
* @param blockName a {@link java.lang.String} object. * @param blockName a {@link java.lang.String} object.
* @return a int. * @return a int.
*/ */
public static int getDraftPackCount(String blockName) { public static int getDraftPackCount(final String blockName) {
if (blockData.size() == 0) if (blockData.size() == 0) {
loadBlockData(); loadBlockData();
}
for (int i = 0; i < blockData.size(); i++) { for (int i = 0; i < blockData.size(); i++) {
if (blockData.get(i).get("Name").equals(blockName)) if (blockData.get(i).get("Name").equals(blockName)) {
return Integer.parseInt(blockData.get(i).get("DraftPacks")); return Integer.parseInt(blockData.get(i).get("DraftPacks"));
} }
}
return 0; return 0;
} }
@@ -260,14 +303,16 @@ public class SetInfoUtil {
* @param blockName a {@link java.lang.String} object. * @param blockName a {@link java.lang.String} object.
* @return a int. * @return a int.
*/ */
public static int getSealedPackCount(String blockName) { public static int getSealedPackCount(final String blockName) {
if (blockData.size() == 0) if (blockData.size() == 0) {
loadBlockData(); loadBlockData();
}
for (int i = 0; i < blockData.size(); i++) { for (int i = 0; i < blockData.size(); i++) {
if (blockData.get(i).get("Name").equals(blockName)) if (blockData.get(i).get("Name").equals(blockName)) {
return Integer.parseInt(blockData.get(i).get("SealedPacks")); return Integer.parseInt(blockData.get(i).get("SealedPacks"));
} }
}
return 0; return 0;
} }
@@ -278,19 +323,27 @@ public class SetInfoUtil {
* @param blockName a {@link java.lang.String} object. * @param blockName a {@link java.lang.String} object.
* @return a {@link java.lang.String} object. * @return a {@link java.lang.String} object.
*/ */
public static String getLandCode(String blockName) { public static String getLandCode(final String blockName) {
if (blockData.size() == 0) if (blockData.size() == 0) {
loadBlockData(); loadBlockData();
}
for (int i = 0; i < blockData.size(); i++) { for (int i = 0; i < blockData.size(); i++) {
if (blockData.get(i).get("Name").equals(blockName)) if (blockData.get(i).get("Name").equals(blockName)) {
return blockData.get(i).get("LandSetCode"); return blockData.get(i).get("LandSetCode");
} }
}
return "M11"; // default, should never happen IRL return "M11"; // default, should never happen IRL
} }
public static ArrayList<String> getLegalSets(String fmt) { /**
*
* TODO Write javadoc for this method.
* @param fmt a String
* @return an ArrayList<String>
*/
public static ArrayList<String> getLegalSets(final String fmt) {
ArrayList<String> lglSets = new ArrayList<String>(); ArrayList<String> lglSets = new ArrayList<String>();
lglSets = FileUtil.readFile("res/blockdata/" + fmt + ".txt"); lglSets = FileUtil.readFile("res/blockdata/" + fmt + ".txt");

View File

@@ -26,11 +26,12 @@ class SimpleCombat {
* *
* @param attackingCreatures a {@link forge.CardList} object. * @param attackingCreatures a {@link forge.CardList} object.
*/ */
public SimpleCombat(CardList attackingCreatures) { public SimpleCombat(final CardList attackingCreatures) {
CardList a = attackingCreatures; CardList a = attackingCreatures;
for (int i = 0; i < a.size(); i++) for (int i = 0; i < a.size(); i++) {
addAttacker(a.get(i)); addAttacker(a.get(i));
} }
}
/** /**
* <p>Getter for the field <code>attackers</code>.</p> * <p>Getter for the field <code>attackers</code>.</p>
@@ -46,7 +47,7 @@ class SimpleCombat {
* *
* @param c a {@link forge.Card} object. * @param c a {@link forge.Card} object.
*/ */
public void addAttacker(Card c) { public void addAttacker(final Card c) {
attackers.add(c); attackers.add(c);
map.put(c, new CardList()); map.put(c, new CardList());
} }
@@ -57,7 +58,7 @@ class SimpleCombat {
* @param attacker a {@link forge.Card} object. * @param attacker a {@link forge.Card} object.
* @return a {@link forge.CardList} object. * @return a {@link forge.CardList} object.
*/ */
public CardList getBlockers(Card attacker) { public CardList getBlockers(final Card attacker) {
return map.get(attacker); return map.get(attacker);
} }
@@ -67,9 +68,11 @@ class SimpleCombat {
* @param attacker a {@link forge.Card} object. * @param attacker a {@link forge.Card} object.
* @param blocker a {@link forge.Card} object. * @param blocker a {@link forge.Card} object.
*/ */
public void addBlocker(Card attacker, Card blocker) { public void addBlocker(final Card attacker, final Card blocker) {
CardList list = map.get(attacker); CardList list = map.get(attacker);
if (list == null) throw new RuntimeException("SimpleCombat : addBlocker() attacker not found - " + attacker); if (list == null) {
throw new RuntimeException("SimpleCombat : addBlocker() attacker not found - " + attacker);
}
list.add(blocker); list.add(blocker);
} }
@@ -85,7 +88,9 @@ class SimpleCombat {
while (it.hasNext()) { while (it.hasNext()) {
Card attack = it.next(); Card attack = it.next();
CardList block = map.get(attack); CardList block = map.get(attack);
if (block.size() == 0) list.add(attack); if (block.size() == 0) {
list.add(attack);
}
} }
return list; return list;
@@ -114,9 +119,13 @@ class SimpleCombat {
int blockerDamage = block.getNetCombatDamage(); int blockerDamage = block.getNetCombatDamage();
int attackerDamage = attack.getNetCombatDamage(); int attackerDamage = attack.getNetCombatDamage();
if (attack.getNetDefense() <= blockerDamage) aDestroy.add(attack); if (attack.getNetDefense() <= blockerDamage) {
aDestroy.add(attack);
}
if (block.getNetDefense() <= attackerDamage) bDestroy.add(block); if (block.getNetDefense() <= attackerDamage) {
bDestroy.add(block);
}
} }
} //while } //while
return new CardList[]{aDestroy, bDestroy}; return new CardList[]{aDestroy, bDestroy};
@@ -143,4 +152,4 @@ class SimpleCombat {
return sb.toString(); return sb.toString();
} }
}//Combat } //end class SimpleCombat

View File

@@ -20,7 +20,7 @@ public class Time {
/** /**
* <p>start.</p> * <p>start.</p>
*/ */
public void start() { public final void start() {
startTime = System.currentTimeMillis(); startTime = System.currentTimeMillis();
} }
@@ -29,7 +29,7 @@ public class Time {
* *
* @return a double. * @return a double.
*/ */
public double stop() { public final double stop() {
stopTime = System.currentTimeMillis(); stopTime = System.currentTimeMillis();
return getTime(); return getTime();
} }
@@ -39,7 +39,7 @@ public class Time {
* *
* @return a double. * @return a double.
*/ */
public double getTime() { public final double getTime() {
return (stopTime - startTime) / 1000.0; return (stopTime - startTime) / 1000.0;
} }
} }

View File

@@ -10,10 +10,10 @@ public interface UndoCommand extends Command {
/** /**
* <p>execute.</p> * <p>execute.</p>
*/ */
public void execute(); void execute();
/** /**
* <p>undo.</p> * <p>undo.</p>
*/ */
public void undo(); void undo();
} }

View File

@@ -20,7 +20,7 @@ public enum ZCTrigger {
* @param text a {@link java.lang.String} object. * @param text a {@link java.lang.String} object.
* @param tofrom a {@link java.lang.String} object. * @param tofrom a {@link java.lang.String} object.
*/ */
ZCTrigger(String text, String tofrom) { ZCTrigger(final String text, final String tofrom) {
this.ruleText = text; this.ruleText = text;
this.triggerZones = tofrom.split(" > "); this.triggerZones = tofrom.split(" > ");
} }
@@ -32,8 +32,9 @@ public enum ZCTrigger {
* @param destintationZone a {@link java.lang.String} object. * @param destintationZone a {@link java.lang.String} object.
* @return a boolean. * @return a boolean.
*/ */
public boolean triggerOn(String sourceZone, String destintationZone) { public boolean triggerOn(final String sourceZone, final String destintationZone) {
return ((triggerZones[0].equals("any") || triggerZones[0].equals(sourceZone)) && (triggerZones[1].equals("any") || triggerZones[0].equals(sourceZone))); return ((triggerZones[0].equals("any") || triggerZones[0].equals(sourceZone))
&& (triggerZones[1].equals("any") || triggerZones[0].equals(sourceZone)));
} }
/** /**
@@ -42,9 +43,12 @@ public enum ZCTrigger {
* @param description a {@link java.lang.String} object. * @param description a {@link java.lang.String} object.
* @return a {@link forge.ZCTrigger} object. * @return a {@link forge.ZCTrigger} object.
*/ */
public static ZCTrigger getTrigger(String description) { public static ZCTrigger getTrigger(final String description) {
for (ZCTrigger t : ZCTrigger.values()) for (ZCTrigger t : ZCTrigger.values()) {
if (t.ruleText.equals(description)) return t; if (t.ruleText.equals(description)) {
return t;
}
}
return null; return null;
} }

File diff suppressed because it is too large Load Diff

View File

@@ -19,11 +19,13 @@ import forge.card.spellability.SpellAbility;
import forge.card.spellability.Target; import forge.card.spellability.Target;
import javax.swing.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import javax.swing.JOptionPane;
/** /**
* <p>AbilityFactory_Choose class.</p> * <p>AbilityFactory_Choose class.</p>
* *
@@ -31,6 +33,11 @@ import java.util.HashMap;
* @version $Id$ * @version $Id$
*/ */
public class AbilityFactory_Choose { public class AbilityFactory_Choose {
private AbilityFactory_Choose() {
throw new AssertionError();
}
// ************************************************************************* // *************************************************************************
// ************************* ChooseType ************************************ // ************************* ChooseType ************************************
// ************************************************************************* // *************************************************************************