* cleanups

* bugfix += != =+
This commit is contained in:
jendave
2011-08-06 10:50:44 +00:00
parent 1277f0fed5
commit 5c0cbda8af
4 changed files with 7 additions and 35 deletions

View File

@@ -73,9 +73,7 @@ public class DeckConverter {
return o; return o;
} else if(o instanceof forge.Deck[]) { } else if(o instanceof forge.Deck[]) {
//a new-type booster deck //a new-type booster deck
//TODO: FIX this impossible cast return o;
Deck d = (Deck) o;
return d.migrate();
} else if(o instanceof Deck) { } else if(o instanceof Deck) {
// an old type deck // an old type deck
Deck d = (Deck) o; Deck d = (Deck) o;

View File

@@ -225,7 +225,7 @@ public class AbilityFactory_Pump {
boolean kSize = Keywords.size() > 0; boolean kSize = Keywords.size() > 0;
String KWs[] = {"none"}; String KWs[] = {"none"};
if (!Keywords.get(0).equals("none")) if (!Keywords.get(0).equals("none"))
KWs = (String[]) Keywords.toArray(); KWs = Keywords.toArray(new String[Keywords.size()]);
boolean hKW = c.hasAnyKeyword(KWs); boolean hKW = c.hasAnyKeyword(KWs);
return (cAtt && cTgt && (kSize && !hKW) && !(!hSick && kHaste)); return (cAtt && cTgt && (kSize && !hKW) && !(!hSick && kHaste));

View File

@@ -418,14 +418,14 @@ public class CardFactoryUtil {
public static int evaluateCreatureList(CardList list) { public static int evaluateCreatureList(CardList list) {
int value = 0; int value = 0;
for(int i = 0; i < list.size(); i++) value =+ evaluateCreature(list.get(i)); for(int i = 0; i < list.size(); i++) value += evaluateCreature(list.get(i));
return value; return value;
} }
public static int evaluatePermanentList(CardList list) { public static int evaluatePermanentList(CardList list) {
int value = 0; int value = 0;
for(int i = 0; i < list.size(); i++) value =+ list.get(i).getCMC() + 1; for(int i = 0; i < list.size(); i++) value += list.get(i).getCMC() + 1;
return value; return value;
} }

View File

@@ -31,26 +31,7 @@ public class TableSorter implements Comparator<Card>, NewConstants
all = new CardList(in_all.toArray()); all = new CardList(in_all.toArray());
column = in_column; column = in_column;
ascending = in_ascending; ascending = in_ascending;
/*
if(cardsTxt == null)
cardsTxt = readCardsTxt();
*/
} }
/*
//reads the file "cards.txt"
private HashMap<String, Integer> readCardsTxt()
{
HashMap<String, Integer> map = new HashMap<String, Integer> ();
ArrayList<String> list = FileUtil.readFile(ForgeProps.getFile(CARDS));
for(int i = 0; i < list.size(); i++)
map.put(list.get(i).toString().trim(), Integer.valueOf(i));
return map;
}
*/
final public int compare(Card a, Card b) final public int compare(Card a, Card b)
{ {
@@ -105,11 +86,11 @@ public class TableSorter implements Comparator<Card>, NewConstants
aCom = getValue(a); aCom = getValue(a);
bCom = getValue(b); bCom = getValue(b);
} }
else if (column == 99)//New First /*else if (column == 99)//New First
{ {
aCom = sortNewFirst(a); aCom = sortNewFirst(a);
bCom = sortNewFirst(b); bCom = sortNewFirst(b);
} }*/
if(ascending) if(ascending)
return aCom.compareTo(bCom); return aCom.compareTo(bCom);
@@ -161,11 +142,4 @@ public class TableSorter implements Comparator<Card>, NewConstants
return c.getType().toString(); return c.getType().toString();
} }
final private Comparable<Integer> sortNewFirst(Card c)
{
if(! cardsTxt.containsKey(c.getName()))
throw new RuntimeException("TableSorter : sortNewFirst() error, Card not found - " +c.getName() +" in hashmap - " +cardsTxt);
return cardsTxt.get(c.getName());
}
} }