Merge branch 'master' into 7859-DisplayTextTooltip

This commit is contained in:
Eradev
2025-07-11 21:57:48 -04:00
committed by GitHub
8 changed files with 89 additions and 35 deletions

View File

@@ -323,24 +323,31 @@ public class AdventureEventData implements Serializable {
private CardBlock pickWeightedCardBlock() {
CardEdition.Collection editions = FModel.getMagicDb().getEditions();
ConfigData configData = Config.instance().getConfigData();
Iterable<CardBlock> src = FModel.getBlocks(); //all blocks
Predicate<CardEdition> filter = CardEdition.Predicates.CAN_MAKE_BOOSTER.and(selectSetPool());
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);
filter = filter.and((q) -> !restrictedEvents.contains(q.getCode()));
}
if (configData.allowedEditions != null) {
Set<String> allowed = Set.of(configData.allowedEditions);
filter = filter.and(q -> allowed.contains(q.getCode()));
} else {
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()));
}
List<CardEdition> allEditions = new ArrayList<>();
StreamUtil.stream(editions)
.filter(filter)
.filter(CardEdition::hasBoosterTemplate)
.forEach(allEditions::add);
//Temporary restriction until rewards are more diverse - don't want to award restricted cards so these editions need different rewards added.
List<String> restrictedDrafts = new ArrayList<>();
restrictedDrafts.add("LEA");
restrictedDrafts.add("LEB");
restrictedDrafts.add("2ED");
restrictedDrafts.add("30A");
restrictedDrafts.add("CNS");
restrictedDrafts.add("CN2");
allEditions.removeIf(q -> restrictedDrafts.contains(q.getCode()));
List<CardBlock> legalBlocks = new ArrayList<>();
for (CardBlock b : src) { // for each block
if (b.getSets().isEmpty() || (b.getCntBoostersDraft() < 1))
@@ -383,34 +390,40 @@ public class AdventureEventData implements Serializable {
}
}
ConfigData configData = Config.instance().getConfigData();
if (configData.allowedEditions != null) {
List<String> allowed = Arrays.asList(configData.allowedEditions);
legalBlocks.removeIf(q -> !allowed.contains(q.getName()));
} else {
for (String restricted : configData.restrictedEditions) {
legalBlocks.removeIf(q -> q.getName().equals(restricted));
}
}
return legalBlocks.isEmpty() ? null : Aggregates.random(legalBlocks);
}
private CardBlock pickJumpstartCardBlock() {
Iterable<CardBlock> src = FModel.getBlocks(); //all blocks
List<CardBlock> legalBlocks = new ArrayList<>();
for (CardBlock b : src) { // for each block
//I hate doing this, but it seems like the simplest way to reliably filter out prereleases
if (b.getName().toUpperCase().contains("JUMPSTART")) {
legalBlocks.add(b);
ConfigData configData = Config.instance().getConfigData();
if (configData.allowedJumpstart != null) {
Set<String> allowed = Set.of(configData.allowedJumpstart);
for (CardBlock b : src) { // for each block
if (allowed.contains(b.getName())) {
legalBlocks.add(b);
}
}
for (CardBlock b : FModel.getFantasyBlocks()) {
if (allowed.contains(b.getName())) {
legalBlocks.add(b);
}
}
}
ConfigData configData = Config.instance().getConfigData();
if (configData.allowedEditions != null) {
List<String> allowed = Arrays.asList(configData.allowedEditions);
legalBlocks.removeIf(q -> !allowed.contains(q.getName()));
} else {
for (String restricted : configData.restrictedEditions) {
legalBlocks.removeIf(q -> q.getName().equals(restricted));
else {
for (CardBlock b : src) { // for each block
//I hate doing this, but it seems like the simplest way to reliably filter out prereleases
if (b.getName().toUpperCase().contains("JUMPSTART")) {
legalBlocks.add(b);
}
}
if (configData.allowedEditions != null) {
Set<String> allowed = Set.of(configData.allowedEditions);
legalBlocks.removeIf(q -> !allowed.contains(q.getName()));
} else {
for (String restricted : configData.restrictedEditions) {
legalBlocks.removeIf(q -> q.getName().equals(restricted));
}
}
}
return legalBlocks.isEmpty() ? null : Aggregates.random(legalBlocks);

View File

@@ -23,4 +23,6 @@ public class ConfigData {
public String[] restrictedCards;
public String[] restrictedEditions;
public String[] allowedEditions;
public String[] restrictedEvents;
public String[] allowedJumpstart;
}

View File

@@ -111,9 +111,12 @@ public class Config {
currentConfig = this;
if (FModel.getPreferences() != null)
Lang = FModel.getPreferences().getPref(ForgePreferences.FPref.UI_LANGUAGE);
FileHandle file = new FileHandle(prefix + "config.json");
//TODO: Plane's config file should be merged with the common config file.
if(!file.exists())
file = new FileHandle(commonPrefix + "config.json");
try {
configData = new Json().fromJson(ConfigData.class, new FileHandle(commonPrefix + "config.json"));
configData = new Json().fromJson(ConfigData.class, file);
} catch (Exception e) {
e.printStackTrace();
configData = new ConfigData();

View File

@@ -85,9 +85,19 @@
"UND",
"PUST",
"DA1",
"UST",
"UNF"
],
"restrictedEvents": [
"LEA",
"LEB",
"2ED",
"30A",
"CNS",
"CN2",
"CMR",
"CLB",
"CMM"
],
"difficulties": [
{
"name": "Easy",

View File

@@ -1,10 +1,10 @@
Name:Bioengineered Future
ManaCost:1 G G
Types:Enchantment
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigToken | TriggerDescription$ When this enchantment enters, create a Lander token.
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigToken | TriggerDescription$ When this enchantment enters, create a Lander token. (It's an artifact with "{2}, {T}, Sacrifice this token: Search your library for a basic land card, put it onto the battlefield tapped, then shuffle.")
SVar:TrigToken:DB$ Token | TokenAmount$ 1 | TokenScript$ c_a_lander_sac_search | TokenOwner$ You
K:ETBReplacement:Other:AddExtraCounter:Mandatory:Battlefield:Creature.YouCtrl
SVar:AddExtraCounter:DB$ PutCounter | ETB$ True | Defined$ ReplacedCard | CounterType$ P1P1 | CounterNum$ X | SpellDescription$ Each creature you control enters with an additional +1/+1 counter on it for each land that entered the battlefield under your control this turn.
SVar:X:Count$ThisTurnEntered_Battlefield_Land.YouCtrl
DeckHas:Ability$Counters
Oracle:When this enchantment enters, create a Lander token.\nEach creature you control enters with an additional +1/+1 counter on it for each land that entered the battlefield under your control this turn.
Oracle:When this enchantment enters, create a Lander token. (It's an artifact with "{2}, {T}, Sacrifice this token: Search your library for a basic land card, put it onto the battlefield tapped, then shuffle.")\nEach creature you control enters with an additional +1/+1 counter on it for each land that entered the battlefield under your control this turn.

View File

@@ -0,0 +1,11 @@
Name:Monoist Circuit-Feeder
ManaCost:4 B B
Types:Artifact Creature Nautilus
PT:4/4
K:Flying
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigPump | TriggerDescription$ When this creature enters, until end of turn, target creature you control gets +X/+0 and target creature an opponent controls gets -0/-X, where X is the number of artifacts you control.
SVar:TrigPump:DB$ Pump | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Select target creature you control | NumAtt$ +X | SubAbility$ DBPump
SVar:DBPump:DB$ Pump | ValidTgts$ Creature.OppCtrl | TgtPrompt$ Select target creature an opponent controls | NumDef$ -X | IsCurse$ True
SVar:X:Count$Valid Artifact.YouCtrl
SVar:PlayMain1:TRUE
Oracle:Flying\nWhen this creature enters, until end of turn, target creature you control gets +X/+0 and target creature an opponent controls gets -0/-X, where X is the number of artifacts you control.

View File

@@ -0,0 +1,6 @@
Name:Sami's Curiosity
ManaCost:G
Types:Instant
A:SP$ GainLife | LifeAmount$ 2 | SubAbility$ DBToken | SpellDescription$ You gain 2 life. Create a Lander token. (It's an artifact with "{2}, {T}, Sacrifice this token: Search your library for a basic land card, put it onto the battlefield tapped, then shuffle.")
SVar:DBToken:DB$ Token | TokenAmount$ 1 | TokenScript$ c_a_lander_sac_search | TokenOwner$ You
Oracle:You gain 2 life. Create a Lander token. (It's an artifact with "{2}, {T}, Sacrifice this token: Search your library for a basic land card, put it onto the battlefield tapped, then shuffle.")

View File

@@ -0,0 +1,9 @@
Name:Weftwalking
ManaCost:4 U U
Types:Enchantment
T:Mode$ ChangesZone | ValidCard$ Card.wasCastByYou+Self | Destination$ Battlefield | Execute$ TrigChangeAll | TriggerDescription$ When this enchantment enters, if you cast it, shuffle your hand and graveyard into your library, then draw seven cards.
SVar:TrigChangeAll:DB$ ChangeZoneAll | Origin$ Graveyard,Hand | Destination$ Library | ChangeType$ Card.YouOwn | Shuffle$ True | SubAbility$ DBDraw
SVar:DBDraw:DB$ Draw | Defined$ You | NumCards$ 7
S:Mode$ Continuous | Affected$ Card.nonLand+ControlledBy Player.Active | MayPlayPlayer$ Player.Active | MayPlay$ True | MayPlayWithoutManaCost$ True | MayPlayDontGrantZonePermissions$ True | AffectedZone$ All | CheckSVar$ Y | SVarCompare$ EQ0 | Description$ The first spell each player casts during each of their turns may be cast without paying its mana cost.
SVar:Y:Count$ThisTurnCast_Card.ControlledBy Player.Active
Oracle:When this enchantment enters, if you cast it, shuffle your hand and graveyard into your library, then draw seven cards.\nThe first spell each player casts during each of their turns may be cast without paying its mana cost.