mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
many Checkstyle fixes
This commit is contained in:
@@ -18,36 +18,36 @@ public interface BoosterDraft {
|
||||
*
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public CardPoolView nextChoice();
|
||||
CardPoolView nextChoice();
|
||||
|
||||
/**
|
||||
* <p>setChoice.</p>
|
||||
*
|
||||
* @param c a {@link forge.Card} object.
|
||||
*/
|
||||
public void setChoice(CardPrinted c);
|
||||
void setChoice(CardPrinted c);
|
||||
|
||||
/**
|
||||
* <p>hasNextChoice.</p>
|
||||
*
|
||||
* @return a boolean.
|
||||
*/
|
||||
public boolean hasNextChoice();
|
||||
boolean hasNextChoice();
|
||||
|
||||
/**
|
||||
* <p>getDecks.</p>
|
||||
*
|
||||
* @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[] = {""};
|
||||
|
||||
/** Constant <code>draftFormat="{}"</code> */
|
||||
/** Constant <code>draftFormat="{}"</code>. */
|
||||
public String draftFormat[] = {""};
|
||||
|
||||
/** Constant <code>draftPicks="{}"</code> */
|
||||
/** Constant <code>draftPicks="{}"</code>. */
|
||||
public Map<String,Float> draftPicks = new TreeMap<String,Float>();
|
||||
}
|
||||
|
||||
|
||||
@@ -6,11 +6,17 @@ import forge.card.CardPrinted;
|
||||
import forge.deck.Deck;
|
||||
import forge.gui.GuiUtils;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
/**
|
||||
*
|
||||
* TODO Write javadoc for this type.
|
||||
*
|
||||
*/
|
||||
public class BoosterDraft_1 implements BoosterDraft {
|
||||
private final BoosterDraftAI draftAI = new BoosterDraftAI();
|
||||
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
|
||||
//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
|
||||
private final int computerChoose[][] = {
|
||||
private final int[][] computerChoose = {
|
||||
{1, 2, 3, 4, 5, 6, 7},
|
||||
{0, 2, 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}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* TODO Write javadoc for Constructor.
|
||||
*/
|
||||
BoosterDraft_1() {
|
||||
pack = get8BoosterPack();
|
||||
}
|
||||
@@ -52,19 +62,21 @@ public class BoosterDraft_1 implements BoosterDraft {
|
||||
|
||||
if (draftType.equals("Full")) { // Draft from all cards in Forge
|
||||
BoosterGenerator bpFull = new BoosterGenerator();
|
||||
for (int i = 0; i < 3; i++)
|
||||
for (int i = 0; i < 3; i++) {
|
||||
packs.add(bpFull);
|
||||
}
|
||||
|
||||
LandSetCode[0] = AllZone.getCardFactory().getCard("Plains", AllZone.getHumanPlayer()).getMostRecentSet();
|
||||
} else if (draftType.equals("Block")) { // Draft from cards by block or set
|
||||
ArrayList<String> bNames = SetInfoUtil.getBlockNameList();
|
||||
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));
|
||||
}
|
||||
|
||||
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());
|
||||
|
||||
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());
|
||||
|
||||
String pp[] = p.toString().split("/");
|
||||
String[] pp = p.toString().split("/");
|
||||
int n = 0;
|
||||
for (int i = 0; i < nPacks; i++) {
|
||||
BoosterGenerator bpMulti = new BoosterGenerator(pp[i]);
|
||||
@@ -112,17 +124,19 @@ public class BoosterDraft_1 implements BoosterDraft {
|
||||
|
||||
LandSetCode[0] = SetInfoUtil.getLandCode(o.toString());
|
||||
} else if (draftType.equals("Custom")) { // Draft from user-defined cardpools
|
||||
String dList[];
|
||||
String[] dList;
|
||||
ArrayList<CustomDraft> customs = new ArrayList<CustomDraft>();
|
||||
ArrayList<String> customList = new ArrayList<String>();
|
||||
|
||||
// get list of custom draft files
|
||||
File dFolder = new File("res/draft/");
|
||||
if (!dFolder.exists())
|
||||
if (!dFolder.exists()) {
|
||||
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());
|
||||
}
|
||||
|
||||
dList = dFolder.list();
|
||||
|
||||
@@ -136,31 +150,43 @@ public class BoosterDraft_1 implements BoosterDraft {
|
||||
|
||||
String dfd = dfData.get(j);
|
||||
|
||||
if (dfd.startsWith("Name:"))
|
||||
if (dfd.startsWith("Name:")) {
|
||||
cd.Name = dfd.substring(5);
|
||||
if (dfd.startsWith("Type:"))
|
||||
}
|
||||
if (dfd.startsWith("Type:")) {
|
||||
cd.Type = dfd.substring(5);
|
||||
if (dfd.startsWith("DeckFile:"))
|
||||
}
|
||||
if (dfd.startsWith("DeckFile:")) {
|
||||
cd.DeckFile = dfd.substring(9);
|
||||
if (dfd.startsWith("IgnoreRarity:"))
|
||||
}
|
||||
if (dfd.startsWith("IgnoreRarity:")) {
|
||||
cd.IgnoreRarity = dfd.substring(13).equals("True");
|
||||
if (dfd.startsWith("LandSetCode:"))
|
||||
}
|
||||
if (dfd.startsWith("LandSetCode:")) {
|
||||
cd.LandSetCode = dfd.substring(12);
|
||||
}
|
||||
|
||||
if (dfd.startsWith("NumCards:"))
|
||||
if (dfd.startsWith("NumCards:")) {
|
||||
cd.NumCards = Integer.parseInt(dfd.substring(9));
|
||||
if (dfd.startsWith("NumSpecials:"))
|
||||
}
|
||||
if (dfd.startsWith("NumSpecials:")) {
|
||||
cd.NumSpecials = Integer.parseInt(dfd.substring(12));
|
||||
if (dfd.startsWith("NumMythics:"))
|
||||
}
|
||||
if (dfd.startsWith("NumMythics:")) {
|
||||
cd.NumMythics = Integer.parseInt(dfd.substring(11));
|
||||
if (dfd.startsWith("NumRares:"))
|
||||
}
|
||||
if (dfd.startsWith("NumRares:")) {
|
||||
cd.NumRares = Integer.parseInt(dfd.substring(9));
|
||||
if (dfd.startsWith("NumUncommons:"))
|
||||
}
|
||||
if (dfd.startsWith("NumUncommons:")) {
|
||||
cd.NumUncommons = Integer.parseInt(dfd.substring(13));
|
||||
if (dfd.startsWith("NumCommons:"))
|
||||
}
|
||||
if (dfd.startsWith("NumCommons:")) {
|
||||
cd.NumCommons = Integer.parseInt(dfd.substring(11));
|
||||
if (dfd.startsWith("NumPacks:"))
|
||||
}
|
||||
if (dfd.startsWith("NumPacks:")) {
|
||||
cd.NumPacks = Integer.parseInt(dfd.substring(9));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -173,23 +199,26 @@ public class BoosterDraft_1 implements BoosterDraft {
|
||||
CustomDraft chosenDraft = null;
|
||||
|
||||
// present list to user
|
||||
if (customs.size() < 1)
|
||||
if (customs.size() < 1) {
|
||||
JOptionPane.showMessageDialog(null, "No custom draft files found.", "", JOptionPane.INFORMATION_MESSAGE);
|
||||
|
||||
else {
|
||||
} else {
|
||||
Object p = GuiUtils.getChoice("Choose Custom Draft", customList.toArray());
|
||||
|
||||
for (int i = 0; i < customs.size(); i++) {
|
||||
CustomDraft cd = customs.get(i);
|
||||
|
||||
if (cd.Name.equals(p.toString()))
|
||||
if (cd.Name.equals(p.toString())) {
|
||||
chosenDraft = cd;
|
||||
}
|
||||
}
|
||||
|
||||
if (chosenDraft.IgnoreRarity)
|
||||
if (chosenDraft.IgnoreRarity) {
|
||||
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;
|
||||
for (int i = 0; i < chosenDraft.NumPacks; i++) {
|
||||
packs.add(bpCustom);
|
||||
@@ -210,9 +239,10 @@ public class BoosterDraft_1 implements BoosterDraft {
|
||||
*
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public CardPoolView nextChoice() {
|
||||
if (pack.get(getCurrentBoosterIndex()).size() == 0)
|
||||
public final CardPoolView nextChoice() {
|
||||
if (pack.get(getCurrentBoosterIndex()).size() == 0) {
|
||||
pack = get8BoosterPack();
|
||||
}
|
||||
|
||||
computerChoose();
|
||||
return new CardPool(pack.get(getCurrentBoosterIndex()));
|
||||
@@ -223,13 +253,14 @@ public class BoosterDraft_1 implements BoosterDraft {
|
||||
*
|
||||
* @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>>();
|
||||
|
||||
if (packNum < packs.size()) {
|
||||
for (int i = 0; i < 8; i++)
|
||||
for (int i = 0; i < 8; i++) {
|
||||
list.add(packs.get(packNum).getBoosterPack());
|
||||
}
|
||||
}
|
||||
|
||||
packNum++;
|
||||
|
||||
@@ -243,12 +274,12 @@ public class BoosterDraft_1 implements BoosterDraft {
|
||||
*
|
||||
* @return an array of {@link forge.deck.Deck} objects.
|
||||
*/
|
||||
public Deck[] getDecks() {
|
||||
public final Deck[] getDecks() {
|
||||
return draftAI.getDecks();
|
||||
}
|
||||
|
||||
private void computerChoose() {
|
||||
int row[] = computerChoose[getCurrentBoosterIndex()];
|
||||
int[] row = computerChoose[getCurrentBoosterIndex()];
|
||||
|
||||
for (int i = 0; i < row.length; i++) {
|
||||
CardList forAi = new CardList();
|
||||
@@ -256,7 +287,7 @@ public class BoosterDraft_1 implements BoosterDraft {
|
||||
for (CardPrinted cr : booster) {
|
||||
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);
|
||||
String pickedName = aiPick.getName();
|
||||
|
||||
@@ -279,34 +310,36 @@ public class BoosterDraft_1 implements BoosterDraft {
|
||||
*
|
||||
* @return a boolean.
|
||||
*/
|
||||
public boolean hasNextChoice() {
|
||||
public final boolean hasNextChoice() {
|
||||
return currentCount < stopCount;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void setChoice(CardPrinted c) {
|
||||
public final void setChoice(final CardPrinted c) {
|
||||
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);
|
||||
}
|
||||
|
||||
if (Constant.Runtime.UpldDrft[0]) {
|
||||
for (int i = 0; i < thisBooster.size(); i++) {
|
||||
CardPrinted cc = thisBooster.get(i);
|
||||
String CnBk = cc.getName() + "|" + cc.getSet();
|
||||
String cnBk = cc.getName() + "|" + cc.getSet();
|
||||
|
||||
float pickValue = 0;
|
||||
if (cc.equals(c))
|
||||
if (cc.equals(c)) {
|
||||
pickValue = thisBooster.size() * (1f - ((float) currentCount) / stopCount) * 2f;
|
||||
else
|
||||
pickValue = 0;
|
||||
|
||||
if (!draftPicks.containsKey(CnBk)) {
|
||||
draftPicks.put(CnBk, pickValue);
|
||||
} 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;
|
||||
draftPicks.put(CnBk, newValue);
|
||||
draftPicks.put(cnBk, newValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,6 @@ public class BoosterGenerator {
|
||||
numMythics = 0;
|
||||
numSpecials = 0;
|
||||
|
||||
|
||||
for (CardPrinted c : CardDb.instance().getAllUniqueCards()) {
|
||||
addToRarity(c);
|
||||
}
|
||||
@@ -59,7 +58,20 @@ public class BoosterGenerator {
|
||||
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;
|
||||
numUncommons = nUncommons;
|
||||
numRares = nRares;
|
||||
@@ -68,9 +80,10 @@ public class BoosterGenerator {
|
||||
|
||||
//DeckManager dio = new DeckManager(ForgeProps.getFile(NewConstants.NEW_DECKS));
|
||||
DeckManager dio = AllZone.getDeckManager();
|
||||
Deck dPool = dio.getDeck(DeckFile);
|
||||
if (dPool == null)
|
||||
throw new RuntimeException("BoosterGenerator : deck not found - " + DeckFile);
|
||||
Deck dPool = dio.getDeck(deckFile);
|
||||
if (dPool == null) {
|
||||
throw new RuntimeException("BoosterGenerator : deck not found - " + deckFile);
|
||||
}
|
||||
|
||||
CardPoolView tList = dPool.getMain();
|
||||
for (Entry<CardPrinted, Integer> e : tList) {
|
||||
@@ -84,7 +97,7 @@ public class BoosterGenerator {
|
||||
/**
|
||||
* <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) {
|
||||
numCommons = 0;
|
||||
@@ -155,15 +168,16 @@ public class BoosterGenerator {
|
||||
*
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public List<CardPrinted> getBoosterPack() {
|
||||
public final List<CardPrinted> getBoosterPack() {
|
||||
List<CardPrinted> temp = new ArrayList<CardPrinted>();
|
||||
|
||||
int i = 0;
|
||||
|
||||
if (commons.size() > numCommons) {
|
||||
for (i = 0; i < numCommons; i++) {
|
||||
if (iCommons >= commons.size())
|
||||
if (iCommons >= commons.size()) {
|
||||
iCommons = 0;
|
||||
}
|
||||
|
||||
temp.add(commons.get(iCommons++));
|
||||
}
|
||||
@@ -171,8 +185,9 @@ public class BoosterGenerator {
|
||||
|
||||
if (uncommons.size() > numUncommons) {
|
||||
for (i = 0; i < numUncommons; i++) {
|
||||
if (iUncommons >= uncommons.size())
|
||||
if (iUncommons >= uncommons.size()) {
|
||||
iUncommons = 0;
|
||||
}
|
||||
|
||||
temp.add(uncommons.get(iUncommons++));
|
||||
}
|
||||
@@ -182,21 +197,24 @@ public class BoosterGenerator {
|
||||
if (numMythics > 0) {
|
||||
if (mythics.size() > numMythics) {
|
||||
if (MyRandom.random.nextInt(8) <= 1) {
|
||||
if (iMythics >= mythics.size())
|
||||
if (iMythics >= mythics.size()) {
|
||||
iMythics = 0;
|
||||
}
|
||||
|
||||
temp.add(mythics.get(iMythics++));
|
||||
} else {
|
||||
if (iRares >= rares.size())
|
||||
if (iRares >= rares.size()) {
|
||||
iRares = 0;
|
||||
}
|
||||
|
||||
temp.add(rares.get(iRares++));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (rares.size() > numRares) {
|
||||
if (iRares >= rares.size())
|
||||
if (iRares >= rares.size()) {
|
||||
iRares = 0;
|
||||
}
|
||||
|
||||
temp.add(rares.get(iRares++));
|
||||
}
|
||||
@@ -205,8 +223,9 @@ public class BoosterGenerator {
|
||||
|
||||
if (specials.size() > numSpecials) {
|
||||
for (i = 0; i < numSpecials; i++) {
|
||||
if (iSpecials >= specials.size())
|
||||
if (iSpecials >= specials.size()) {
|
||||
iSpecials = 0;
|
||||
}
|
||||
|
||||
temp.add(specials.get(iSpecials++));
|
||||
}
|
||||
@@ -220,11 +239,11 @@ public class BoosterGenerator {
|
||||
*
|
||||
* @return a int.
|
||||
*/
|
||||
public int getBoosterPackSize() {
|
||||
public final int getBoosterPackSize() {
|
||||
return numCommons + numUncommons + numRares + numSpecials;
|
||||
}
|
||||
|
||||
private void addToRarity(CardPrinted c) {
|
||||
private void addToRarity(final CardPrinted c) {
|
||||
switch(c.getRarity()) {
|
||||
case Common: commons.add(c); break;
|
||||
case Uncommon: uncommons.add(c); break;
|
||||
|
||||
@@ -1068,7 +1068,7 @@ public class GameAction {
|
||||
card.setRandomSetCode();
|
||||
|
||||
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)
|
||||
card.setRandomPicture(generator.nextInt(n - 1) + 1);
|
||||
|
||||
@@ -1119,7 +1119,7 @@ public class GameAction {
|
||||
card.setRandomSetCode();
|
||||
|
||||
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)
|
||||
card.setRandomPicture(generator.nextInt(n - 1) + 1);
|
||||
|
||||
|
||||
@@ -33,10 +33,10 @@ public class Quest_Assignment {
|
||||
/**
|
||||
* <p>Setter for the field <code>id</code>.</p>
|
||||
*
|
||||
* @param id a int.
|
||||
* @param idIn a int.
|
||||
*/
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
public final void setId(final int idIn) {
|
||||
this.id = idIn;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,17 +44,17 @@ public class Quest_Assignment {
|
||||
*
|
||||
* @return a int.
|
||||
*/
|
||||
public int getId() {
|
||||
public final int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Setter for the field <code>creditsReward</code>.</p>
|
||||
*
|
||||
* @param creditsReward a long.
|
||||
* @param creditsRewardIn a long.
|
||||
*/
|
||||
public void setCreditsReward(long creditsReward) {
|
||||
this.creditsReward = creditsReward;
|
||||
public final void setCreditsReward(final long creditsRewardIn) {
|
||||
this.creditsReward = creditsRewardIn;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,17 +62,17 @@ public class Quest_Assignment {
|
||||
*
|
||||
* @return a long.
|
||||
*/
|
||||
public long getCreditsReward() {
|
||||
public final long getCreditsReward() {
|
||||
return creditsReward;
|
||||
}
|
||||
|
||||
/**
|
||||
* <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) {
|
||||
this.name = name;
|
||||
public final void setName(final String nameIn) {
|
||||
this.name = nameIn;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,17 +80,17 @@ public class Quest_Assignment {
|
||||
*
|
||||
* @return a {@link java.lang.String} object.
|
||||
*/
|
||||
public String getName() {
|
||||
public final String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* <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) {
|
||||
this.desc = desc;
|
||||
public final void setDesc(final String descIn) {
|
||||
this.desc = descIn;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,17 +98,17 @@ public class Quest_Assignment {
|
||||
*
|
||||
* @return a {@link java.lang.String} object.
|
||||
*/
|
||||
public String getDesc() {
|
||||
public final String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* <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) {
|
||||
this.difficulty = difficulty;
|
||||
public final void setDifficulty(final String difficultyIn) {
|
||||
this.difficulty = difficultyIn;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,17 +116,17 @@ public class Quest_Assignment {
|
||||
*
|
||||
* @return a {@link java.lang.String} object.
|
||||
*/
|
||||
public String getDifficulty() {
|
||||
public final String getDifficulty() {
|
||||
return difficulty;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Setter for the field <code>repeatable</code>.</p>
|
||||
*
|
||||
* @param repeatable a boolean.
|
||||
* @param repeatableIn a boolean.
|
||||
*/
|
||||
public void setRepeatable(boolean repeatable) {
|
||||
this.repeatable = repeatable;
|
||||
public final void setRepeatable(final boolean repeatableIn) {
|
||||
this.repeatable = repeatableIn;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -134,17 +134,17 @@ public class Quest_Assignment {
|
||||
*
|
||||
* @return a boolean.
|
||||
*/
|
||||
public boolean isRepeatable() {
|
||||
public final boolean isRepeatable() {
|
||||
return repeatable;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Setter for the field <code>requiredNumberWins</code>.</p>
|
||||
*
|
||||
* @param requiredNumberWins a int.
|
||||
* @param requiredNumberWinsIn a int.
|
||||
*/
|
||||
public void setRequiredNumberWins(int requiredNumberWins) {
|
||||
this.requiredNumberWins = requiredNumberWins;
|
||||
public final void setRequiredNumberWins(final int requiredNumberWinsIn) {
|
||||
this.requiredNumberWins = requiredNumberWinsIn;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -152,17 +152,17 @@ public class Quest_Assignment {
|
||||
*
|
||||
* @return a int.
|
||||
*/
|
||||
public int getRequiredNumberWins() {
|
||||
public final int getRequiredNumberWins() {
|
||||
return requiredNumberWins;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Setter for the field <code>computerLife</code>.</p>
|
||||
*
|
||||
* @param computerLife a int.
|
||||
* @param computerLifeIn a int.
|
||||
*/
|
||||
public void setComputerLife(int computerLife) {
|
||||
this.computerLife = computerLife;
|
||||
public final void setComputerLife(final int computerLifeIn) {
|
||||
this.computerLife = computerLifeIn;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -170,17 +170,17 @@ public class Quest_Assignment {
|
||||
*
|
||||
* @return a int.
|
||||
*/
|
||||
public int getComputerLife() {
|
||||
public final int getComputerLife() {
|
||||
return computerLife;
|
||||
}
|
||||
|
||||
/**
|
||||
* <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) {
|
||||
this.cardReward = cardReward;
|
||||
public final void setCardReward(final String cardRewardIn) {
|
||||
this.cardReward = cardRewardIn;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -188,7 +188,7 @@ public class Quest_Assignment {
|
||||
*
|
||||
* @return a {@link java.lang.String} object.
|
||||
*/
|
||||
public String getCardReward() {
|
||||
public final String getCardReward() {
|
||||
return cardReward;
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ public class Quest_Assignment {
|
||||
*
|
||||
* @param s a {@link java.lang.String} object.
|
||||
*/
|
||||
public void setIconName(String s) {
|
||||
public final void setIconName(final String s) {
|
||||
iconName = s;
|
||||
}
|
||||
|
||||
@@ -206,17 +206,17 @@ public class Quest_Assignment {
|
||||
*
|
||||
* @return a {@link java.lang.String} object.
|
||||
*/
|
||||
public String getIconName() {
|
||||
public final String getIconName() {
|
||||
return iconName;
|
||||
}
|
||||
|
||||
/**
|
||||
* <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) {
|
||||
this.human = human;
|
||||
public final void setHuman(final CardList humanIn) {
|
||||
this.human = humanIn;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -224,7 +224,7 @@ public class Quest_Assignment {
|
||||
*
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public CardList getHuman() {
|
||||
public final CardList getHuman() {
|
||||
return human;
|
||||
}
|
||||
|
||||
@@ -233,14 +233,14 @@ public class Quest_Assignment {
|
||||
*
|
||||
* @param s a {@link java.lang.String} object.
|
||||
*/
|
||||
public void addCompy(String s) {
|
||||
public final void addCompy(final String s) {
|
||||
this.compy.add(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>clearCompy.</p>
|
||||
*/
|
||||
public void clearCompy() {
|
||||
public final void clearCompy() {
|
||||
this.compy.clear();
|
||||
}
|
||||
|
||||
@@ -250,17 +250,17 @@ public class Quest_Assignment {
|
||||
*
|
||||
* @return a {@link java.util.ArrayList} object.
|
||||
*/
|
||||
public ArrayList<String> getCompy() {
|
||||
public final ArrayList<String> getCompy() {
|
||||
return compy;
|
||||
}
|
||||
|
||||
/**
|
||||
* <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) {
|
||||
this.cardRewardList = cardRewardList;
|
||||
public final void setCardRewardList(final ArrayList<CardPrinted> cardRewardListIn) {
|
||||
this.cardRewardList = cardRewardListIn;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -268,7 +268,7 @@ public class Quest_Assignment {
|
||||
*
|
||||
* @return a {@link java.util.ArrayList} object.
|
||||
*/
|
||||
public ArrayList<CardPrinted> getCardRewardList() {
|
||||
public final ArrayList<CardPrinted> getCardRewardList() {
|
||||
return cardRewardList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class SealedDeck {
|
||||
|
||||
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());
|
||||
|
||||
ArrayList<String> setCombos = new ArrayList<String>();
|
||||
|
||||
@@ -29,7 +29,7 @@ public class SetInfo {
|
||||
* @param r 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;
|
||||
Rarity = r;
|
||||
URL = u;
|
||||
@@ -44,7 +44,7 @@ public class SetInfo {
|
||||
* @param u a {@link java.lang.String} object.
|
||||
* @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;
|
||||
Rarity = r;
|
||||
URL = u;
|
||||
@@ -56,32 +56,35 @@ public class SetInfo {
|
||||
*
|
||||
* @param parse a {@link java.lang.String} object.
|
||||
*/
|
||||
public SetInfo(String parse) {
|
||||
public SetInfo(final String parse) {
|
||||
String[] pp = parse.split("\\|");
|
||||
Code = pp[0];
|
||||
Rarity = pp[1];
|
||||
URL = pp[2];
|
||||
if (pp.length > 3)
|
||||
if (pp.length > 3) {
|
||||
PicCount = Integer.parseInt(pp[3]);
|
||||
else
|
||||
} else {
|
||||
PicCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>toString.</p>
|
||||
*
|
||||
* @return a {@link java.lang.String} object.
|
||||
*/
|
||||
public String toString() {
|
||||
public final String toString() {
|
||||
return Code;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public boolean equals(Object o) {
|
||||
public final boolean equals(final Object o) {
|
||||
if (o instanceof SetInfo) {
|
||||
SetInfo siO = (SetInfo) o;
|
||||
return Code.equals(siO.Code);
|
||||
} else return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,8 +16,13 @@ import forge.card.CardSet;
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class SetInfoUtil {
|
||||
/** Constant <code>setData</code> */
|
||||
public final class SetInfoUtil {
|
||||
|
||||
private SetInfoUtil() {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
/** Constant <code>setData</code>. */
|
||||
private static HashMap<String, CardSet> setsByCode = new HashMap<String, CardSet>();
|
||||
private static List<CardSet> allSets = new ArrayList<CardSet>();
|
||||
|
||||
@@ -58,10 +63,23 @@ public class SetInfoUtil {
|
||||
Collections.sort(allSets);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* TODO Write javadoc for this method.
|
||||
* @param code a String
|
||||
* @return a CardSet
|
||||
*/
|
||||
public static CardSet getSetByCode(final String code) {
|
||||
if (setsByCode.isEmpty()) { loadSetData(); }
|
||||
return setsByCode.get(code);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* TODO Write javadoc for this method.
|
||||
* @param code a String
|
||||
* @return a CardSet
|
||||
*/
|
||||
public static CardSet getSetByCodeOrThrow(final String code) {
|
||||
if (setsByCode.isEmpty()) { loadSetData(); }
|
||||
CardSet set = setsByCode.get(code);
|
||||
@@ -69,6 +87,11 @@ public class SetInfoUtil {
|
||||
return set;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* TODO Write javadoc for this method.
|
||||
* @return a List<String>
|
||||
*/
|
||||
public static List<String> getCodeList() {
|
||||
if (setsByCode.isEmpty()) { loadSetData(); }
|
||||
return new ArrayList<String>(setsByCode.keySet());
|
||||
@@ -85,6 +108,12 @@ public class SetInfoUtil {
|
||||
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) {
|
||||
if (setsByCode.isEmpty()) { loadSetData(); }
|
||||
|
||||
@@ -95,6 +124,12 @@ public class SetInfoUtil {
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* TODO Write javadoc for this method.
|
||||
* @param code a String
|
||||
* @return a String
|
||||
*/
|
||||
public static String getCode2ByCode(final String code) {
|
||||
if (setsByCode.isEmpty()) { loadSetData(); }
|
||||
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.
|
||||
*/
|
||||
public static String getNameByCode(String code) {
|
||||
public static String getNameByCode(final String code) {
|
||||
if (setsByCode.isEmpty()) { loadSetData(); }
|
||||
CardSet set = setsByCode.get(code);
|
||||
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 SetCode a {@link java.lang.String} object.
|
||||
* @param setList a {@link java.util.ArrayList} object.
|
||||
* @param setCode a {@link java.lang.String} 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;
|
||||
|
||||
for (int i = 0; i < SetList.size(); i++) {
|
||||
si = SetList.get(i);
|
||||
if (si.Code.equals(SetCode)) { return si; }
|
||||
for (int i = 0; i < setList.size(); i++) {
|
||||
si = setList.get(i);
|
||||
if (si.Code.equals(setCode)) { return si; }
|
||||
}
|
||||
|
||||
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.
|
||||
*/
|
||||
public static int getIndexByCode(final String code) {
|
||||
@@ -163,7 +198,7 @@ public class SetInfoUtil {
|
||||
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>>();
|
||||
|
||||
/**
|
||||
@@ -178,9 +213,9 @@ public class SetInfoUtil {
|
||||
if (s.length() > 5) {
|
||||
HashMap<String, String> sm = new HashMap<String, String>();
|
||||
|
||||
String ss[] = s.split("\\|");
|
||||
String[] ss = s.split("\\|");
|
||||
for (int j = 0; j < ss.length; j++) {
|
||||
String kv[] = ss[j].split(":");
|
||||
String[] kv = ss[j].split(":");
|
||||
sm.put(kv[0], kv[1]);
|
||||
}
|
||||
|
||||
@@ -199,39 +234,45 @@ public class SetInfoUtil {
|
||||
public static ArrayList<String> getBlockNameList() {
|
||||
ArrayList<String> bnl = new ArrayList<String>();
|
||||
|
||||
if (blockData.size() == 0)
|
||||
if (blockData.size() == 0) {
|
||||
loadBlockData();
|
||||
}
|
||||
|
||||
for (int i = 0; i < blockData.size(); i++)
|
||||
for (int i = 0; i < blockData.size(); i++) {
|
||||
bnl.add(blockData.get(i).get("Name"));
|
||||
}
|
||||
|
||||
return bnl;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>getSets_BlockName.</p>
|
||||
* <p>getSetsBlockName.</p>
|
||||
*
|
||||
* @param blockName a {@link java.lang.String} 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>();
|
||||
|
||||
if (blockData.size() == 0)
|
||||
if (blockData.size() == 0) {
|
||||
loadBlockData();
|
||||
}
|
||||
|
||||
for (int i = 0; i < blockData.size(); i++) {
|
||||
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"));
|
||||
}
|
||||
|
||||
if (blockData.get(i).containsKey("Set1"))
|
||||
if (blockData.get(i).containsKey("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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sets;
|
||||
}
|
||||
@@ -242,14 +283,16 @@ public class SetInfoUtil {
|
||||
* @param blockName a {@link java.lang.String} object.
|
||||
* @return a int.
|
||||
*/
|
||||
public static int getDraftPackCount(String blockName) {
|
||||
if (blockData.size() == 0)
|
||||
public static int getDraftPackCount(final String blockName) {
|
||||
if (blockData.size() == 0) {
|
||||
loadBlockData();
|
||||
}
|
||||
|
||||
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 0;
|
||||
}
|
||||
@@ -260,14 +303,16 @@ public class SetInfoUtil {
|
||||
* @param blockName a {@link java.lang.String} object.
|
||||
* @return a int.
|
||||
*/
|
||||
public static int getSealedPackCount(String blockName) {
|
||||
if (blockData.size() == 0)
|
||||
public static int getSealedPackCount(final String blockName) {
|
||||
if (blockData.size() == 0) {
|
||||
loadBlockData();
|
||||
}
|
||||
|
||||
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 0;
|
||||
}
|
||||
@@ -278,19 +323,27 @@ public class SetInfoUtil {
|
||||
* @param blockName a {@link java.lang.String} object.
|
||||
* @return a {@link java.lang.String} object.
|
||||
*/
|
||||
public static String getLandCode(String blockName) {
|
||||
if (blockData.size() == 0)
|
||||
public static String getLandCode(final String blockName) {
|
||||
if (blockData.size() == 0) {
|
||||
loadBlockData();
|
||||
}
|
||||
|
||||
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 "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>();
|
||||
|
||||
lglSets = FileUtil.readFile("res/blockdata/" + fmt + ".txt");
|
||||
|
||||
@@ -26,11 +26,12 @@ class SimpleCombat {
|
||||
*
|
||||
* @param attackingCreatures a {@link forge.CardList} object.
|
||||
*/
|
||||
public SimpleCombat(CardList attackingCreatures) {
|
||||
public SimpleCombat(final CardList attackingCreatures) {
|
||||
CardList a = attackingCreatures;
|
||||
for (int i = 0; i < a.size(); i++)
|
||||
for (int i = 0; i < a.size(); i++) {
|
||||
addAttacker(a.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Getter for the field <code>attackers</code>.</p>
|
||||
@@ -46,7 +47,7 @@ class SimpleCombat {
|
||||
*
|
||||
* @param c a {@link forge.Card} object.
|
||||
*/
|
||||
public void addAttacker(Card c) {
|
||||
public void addAttacker(final Card c) {
|
||||
attackers.add(c);
|
||||
map.put(c, new CardList());
|
||||
}
|
||||
@@ -57,7 +58,7 @@ class SimpleCombat {
|
||||
* @param attacker a {@link forge.Card} object.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public CardList getBlockers(Card attacker) {
|
||||
public CardList getBlockers(final Card attacker) {
|
||||
return map.get(attacker);
|
||||
}
|
||||
|
||||
@@ -67,9 +68,11 @@ class SimpleCombat {
|
||||
* @param attacker 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);
|
||||
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);
|
||||
}
|
||||
@@ -85,7 +88,9 @@ class SimpleCombat {
|
||||
while (it.hasNext()) {
|
||||
Card attack = it.next();
|
||||
CardList block = map.get(attack);
|
||||
if (block.size() == 0) list.add(attack);
|
||||
if (block.size() == 0) {
|
||||
list.add(attack);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
@@ -114,9 +119,13 @@ class SimpleCombat {
|
||||
int blockerDamage = block.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
|
||||
return new CardList[]{aDestroy, bDestroy};
|
||||
@@ -143,4 +152,4 @@ class SimpleCombat {
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}//Combat
|
||||
} //end class SimpleCombat
|
||||
|
||||
@@ -20,7 +20,7 @@ public class Time {
|
||||
/**
|
||||
* <p>start.</p>
|
||||
*/
|
||||
public void start() {
|
||||
public final void start() {
|
||||
startTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public class Time {
|
||||
*
|
||||
* @return a double.
|
||||
*/
|
||||
public double stop() {
|
||||
public final double stop() {
|
||||
stopTime = System.currentTimeMillis();
|
||||
return getTime();
|
||||
}
|
||||
@@ -39,7 +39,7 @@ public class Time {
|
||||
*
|
||||
* @return a double.
|
||||
*/
|
||||
public double getTime() {
|
||||
public final double getTime() {
|
||||
return (stopTime - startTime) / 1000.0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,10 +10,10 @@ public interface UndoCommand extends Command {
|
||||
/**
|
||||
* <p>execute.</p>
|
||||
*/
|
||||
public void execute();
|
||||
void execute();
|
||||
|
||||
/**
|
||||
* <p>undo.</p>
|
||||
*/
|
||||
public void undo();
|
||||
void undo();
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public enum ZCTrigger {
|
||||
* @param text 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.triggerZones = tofrom.split(" > ");
|
||||
}
|
||||
@@ -32,8 +32,9 @@ public enum ZCTrigger {
|
||||
* @param destintationZone a {@link java.lang.String} object.
|
||||
* @return a boolean.
|
||||
*/
|
||||
public boolean triggerOn(String sourceZone, String destintationZone) {
|
||||
return ((triggerZones[0].equals("any") || triggerZones[0].equals(sourceZone)) && (triggerZones[1].equals("any") || triggerZones[0].equals(sourceZone)));
|
||||
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)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,9 +43,12 @@ public enum ZCTrigger {
|
||||
* @param description a {@link java.lang.String} object.
|
||||
* @return a {@link forge.ZCTrigger} object.
|
||||
*/
|
||||
public static ZCTrigger getTrigger(String description) {
|
||||
for (ZCTrigger t : ZCTrigger.values())
|
||||
if (t.ruleText.equals(description)) return t;
|
||||
public static ZCTrigger getTrigger(final String description) {
|
||||
for (ZCTrigger t : ZCTrigger.values()) {
|
||||
if (t.ruleText.equals(description)) {
|
||||
return t;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -19,11 +19,13 @@ import forge.card.spellability.SpellAbility;
|
||||
import forge.card.spellability.Target;
|
||||
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
/**
|
||||
* <p>AbilityFactory_Choose class.</p>
|
||||
*
|
||||
@@ -31,6 +33,11 @@ import java.util.HashMap;
|
||||
* @version $Id$
|
||||
*/
|
||||
public class AbilityFactory_Choose {
|
||||
|
||||
private AbilityFactory_Choose() {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
// *************************************************************************
|
||||
// ************************* ChooseType ************************************
|
||||
// *************************************************************************
|
||||
|
||||
Reference in New Issue
Block a user