Game formats - file format changed to use sections.

boosters - simplier restriction
This commit is contained in:
Maxmtg
2013-05-06 09:53:56 +00:00
parent 7891d7d6ff
commit 8ddb9e0d01
4 changed files with 27 additions and 35 deletions

View File

@@ -20,7 +20,7 @@ CFX: 3 covers, 10 Common, 3 Uncommon, 1 RareMythic, 1 BasicLand ALA
CHK: 5 covers, 11 Common, 3 Uncommon, 1 Rare
CHR: 1 covers, 9 Common, 3 UncommonRare
CSP: 3 covers, 11 Common, 3 Uncommon, 1 Rare
DGM: 3 covers, 10 Common:!land, 3 Uncommon, 1 RareMythic:!name("Maze's End"), 1 Custom("Dragon's Maze Lands")
DGM: 3 covers, 10 Common:!land, 3 Uncommon, 1 RareMythic:!land, 1 Custom("Dragon's Maze Lands")
DIS: 3 covers, 11 Common, 3 Uncommon, 1 Rare
DKA: 3 covers, 9 Common:!dfc, 3 Uncommon:!dfc, 1 RareMythic:!dfc, 1 Any:dfc, 1 BasicLand ISD
DRK: 1 covers, 6 Common, 2 UncommonRare

View File

@@ -1,5 +1,16 @@
Name:Standard|Index:1|Sets:ISD, DKA, AVR, M13, RTR, GTC, DGM
Name:Extended|Index:2|Sets:ZEN, WWK, ROE, M11, SOM, MBS, NPH, M12, ISD, DKA, AVR, M13, RTR, GTC, DGM|Banned:Stoneforge Mystic; Jace, the Mind Sculptor; Ponder; Preordain; Mental Misstep
Name:Modern|Index:3|Sets:8ED, MRD, DST, 5DN, CHK, BOK, SOK, 9ED, RAV, GPT, DIS, CSP, TSP, PLC, FUT, 10E, LRW, EVE, SHM, MOR, ALA, CFX, ARB, M10, ZEN, WWK, ROE, M11, SOM, MBS, NPH, M12, ISD, DKA, AVR, M13, RTR, GTC, DGM|Banned:Ancestral Vision; Ancient Den; Bitterblossom; Blazing Shoal; Bloodbraid Elf; Chrome Mox; Cloudpost; Dark Depths; Dread Return; Glimpse of Nature; Golgari Grave-Troll; Great Furnace; Green Sun's Zenith; Hypergenesis; Jace, the Mind Sculptor; Mental Misstep; Ponder; Preordain; Punishing Fire; Rite of Flame; Seat of the Synod; Seething Song; Sensei's Divining Top; Stoneforge Mystic; Skullclamp; Sword of the Meek; Tree of Tales; Umezawa's Jitte; Vault of Whispers; Wild Nacatl
Name:Legacy|Index:4|Banned:Amulet of Quoz; Ancestral Recall; Balance; Bazaar of Baghdad; Black Lotus; Black Vise; Bronze Tablet; Channel; Chaos Orb; Contract from Below; Darkpact; Demonic Attorney; Demonic Consultation; Demonic Tutor; Earthcraft; Falling Star; Fastbond; Flash; Frantic Search; Goblin Recruiter; Gush; Hermit Druid; Imperial Seal; Jeweled Bird; Land Tax; Library of Alexandria; Mana Crypt; Mana Drain; Mana Vault; Memory Jar; Mind Twist; Mind's Desire; Mishra's Workshop; Mox Emerald; Mox Jet; Mox Pearl; Mox Ruby; Mox Sapphire; Mystical Tutor; Necropotence; Oath of Druids; Rebirth; Shahrazad; Skullclamp; Sol Ring; Strip Mine; Survival of the Fittest; Tempest Efreet; Time Vault; Time Walk; Timetwister; Timmerian Fiends; Tinker; Tolarian Academy; Vampiric Tutor; Wheel of Fortune; Windfall; Worldgorger Dragon; Yawgmoth's Bargain; Yawgmoth's Will; Mental Misstep
Name:Vintage|Index:5|Banned:Amulet of Quoz; Bronze Tablet; Chaos Orb; Contract from Below; Darkpact; Demonic Attorney; Falling Star; Jeweled Bird; Rebirth; Shahrazad; Tempest Efreet; Timmerian Fiends
[Standard]
Sets:ISD, DKA, AVR, M13, RTR, GTC, DGM
[Extended]
Sets:ZEN, WWK, ROE, M11, SOM, MBS, NPH, M12, ISD, DKA, AVR, M13, RTR, GTC, DGM
Banned:Stoneforge Mystic; Jace, the Mind Sculptor; Ponder; Preordain; Mental Misstep
[Modern]
Sets:8ED, MRD, DST, 5DN, CHK, BOK, SOK, 9ED, RAV, GPT, DIS, CSP, TSP, PLC, FUT, 10E, LRW, EVE, SHM, MOR, ALA, CFX, ARB, M10, ZEN, WWK, ROE, M11, SOM, MBS, NPH, M12, ISD, DKA, AVR, M13, RTR, GTC, DGM
Banned:Ancestral Vision; Ancient Den; Bitterblossom; Blazing Shoal; Bloodbraid Elf; Chrome Mox; Cloudpost; Dark Depths; Dread Return; Glimpse of Nature; Golgari Grave-Troll; Great Furnace; Green Sun's Zenith; Hypergenesis; Jace, the Mind Sculptor; Mental Misstep; Ponder; Preordain; Punishing Fire; Rite of Flame; Seat of the Synod; Seething Song; Sensei's Divining Top; Stoneforge Mystic; Skullclamp; Sword of the Meek; Tree of Tales; Umezawa's Jitte; Vault of Whispers; Wild Nacatl
[Legacy]
Banned:Amulet of Quoz; Ancestral Recall; Balance; Bazaar of Baghdad; Black Lotus; Black Vise; Bronze Tablet; Channel; Chaos Orb; Contract from Below; Darkpact; Demonic Attorney; Demonic Consultation; Demonic Tutor; Earthcraft; Falling Star; Fastbond; Flash; Frantic Search; Goblin Recruiter; Gush; Hermit Druid; Imperial Seal; Jeweled Bird; Land Tax; Library of Alexandria; Mana Crypt; Mana Drain; Mana Vault; Memory Jar; Mind Twist; Mind's Desire; Mishra's Workshop; Mox Emerald; Mox Jet; Mox Pearl; Mox Ruby; Mox Sapphire; Mystical Tutor; Necropotence; Oath of Druids; Rebirth; Shahrazad; Skullclamp; Sol Ring; Strip Mine; Survival of the Fittest; Tempest Efreet; Time Vault; Time Walk; Timetwister; Timmerian Fiends; Tinker; Tolarian Academy; Vampiric Tutor; Wheel of Fortune; Windfall; Worldgorger Dragon; Yawgmoth's Bargain; Yawgmoth's Will; Mental Misstep
[Vintage]
Banned:Amulet of Quoz; Bronze Tablet; Chaos Orb; Contract from Below; Darkpact; Demonic Attorney; Falling Star; Jeweled Bird; Rebirth; Shahrazad; Tempest Efreet; Timmerian Fiends

