mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-11 16:26:22 +00:00
Reduce bias towards standard in event selection.
Make allowedEvents override other filters. Ensure set pool filter can't filter out every event.
This commit is contained in:
@@ -175,17 +175,17 @@ public class AdventureEventData implements Serializable {
|
||||
private static final Predicate<CardEdition> filterStandard = FModel.getFormats().getStandard().editionLegalPredicate;
|
||||
|
||||
public static Predicate<CardEdition> selectSetPool() {
|
||||
// Should we negate any of these to avoid overlap?
|
||||
final int rollD100 = MyRandom.getRandom().nextInt(100);
|
||||
Predicate<CardEdition> rolledFilter;
|
||||
if (rollD100 < 30) {
|
||||
rolledFilter = filterStandard;
|
||||
} else if (rollD100 < 60) {
|
||||
rolledFilter = filterPioneer;
|
||||
// Remove standard from older pools because its representation is already inflated.
|
||||
rolledFilter = filterPioneer.and(filterStandard.negate());
|
||||
} else if (rollD100 < 80) {
|
||||
rolledFilter = filterModern;
|
||||
rolledFilter = filterModern.and(filterStandard.negate());
|
||||
} else {
|
||||
rolledFilter = filterVintage;
|
||||
rolledFilter = filterVintage.and(filterStandard.negate());
|
||||
}
|
||||
return rolledFilter;
|
||||
}
|
||||
@@ -195,13 +195,16 @@ public class AdventureEventData implements Serializable {
|
||||
private static CardBlock pickWeightedCardBlock() {
|
||||
CardEdition.Collection editions = FModel.getMagicDb().getEditions();
|
||||
ConfigData configData = Config.instance().getConfigData();
|
||||
Predicate<CardEdition> filter = CardEdition.Predicates.CAN_MAKE_BOOSTER.and(selectSetPool());
|
||||
Predicate<CardEdition> filter = CardEdition.Predicates.CAN_MAKE_BOOSTER;
|
||||
|
||||
if(configData.allowedEvents != null) {
|
||||
Set<String> allowedEvents = Set.of(configData.allowedEvents);
|
||||
filter = filter.and(q -> allowedEvents.contains(q.getCode()));
|
||||
}
|
||||
else if(configData.restrictedEvents != null) {
|
||||
else
|
||||
{
|
||||
//The whitelist beats all other filters.
|
||||
if(configData.restrictedEvents != null) {
|
||||
//Temporary restriction until rewards are more diverse - don't want to award restricted cards so these editions need different rewards added.
|
||||
//Also includes sets that use conspiracy or commander drafts.
|
||||
Set<String> restrictedEvents = Set.of(configData.restrictedEvents);
|
||||
@@ -216,6 +219,11 @@ public class AdventureEventData implements Serializable {
|
||||
filter = filter.and(q -> !restricted.contains(q.getCode()));
|
||||
}
|
||||
|
||||
Predicate<CardEdition> setPoolFilter = selectSetPool();
|
||||
if(editions.stream().anyMatch(setPoolFilter))
|
||||
filter = filter.and(setPoolFilter);
|
||||
}
|
||||
|
||||
List<CardEdition> allEditions = new ArrayList<>();
|
||||
StreamUtil.stream(editions)
|
||||
.filter(filter)
|
||||
|
||||
Reference in New Issue
Block a user