mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-14 09:48:02 +00:00
Merge remote-tracking branch 'core/master' into newBranch
This commit is contained in:
@@ -124,6 +124,7 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
||||
private boolean smallSetOverride = false;
|
||||
private String boosterMustContain = "";
|
||||
private String boosterReplaceSlotFromPrintSheet = "";
|
||||
private String[] chaosDraftThemes = new String[0];
|
||||
private boolean doublePickToStartRound = false;
|
||||
private final CardInSet[] cards;
|
||||
private final Map<String, Integer> tokenNormalized;
|
||||
@@ -195,6 +196,7 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
||||
public boolean getDoublePickToStartRound() { return doublePickToStartRound; }
|
||||
public String getBoosterMustContain() { return boosterMustContain; }
|
||||
public String getBoosterReplaceSlotFromPrintSheet() { return boosterReplaceSlotFromPrintSheet; }
|
||||
public String[] getChaosDraftThemes() { return chaosDraftThemes; }
|
||||
public CardInSet[] getCards() { return cards; }
|
||||
public boolean isModern() { return getDate().after(parseDate("2003-07-27")); } //8ED and above are modern except some promo cards and others
|
||||
|
||||
@@ -385,6 +387,9 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
|
||||
|
||||
res.boosterMustContain = section.get("BoosterMustContain", ""); // e.g. Dominaria guaranteed legendary creature
|
||||
res.boosterReplaceSlotFromPrintSheet = section.get("BoosterReplaceSlotFromPrintSheet", ""); // e.g. Zendikar Rising guaranteed double-faced card
|
||||
|
||||
res.chaosDraftThemes = section.get("ChaosDraftThemes", "").split(";"); // semicolon separated list of theme names
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,23 +3,20 @@ package forge.item.generation;
|
||||
import forge.card.CardEdition;
|
||||
import forge.item.BoosterPack;
|
||||
import forge.item.PaperCard;
|
||||
import forge.util.BagRandomizer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ChaosBoosterSupplier implements IUnOpenedProduct {
|
||||
private List<CardEdition> sets;
|
||||
private BagRandomizer<CardEdition> randomizer;
|
||||
|
||||
public ChaosBoosterSupplier(List<CardEdition> sets) {
|
||||
this.sets = sets;
|
||||
public ChaosBoosterSupplier(Iterable<CardEdition> sets) throws IllegalArgumentException {
|
||||
randomizer = new BagRandomizer<>(sets);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PaperCard> get() {
|
||||
if (sets.size() == 0) {
|
||||
System.out.println("No chaos boosters left to supply.");
|
||||
return null;
|
||||
}
|
||||
final CardEdition set = sets.remove(0);
|
||||
final CardEdition set = randomizer.getNextItem();
|
||||
final BoosterPack pack = new BoosterPack(set.getCode(), set.getBoosterTemplate());
|
||||
return pack.getCards();
|
||||
}
|
||||
|
||||
76
forge-core/src/main/java/forge/util/BagRandomizer.java
Normal file
76
forge-core/src/main/java/forge/util/BagRandomizer.java
Normal file
@@ -0,0 +1,76 @@
|
||||
package forge.util;
|
||||
|
||||
import java.security.SecureRandom;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Data structure that allows random draws from a set number of items,
|
||||
* where all items are returned once before the first will be retrieved.
|
||||
* The bag will be shuffled after each time all items have been returned.
|
||||
* @param <T> an object
|
||||
*/
|
||||
public class BagRandomizer<T > implements Iterable<T>{
|
||||
private static Random random = new SecureRandom();
|
||||
|
||||
private T[] bag;
|
||||
private int currentPosition = 0;
|
||||
|
||||
public BagRandomizer(T[] items) throws IllegalArgumentException {
|
||||
if (items.length == 0) {
|
||||
throw new IllegalArgumentException("Must include at least one item!");
|
||||
}
|
||||
bag = items;
|
||||
shuffleBag();
|
||||
}
|
||||
|
||||
public BagRandomizer(Iterable<T> items) throws IllegalArgumentException {
|
||||
ArrayList<T> list = new ArrayList<>();
|
||||
for (T item : items) {
|
||||
list.add(item);
|
||||
}
|
||||
if (list.size() == 0) {
|
||||
throw new IllegalArgumentException("Must include at least one item!");
|
||||
}
|
||||
bag = (T[]) list.toArray();
|
||||
shuffleBag();
|
||||
}
|
||||
|
||||
public T getNextItem() {
|
||||
// reset bag if last position is reached
|
||||
if (currentPosition >= bag.length) {
|
||||
shuffleBag();
|
||||
currentPosition = 0;
|
||||
}
|
||||
return bag[currentPosition++];
|
||||
}
|
||||
|
||||
private void shuffleBag() {
|
||||
int n = bag.length;
|
||||
for (int i = 0; i < n; i++) {
|
||||
int r = (int) (random.nextDouble() * (i + 1));
|
||||
T swap = bag[r];
|
||||
bag[r] = bag[i];
|
||||
bag[i] = swap;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<T> iterator() {
|
||||
return new BagRandomizerIterator<T>();
|
||||
}
|
||||
|
||||
private class BagRandomizerIterator<T> implements Iterator<T> {
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return bag.length > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T next() {
|
||||
return (T) BagRandomizer.this.getNextItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
10
forge-gui/res/blockdata/chaosdraftthemes.txt
Normal file
10
forge-gui/res/blockdata/chaosdraftthemes.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
# Order, Tag, Label
|
||||
1, DEFAULT, All sets (default)
|
||||
11, MODERN, Modern legal expansions
|
||||
12, PIONEER, Pioneer legal expansions
|
||||
13, STANDARD, Standard legal expansions
|
||||
21, CORE_SET, Core Sets
|
||||
22, MASTERS_SET, Masters Sets (paper only)
|
||||
30, MIRRODIN, Mirrodin (Plane)
|
||||
30, RAVNICA, Ravnica (Plane)
|
||||
40, GRAVEYARD_MATTERS, Graveyard matters
|
||||
@@ -9,6 +9,7 @@ BoosterCovers=5
|
||||
Booster=10 Common:!fromSheet("AKH Planeswalker Decks and Toolkit"), 3 Uncommon:!fromSheet("AKH Planeswalker Decks and Toolkit"), 1 RareMythic:!fromSheet("AKH Planeswalker Decks and Toolkit"), 1 BasicLand AKH
|
||||
AdditionalSheetForFoils=fromSheet("MPS Amonkhet Invocations")
|
||||
AdditionalSetUnlockedInQuest=MPS_AKH
|
||||
ChaosDraftThemes=GRAVEYARD_MATTERS
|
||||
|
||||
[cards]
|
||||
1 M Angel of Sanctions
|
||||
|
||||
@@ -7,6 +7,7 @@ MciCode=avr
|
||||
Type=Expansion
|
||||
BoosterCovers=5
|
||||
Booster=10 Common, 3 Uncommon, 1 RareMythic, 1 BasicLand
|
||||
ChaosDraftThemes=GRAVEYARD_MATTERS
|
||||
|
||||
[cards]
|
||||
167 C Abundant Growth
|
||||
|
||||
@@ -9,6 +9,7 @@ Border=White
|
||||
BoosterCovers=1
|
||||
Booster=11 Common, 3 Uncommon, 1 Rare
|
||||
Foil=NotSupported
|
||||
ChaosDraftThemes=CORE_SET
|
||||
|
||||
[cards]
|
||||
163 U AEther Flash
|
||||
|
||||
@@ -7,6 +7,7 @@ MciCode=dka
|
||||
Type=Expansion
|
||||
BoosterCovers=3
|
||||
Booster=9 Common:!dfc, 3 Uncommon:!dfc, 1 RareMythic:!dfc, 1 dfc, 1 BasicLand ISD
|
||||
ChaosDraftThemes=GRAVEYARD_MATTERS
|
||||
|
||||
[cards]
|
||||
81 U Afflicted Deserter
|
||||
|
||||
@@ -8,6 +8,7 @@ Type=Expansion
|
||||
BoosterCovers=3
|
||||
Booster=11 Common, 3 Uncommon, 1 Rare
|
||||
FoilAlwaysInCommonSlot=False
|
||||
ChaosDraftThemes=MIRRODIN
|
||||
|
||||
[cards]
|
||||
37 R AEther Snap
|
||||
|
||||
@@ -8,6 +8,7 @@ Type=Expansion
|
||||
BoosterCovers=3
|
||||
Booster=11 Common, 3 Uncommon, 1 Rare
|
||||
FoilAlwaysInCommonSlot=False
|
||||
ChaosDraftThemes=RAVNICA
|
||||
|
||||
[cards]
|
||||
1 C Aurora Eidolon
|
||||
|
||||
@@ -7,6 +7,7 @@ BoosterCovers=3
|
||||
Booster=8 Common, 3 Uncommon, 2 RareMythic, 2 fromSheet("2XM Foils")
|
||||
Foil=NotSupported
|
||||
DoublePick=true
|
||||
ChaosDraftThemes=MASTERS_SET
|
||||
|
||||
[cards]
|
||||
1 M Karn Liberated
|
||||
|
||||
@@ -7,6 +7,7 @@ MciCode=dgm
|
||||
Type=Expansion
|
||||
BoosterCovers=3
|
||||
Booster=10 Common:!land, 3 Uncommon, 1 RareMythic:!land, 1 fromSheet("DGM Lands")
|
||||
ChaosDraftThemes=RAVNICA
|
||||
|
||||
[cards]
|
||||
1 C Boros Mastiff
|
||||
|
||||
@@ -9,6 +9,7 @@ Border=White
|
||||
BoosterCovers=5
|
||||
Booster=10 Common, 3 Uncommon, 1 Rare, 1 BasicLand
|
||||
FoilAlwaysInCommonSlot=False
|
||||
ChaosDraftThemes=CORE_SET
|
||||
|
||||
[cards]
|
||||
117 U Abyssal Specter
|
||||
|
||||
@@ -9,6 +9,7 @@ BoosterCovers=3
|
||||
Booster=9 Common:!dfc, 3 Uncommon:!dfc, 1 RareMythic:!dfc, 1 dfc:!Rare:!Mythic, 1 BasicLand SOI
|
||||
ChanceReplaceCommonWith=.125F dfc:RareMythic
|
||||
TreatAsSmallSet=true
|
||||
ChaosDraftThemes=GRAVEYARD_MATTERS
|
||||
|
||||
[cards]
|
||||
1 U Abundant Maw
|
||||
|
||||
@@ -7,6 +7,7 @@ Type=Reprint
|
||||
BoosterCovers=3
|
||||
Booster=11 Common, 3 Uncommon, 1 RareMythic
|
||||
FoilChanceInBooster=100
|
||||
ChaosDraftThemes=MASTERS_SET
|
||||
|
||||
[cards]
|
||||
1 C Aven Riftwatcher
|
||||
|
||||
@@ -6,6 +6,7 @@ MciCode=frf
|
||||
Type=Expansion
|
||||
BoosterCovers=3
|
||||
Booster=10 Common:!land, 3 Uncommon, 1 RareMythic, 1 fromSheet("FRF Lands"), 0 fromSheet("FRF Basic Lands")
|
||||
ChaosDraftThemes=GRAVEYARD_MATTERS
|
||||
|
||||
[cards]
|
||||
1 M Ugin, the Spirit Dragon
|
||||
|
||||
@@ -8,6 +8,7 @@ Type=Expansion
|
||||
BoosterCovers=3
|
||||
Booster=11 Common, 3 Uncommon, 1 Rare
|
||||
FoilAlwaysInCommonSlot=False
|
||||
ChaosDraftThemes=MIRRODIN
|
||||
|
||||
[cards]
|
||||
1 C Abuna's Chant
|
||||
|
||||
@@ -9,6 +9,7 @@ Border=White
|
||||
BoosterCovers=5
|
||||
Booster=11 Common, 3 Uncommon, 1 Rare
|
||||
Foil=NotSupported
|
||||
ChaosDraftThemes=CORE_SET
|
||||
|
||||
[cards]
|
||||
U AEther Storm
|
||||
|
||||
@@ -9,6 +9,7 @@ Border=White
|
||||
BoosterCovers=5
|
||||
Booster=11 Common, 3 Uncommon, 1 Rare
|
||||
Foil=NotSupported
|
||||
ChaosDraftThemes=CORE_SET
|
||||
|
||||
[cards]
|
||||
U Abomination
|
||||
|
||||
@@ -7,6 +7,7 @@ MciCode=gtc
|
||||
Type=Expansion
|
||||
BoosterCovers=5
|
||||
Booster=10 Common, 3 Uncommon, 1 RareMythic, 1 BasicLand RTR
|
||||
ChaosDraftThemes=RAVNICA
|
||||
|
||||
[cards]
|
||||
29 U AEtherize
|
||||
|
||||
@@ -8,6 +8,7 @@ Type=Expansion
|
||||
BoosterCovers=3
|
||||
Booster=11 Common, 3 Uncommon, 1 Rare
|
||||
FoilAlwaysInCommonSlot=False
|
||||
ChaosDraftThemes=RAVNICA
|
||||
|
||||
[cards]
|
||||
22 U AEtherplasm
|
||||
|
||||
@@ -8,6 +8,7 @@ Type=Expansion
|
||||
BoosterCovers=5
|
||||
Booster=10 Common:!fromSheet("GRN Secret Cards"), 3 Uncommon:!fromSheet("GRN Secret Cards"), 1 RareMythic:!fromSheet("GRN Secret Cards"), 1 fromSheet("GRN Lands")
|
||||
AdditionalSetUnlockedInQuest=GK1
|
||||
ChaosDraftThemes=RAVNICA;GRAVEYARD_MATTERS
|
||||
|
||||
[cards]
|
||||
1 C Blade Instructor
|
||||
|
||||
@@ -10,6 +10,7 @@ Booster=10 Common:!fromSheet("HOU Planeswalker Decks and Toolkit"), 3 Uncommon:!
|
||||
AdditionalSheetForFoils=fromSheet("MPS Hour of Devastation Invocations")
|
||||
AdditionalSetUnlockedInQuest=MPS_AKH
|
||||
TreatAsSmallSet=true
|
||||
ChaosDraftThemes=GRAVEYARD_MATTERS
|
||||
|
||||
[cards]
|
||||
1 C Act of Heroism
|
||||
|
||||
@@ -7,6 +7,7 @@ Type=Reprint
|
||||
BoosterCovers=3
|
||||
Booster=11 Common, 3 Uncommon, 1 RareMythic
|
||||
FoilChanceInBooster=100
|
||||
ChaosDraftThemes=MASTERS_SET
|
||||
|
||||
[cards]
|
||||
1 C Scion of Ugin
|
||||
|
||||
@@ -7,6 +7,7 @@ MciCode=isd
|
||||
Type=Expansion
|
||||
BoosterCovers=5
|
||||
Booster=9 Common:!dfc, 3 Uncommon:!dfc, 1 RareMythic:!dfc, 1 dfc, 1 BasicLand
|
||||
ChaosDraftThemes=GRAVEYARD_MATTERS
|
||||
|
||||
[cards]
|
||||
85 U Abattoir Ghoul
|
||||
|
||||
@@ -9,6 +9,7 @@ BoosterCovers=1
|
||||
Booster=11 Common, 3 Uncommon, 1 Rare
|
||||
Foil=OldStyle
|
||||
FoilAlwaysInCommonSlot=False
|
||||
ChaosDraftThemes=GRAVEYARD_MATTERS
|
||||
|
||||
[cards]
|
||||
1 U Ancestor's Chosen
|
||||
|
||||
@@ -7,6 +7,7 @@ MciCode=ktk
|
||||
Type=Expansion
|
||||
BoosterCovers=5
|
||||
Booster=10 Common, 3 Uncommon, 1 RareMythic, 1 BasicLand KTK
|
||||
ChaosDraftThemes=GRAVEYARD_MATTERS
|
||||
|
||||
[cards]
|
||||
1 U Abzan Battle Priest
|
||||
|
||||
@@ -8,6 +8,7 @@ Type=Core
|
||||
BoosterCovers=1
|
||||
Booster=11 Common, 3 Uncommon, 1 Rare
|
||||
Foil=NotSupported
|
||||
ChaosDraftThemes=CORE_SET
|
||||
|
||||
[cards]
|
||||
U Air Elemental
|
||||
|
||||
@@ -7,6 +7,7 @@ MciCode=m10
|
||||
Type=Core
|
||||
BoosterCovers=5
|
||||
Booster=10 Common, 3 Uncommon, 1 RareMythic, 1 BasicLand
|
||||
ChaosDraftThemes=CORE_SET
|
||||
|
||||
[cards]
|
||||
165 U Acidic Slime
|
||||
|
||||
@@ -7,6 +7,7 @@ MciCode=m11
|
||||
Type=Core
|
||||
BoosterCovers=5
|
||||
Booster=10 Common, 3 Uncommon, 1 RareMythic, 1 BasicLand
|
||||
ChaosDraftThemes=CORE_SET
|
||||
|
||||
[cards]
|
||||
41 C AEther Adept
|
||||
|
||||
@@ -7,6 +7,7 @@ MciCode=m12
|
||||
Type=Core
|
||||
BoosterCovers=5
|
||||
Booster=10 Common, 3 Uncommon, 1 RareMythic, 1 BasicLand
|
||||
ChaosDraftThemes=CORE_SET
|
||||
|
||||
[cards]
|
||||
41 C AEther Adept
|
||||
|
||||
@@ -7,6 +7,7 @@ MciCode=m13
|
||||
Type=Core
|
||||
BoosterCovers=5
|
||||
Booster=10 Common, 3 Uncommon, 1 RareMythic, 1 BasicLand
|
||||
ChaosDraftThemes=CORE_SET
|
||||
|
||||
[cards]
|
||||
159 U Acidic Slime
|
||||
|
||||
@@ -7,6 +7,7 @@ MciCode=m14
|
||||
Type=Core
|
||||
BoosterCovers=5
|
||||
Booster=10 Common, 3 Uncommon, 1 RareMythic, 1 BasicLand
|
||||
ChaosDraftThemes=CORE_SET
|
||||
|
||||
[cards]
|
||||
1 M Ajani, Caller of the Pride
|
||||
|
||||
@@ -7,6 +7,7 @@ MciCode=m15
|
||||
Type=Core
|
||||
BoosterCovers=5
|
||||
Booster=10 Common:!fromSheet("M15 Sample Cards"), 3 Uncommon:!fromSheet("M15 Sample Cards"), 1 RareMythic:!fromSheet("M15 Sample Cards"), 1 BasicLand
|
||||
ChaosDraftThemes=CORE_SET
|
||||
|
||||
[cards]
|
||||
1 M Ajani Steadfast
|
||||
|
||||
@@ -7,6 +7,7 @@ MciCode=m19
|
||||
Type=Core
|
||||
BoosterCovers=5
|
||||
Booster=10 Common:!fromSheet("M19 Secret Cards"), 3 Uncommon:!fromSheet("M19 Secret Cards"), 1 RareMythic:!fromSheet("M19 Secret Cards"), 1 fromSheet("M19 Lands")
|
||||
ChaosDraftThemes=CORE_SET
|
||||
|
||||
[cards]
|
||||
1 U Aegis of the Heavens
|
||||
|
||||
@@ -6,6 +6,7 @@ MciCode=m20
|
||||
Type=Core
|
||||
BoosterCovers=3
|
||||
Booster=10 Common:!fromSheet("M20 Secret Cards"), 3 Uncommon:!fromSheet("M20 Secret Cards"), 1 RareMythic:!fromSheet("M20 Secret Cards"), 1 fromSheet("M20 Lands")
|
||||
ChaosDraftThemes=CORE_SET
|
||||
|
||||
[cards]
|
||||
1 C Aerial Assault
|
||||
|
||||
@@ -6,6 +6,7 @@ Type=Core
|
||||
BoosterCovers=3
|
||||
Booster=10 Common:!fromSheet("M21 Secret Cards"), 3 Uncommon:!fromSheet("M21 Secret Cards"), 1 RareMythic:!fromSheet("M21 Secret Cards"), 1 fromSheet("M21 Lands")
|
||||
Prerelease=6 Boosters, 1 RareMythic+
|
||||
ChaosDraftThemes=CORE_SET
|
||||
|
||||
[cards]
|
||||
1 M Ugin, the Spirit Dragon
|
||||
|
||||
@@ -7,6 +7,7 @@ MciCode=ori
|
||||
Type=Core
|
||||
BoosterCovers=5
|
||||
Booster=10 Common:!fromSheet("ORI Sample Cards"), 3 Uncommon:!fromSheet("ORI Sample Cards"), 1 RareMythic:!fromSheet("ORI Sample Cards"), 1 BasicLand
|
||||
ChaosDraftThemes=CORE_SET
|
||||
|
||||
[cards]
|
||||
1 C Akroan Jailer
|
||||
|
||||
@@ -7,6 +7,7 @@ Type=Reprint
|
||||
BoosterCovers=3
|
||||
Booster=11 Common, 3 Uncommon, 1 RareMythic
|
||||
FoilChanceInBooster=100
|
||||
ChaosDraftThemes=MASTERS_SET
|
||||
|
||||
[cards]
|
||||
1 C Act of Heroism
|
||||
|
||||
@@ -7,6 +7,7 @@ MciCode=mbs
|
||||
Type=Expansion
|
||||
BoosterCovers=3
|
||||
Booster=10 Common, 3 Uncommon, 1 RareMythic, 1 BasicLand
|
||||
ChaosDraftThemes=MIRRODIN
|
||||
|
||||
[cards]
|
||||
1 U Accorder Paladin
|
||||
|
||||
@@ -8,6 +8,7 @@ Type=Expansion
|
||||
BoosterCovers=5
|
||||
Booster=11 Common, 3 Uncommon, 1 Rare
|
||||
FoilAlwaysInCommonSlot=False
|
||||
ChaosDraftThemes=MIRRODIN
|
||||
|
||||
[cards]
|
||||
141 C AEther Spellbomb
|
||||
|
||||
@@ -7,6 +7,7 @@ MciCode=mh1
|
||||
Type=Other
|
||||
BoosterCovers=5
|
||||
Booster=10 Common:!fromSheet("MH1 Secret Cards"), 3 Uncommon:!fromSheet("MH1 Secret Cards"), 1 RareMythic:!fromSheet("MH1 Secret Cards"), 1 fromSheet("MH1 Lands")
|
||||
ChaosDraftThemes=MASTERS_SET;GRAVEYARD_MATTERS
|
||||
|
||||
|
||||
[cards]
|
||||
|
||||
@@ -7,6 +7,7 @@ Type=Reprint
|
||||
BoosterCovers=3
|
||||
Booster=11 Common, 3 Uncommon, 1 RareMythic
|
||||
FoilChanceInBooster=100
|
||||
ChaosDraftThemes=MASTERS_SET
|
||||
|
||||
[cards]
|
||||
1 R All Is Dust
|
||||
|
||||
@@ -7,6 +7,7 @@ Type=Reprint
|
||||
BoosterCovers=3
|
||||
Booster=11 Common, 3 Uncommon, 1 RareMythic
|
||||
FoilChanceInBooster=100
|
||||
ChaosDraftThemes=MASTERS_SET;GRAVEYARD_MATTERS
|
||||
|
||||
[cards]
|
||||
1 C Attended Knight
|
||||
|
||||
@@ -7,6 +7,7 @@ Type=Reprint
|
||||
BoosterCovers=3
|
||||
Booster=11 Common, 3 Uncommon, 1 RareMythic
|
||||
FoilChanceInBooster=100
|
||||
ChaosDraftThemes=MASTERS_SET
|
||||
|
||||
[cards]
|
||||
1 R Adarkar Valkyrie
|
||||
|
||||
@@ -7,6 +7,7 @@ MciCode=nph
|
||||
Type=Expansion
|
||||
BoosterCovers=3
|
||||
Booster=10 Common, 3 Uncommon, 1 RareMythic, 1 BasicLand
|
||||
ChaosDraftThemes=MIRRODIN
|
||||
|
||||
[cards]
|
||||
78 U Act of Aggression
|
||||
|
||||
@@ -9,6 +9,7 @@ Border=White
|
||||
BoosterCovers=5
|
||||
Booster=10 Common, 3 Uncommon, 1 Rare, 1 BasicLand
|
||||
FoilAlwaysInCommonSlot=False
|
||||
ChaosDraftThemes=CORE_SET
|
||||
|
||||
[cards]
|
||||
317 R Adarkar Wastes
|
||||
|
||||
@@ -9,6 +9,7 @@ BoosterCovers=3
|
||||
Booster=11 Common, 3 Uncommon, 1 Rare
|
||||
Foil=OldStyle
|
||||
FoilAlwaysInCommonSlot=False
|
||||
ChaosDraftThemes=GRAVEYARD_MATTERS
|
||||
|
||||
[cards]
|
||||
60 C AEther Burst
|
||||
|
||||
@@ -7,6 +7,7 @@ MciCode=rna
|
||||
Type=Expansion
|
||||
BoosterCovers=5
|
||||
Booster=10 Common:!fromSheet("RNA Secret Cards"), 3 Uncommon:!fromSheet("RNA Secret Cards"), 1 RareMythic:!fromSheet("RNA Secret Cards"), 1 fromSheet("RNA Lands")
|
||||
ChaosDraftThemes=RAVNICA
|
||||
|
||||
[cards]
|
||||
1 M Angel of Grace
|
||||
|
||||
@@ -8,6 +8,7 @@ Type=Expansion
|
||||
BoosterCovers=5
|
||||
Booster=11 Common, 3 Uncommon, 1 Rare
|
||||
FoilAlwaysInCommonSlot=False
|
||||
ChaosDraftThemes=RAVNICA
|
||||
|
||||
[cards]
|
||||
190 R Agrus Kos, Wojek Veteran
|
||||
|
||||
@@ -7,6 +7,7 @@ MciCode=rtr
|
||||
Type=Expansion
|
||||
BoosterCovers=5
|
||||
Booster=10 Common, 3 Uncommon, 1 RareMythic, 1 BasicLand
|
||||
ChaosDraftThemes=RAVNICA;GRAVEYARD_MATTERS
|
||||
|
||||
[cards]
|
||||
141 R Abrupt Decay
|
||||
|
||||
@@ -9,6 +9,7 @@ Border=White
|
||||
BoosterCovers=1
|
||||
Booster=11 Common, 3 Uncommon, 1 Rare
|
||||
Foil=NotSupported
|
||||
ChaosDraftThemes=CORE_SET
|
||||
|
||||
[cards]
|
||||
U Air Elemental
|
||||
|
||||
@@ -7,6 +7,7 @@ MciCode=som
|
||||
Type=Expansion
|
||||
BoosterCovers=5
|
||||
Booster=10 Common, 3 Uncommon, 1 RareMythic, 1 BasicLand
|
||||
ChaosDraftThemes=MIRRODIN
|
||||
|
||||
[cards]
|
||||
1 U Abuna Acolyte
|
||||
|
||||
@@ -9,6 +9,7 @@ BoosterCovers=3
|
||||
Booster=11 Common, 3 Uncommon, 1 Rare
|
||||
Foil=OldStyle
|
||||
FoilAlwaysInCommonSlot=False
|
||||
ChaosDraftThemes=GRAVEYARD_MATTERS
|
||||
|
||||
[cards]
|
||||
109 C Accelerated Mutation
|
||||
|
||||
@@ -10,6 +10,7 @@ BoosterCovers=5
|
||||
Booster=10 Common, 3 Uncommon, 1 Rare, 1 BasicLand
|
||||
Foil=OldStyle
|
||||
FoilAlwaysInCommonSlot=False
|
||||
ChaosDraftThemes=CORE_SET
|
||||
|
||||
[cards]
|
||||
172 U AEther Flash
|
||||
|
||||
@@ -8,6 +8,7 @@ MciCode=soi
|
||||
BoosterCovers=5
|
||||
Booster=9 Common:!dfc, 3 Uncommon:!dfc, 1 RareMythic:!dfc, 1 dfc:!Rare:!Mythic, 1 BasicLand
|
||||
ChanceReplaceCommonWith=.125F dfc:RareMythic
|
||||
ChaosDraftThemes=GRAVEYARD_MATTERS
|
||||
|
||||
|
||||
[cards]
|
||||
|
||||
@@ -7,6 +7,7 @@ MciCode=10e
|
||||
Type=Core
|
||||
BoosterCovers=5
|
||||
Booster=10 Common, 3 Uncommon, 1 Rare, 1 BasicLand
|
||||
ChaosDraftThemes=CORE_SET
|
||||
|
||||
[cards]
|
||||
249 R Abundance
|
||||
|
||||
@@ -7,6 +7,7 @@ Type=Expansion
|
||||
BoosterCovers=3
|
||||
Booster=10 Common:!fromSheet("THB Secret Cards"), 3 Uncommon:!fromSheet("THB Secret Cards"), 1 RareMythic:!fromSheet("THB Secret Cards"), 1 BasicLand
|
||||
Prerelease=6 Boosters, 1 RareMythic+
|
||||
ChaosDraftThemes=GRAVEYARD_MATTERS
|
||||
|
||||
[cards]
|
||||
1 U Alseid of Life's Bounty
|
||||
|
||||
@@ -9,6 +9,7 @@ BoosterCovers=1
|
||||
Booster=11 Common, 3 Uncommon, 1 Rare
|
||||
Foil=OldStyle
|
||||
FoilAlwaysInCommonSlot=False
|
||||
ChaosDraftThemes=GRAVEYARD_MATTERS
|
||||
|
||||
[cards]
|
||||
90 C Accelerate
|
||||
|
||||
@@ -8,6 +8,7 @@ Type=Reprint
|
||||
BoosterCovers=3
|
||||
Booster=11 Common, 3 Uncommon, 1 RareMythic
|
||||
FoilChanceInBooster=100
|
||||
ChaosDraftThemes=MASTERS_SET;GRAVEYARD_MATTERS
|
||||
|
||||
[cards]
|
||||
1 R All Is Dust
|
||||
|
||||
@@ -9,6 +9,7 @@ Border=White
|
||||
BoosterCovers=1
|
||||
Booster=11 Common, 3 Uncommon, 1 Rare
|
||||
Foil=NotSupported
|
||||
ChaosDraftThemes=CORE_SET
|
||||
|
||||
[cards]
|
||||
U Air Elemental
|
||||
|
||||
@@ -8,6 +8,7 @@ Type=Expansion
|
||||
BoosterCovers=3
|
||||
Booster=10 Common:!fromSheet("WAR Secret Cards"), 3 Uncommon:!fromSheet("WAR Secret Cards"), 1 RareMythic:!fromSheet("WAR Secret Cards"), 1 BasicLand
|
||||
BoosterMustContain=Planeswalker
|
||||
ChaosDraftThemes=RAVNICA
|
||||
|
||||
[cards]
|
||||
1 R Karn, the Great Creator
|
||||
|
||||
@@ -8,6 +8,7 @@ Type=Expansion
|
||||
BoosterCovers=1
|
||||
Booster=11 Common, 3 Uncommon, 1 Rare
|
||||
Foil=NotSupported
|
||||
ChaosDraftThemes=GRAVEYARD_MATTERS
|
||||
|
||||
[cards]
|
||||
U AEther Flash
|
||||
|
||||
@@ -1929,6 +1929,7 @@ lblPlanarDeckZone=Weltendeck
|
||||
lblNoneZone=Keine
|
||||
#BoosterDraft.java
|
||||
lblChooseBlock=Wähle Block
|
||||
lblChooseChaosTheme=Wähle ein Chaos-Draft-Thema
|
||||
lblBlockNotContainSetCombinations={0} enthält keine Set-Auswahl.
|
||||
lblChooseSetCombination=Treffe Set-Auswahl
|
||||
lblNotFoundCustomDraftFiles=Keine angepaßte Draft-Datei gefunden.
|
||||
|
||||
@@ -1929,6 +1929,7 @@ lblPlanarDeckZone=planardeck
|
||||
lblNoneZone=none
|
||||
#BoosterDraft.java
|
||||
lblChooseBlock=Choose Block
|
||||
lblChooseChaosTheme=Choose Chaos Draft Theme
|
||||
lblBlockNotContainSetCombinations={0} does not contain any set combinations.
|
||||
lblChooseSetCombination=Choose Set Combination
|
||||
lblNotFoundCustomDraftFiles=No custom draft files found.
|
||||
|
||||
@@ -20,7 +20,6 @@ package forge.limited;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
import forge.StaticData;
|
||||
import forge.card.CardEdition;
|
||||
import forge.deck.CardPool;
|
||||
@@ -41,7 +40,6 @@ import forge.util.gui.SGuiChoose;
|
||||
import forge.util.gui.SOptionPane;
|
||||
import forge.util.storage.IStorage;
|
||||
import forge.util.Localizer;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
import java.io.File;
|
||||
@@ -181,34 +179,40 @@ public class BoosterDraft implements IBoosterDraft {
|
||||
break;
|
||||
|
||||
case Chaos:
|
||||
/**
|
||||
* A chaos draft consists of boosters from many different sets.
|
||||
* Default settings are boosters from all sets with a booster size of 15 cards.
|
||||
* Alternatively, the sets can be restricted to a format like Modern or to a theme.
|
||||
* Examples for themes: sets that take place on a certain plane, core sets, masters sets,
|
||||
* or sets that share a mechanic.
|
||||
*/
|
||||
// Get chaos draft themes
|
||||
final List<ThemedChaosDraft> themes = new ArrayList<>();
|
||||
final IStorage<ThemedChaosDraft> themeStorage = FModel.getThemedChaosDrafts();
|
||||
for (final ThemedChaosDraft theme : themeStorage) {
|
||||
themes.add(theme);
|
||||
}
|
||||
Collections.sort(themes); // sort for user interface
|
||||
// Ask user to select theme
|
||||
final String dialogQuestion = Localizer.getInstance().getMessage("lblChooseChaosTheme");
|
||||
final ThemedChaosDraft theme = SGuiChoose.oneOrNone(dialogQuestion, themes);
|
||||
if (theme == null) {
|
||||
return false; // abort if no theme is selected
|
||||
}
|
||||
// Filter all sets by theme restrictions
|
||||
final Predicate<CardEdition> themeFilter = theme.getEditionFilter();
|
||||
final CardEdition.Collection allEditions = StaticData.instance().getEditions();
|
||||
final Iterable<CardEdition> chaosDraftEditions = Iterables.filter(allEditions.getOrderedEditions(), new Predicate<CardEdition>() {
|
||||
@Override
|
||||
public boolean apply(final CardEdition cardEdition) {
|
||||
boolean isExpansion = cardEdition.getType().equals(CardEdition.Type.EXPANSION);
|
||||
boolean isCoreSet = cardEdition.getType().equals(CardEdition.Type.CORE);
|
||||
boolean isReprintSet = cardEdition.getType().equals(CardEdition.Type.REPRINT);
|
||||
if (isExpansion || isCoreSet || isReprintSet) {
|
||||
// Only allow sets with 15 cards in booster packs
|
||||
if (cardEdition.hasBoosterTemplate()) {
|
||||
final List<Pair<String, Integer>> slots = cardEdition.getBoosterTemplate().getSlots();
|
||||
int boosterSize = 0;
|
||||
for (Pair<String, Integer> slot : slots) {
|
||||
boosterSize += slot.getRight();
|
||||
}
|
||||
return boosterSize == 15;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// Randomize order of sets
|
||||
List<CardEdition> shuffled = Lists.newArrayList(chaosDraftEditions);
|
||||
Collections.shuffle(shuffled);
|
||||
|
||||
final Supplier<List<PaperCard>> ChaosDraftSupplier = new ChaosBoosterSupplier(shuffled);
|
||||
|
||||
final Iterable<CardEdition> chaosDraftEditions = Iterables.filter(
|
||||
allEditions.getOrderedEditions(),
|
||||
themeFilter);
|
||||
// Add chaos "boosters" as special suppliers
|
||||
final Supplier<List<PaperCard>> ChaosDraftSupplier;
|
||||
try {
|
||||
ChaosDraftSupplier = new ChaosBoosterSupplier(chaosDraftEditions);
|
||||
} catch(IllegalArgumentException e) {
|
||||
System.out.println(e.getMessage());
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < 3; i++) {
|
||||
this.product.add(ChaosDraftSupplier);
|
||||
}
|
||||
|
||||
218
forge-gui/src/main/java/forge/limited/ThemedChaosDraft.java
Normal file
218
forge-gui/src/main/java/forge/limited/ThemedChaosDraft.java
Normal file
@@ -0,0 +1,218 @@
|
||||
package forge.limited;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
import forge.card.CardEdition;
|
||||
import forge.game.GameFormat;
|
||||
import forge.model.FModel;
|
||||
import forge.util.TextUtil;
|
||||
import forge.util.storage.StorageReaderFile;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Themed chaos draft allows limiting the pool of available random boosters for a draft to a certain theme.
|
||||
*/
|
||||
public class ThemedChaosDraft implements Comparable<ThemedChaosDraft> {
|
||||
private final String tag;
|
||||
private final String label;
|
||||
private final int orderNumber;
|
||||
|
||||
/**
|
||||
* @param tag Tag name used in edition files.
|
||||
* @param label Label used in user interface.
|
||||
* @param orderNumber Number used to order entries in user interface.
|
||||
*/
|
||||
public ThemedChaosDraft(String tag, String label, int orderNumber) {
|
||||
this.tag = tag;
|
||||
this.label = label;
|
||||
this.orderNumber = orderNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return theme tag
|
||||
*/
|
||||
public String getTag() { return tag; }
|
||||
|
||||
/**
|
||||
* @return theme label
|
||||
*/
|
||||
public String getLabel() { return label; }
|
||||
|
||||
/**
|
||||
* @return theme order number
|
||||
*/
|
||||
public int getOrderNumber() { return orderNumber; }
|
||||
|
||||
/**
|
||||
* @return Predicate to sort out editions not belonging to the chaos draft theme
|
||||
*/
|
||||
public Predicate<CardEdition> getEditionFilter() {
|
||||
Predicate<CardEdition> filter;
|
||||
switch(tag) {
|
||||
case "DEFAULT":
|
||||
filter = DEFAULT_FILTER;
|
||||
break;
|
||||
case "MODERN":
|
||||
case "PIONEER":
|
||||
case "STANDARD":
|
||||
filter = getFormatFilter(tag);
|
||||
break;
|
||||
default:
|
||||
filter = themedFilter;
|
||||
}
|
||||
return filter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter to select editions by ChaosDraftThemes tag defined in edition files.
|
||||
* Tag must be defined in res/blockdata/chaosdraftthemes.txt
|
||||
*/
|
||||
private final Predicate<CardEdition> themedFilter = new Predicate<CardEdition>() {
|
||||
@Override
|
||||
public boolean apply(final CardEdition cardEdition) {
|
||||
String[] themes = cardEdition.getChaosDraftThemes();
|
||||
for (String theme : themes) {
|
||||
if (tag.equals(theme)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @param formatName format to filter by, currently supported: MODERN, PIONEER, STANDARD
|
||||
* @return Filter to select editions belonging to a certain constructed format.
|
||||
*/
|
||||
private Predicate<CardEdition> getFormatFilter(String formatName) {
|
||||
GameFormat.Collection formats = FModel.getFormats();
|
||||
GameFormat format;
|
||||
switch(formatName) {
|
||||
case "MODERN":
|
||||
format = formats.getModern();
|
||||
break;
|
||||
case "PIONEER":
|
||||
format = formats.getPioneer();
|
||||
break;
|
||||
case "STANDARD":
|
||||
default:
|
||||
format = formats.getStandard();
|
||||
}
|
||||
return new Predicate<CardEdition>() {
|
||||
@Override
|
||||
public boolean apply(final CardEdition cardEdition){
|
||||
return DEFAULT_FILTER.apply(cardEdition) && format.isSetLegal(cardEdition.getCode());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Default filter that only allows actual sets that were printed as 15-card boosters
|
||||
*/
|
||||
private static final Predicate<CardEdition> DEFAULT_FILTER = new Predicate<CardEdition>() {
|
||||
@Override
|
||||
public boolean apply(final CardEdition cardEdition) {
|
||||
boolean isExpansion = cardEdition.getType().equals(CardEdition.Type.EXPANSION);
|
||||
boolean isCoreSet = cardEdition.getType().equals(CardEdition.Type.CORE);
|
||||
boolean isReprintSet = cardEdition.getType().equals(CardEdition.Type.REPRINT);
|
||||
if (isExpansion || isCoreSet || isReprintSet) {
|
||||
// Only allow sets with 15 cards in booster packs
|
||||
if (cardEdition.hasBoosterTemplate()) {
|
||||
final List<Pair<String, Integer>> slots = cardEdition.getBoosterTemplate().getSlots();
|
||||
int boosterSize = 0;
|
||||
for (Pair<String, Integer> slot : slots) {
|
||||
boosterSize += slot.getRight();
|
||||
}
|
||||
return boosterSize == 15;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.label;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = (prime * result) + ((this.tag == null) ? 0 : this.tag.hashCode());
|
||||
result = (prime * result) + ((this.label == null) ? 0 : this.label.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Comparable#compareTo(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(ThemedChaosDraft other) {
|
||||
return (this.orderNumber != other.orderNumber)
|
||||
? this.orderNumber - other.orderNumber
|
||||
: this.label.compareTo(other.label);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (this.getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final ThemedChaosDraft other = (ThemedChaosDraft) obj;
|
||||
if (!this.label.equals(other.label)) {
|
||||
return false;
|
||||
}
|
||||
if (!this.tag.equals(other.tag)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static final Function<ThemedChaosDraft, String> FN_GET_TAG = new Function<ThemedChaosDraft, String>() {
|
||||
@Override
|
||||
public String apply(ThemedChaosDraft themedChaosBooster) {
|
||||
return themedChaosBooster.getTag();
|
||||
}
|
||||
};
|
||||
|
||||
public static class Reader extends StorageReaderFile<ThemedChaosDraft> {
|
||||
public Reader(String pathname) {
|
||||
super(pathname, ThemedChaosDraft.FN_GET_TAG);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ThemedChaosDraft read(String line, int idx) {
|
||||
final String[] sParts = TextUtil.splitWithParenthesis(line, ',', 3);
|
||||
int orderNumber = Integer.parseInt(sParts[0].trim(), 10);
|
||||
String tag = sParts[1].trim();
|
||||
String label = sParts[2].trim();
|
||||
return new ThemedChaosDraft(tag, label, orderNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37,6 +37,7 @@ import forge.gauntlet.GauntletData;
|
||||
import forge.interfaces.IProgressBar;
|
||||
import forge.itemmanager.ItemManagerConfig;
|
||||
import forge.limited.GauntletMini;
|
||||
import forge.limited.ThemedChaosDraft;
|
||||
import forge.planarconquest.ConquestController;
|
||||
import forge.planarconquest.ConquestPlane;
|
||||
import forge.planarconquest.ConquestPreferences;
|
||||
@@ -91,6 +92,7 @@ public final class FModel {
|
||||
|
||||
private static IStorage<CardBlock> blocks;
|
||||
private static IStorage<CardBlock> fantasyBlocks;
|
||||
private static IStorage<ThemedChaosDraft> themedChaosDrafts;
|
||||
private static IStorage<ConquestPlane> planes;
|
||||
private static IStorage<QuestWorld> worlds;
|
||||
private static GameFormat.Collection formats;
|
||||
@@ -187,6 +189,7 @@ public final class FModel {
|
||||
questPreferences = new QuestPreferences();
|
||||
conquestPreferences = new ConquestPreferences();
|
||||
fantasyBlocks = new StorageBase<>("Custom blocks", new CardBlock.Reader(ForgeConstants.BLOCK_DATA_DIR + "fantasyblocks.txt", magicDb.getEditions()));
|
||||
themedChaosDrafts = new StorageBase<>("Themed Chaos Drafts", new ThemedChaosDraft.Reader(ForgeConstants.BLOCK_DATA_DIR + "chaosdraftthemes.txt"));
|
||||
planes = new StorageBase<>("Conquest planes", new ConquestPlane.Reader(ForgeConstants.CONQUEST_PLANES_DIR + "planes.txt"));
|
||||
Map<String, QuestWorld> standardWorlds = new QuestWorld.Reader(ForgeConstants.QUEST_WORLD_DIR + "worlds.txt").readAll();
|
||||
Map<String, QuestWorld> customWorlds = new QuestWorld.Reader(ForgeConstants.USER_QUEST_WORLD_DIR + "customworlds.txt").readAll();
|
||||
@@ -383,6 +386,10 @@ public final class FModel {
|
||||
return fantasyBlocks;
|
||||
}
|
||||
|
||||
public static IStorage<ThemedChaosDraft> getThemedChaosDrafts() {
|
||||
return themedChaosDrafts;
|
||||
}
|
||||
|
||||
public static TournamentData getTournamentData() { return tournamentData; }
|
||||
|
||||
public static void setTournamentData(TournamentData tournamentData) { FModel.tournamentData = tournamentData; }
|
||||
|
||||
Reference in New Issue
Block a user