cleanup in constants, removing unused ones,

replacing maps with list/arrays traversal by indexes
remove imports
This commit is contained in:
Maxmtg
2013-05-26 13:32:38 +00:00
parent ce2d19ab90
commit 96069d7c65
3 changed files with 3 additions and 27 deletions

View File

@@ -20,10 +20,7 @@ package forge;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.google.common.collect.ImmutableList;
/**
@@ -82,8 +79,6 @@ public final class Constant {
/** The Colorless. */
public static final String COLORLESS = "colorless";
// color order "wubrg"
/** The Colors. */
public static final ImmutableList<String> COLORS = ImmutableList.of(Color.WHITE, Color.BLUE, Color.BLACK, Color.RED, Color.GREEN, Color.COLORLESS);
/** The only colors. */
public static final ImmutableList<String> ONLY_COLORS = ImmutableList.of(Color.WHITE, Color.BLUE, Color.BLACK, Color.RED, Color.GREEN);
@@ -91,26 +86,8 @@ public final class Constant {
/** The Snow. */
public static final String SNOW = "snow";
/** The Mana colors. */
public static final String[] MANA_COLORS = { Color.WHITE, Color.BLUE, Color.BLACK, Color.RED, Color.GREEN,
Color.COLORLESS, Color.SNOW };
/** The Basic lands. */
public static final List<String> BASIC_LANDS = Collections.unmodifiableList(Arrays.asList("Plains", "Island", "Swamp", "Mountain", "Forest"));
public static final Map<String, String> BASIC_LAND_TYPE_TO_COLOR_MAP;
static
{
Map<String, String> TypeTocol = new HashMap<String, String>();
TypeTocol.put("Plains", Color.WHITE);
TypeTocol.put("Island", Color.BLUE);
TypeTocol.put("Swamp", Color.BLACK);
TypeTocol.put("Mountain", Color.RED);
TypeTocol.put("Forest", Color.GREEN);
BASIC_LAND_TYPE_TO_COLOR_MAP = Collections.unmodifiableMap(TypeTocol);
}
}
/**

View File

@@ -24,11 +24,9 @@ import java.util.Map.Entry;
import org.apache.commons.lang.math.IntRange;
import forge.Constant;
import forge.Singletons;
import forge.card.CardCoreType;
import forge.card.ColorSet;
import forge.card.MagicColor;
import forge.item.CardDb;
import forge.item.CardPrinted;
import forge.item.IPaperCard;

View File

@@ -683,8 +683,9 @@ public final class GameActionUtil {
}
// add all appropriate mana abilities based on current types
for (String landType : Constant.Color.BASIC_LANDS) {
String color = MagicColor.toShortString(Constant.Color.BASIC_LAND_TYPE_TO_COLOR_MAP.get(landType));
for(int i = 0; i < MagicColor.WUBRG.length; i++ ) {
String landType = Constant.Color.BASIC_LANDS.get(i);
String color = MagicColor.toShortString(MagicColor.WUBRG[i]);
String abString = "AB$ Mana | Cost$ T | Produced$ " + color + " | SpellDescription$ Add " + color + " to your mana pool.";
for (final Card land : lands) {
if (land.isType(landType)) {