mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-11 16:26:22 +00:00
Merge pull request #9096 from Jetz72/fixes20251106
Minor Adventure Updates
This commit is contained in:
@@ -1,7 +1,5 @@
|
|||||||
package forge.ai.ability;
|
package forge.ai.ability;
|
||||||
|
|
||||||
import forge.ai.AiAbilityDecision;
|
|
||||||
import forge.ai.AiPlayDecision;
|
|
||||||
import forge.ai.*;
|
import forge.ai.*;
|
||||||
import forge.game.Game;
|
import forge.game.Game;
|
||||||
import forge.game.ability.AbilityUtils;
|
import forge.game.ability.AbilityUtils;
|
||||||
|
|||||||
@@ -450,7 +450,9 @@ public class EnemySprite extends CharacterSprite implements Steerable<Vector2> {
|
|||||||
.filter(paperCard -> !paperCard.isVeryBasicLand())
|
.filter(paperCard -> !paperCard.isVeryBasicLand())
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
if (paperCardList.size() < 6) {
|
int uniqueRules = paperCardList.stream().map(PaperCard::getRules).collect(Collectors.toSet()).size();
|
||||||
|
|
||||||
|
if (uniqueRules < 4 || paperCardList.size() < 10) {
|
||||||
// Player trying to cheese doppleganger and farm cards. Sorry, the fun police have arrived
|
// Player trying to cheese doppleganger and farm cards. Sorry, the fun police have arrived
|
||||||
// Static rewards of 199 GP, 9 Shards, and 1 Cheese Stands Alone
|
// Static rewards of 199 GP, 9 Shards, and 1 Cheese Stands Alone
|
||||||
rewards.add(new Reward(199));
|
rewards.add(new Reward(199));
|
||||||
@@ -466,7 +468,7 @@ public class EnemySprite extends CharacterSprite implements Steerable<Vector2> {
|
|||||||
if (AdventurePlayer.current().isFantasyMode()) {
|
if (AdventurePlayer.current().isFantasyMode()) {
|
||||||
//random uncommons from deck
|
//random uncommons from deck
|
||||||
List<PaperCard> uncommonCards = paperCardList.stream()
|
List<PaperCard> uncommonCards = paperCardList.stream()
|
||||||
.filter(paperCard -> CardRarity.Uncommon.equals(paperCard.getRarity()) || CardRarity.Special.equals(paperCard.getRarity()))
|
.filter(paperCard -> paperCard.getRarity() == CardRarity.Uncommon || paperCard.getRarity() == CardRarity.Special)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
if (!uncommonCards.isEmpty()) {
|
if (!uncommonCards.isEmpty()) {
|
||||||
rewards.add(new Reward(Aggregates.random(uncommonCards)));
|
rewards.add(new Reward(Aggregates.random(uncommonCards)));
|
||||||
@@ -474,7 +476,7 @@ public class EnemySprite extends CharacterSprite implements Steerable<Vector2> {
|
|||||||
}
|
}
|
||||||
//random commons from deck
|
//random commons from deck
|
||||||
List<PaperCard> commmonCards = paperCardList.stream()
|
List<PaperCard> commmonCards = paperCardList.stream()
|
||||||
.filter(paperCard -> CardRarity.Common.equals(paperCard.getRarity()))
|
.filter(paperCard -> paperCard.getRarity() == CardRarity.Common)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
if (!commmonCards.isEmpty()) {
|
if (!commmonCards.isEmpty()) {
|
||||||
rewards.add(new Reward(Aggregates.random(commmonCards)));
|
rewards.add(new Reward(Aggregates.random(commmonCards)));
|
||||||
@@ -483,7 +485,7 @@ public class EnemySprite extends CharacterSprite implements Steerable<Vector2> {
|
|||||||
}
|
}
|
||||||
//random rare from deck
|
//random rare from deck
|
||||||
List<PaperCard> rareCards = paperCardList.stream()
|
List<PaperCard> rareCards = paperCardList.stream()
|
||||||
.filter(paperCard -> CardRarity.Rare.equals(paperCard.getRarity()) || CardRarity.MythicRare.equals(paperCard.getRarity()))
|
.filter(paperCard -> paperCard.getRarity() == CardRarity.Rare || paperCard.getRarity() == CardRarity.MythicRare)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
if (!rareCards.isEmpty()) {
|
if (!rareCards.isEmpty()) {
|
||||||
rewards.add(new Reward(Aggregates.random(rareCards)));
|
rewards.add(new Reward(Aggregates.random(rareCards)));
|
||||||
|
|||||||
@@ -175,17 +175,17 @@ public class AdventureEventData implements Serializable {
|
|||||||
private static final Predicate<CardEdition> filterStandard = FModel.getFormats().getStandard().editionLegalPredicate;
|
private static final Predicate<CardEdition> filterStandard = FModel.getFormats().getStandard().editionLegalPredicate;
|
||||||
|
|
||||||
public static Predicate<CardEdition> selectSetPool() {
|
public static Predicate<CardEdition> selectSetPool() {
|
||||||
// Should we negate any of these to avoid overlap?
|
|
||||||
final int rollD100 = MyRandom.getRandom().nextInt(100);
|
final int rollD100 = MyRandom.getRandom().nextInt(100);
|
||||||
Predicate<CardEdition> rolledFilter;
|
Predicate<CardEdition> rolledFilter;
|
||||||
if (rollD100 < 30) {
|
if (rollD100 < 30) {
|
||||||
rolledFilter = filterStandard;
|
rolledFilter = filterStandard;
|
||||||
} else if (rollD100 < 60) {
|
} 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) {
|
} else if (rollD100 < 80) {
|
||||||
rolledFilter = filterModern;
|
rolledFilter = filterModern.and(filterStandard.negate());
|
||||||
} else {
|
} else {
|
||||||
rolledFilter = filterVintage;
|
rolledFilter = filterVintage.and(filterStandard.negate());
|
||||||
}
|
}
|
||||||
return rolledFilter;
|
return rolledFilter;
|
||||||
}
|
}
|
||||||
@@ -195,21 +195,33 @@ public class AdventureEventData implements Serializable {
|
|||||||
private static CardBlock pickWeightedCardBlock() {
|
private static CardBlock pickWeightedCardBlock() {
|
||||||
CardEdition.Collection editions = FModel.getMagicDb().getEditions();
|
CardEdition.Collection editions = FModel.getMagicDb().getEditions();
|
||||||
ConfigData configData = Config.instance().getConfigData();
|
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.restrictedEvents != null) {
|
if(configData.allowedEvents != null && configData.allowedEvents.length > 0) {
|
||||||
//Temporary restriction until rewards are more diverse - don't want to award restricted cards so these editions need different rewards added.
|
Set<String> allowedEvents = Set.of(configData.allowedEvents);
|
||||||
//Also includes sets that use conspiracy or commander drafts.
|
filter = filter.and(q -> allowedEvents.contains(q.getCode()));
|
||||||
Set<String> restrictedEvents = Set.of(configData.restrictedEvents);
|
|
||||||
filter = filter.and((q) -> !restrictedEvents.contains(q.getCode()));
|
|
||||||
}
|
}
|
||||||
if (configData.allowedEditions != null) {
|
else
|
||||||
Set<String> allowed = Set.of(configData.allowedEditions);
|
{
|
||||||
filter = filter.and(q -> allowed.contains(q.getCode()));
|
//The whitelist beats all other filters.
|
||||||
} else {
|
if(configData.restrictedEvents != null) {
|
||||||
List<String> restrictedList = Arrays.asList(configData.restrictedEditions);
|
//Temporary restriction until rewards are more diverse - don't want to award restricted cards so these editions need different rewards added.
|
||||||
Set<String> restricted = new HashSet<>(restrictedList); //Would use Set.of but that throws an error if there's any duplicates, and users edit these lists all the time.
|
//Also includes sets that use conspiracy or commander drafts.
|
||||||
filter = filter.and(q -> !restricted.contains(q.getCode()));
|
Set<String> restrictedEvents = Set.of(configData.restrictedEvents);
|
||||||
|
filter = filter.and((q) -> !restrictedEvents.contains(q.getCode()));
|
||||||
|
}
|
||||||
|
if (configData.allowedEditions != null && configData.allowedEditions.length > 0) {
|
||||||
|
Set<String> allowed = Set.of(configData.allowedEditions);
|
||||||
|
filter = filter.and(q -> allowed.contains(q.getCode()));
|
||||||
|
} else if(configData.restrictedEditions != null) {
|
||||||
|
List<String> restrictedList = Arrays.asList(configData.restrictedEditions);
|
||||||
|
Set<String> restricted = new HashSet<>(restrictedList); //Would use Set.of but that throws an error if there's any duplicates, and users edit these lists all the time.
|
||||||
|
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<>();
|
List<CardEdition> allEditions = new ArrayList<>();
|
||||||
|
|||||||
@@ -24,5 +24,6 @@ public class ConfigData {
|
|||||||
public String[] restrictedEditions;
|
public String[] restrictedEditions;
|
||||||
public String[] allowedEditions;
|
public String[] allowedEditions;
|
||||||
public String[] restrictedEvents;
|
public String[] restrictedEvents;
|
||||||
|
public String[] allowedEvents;
|
||||||
public String[] allowedJumpstart;
|
public String[] allowedJumpstart;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user