View File

@@ -17,13 +17,12 @@
*/
package forge.card;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import forge.game.GameFormat;
import forge.util.FileSection;
import forge.util.storage.StorageReaderFile;
import forge.util.storage.StorageReaderFileSections;
import forge.util.storage.StorageView;
/**
@@ -79,46 +78,28 @@ public final class FormatCollection extends StorageView<GameFormat> {
/**
* Instantiates a new format utils.
*/
public static class FormatReader extends StorageReaderFile<GameFormat> {
/**
* TODO: Write javadoc for Constructor.
* @param file0
* @param keySelector0
*/
public static class FormatReader extends StorageReaderFileSections<GameFormat> {
public FormatReader(String file0) {
super(file0, GameFormat.FN_GET_NAME);
}
/* (non-Javadoc)
* @see forge.util.StorageReaderFile#read(java.lang.String)
*/
@Override
protected GameFormat read(String line, int i) {
final List<String> sets = new ArrayList<String>(); // default: all sets allowed
final List<String> bannedCards = new ArrayList<String>(); // default:
// nothing
// banned
protected GameFormat read(String title, Iterable<String> body, int idx) {
List<String> sets = null; // default: all sets allowed
List<String> bannedCards = null; // default: nothing banned
FileSection section = FileSection.parse(line, ":", "|");
String name = section.get("name");
int index = 1 + i;
FileSection section = FileSection.parse(body, ":");
String strSets = section.get("sets");
if ( null != strSets ) {
sets.addAll(Arrays.asList(strSets.split(", ")));
sets = Arrays.asList(strSets.split(", "));
}
String strCars = section.get("banned");
if ( strCars != null ) {
bannedCards.addAll(Arrays.asList(strCars.split("; ")));
bannedCards = Arrays.asList(strCars.split("; "));
}
if (name == null) {
throw new RuntimeException("Format must have a name! Check formats.txt file");
return new GameFormat(title, sets, bannedCards, 1 + idx);
}
return new GameFormat(name, sets, bannedCards, index);
}
}
}

View File

@@ -67,7 +67,7 @@ public class GameFormat implements Comparable<GameFormat> {
public GameFormat(final String fName, final Iterable<String> sets, final List<String> bannedCards, int compareIdx) {
this.index = compareIdx;
this.name = fName;
this.allowedSetCodes = Lists.newArrayList(sets);
this.allowedSetCodes = sets == null ? new ArrayList<String>() : Lists.newArrayList(sets);
this.bannedCardNames = bannedCards == null ? new ArrayList<String>() : Lists.newArrayList(bannedCards);
this.allowedSetCodes_ro = Collections.unmodifiableList(allowedSetCodes);