diff --git a/forge-gui-mobile/src/forge/adventure/data/AdventureEventData.java b/forge-gui-mobile/src/forge/adventure/data/AdventureEventData.java index eafd98fb022..a602a929111 100644 --- a/forge-gui-mobile/src/forge/adventure/data/AdventureEventData.java +++ b/forge-gui-mobile/src/forge/adventure/data/AdventureEventData.java @@ -323,24 +323,31 @@ public class AdventureEventData implements Serializable { private CardBlock pickWeightedCardBlock() { CardEdition.Collection editions = FModel.getMagicDb().getEditions(); + ConfigData configData = Config.instance().getConfigData(); Iterable src = FModel.getBlocks(); //all blocks Predicate 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 restrictedEvents = Set.of(configData.restrictedEvents); + filter = filter.and((q) -> !restrictedEvents.contains(q.getCode())); + } + if (configData.allowedEditions != null) { + Set allowed = Set.of(configData.allowedEditions); + filter = filter.and(q -> allowed.contains(q.getCode())); + } else { + List restrictedList = Arrays.asList(configData.restrictedEditions); + Set 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 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 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 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 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 src = FModel.getBlocks(); //all blocks List 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 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 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 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); diff --git a/forge-gui-mobile/src/forge/adventure/data/ConfigData.java b/forge-gui-mobile/src/forge/adventure/data/ConfigData.java index 453affb632e..c5b2a78ba32 100644 --- a/forge-gui-mobile/src/forge/adventure/data/ConfigData.java +++ b/forge-gui-mobile/src/forge/adventure/data/ConfigData.java @@ -23,4 +23,6 @@ public class ConfigData { public String[] restrictedCards; public String[] restrictedEditions; public String[] allowedEditions; + public String[] restrictedEvents; + public String[] allowedJumpstart; } diff --git a/forge-gui-mobile/src/forge/adventure/util/Config.java b/forge-gui-mobile/src/forge/adventure/util/Config.java index c9a55d71215..9e4238cd49f 100644 --- a/forge-gui-mobile/src/forge/adventure/util/Config.java +++ b/forge-gui-mobile/src/forge/adventure/util/Config.java @@ -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(); diff --git a/forge-gui/res/adventure/common/config.json b/forge-gui/res/adventure/common/config.json index 53bcaf76a99..09f97b41f22 100644 --- a/forge-gui/res/adventure/common/config.json +++ b/forge-gui/res/adventure/common/config.json @@ -85,9 +85,19 @@ "UND", "PUST", "DA1", - "UST", "UNF" ], + "restrictedEvents": [ + "LEA", + "LEB", + "2ED", + "30A", + "CNS", + "CN2", + "CMR", + "CLB", + "CMM" + ], "difficulties": [ { "name": "Easy", diff --git a/forge-gui/res/cardsfolder/upcoming/bioengineered_future.txt b/forge-gui/res/cardsfolder/upcoming/bioengineered_future.txt index e0069f3c006..45ce7c8c1d7 100644 --- a/forge-gui/res/cardsfolder/upcoming/bioengineered_future.txt +++ b/forge-gui/res/cardsfolder/upcoming/bioengineered_future.txt @@ -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. \ No newline at end of file +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. diff --git a/forge-gui/res/cardsfolder/upcoming/monoist_circuit_feeder.txt b/forge-gui/res/cardsfolder/upcoming/monoist_circuit_feeder.txt new file mode 100644 index 00000000000..9edf469710a --- /dev/null +++ b/forge-gui/res/cardsfolder/upcoming/monoist_circuit_feeder.txt @@ -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. diff --git a/forge-gui/res/cardsfolder/upcoming/samis_curiosity.txt b/forge-gui/res/cardsfolder/upcoming/samis_curiosity.txt new file mode 100644 index 00000000000..2ff4f175bfe --- /dev/null +++ b/forge-gui/res/cardsfolder/upcoming/samis_curiosity.txt @@ -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.") diff --git a/forge-gui/res/cardsfolder/upcoming/weftwalking.txt b/forge-gui/res/cardsfolder/upcoming/weftwalking.txt new file mode 100644 index 00000000000..02382a1f0ea --- /dev/null +++ b/forge-gui/res/cardsfolder/upcoming/weftwalking.txt @@ -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.