fixed type for boosterpack, base price set to $3.95, fixed text, removed unused imports

This commit is contained in:
Maxmtg
2011-09-14 22:14:16 +00:00
parent 63de7ff3c1
commit 8c7f78ec19
6 changed files with 27 additions and 12 deletions

View File

@@ -1,7 +1,5 @@
package forge.card; package forge.card;
import forge.Constant;
import forge.FileUtil;
import forge.MyRandom; import forge.MyRandom;
import forge.deck.Deck; import forge.deck.Deck;
import forge.item.CardDb; import forge.item.CardDb;
@@ -9,7 +7,6 @@ import forge.item.CardPrinted;
import java.security.InvalidParameterException; import java.security.InvalidParameterException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;

View File

@@ -255,6 +255,8 @@ public final class DeckEditorShop extends DeckEditorBase {
case MythicRare: return Integer.valueOf(600); case MythicRare: return Integer.valueOf(600);
default: return Integer.valueOf(15); default: return Integer.valueOf(15);
} }
} else if (card instanceof BoosterPack) {
return 395;
} }
return 1337; return 1337;
} }
@@ -278,7 +280,7 @@ public final class DeckEditorShop extends DeckEditorBase {
List<CardPrinted> newCards = booster.getCards(); List<CardPrinted> newCards = booster.getCards();
for (CardPrinted card : newCards) { bottom.addCard(card); } for (CardPrinted card : newCards) { bottom.addCard(card); }
CardListViewer c = new CardListViewer(booster.getName(), "You have found the following new cards inside booster", newCards); CardListViewer c = new CardListViewer(booster.getName(), "You have found the following cards inside:", newCards);
c.show(); c.show();
questData.getCards().buyBooster(booster, value); questData.getCards().buyBooster(booster, value);

View File

@@ -20,7 +20,6 @@ public abstract class PresetColumns {
private static CardManaCost toManaCost(InventoryItem i) { return i instanceof CardPrinted ? ((CardPrinted) i).getCard().getManaCost() : CardManaCost.empty; } private static CardManaCost toManaCost(InventoryItem i) { return i instanceof CardPrinted ? ((CardPrinted) i).getCard().getManaCost() : CardManaCost.empty; }
private static CardColor toColor(InventoryItem i) { return i instanceof CardPrinted ? ((CardPrinted) i).getCard().getColor() : CardColor.nullColor; } private static CardColor toColor(InventoryItem i) { return i instanceof CardPrinted ? ((CardPrinted) i).getCard().getColor() : CardColor.nullColor; }
private static String toType(InventoryItem i) { return i instanceof CardPrinted ? ((CardPrinted) i).getCard().getType().toString() : i.getClass().toString(); }
private static String toPTL(InventoryItem i) { return i instanceof CardPrinted ? ((CardPrinted) i).getCard().getPTorLoyalty() : ""; } private static String toPTL(InventoryItem i) { return i instanceof CardPrinted ? ((CardPrinted) i).getCard().getPTorLoyalty() : ""; }
private static CardRarity toRarity(InventoryItem i) { return i instanceof CardPrinted ? ((CardPrinted) i).getRarity() : CardRarity.Unknown; } private static CardRarity toRarity(InventoryItem i) { return i instanceof CardPrinted ? ((CardPrinted) i).getRarity() : CardRarity.Unknown; }
private static CardSet toSetCmp(InventoryItem i) { return i instanceof InventoryItemFromSet ? SetUtils.getSetByCode(((InventoryItemFromSet) i).getSet()) : CardSet.unknown; } private static CardSet toSetCmp(InventoryItem i) { return i instanceof InventoryItemFromSet ? SetUtils.getSetByCode(((InventoryItemFromSet) i).getSet()) : CardSet.unknown; }
@@ -63,10 +62,10 @@ public abstract class PresetColumns {
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public static final Lambda1<Comparable, Entry<InventoryItem, Integer>> fnTypeCompare = public static final Lambda1<Comparable, Entry<InventoryItem, Integer>> fnTypeCompare =
new Lambda1<Comparable, Entry<InventoryItem, Integer>>() { @Override new Lambda1<Comparable, Entry<InventoryItem, Integer>>() { @Override
public Comparable apply(final Entry<InventoryItem, Integer> from) { return toType(from.getKey()); } }; public Comparable apply(final Entry<InventoryItem, Integer> from) { return from.getKey().getType(); } };
public static final Lambda1<Object, Entry<InventoryItem, Integer>> fnTypeGet = public static final Lambda1<Object, Entry<InventoryItem, Integer>> fnTypeGet =
new Lambda1<Object, Entry<InventoryItem, Integer>>() { @Override new Lambda1<Object, Entry<InventoryItem, Integer>>() { @Override
public Object apply(final Entry<InventoryItem, Integer> from) { return toType(from.getKey()); } }; public Object apply(final Entry<InventoryItem, Integer> from) { return from.getKey().getType(); } };
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public static final Lambda1<Comparable, Entry<InventoryItem, Integer>> fnStatsCompare = public static final Lambda1<Comparable, Entry<InventoryItem, Integer>> fnStatsCompare =

View File

@@ -4,6 +4,7 @@ import java.util.List;
import forge.SetUtils; import forge.SetUtils;
import forge.card.BoosterGenerator; import forge.card.BoosterGenerator;
import forge.card.CardSet;
/** /**
* TODO: Write javadoc for this type. * TODO: Write javadoc for this type.
@@ -11,17 +12,22 @@ import forge.card.BoosterGenerator;
*/ */
public class BoosterPack implements InventoryItemFromSet { public class BoosterPack implements InventoryItemFromSet {
private final String cardSet; private final CardSet cardSet;
private final String name; private final String name;
private List<CardPrinted> cards = null; private List<CardPrinted> cards = null;
public BoosterPack(String set) { public BoosterPack(String set) {
cardSet = set; this(SetUtils.getSetByCodeOrThrow(set));
name = SetUtils.getSetByCodeOrThrow(set).getName() + " booster";
} }
@Override public String getSet() { return cardSet; } public BoosterPack(CardSet set) {
cardSet = set;
name = cardSet.getName() + " Booster Pack";
}
@Override public String getSet() { return cardSet.getCode(); }
@Override public String getName() { return name; } @Override public String getName() { return name; }
@Override public String getImageFilename() { @Override public String getImageFilename() {
@@ -32,7 +38,7 @@ public class BoosterPack implements InventoryItemFromSet {
public List<CardPrinted> getCards() { public List<CardPrinted> getCards() {
if (null == cards) if (null == cards)
{ {
BoosterGenerator gen = new BoosterGenerator(SetUtils.getSetByCode(cardSet)); BoosterGenerator gen = new BoosterGenerator(cardSet);
cards = gen.getBoosterPack(); cards = gen.getBoosterPack();
// TODO: Add land here! // TODO: Add land here!
} }
@@ -63,6 +69,14 @@ public class BoosterPack implements InventoryItemFromSet {
return false; return false;
return true; return true;
} }
/* (non-Javadoc)
* @see forge.item.InventoryItem#getType()
*/
@Override
public String getType() {
return "Booster Pack";
}

View File

@@ -50,6 +50,7 @@ public final class CardPrinted implements Comparable<CardPrinted>, InventoryItem
if (imageFilename == null) { imageFilename = CardUtil.buildFilename(this); } if (imageFilename == null) { imageFilename = CardUtil.buildFilename(this); }
return imageFilename; return imageFilename;
} }
public String getType() { return card.getType().toString(); }
// Lambda to get rules for selects from list of printed cards // Lambda to get rules for selects from list of printed cards
public static final Lambda1<CardRules, CardPrinted> fnGetRules = new Lambda1<CardRules, CardPrinted>() { public static final Lambda1<CardRules, CardPrinted> fnGetRules = new Lambda1<CardRules, CardPrinted>() {

View File

@@ -9,4 +9,6 @@ public interface InventoryItem /* extends Comparable */ {
String getName(); String getName();
/** An inventory item has to provide a picture. */ /** An inventory item has to provide a picture. */
String getImageFilename(); String getImageFilename();
/** Return type as a string */
String getType();
} }