mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
Remove conjured cards from rewards
This commit is contained in:
@@ -1134,8 +1134,10 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
|
|||||||
public Predicate<? super PaperCard> wasPrintedInSets(Collection<String> setCodes) {
|
public Predicate<? super PaperCard> wasPrintedInSets(Collection<String> setCodes) {
|
||||||
Set<String> sets = new HashSet<>(setCodes);
|
Set<String> sets = new HashSet<>(setCodes);
|
||||||
return paperCard -> getAllCards(paperCard.getName()).stream()
|
return paperCard -> getAllCards(paperCard.getName()).stream()
|
||||||
.map(PaperCard::getEdition)
|
.map(PaperCard::getEdition).anyMatch(editionCode ->
|
||||||
.anyMatch(sets::contains);
|
sets.contains(editionCode) &&
|
||||||
|
StaticData.instance().getCardEdition(editionCode).isCardObtainable(paperCard.getName())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This Predicate validates if a card is legal in a given format (identified by the list of allowed sets)
|
// This Predicate validates if a card is legal in a given format (identified by the list of allowed sets)
|
||||||
|
|||||||
@@ -437,6 +437,15 @@ public final class CardEdition implements Comparable<CardEdition> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isCardObtainable(String cardName) {
|
||||||
|
for (EditionEntry ee : cardMap.get(EditionSectionWithCollectorNumbers.CONJURED.getName())) {
|
||||||
|
if (ee.name.equals(cardName)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isModern() { return getDate().after(parseDate("2003-07-27")); } //8ED and above are modern except some promo cards and others
|
public boolean isModern() { return getDate().after(parseDate("2003-07-27")); } //8ED and above are modern except some promo cards and others
|
||||||
|
|
||||||
public Multimap<String, EditionEntry> getTokens() { return tokenMap; }
|
public Multimap<String, EditionEntry> getTokens() { return tokenMap; }
|
||||||
@@ -547,6 +556,9 @@ public final class CardEdition implements Comparable<CardEdition> {
|
|||||||
|
|
||||||
List<PrintSheet> sheets = Lists.newArrayList();
|
List<PrintSheet> sheets = Lists.newArrayList();
|
||||||
for (String sectionName : cardMap.keySet()) {
|
for (String sectionName : cardMap.keySet()) {
|
||||||
|
if (sectionName.equals(EditionSectionWithCollectorNumbers.CONJURED.getName())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
PrintSheet sheet = new PrintSheet(String.format("%s %s", this.getCode(), sectionName));
|
PrintSheet sheet = new PrintSheet(String.format("%s %s", this.getCode(), sectionName));
|
||||||
|
|
||||||
List<EditionEntry> cards = cardMap.get(sectionName);
|
List<EditionEntry> cards = cardMap.get(sectionName);
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package forge.item;
|
package forge.item;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
|
import forge.StaticData;
|
||||||
import forge.card.*;
|
import forge.card.*;
|
||||||
import forge.util.PredicateString;
|
import forge.util.PredicateString;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -87,7 +89,8 @@ public abstract class PaperCardPredicates {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean test(final PaperCard card) {
|
public boolean test(final PaperCard card) {
|
||||||
return this.sets.contains(card.getEdition()) == this.mustContain;
|
return this.sets.contains(card.getEdition()) == this.mustContain &&
|
||||||
|
StaticData.instance().getCardEdition(card.getEdition()).isCardObtainable(card.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
private PredicateSets(final List<String> wantSets, final boolean shouldContain) {
|
private PredicateSets(final List<String> wantSets, final boolean shouldContain) {
|
||||||
|
|||||||
@@ -118,6 +118,10 @@ public class RewardData implements Serializable {
|
|||||||
return false;
|
return false;
|
||||||
return !Arrays.asList(configData.restrictedCards).contains(input.getName());
|
return !Arrays.asList(configData.restrictedCards).contains(input.getName());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Only allow obtainable cards
|
||||||
|
allCards = IterableUtil.filter(allCards, input -> StaticData.instance().getCardEdition(input.getEdition()).isCardObtainable(input.getCardName()));
|
||||||
|
|
||||||
//Filter AI cards for enemies.
|
//Filter AI cards for enemies.
|
||||||
allEnemyCards= IterableUtil.filter(allCards, input -> {
|
allEnemyCards= IterableUtil.filter(allCards, input -> {
|
||||||
if (input == null) return false;
|
if (input == null) return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user