mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
(minor) Changed from ArrayList to List in a chain of booster generation
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package forge;
|
package forge;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import forge.card.CardPrinted;
|
import forge.card.CardPrinted;
|
||||||
|
|
||||||
@@ -30,7 +31,7 @@ public class Quest_Assignment {
|
|||||||
// Other cards used in assignment: starting, and reward.
|
// Other cards used in assignment: starting, and reward.
|
||||||
private CardList humanExtraCards = new CardList();
|
private CardList humanExtraCards = new CardList();
|
||||||
private CardList aiExtraCards = new CardList();
|
private CardList aiExtraCards = new CardList();
|
||||||
private ArrayList<CardPrinted> cardRewardList = new ArrayList<CardPrinted>();
|
private List<CardPrinted> cardRewardList = new ArrayList<CardPrinted>();
|
||||||
|
|
||||||
// No constructor required; fields are set dynamically.
|
// No constructor required; fields are set dynamically.
|
||||||
|
|
||||||
@@ -81,7 +82,7 @@ public class Quest_Assignment {
|
|||||||
*
|
*
|
||||||
* @return a {@link java.util.ArrayList} object.
|
* @return a {@link java.util.ArrayList} object.
|
||||||
*/
|
*/
|
||||||
public void setCardRewardList(final ArrayList<CardPrinted> cp) {
|
public void setCardRewardList(final List<CardPrinted> cp) {
|
||||||
this.cardRewardList = cp;
|
this.cardRewardList = cp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,7 +92,7 @@ public class Quest_Assignment {
|
|||||||
*
|
*
|
||||||
* @return a {@link java.util.ArrayList} object.
|
* @return a {@link java.util.ArrayList} object.
|
||||||
*/
|
*/
|
||||||
public final ArrayList<CardPrinted> getCardRewardList() {
|
public final List<CardPrinted> getCardRewardList() {
|
||||||
return cardRewardList;
|
return cardRewardList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -106,8 +106,18 @@ public final class QuestBoosterPack {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Left if only for backwards compatibility
|
||||||
|
public List<CardPrinted> generateCards(final int num, final CardRarity rarity, final String color) {
|
||||||
|
Predicate<CardPrinted> whatYouWant = getPredicateForConditions(rarity, color);
|
||||||
|
return generateDistinctCards(CardDb.instance().getAllUniqueCards(), whatYouWant, num);
|
||||||
|
}
|
||||||
|
|
||||||
private static ArrayList<CardPrinted> generateDistinctCards(
|
public static List<CardPrinted> generateCards(final Predicate<CardPrinted> filter, int num, CardRarity rarity, String color) {
|
||||||
|
Predicate<CardPrinted> whatYouWant = Predicate.and(filter, getPredicateForConditions(rarity, color));
|
||||||
|
return generateDistinctCards(CardDb.instance().getAllUniqueCards(), whatYouWant, num);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<CardPrinted> generateDistinctCards(
|
||||||
final Iterable<CardPrinted> source,
|
final Iterable<CardPrinted> source,
|
||||||
final Predicate<CardPrinted> filter,
|
final Predicate<CardPrinted> filter,
|
||||||
final int cntNeeded)
|
final int cntNeeded)
|
||||||
@@ -131,18 +141,6 @@ public final class QuestBoosterPack {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Left if only for backwards compatibility
|
|
||||||
public ArrayList<CardPrinted> generateCards(final int num, final CardRarity rarity, final String color) {
|
|
||||||
Predicate<CardPrinted> whatYouWant = getPredicateForConditions(rarity, color);
|
|
||||||
return generateDistinctCards(CardDb.instance().getAllUniqueCards(), whatYouWant, num);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ArrayList<CardPrinted> generateCards(final Predicate<CardPrinted> filter, int num, CardRarity rarity, String color) {
|
|
||||||
Predicate<CardPrinted> whatYouWant = Predicate.and(filter, getPredicateForConditions(rarity, color));
|
|
||||||
return generateDistinctCards(CardDb.instance().getAllUniqueCards(), whatYouWant, num);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Predicate<CardPrinted> getPredicateForConditions(final CardRarity rarity, final String color)
|
private static Predicate<CardPrinted> getPredicateForConditions(final CardRarity rarity, final String color)
|
||||||
{
|
{
|
||||||
Predicate<CardPrinted> rFilter;
|
Predicate<CardPrinted> rFilter;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import forge.card.CardPrinted;
|
|||||||
import forge.card.CardRarity;
|
import forge.card.CardRarity;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>QuestUtil class.</p>
|
* <p>QuestUtil class.</p>
|
||||||
@@ -125,7 +126,7 @@ public class QuestUtil {
|
|||||||
* @param s Properties string of reward (97 multicolor rares)
|
* @param s Properties string of reward (97 multicolor rares)
|
||||||
* @return CardList
|
* @return CardList
|
||||||
*/
|
*/
|
||||||
public static ArrayList<CardPrinted> generateCardRewardList(String s) {
|
public static List<CardPrinted> generateCardRewardList(String s) {
|
||||||
QuestBoosterPack pack = new QuestBoosterPack();
|
QuestBoosterPack pack = new QuestBoosterPack();
|
||||||
String[] temp = s.split(" ");
|
String[] temp = s.split(" ");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user