quest challenges rewards will not repeat that much.

This commit is contained in:
Maxmtg
2012-02-25 14:59:26 +00:00
parent 66aabc0910
commit 6cf7c16ba8
3 changed files with 16 additions and 6 deletions

View File

@@ -3,7 +3,6 @@ package forge.item;
import java.util.List;
import forge.card.BoosterData;
import forge.card.BoosterGenerator;
/**
* TODO: Write javadoc for this type.

View File

@@ -21,8 +21,12 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.slightlymagic.braids.util.lambda.Lambda1;
import forge.card.BoosterGenerator;
import forge.card.CardRules;
import forge.card.UnOpenedProduct;
import forge.item.CardDb;
import forge.item.CardPrinted;
import forge.util.MyRandom;
@@ -214,7 +218,7 @@ public final class BoosterUtils {
* Properties string of reward (97 multicolor rares)
* @return CardList
*/
public static List<CardPrinted> generateCardRewardList(final String s) {
public static UnOpenedProduct generateCardRewardList(final String s) {
final String[] temp = s.split(" ");
final int qty = Integer.parseInt(temp[0]);
@@ -242,6 +246,12 @@ public final class BoosterUtils {
col = CardRules.Predicates.Presets.IS_WHITE;
}
return BoosterUtils.generateDistinctCards(Predicate.and(rar, col, CardPrinted.FN_GET_RULES), qty);
Lambda1<List<CardPrinted>, BoosterGenerator> openWay = new Lambda1<List<CardPrinted>, BoosterGenerator>() {
@Override
public List<CardPrinted> apply(BoosterGenerator arg1) {
return arg1.getSingletonBoosterPack(qty);
}
};
return new UnOpenedProduct(openWay, new BoosterGenerator(Predicate.and(rar, col, CardPrinted.FN_GET_RULES))); // qty))
}
}

View File

@@ -20,6 +20,7 @@ package forge.quest.data;
import java.util.ArrayList;
import java.util.List;
import forge.card.UnOpenedProduct;
import forge.item.CardPrinted;
/**
@@ -60,7 +61,7 @@ public class QuestChallenge extends QuestEvent {
private List<String> aiExtraCards = new ArrayList<String>();
/** The card reward list. */
private List<CardPrinted> cardRewardList = new ArrayList<CardPrinted>();
private UnOpenedProduct cardRewardList;
/**
* Instantiates a new quest challenge.
@@ -168,7 +169,7 @@ public class QuestChallenge extends QuestEvent {
* @return the card reward list
*/
public final List<CardPrinted> getCardRewardList() {
return this.cardRewardList;
return this.cardRewardList.open();
}
/**
@@ -274,7 +275,7 @@ public class QuestChallenge extends QuestEvent {
* @param cardRewardList0
* the cardRewardList to set
*/
public void setCardRewardList(final List<CardPrinted> cardRewardList0) {
public void setCardRewardList(final UnOpenedProduct cardRewardList0) {
this.cardRewardList = cardRewardList0;
}