mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
Quest will use a single set to generate lands for shop
This commit is contained in:
@@ -38,8 +38,6 @@ import com.google.common.base.Function;
|
|||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.base.Predicates;
|
import com.google.common.base.Predicates;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import forge.card.EditionCollection;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a helper class to execute operations on QuestData. It has been
|
* This is a helper class to execute operations on QuestData. It has been
|
||||||
@@ -62,30 +60,6 @@ public final class QuestUtilCards {
|
|||||||
this.qpref = Singletons.getModel().getQuestPreferences();
|
this.qpref = Singletons.getModel().getQuestPreferences();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds the basic lands.
|
|
||||||
*
|
|
||||||
* @param nBasic the n basic
|
|
||||||
* @param nSnow the n snow
|
|
||||||
* @return the item pool view
|
|
||||||
*/
|
|
||||||
public static ItemPoolView<CardPrinted> generateBasicLands(final int nBasic, final int nSnow) {
|
|
||||||
final CardDb db = CardDb.instance();
|
|
||||||
final ItemPool<CardPrinted> pool = new ItemPool<CardPrinted>(CardPrinted.class);
|
|
||||||
pool.add(db.getCard("Forest", "M10"), nBasic);
|
|
||||||
pool.add(db.getCard("Mountain", "M10"), nBasic);
|
|
||||||
pool.add(db.getCard("Swamp", "M10"), nBasic);
|
|
||||||
pool.add(db.getCard("Island", "M10"), nBasic);
|
|
||||||
pool.add(db.getCard("Plains", "M10"), nBasic);
|
|
||||||
|
|
||||||
pool.add(db.getCard("Snow-Covered Forest", "ICE"), nSnow);
|
|
||||||
pool.add(db.getCard("Snow-Covered Mountain", "ICE"), nSnow);
|
|
||||||
pool.add(db.getCard("Snow-Covered Swamp", "ICE"), nSnow);
|
|
||||||
pool.add(db.getCard("Snow-Covered Island", "ICE"), nSnow);
|
|
||||||
pool.add(db.getCard("Snow-Covered Plains", "ICE"), nSnow);
|
|
||||||
return pool;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the basic lands (from random sets as limited by the format).
|
* Adds the basic lands (from random sets as limited by the format).
|
||||||
*
|
*
|
||||||
@@ -98,7 +72,6 @@ public final class QuestUtilCards {
|
|||||||
final CardDb db = CardDb.instance();
|
final CardDb db = CardDb.instance();
|
||||||
final ItemPool<CardPrinted> pool = new ItemPool<CardPrinted>(CardPrinted.class);
|
final ItemPool<CardPrinted> pool = new ItemPool<CardPrinted>(CardPrinted.class);
|
||||||
|
|
||||||
Random r = new Random();
|
|
||||||
List<String> landCodes = new ArrayList<String>();
|
List<String> landCodes = new ArrayList<String>();
|
||||||
List<String> snowLandCodes = new ArrayList<String>();
|
List<String> snowLandCodes = new ArrayList<String>();
|
||||||
|
|
||||||
@@ -113,30 +86,31 @@ public final class QuestUtilCards {
|
|||||||
if (usedFormat.isSetLegal("CSP"))
|
if (usedFormat.isSetLegal("CSP"))
|
||||||
snowLandCodes.add("CSP");
|
snowLandCodes.add("CSP");
|
||||||
} else {
|
} else {
|
||||||
EditionCollection editions = Singletons.getModel().getEditions();
|
Iterable<CardEdition> allEditions = Singletons.getModel().getEditions();
|
||||||
Iterable<CardEdition> allLandCodes = Iterables.filter(editions, CardEdition.Predicates.hasBasicLands);
|
for (CardEdition edition : Iterables.filter(allEditions, CardEdition.Predicates.hasBasicLands)) {
|
||||||
for (CardEdition edition : allLandCodes) {
|
|
||||||
landCodes.add(edition.getCode());
|
landCodes.add(edition.getCode());
|
||||||
}
|
}
|
||||||
snowLandCodes.add("ICE");
|
snowLandCodes.add("ICE");
|
||||||
snowLandCodes.add("CSP");
|
snowLandCodes.add("CSP");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (landCodes.size() == 0)
|
String landCode = Aggregates.random(landCodes);
|
||||||
landCodes.add("M10");
|
if ( null == landCode )
|
||||||
|
landCode = "M10";
|
||||||
|
|
||||||
pool.add(db.getCard("Forest", landCodes.get(r.nextInt(landCodes.size()))), nBasic);
|
pool.add(db.getCard("Forest", landCode), nBasic);
|
||||||
pool.add(db.getCard("Mountain", landCodes.get(r.nextInt(landCodes.size()))), nBasic);
|
pool.add(db.getCard("Mountain", landCode), nBasic);
|
||||||
pool.add(db.getCard("Swamp", landCodes.get(r.nextInt(landCodes.size()))), nBasic);
|
pool.add(db.getCard("Swamp", landCode), nBasic);
|
||||||
pool.add(db.getCard("Island", landCodes.get(r.nextInt(landCodes.size()))), nBasic);
|
pool.add(db.getCard("Island", landCode), nBasic);
|
||||||
pool.add(db.getCard("Plains", landCodes.get(r.nextInt(landCodes.size()))), nBasic);
|
pool.add(db.getCard("Plains", landCode), nBasic);
|
||||||
|
|
||||||
if (snowLandCodes.size() > 0) {
|
if (!snowLandCodes.isEmpty()) {
|
||||||
pool.add(db.getCard("Snow-Covered Forest", snowLandCodes.get(r.nextInt(snowLandCodes.size()))), nSnow);
|
String snowLandCode = Aggregates.random(snowLandCodes);
|
||||||
pool.add(db.getCard("Snow-Covered Mountain", snowLandCodes.get(r.nextInt(snowLandCodes.size()))), nSnow);
|
pool.add(db.getCard("Snow-Covered Forest", snowLandCode), nSnow);
|
||||||
pool.add(db.getCard("Snow-Covered Swamp", snowLandCodes.get(r.nextInt(snowLandCodes.size()))), nSnow);
|
pool.add(db.getCard("Snow-Covered Mountain", snowLandCode), nSnow);
|
||||||
pool.add(db.getCard("Snow-Covered Island", snowLandCodes.get(r.nextInt(snowLandCodes.size()))), nSnow);
|
pool.add(db.getCard("Snow-Covered Swamp", snowLandCode), nSnow);
|
||||||
pool.add(db.getCard("Snow-Covered Plains", snowLandCodes.get(r.nextInt(snowLandCodes.size()))), nSnow);
|
pool.add(db.getCard("Snow-Covered Island", snowLandCode), nSnow);
|
||||||
|
pool.add(db.getCard("Snow-Covered Plains", snowLandCode), nSnow);
|
||||||
}
|
}
|
||||||
|
|
||||||
return pool;
|
return pool;
|
||||||
|
|||||||
Reference in New Issue
Block a user