Support dividing map into regions

This commit is contained in:
drdev
2014-12-18 02:46:41 +00:00
parent d07072af8e
commit d8e146b409
2 changed files with 153 additions and 192 deletions

View File

@@ -20,14 +20,14 @@ package forge.planarconquest;
import java.util.HashSet; import java.util.HashSet;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import forge.GuiBase; import forge.GuiBase;
import forge.assets.ISkinImage; import forge.assets.ISkinImage;
import forge.card.CardEdition; import forge.card.CardEdition;
import forge.card.CardRules;
import forge.card.CardRulesPredicates;
import forge.card.CardEdition.CardInSet; import forge.card.CardEdition.CardInSet;
import forge.card.CardType; import forge.card.CardType;
import forge.card.ColorSet;
import forge.card.MagicColor; import forge.card.MagicColor;
import forge.deck.generation.DeckGenPool; import forge.deck.generation.DeckGenPool;
import forge.item.PaperCard; import forge.item.PaperCard;
@@ -41,16 +41,11 @@ public enum ConquestPlane {
Alara("Alara", new String[] { Alara("Alara", new String[] {
"ALA", "CON", "ARB" "ALA", "CON", "ARB"
}, new Region[] { }, new Region[] {
new Region("Bant {G}{W}{U}", "Seaside Citadel", CardRulesPredicates.hasColorIdentity(MagicColor.GREEN | MagicColor.WHITE | MagicColor.BLUE), new Region("Bant", "Bant Panorama", MagicColor.GREEN | MagicColor.WHITE | MagicColor.BLUE),
new String[] { "Bant" }), new Region("Esper", "Esper Panorama", MagicColor.WHITE | MagicColor.BLUE | MagicColor.BLACK),
new Region("Esper {W}{U}{B}", "Arcane Sanctum", CardRulesPredicates.hasColorIdentity(MagicColor.WHITE | MagicColor.BLUE | MagicColor.BLACK), new Region("Grixis", "Grixis Panorama", MagicColor.BLUE | MagicColor.BLACK | MagicColor.RED),
new String[] { "Esper" }), new Region("Jund", "Jund Panorama", MagicColor.BLACK | MagicColor.RED | MagicColor.GREEN),
new Region("Grixis {U}{B}{R}", "Crumbling Necropolis", CardRulesPredicates.hasColorIdentity(MagicColor.BLUE | MagicColor.BLACK | MagicColor.RED), new Region("Naya", "Naya Panorama", MagicColor.RED | MagicColor.GREEN | MagicColor.WHITE)
new String[] { "Grixis" }),
new Region("Jund {B}{R}{G}", "Savage Lands", CardRulesPredicates.hasColorIdentity(MagicColor.BLACK | MagicColor.RED | MagicColor.GREEN),
new String[] { "Jund" }),
new Region("Naya {R}{G}{W}", "Jungle Shrine", CardRulesPredicates.hasColorIdentity(MagicColor.RED | MagicColor.GREEN | MagicColor.WHITE),
new String[] { "Naya" })
}), }),
Dominaria("Dominaria", new String[] { Dominaria("Dominaria", new String[] {
"ICE", "ALL", "CSP", "ICE", "ALL", "CSP",
@@ -70,144 +65,89 @@ public enum ConquestPlane {
Innistrad("Innistrad", new String[] { Innistrad("Innistrad", new String[] {
"ISD", "DKA", "AVR" "ISD", "DKA", "AVR"
}, new Region[] { }, new Region[] {
new Region("Moorland {W}{U}", "Moorland Haunt", CardRulesPredicates.hasColorIdentity(MagicColor.WHITE | MagicColor.BLUE), new Region("Moorland", "Moorland Haunt", MagicColor.WHITE | MagicColor.BLUE),
new String[] { "Moorland" }), new Region("Nephalia", "Nephalia Drownyard", MagicColor.BLUE | MagicColor.BLACK),
new Region("Nephalia {U}{B}", "Nephalia Drownyard", CardRulesPredicates.hasColorIdentity(MagicColor.BLUE | MagicColor.BLACK), new Region("Stensia", "Stensia Bloodhall", MagicColor.BLACK | MagicColor.RED),
new String[] { "Nephalia" }), new Region("Kessig", "Kessig Wolf Run", MagicColor.RED | MagicColor.GREEN),
new Region("Stensia {B}{R}", "Stensia Bloodhall", CardRulesPredicates.hasColorIdentity(MagicColor.BLACK | MagicColor.RED), new Region("Gavony", "Gavony Township", MagicColor.GREEN | MagicColor.WHITE),
new String[] { "Stensia" }),
new Region("Kessig {R}{G}", "Kessig Wolf Run", CardRulesPredicates.hasColorIdentity(MagicColor.RED | MagicColor.GREEN),
new String[] { "Kessig" }),
new Region("Gavony {G}{W}", "Gavony Township", CardRulesPredicates.hasColorIdentity(MagicColor.GREEN | MagicColor.WHITE),
new String[] { "Gavony" })
}), }),
Jamuraa("Jamuraa", new String[] { Jamuraa("Jamuraa", new String[] {
"MIR", "VIS", "WTH" "MIR", "VIS", "WTH"
}, new Region[] { }, new Region[] {
new Region("Karoo {W}", "Karoo", CardRulesPredicates.hasColorIdentity(MagicColor.WHITE), new Region("Karoo", "Karoo", MagicColor.WHITE),
new String[] { "Karoo" }), new Region("Coral Atoll", "Coral Atoll", MagicColor.BLUE),
new Region("Coral Atoll {U}", "Coral Atoll", CardRulesPredicates.hasColorIdentity(MagicColor.BLUE), new Region("Everglades", "Everglades", MagicColor.BLACK),
new String[] { "Coral" }), new Region("Dormant Volcano", "Dormant Volcano", MagicColor.RED),
new Region("Everglades {B}", "Everglades", CardRulesPredicates.hasColorIdentity(MagicColor.BLACK), new Region("Jungle Basin", "Jungle Basin", MagicColor.GREEN),
new String[] { "Everglades" }),
new Region("Dormant Volcano {R}", "Dormant Volcano", CardRulesPredicates.hasColorIdentity(MagicColor.RED),
new String[] { "Volcano" }),
new Region("Jungle Basin {G}", "Jungle Basin", CardRulesPredicates.hasColorIdentity(MagicColor.GREEN),
new String[] { "Jungle" })
}), }),
Kamigawa("Kamigawa", new String[] { Kamigawa("Kamigawa", new String[] {
"CHK", "BOK", "SOK" "CHK", "BOK", "SOK"
}, new Region[] { }, new Region[] {
new Region("Towabara {W}", "Eiganjo Castle", CardRulesPredicates.hasColorIdentity(MagicColor.WHITE), new Region("Towabara", "Eiganjo Castle", MagicColor.WHITE),
new String[] { "Towabara", "Eiganjo", "Plains" }), new Region("Minamo Academy", "Minamo, School at Water's Edge", MagicColor.BLUE),
new Region("Minamo Academy {U}", "Minamo, School at Water's Edge", CardRulesPredicates.hasColorIdentity(MagicColor.BLUE), new Region("Takenuma", "Shizo, Death's Storehouse", MagicColor.BLACK),
new String[] { "Minamo", "Water", "Island" }), new Region("Sokenzan Mountains", "Shinka, the Bloodsoaked Keep", MagicColor.RED),
new Region("Takenuma {B}", "Shizo, Death's Storehouse", CardRulesPredicates.hasColorIdentity(MagicColor.BLACK), new Region("Jukai Forest", "Okina, Temple to the Grandfathers", MagicColor.GREEN),
new String[] { "Takenuma", "Shizo", "Swamp" }),
new Region("Sokenzan Mountains {R}", "Shinka, the Bloodsoaked Keep", CardRulesPredicates.hasColorIdentity(MagicColor.RED),
new String[] { "Sokenzan", "Shinka", "Mountain" }),
new Region("Jukai Forest {G}", "Okina, Temple to the Grandfathers", CardRulesPredicates.hasColorIdentity(MagicColor.GREEN),
new String[] { "Jukai", "Okina", "Forest" })
}), }),
LorwynShadowmoor("Lorwyn-Shadowmoor", new String[] { LorwynShadowmoor("Lorwyn-Shadowmoor", new String[] {
"LRW", "MOR", "SHM", "EVE" "LRW", "MOR", "SHM", "EVE"
}, new Region[] { }, new Region[] {
new Region("Ancient Amphitheater {R}{W}", "Ancient Amphitheater", CardRulesPredicates.hasCreatureType("Giant"), new Region("Ancient Amphitheater", "Ancient Amphitheater", MagicColor.RED | MagicColor.WHITE),
new String[] { }), new Region("Auntie's Hovel", "Auntie's Hovel", MagicColor.BLACK | MagicColor.RED),
new Region("Auntie's Hovel {B}{R}", "Auntie's Hovel", CardRulesPredicates.hasCreatureType("Goblin"), new Region("Gilt-Leaf Palace", "Gilt-Leaf Palace", MagicColor.BLACK | MagicColor.GREEN),
new String[] { "Auntie", "Boggart", "Hobgoblin", "Redcap", "Spriggan" }), new Region("Murmuring Bosk", "Murmuring Bosk", MagicColor.WHITE | MagicColor.BLACK | MagicColor.GREEN),
new Region("Gilt-Leaf Palace {B}{G}", "", CardRulesPredicates.hasCreatureType("Elf"), new Region("Primal Beyond", "Primal Beyond", MagicColor.ALL_COLORS),
new String[] { "Gilt-Leaf", "Elves", "Wilt-Leaf" }), new Region("Rustic Clachan", "Rustic Clachan", MagicColor.GREEN | MagicColor.WHITE),
new Region("Murmuring Bosk {W}{B}{G}", "Murmuring Bosk", CardRulesPredicates.hasCreatureType("Treefolk"), new Region("Secluded Glen", "Secluded Glen", MagicColor.BLUE | MagicColor.BLACK),
new String[] { "Bosk", "Treefolk" }), new Region("Wanderwine Hub", "Wanderwine Hub", MagicColor.WHITE | MagicColor.BLUE),
new Region("Primal Beyond {W}{U}{B}{R}{G}", "Primal Beyond", CardRulesPredicates.hasCreatureType("Elemental"),
new String[] { "Elemental", "Flamekin", "Tanufel", "Cinder", "Kulrath" }),
new Region("Rustic Clachan {W}", "Rustic Clachan", CardRulesPredicates.hasCreatureType("Kithkin"),
new String[] { "Ballynock", "Ballyrush", "Barrenton", "Burrenton", "Cloverdell", "Goldmeadow", "Kinsbaile", "Kinscaer", "Mistmeadow" }),
new Region("Secluded Glen {U}{B}", "Secluded Glen", CardRulesPredicates.hasCreatureType("Faerie"),
new String[] { "Glen", "Oona", "Fae" }),
new Region("Wanderwine Hub {W}{U}", "Wanderwine Hub", CardRulesPredicates.hasCreatureType("Merfolk"),
new String[] { "Merrow", "Selkie", "Pirate" }),
}), }),
Mercadia("Mercadia", new String[] { Mercadia("Mercadia", new String[] {
"MMQ", "NEM", "PCY" "MMQ", "NEM", "PCY"
}, new Region[] { }, new Region[] {
new Region("Fountain of Cho {W}", "Fountain of Cho", CardRulesPredicates.hasColorIdentity(MagicColor.WHITE), new Region("Fountain of Cho", "Fountain of Cho", MagicColor.WHITE),
new String[] { "Cho" }), new Region("Saprazzan Cove", "Saprazzan Cove", MagicColor.BLUE),
new Region("Saprazzan Cove {U}", "Saprazzan Cove", CardRulesPredicates.hasColorIdentity(MagicColor.BLUE), new Region("Subterranean Hangar", "Subterranean Hangar", MagicColor.BLACK),
new String[] { "Saprazzan", "Saprazzo" }), new Region("Mercadian Bazaar", "Mercadian Bazaar", MagicColor.RED),
new Region("Subterranean Hangar {B}", "Subterranean Hangar", CardRulesPredicates.hasColorIdentity(MagicColor.BLACK), new Region("Rushwood Grove", "Rushwood Grove", MagicColor.GREEN)
new String[] { "Subterranean" }),
new Region("Mercadian Bazaar {R}", "Mercadian Bazaar", CardRulesPredicates.hasColorIdentity(MagicColor.RED),
new String[] { "Mercadian" }),
new Region("Rushwood Grove {G}", "Rushwood Grove", CardRulesPredicates.hasColorIdentity(MagicColor.GREEN),
new String[] { "Rushwood" })
}), }),
Mirrodin("Mirrodin", new String[] { Mirrodin("Mirrodin", new String[] {
"MRD", "DST", "5DN", "SOM", "MBS", "NPH" "MRD", "DST", "5DN", "SOM", "MBS", "NPH"
}, new Region[] { }, new Region[] {
new Region("Panopticon {X}", "Darksteel Citadel", CardRulesPredicates.Presets.IS_ARTIFACT, new Region("Panopticon", "Darksteel Citadel", MagicColor.COLORLESS),
new String[] { "Darksteel" }), new Region("Taj-Nar", "Ancient Den", MagicColor.WHITE),
new Region("Taj-Nar {W}", "Ancient Den", CardRulesPredicates.hasColorIdentity(MagicColor.WHITE), new Region("Lumengrid", "Seat of the Synod", MagicColor.BLUE),
new String[] { "Razor", "Fields", "Plains" }), new Region("Ish Sah", "Vault of Whispers", MagicColor.BLACK),
new Region("Lumengrid {U}", "Seat of the Synod", CardRulesPredicates.hasColorIdentity(MagicColor.BLUE), new Region("Kuldotha", "Great Furnace", MagicColor.RED),
new String[] { "Quicksilver", "Sea", "Island" }), new Region("Tel-Jilad", "Tree of Tales", MagicColor.GREEN),
new Region("Ish Sah {B}", "Vault of Whispers", CardRulesPredicates.hasColorIdentity(MagicColor.BLACK), new Region("Glimmervoid", "Glimmervoid", MagicColor.ALL_COLORS)
new String[] { "Dross", "Mephidross" }),
new Region("Kuldotha {R}", "Great Furnace", CardRulesPredicates.hasColorIdentity(MagicColor.RED),
new String[] { "Oxidda", "Chain", "Mountain" }),
new Region("Tel-Jilad {G}", "Tree of Tales", CardRulesPredicates.hasColorIdentity(MagicColor.GREEN),
new String[] { "Tangle", "Forest" }),
new Region("Glimmervoid {W}{U}{B}{R}{G}", "Glimmervoid", CardRulesPredicates.hasKeyword("Sunburst"),
new String[] { "Glimmervoid" }),
}), }),
Rath("Rath", new String[] { Rath("Rath", new String[] {
"TMP", "STH", "EXO" "TMP", "STH", "EXO"
}, new Region[] { }, new Region[] {
new Region("Caldera Lake {U}{R}", "Caldera Lake", CardRulesPredicates.hasColorIdentity(MagicColor.BLUE | MagicColor.RED), new Region("Caldera Lake", "Caldera Lake", MagicColor.BLUE | MagicColor.RED),
new String[] { "Caldera" }), new Region("Cinder Marsh", "Cinder Marsh", MagicColor.BLACK | MagicColor.RED),
new Region("Cinder Marsh {B}{R}", "Cinder Marsh", CardRulesPredicates.hasColorIdentity(MagicColor.BLACK | MagicColor.RED), new Region("Mogg Hollows", "Mogg Hollows", MagicColor.RED | MagicColor.GREEN),
new String[] { "Cinder", "Marsh" }), new Region("Pine Barrens", "Pine Barrens", MagicColor.BLACK | MagicColor.GREEN),
new Region("Mogg Hollows {R}{G}", "Mogg Hollows", CardRulesPredicates.hasColorIdentity(MagicColor.RED | MagicColor.GREEN), new Region("Rootwater Depths", "Rootwater Depths", MagicColor.BLUE | MagicColor.BLACK),
new String[] { "Mogg", "Hollow" }), new Region("Salt Flats", "Salt Flats", MagicColor.WHITE | MagicColor.BLACK),
new Region("Pine Barrens {B}{G}", "Pine Barrens", CardRulesPredicates.hasColorIdentity(MagicColor.BLACK | MagicColor.GREEN), new Region("Scabland", "Scabland", MagicColor.RED | MagicColor.WHITE),
new String[] { "Barrens" }), new Region("Skyshroud Forest", "Skyshroud Forest", MagicColor.GREEN | MagicColor.BLUE),
new Region("Rootwater Depths {U}{B}", "Rootwater Depths", CardRulesPredicates.hasColorIdentity(MagicColor.BLUE | MagicColor.BLACK), new Region("Thalakos Lowlands", "Thalakos Lowlands", MagicColor.WHITE | MagicColor.BLUE),
new String[] { "Rootwater" }), new Region("Vec Townships", "Vec Townships", MagicColor.GREEN | MagicColor.WHITE)
new Region("Salt Flats {W}{B}", "Salt Flats", CardRulesPredicates.hasColorIdentity(MagicColor.WHITE | MagicColor.BLACK),
new String[] { "Salt Flat" }),
new Region("Scabland {R}{W}", "Scabland", CardRulesPredicates.hasColorIdentity(MagicColor.RED | MagicColor.WHITE),
new String[] { "Scabland" }),
new Region("Skyshroud Forest {G}{U}", "Skyshroud Forest", CardRulesPredicates.hasColorIdentity(MagicColor.GREEN | MagicColor.BLUE),
new String[] { "Skyshroud" }),
new Region("Thalakos Lowlands {W}{U}", "Thalakos Lowlands", CardRulesPredicates.hasColorIdentity(MagicColor.WHITE | MagicColor.BLUE),
new String[] { "Thalakos" }),
new Region("Vec Townships {G}{W}", "Vec Townships", CardRulesPredicates.hasColorIdentity(MagicColor.GREEN | MagicColor.WHITE),
new String[] { "Vec" })
}), }),
Ravnica("Ravnica", new String[] { Ravnica("Ravnica", new String[] {
"RAV", "GPT", "DIS", "RTR", "GTC", "DGM" "RAV", "GPT", "DIS", "RTR", "GTC", "DGM"
}, new Region[] { }, new Region[] {
new Region("Azorius Chancery {W}{U}", "Azorius Chancery", CardRulesPredicates.hasColorIdentity(MagicColor.WHITE | MagicColor.BLUE), new Region("Azorius Chancery", "Azorius Chancery", MagicColor.WHITE | MagicColor.BLUE),
new String[] { "Azorius" }), new Region("Boros Garrison", "Boros Garrison", MagicColor.RED | MagicColor.WHITE),
new Region("Boros Garrison {R}{W}", "Boros Garrison", CardRulesPredicates.hasColorIdentity(MagicColor.RED | MagicColor.WHITE), new Region("Dimir Aqueduct", "Dimir Aqueduct", MagicColor.BLUE | MagicColor.BLACK),
new String[] { "Boros" }), new Region("Golgari Rot Farm", "Golgari Rot Farm", MagicColor.BLACK | MagicColor.GREEN),
new Region("Dimir Aqueduct {U}{B}", "Dimir Aqueduct", CardRulesPredicates.hasColorIdentity(MagicColor.BLUE | MagicColor.BLACK), new Region("Gruul Turf", "Gruul Turf", MagicColor.RED | MagicColor.GREEN),
new String[] { "Dimir" }), new Region("Izzet Boilerworks", "Izzet Boilerworks", MagicColor.BLUE | MagicColor.RED),
new Region("Golgari Rot Farm {B}{G}", "Golgari Rot Farm", CardRulesPredicates.hasColorIdentity(MagicColor.BLACK | MagicColor.GREEN), new Region("Orzhov Basilica", "Orzhov Basilica", MagicColor.WHITE | MagicColor.BLACK),
new String[] { "Golgari" }), new Region("Rakdos Carnarium", "Rakdos Carnarium", MagicColor.BLACK | MagicColor.RED),
new Region("Gruul Turf {R}{G}", "Gruul Turf", CardRulesPredicates.hasColorIdentity(MagicColor.RED | MagicColor.GREEN), new Region("Selesnya Sanctuary", "Selesnya Sanctuary", MagicColor.GREEN | MagicColor.WHITE),
new String[] { "Gruul" }), new Region("Simic Growth Chamber", "Simic Growth Chamber", MagicColor.GREEN | MagicColor.BLUE)
new Region("Izzet Boilerworks {U}{R}", "Izzet Boilerworks", CardRulesPredicates.hasColorIdentity(MagicColor.BLUE | MagicColor.RED),
new String[] { "Izzet" }),
new Region("Orzhov Basilica {W}{B}", "Orzhov Basilica", CardRulesPredicates.hasColorIdentity(MagicColor.WHITE | MagicColor.BLACK),
new String[] { "Orzhov" }),
new Region("Rakdos Carnarium {R}{B}", "Rakdos Carnarium", CardRulesPredicates.hasColorIdentity(MagicColor.BLACK | MagicColor.RED),
new String[] { "Rakdos" }),
new Region("Selesnya Sanctuary {G}{W}", "Selesnya Sanctuary", CardRulesPredicates.hasColorIdentity(MagicColor.GREEN | MagicColor.WHITE),
new String[] { "Selesnya" }),
new Region("Simic Growth Chamber {G}{U}", "Simic Growth Chamber", CardRulesPredicates.hasColorIdentity(MagicColor.GREEN | MagicColor.BLUE),
new String[] { "Simic" })
}), }),
Shandalar("Shandalar", new String[] { Shandalar("Shandalar", new String[] {
"2ED", "3ED", "4ED", "ARN", "ATQ", "LEG", "DRK" "2ED", "3ED", "4ED", "ARN", "ATQ", "LEG", "DRK"
@@ -221,34 +161,26 @@ public enum ConquestPlane {
Tarkir("Tarkir", new String[] { Tarkir("Tarkir", new String[] {
"KTK", "FRF", "DTK" "KTK", "FRF", "DTK"
}, new Region[] { }, new Region[] {
new Region("Abzan Houses {W}{B}{G}", "Sandsteppe Citadel", CardRulesPredicates.hasColorIdentity(MagicColor.WHITE | MagicColor.BLACK | MagicColor.GREEN), new Region("Abzan Houses", "Sandsteppe Citadel", MagicColor.WHITE | MagicColor.BLACK | MagicColor.GREEN),
new String[] { "Abzan", "House", "Citadel", "Arashin", "Wastes", "Mer-Ek" }), new Region("Jeskai Way", "Mystic Monastery", MagicColor.BLUE | MagicColor.RED | MagicColor.WHITE),
new Region("Jeskai Way {U}{R}{W}", "Mystic Monastery", CardRulesPredicates.hasColorIdentity(MagicColor.BLUE | MagicColor.RED | MagicColor.WHITE), new Region("Mardu Horde", "Nomad Outpost", MagicColor.RED | MagicColor.WHITE | MagicColor.BLACK),
new String[] { "Jeskai", "Way", "Mystic", "Monastery", "Stronghold", "Purugir" }), new Region("Sultai Brood", "Opulent Palace", MagicColor.BLACK | MagicColor.GREEN | MagicColor.BLUE),
new Region("Mardu Horde {R}{W}{B}", "Nomad Outpost", CardRulesPredicates.hasColorIdentity(MagicColor.RED | MagicColor.WHITE | MagicColor.BLACK), new Region("Temur Frontier", "Frontier Bivouac", MagicColor.GREEN | MagicColor.BLUE | MagicColor.RED)
new String[] { "Mardu", "Horde", "Nomad", "Outpost", "Wingthrone", "Goldengrave", "Scour", "Screamreach" }),
new Region("Sultai Brood {B}{G}{U}", "Opulent Palace", CardRulesPredicates.hasColorIdentity(MagicColor.BLACK | MagicColor.GREEN | MagicColor.BLUE),
new String[] { "Sultai", "Brood", "Opulent", "Palace", "Sagu", "Jungle", "Kheru", "Gudul", "Gurmag", "Marang" }),
new Region("Temur Frontier {G}{U}{R}", "Frontier Bivouac", CardRulesPredicates.hasColorIdentity(MagicColor.GREEN | MagicColor.BLUE | MagicColor.RED),
new String[] { "Temur", "Frontier", "Bivouac", "Qal Sisma", "Dragon's Throat", "Karakyk Valley", "Staircase of Bones" })
}), }),
Theros("Theros", new String[] { Theros("Theros", new String[] {
"THS", "BNG", "JOU" "THS", "BNG", "JOU"
}, new Region[] { }, new Region[] {
new Region("", "", null, new Region("", "", inSet("THS", "BNG", "JOU"))
new String[] { }),
}), }),
Ulgrotha("Ulgrotha", new String[] { Ulgrotha("Ulgrotha", new String[] {
"HML" "HML"
}, new Region[] { }, new Region[] {
new Region("", "", null, new Region("", "", inSet("HML"))
new String[] { }),
}), }),
Zendikar("Zendikar", new String[] { Zendikar("Zendikar", new String[] {
"ZEN", "WWK", "ROE" "ZEN", "WWK", "ROE"
}, new Region[] { }, new Region[] {
new Region("", "", null, new Region("", "", inSet("ZEN", "WWK", "ROE"))
new String[] { }),
}); });
private final String name; private final String name;
@@ -342,32 +274,29 @@ public enum ConquestPlane {
public static class Region { public static class Region {
private final String name; private final String name;
private final String artCardName; private final String artCardName;
private final ColorSet colorSet;
private final Predicate<PaperCard> pred; private final Predicate<PaperCard> pred;
private final DeckGenPool cardPool = new DeckGenPool(); private final DeckGenPool cardPool = new DeckGenPool();
private final FCollection<PaperCard> commanders = new FCollection<PaperCard>(); private final FCollection<PaperCard> commanders = new FCollection<PaperCard>();
private ISkinImage art; private ISkinImage art;
private Region(String name0, String artCardName0, final int colorMask) {
name = name0;
artCardName = artCardName0;
pred = new Predicate<PaperCard>() {
@Override
public boolean apply(PaperCard pc) {
return pc.getRules().getColorIdentity().hasNoColorsExcept(colorMask);
}
};
colorSet = ColorSet.fromMask(colorMask);
}
private Region(String name0, String artCardName0, Predicate<PaperCard> pred0) { private Region(String name0, String artCardName0, Predicate<PaperCard> pred0) {
name = name0; name = name0;
artCardName = artCardName0; artCardName = artCardName0;
pred = pred0; pred = pred0;
} colorSet = ColorSet.fromMask(MagicColor.ALL_COLORS);
private Region(String name0, String artCardName0, final Predicate<CardRules> rulesPred, final String[] keywords) {
this(name0, artCardName0, new Predicate<PaperCard>() {
@Override
public boolean apply(PaperCard pc) {
if (rulesPred != null && rulesPred.apply(pc.getRules())) {
return true;
}
for (String s : keywords) {
if (pc.getName().contains(s)) {
return true;
}
}
return false;
}
});
} }
public String getName() { public String getName() {
@@ -381,6 +310,10 @@ public enum ConquestPlane {
return art; return art;
} }
public ColorSet getColorSet() {
return colorSet;
}
public DeckGenPool getCardPool() { public DeckGenPool getCardPool() {
return cardPool; return cardPool;
} }

View File

@@ -4,9 +4,14 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import forge.assets.FSkinProp; import forge.assets.FSkinProp;
import forge.card.MagicColor;
import forge.planarconquest.ConquestPlane.Region;
import forge.util.Aggregates; import forge.util.Aggregates;
import forge.util.FCollectionView;
public class ConquestPlaneMap { public class ConquestPlaneMap {
private static final double sqrt3 = (float)Math.sqrt(3);
//use 2 dimensional array to represent tile grid //use 2 dimensional array to represent tile grid
private final int gridSize; private final int gridSize;
private final HexagonTile[][] grid; private final HexagonTile[][] grid;
@@ -14,13 +19,13 @@ public class ConquestPlaneMap {
private int tileWidth, tileHeight, padding; private int tileWidth, tileHeight, padding;
public ConquestPlaneMap(ConquestPlane plane) { public ConquestPlaneMap(ConquestPlane plane) {
int size = (int)Math.round(Math.sqrt(plane.getCardPool().size() / 3)); //use card pool size to determine grid size int size = (int)Math.round(Math.sqrt(plane.getCardPool().size() / 2)); //use card pool size to determine grid size
if (size % 2 == 0) { if (size % 2 == 0) {
size++; //ensure grid size is an odd number size++; //ensure grid size is an odd number
} }
gridSize = size; gridSize = size;
grid = new HexagonTile[gridSize][gridSize]; grid = new HexagonTile[gridSize][gridSize];
generateRandomGrid(); generateRandomGrid(plane);
} }
public void setTileWidth(int tileWidth0) { public void setTileWidth(int tileWidth0) {
@@ -96,48 +101,44 @@ public class ConquestPlaneMap {
void draw(HexagonTile tile, int x, int y, int w, int h); void draw(HexagonTile tile, int x, int y, int w, int h);
} }
private void generateRandomGrid() { private void generateRandomGrid(ConquestPlane plane) {
int startQ = gridSize / 2; //player will start at center of grid always int center = gridSize / 2; //player will start at center of grid always
int startR = startQ; addTile(center, center, null);
int colorIndex = 0; //TODO: Determine initial color index from planeswalker
addTile(startQ, startR, colorIndex);
int max = gridSize - 1; //divide the grid into regions
int minCount = Math.round(gridSize * gridSize * 0.75f); //ensure at least 75% of the grid has tiles FCollectionView<Region> regions = plane.getRegions();
while (tileCount < minCount) { int regionCount = regions.size();
//add a tile in a random location and then ensure it can be reached from start tile double regionAngle = 2 * Math.PI / regionCount;
int q = Aggregates.randomInt(0, max);
int r = Aggregates.randomInt(0, max); //these assume a tile width of 2, radius of 1
while (addTile(q, r, colorIndex)) { double centerX = 1.5 * center;
//alternate which coordinate is incremented as we move towards center double centerY = sqrt3 * (center + 0.5f * (center & 1));
if (tileCount % 2 == 0 && r != startR) { double maxDist = (centerX + centerY) / 2;
if (r > startR) {
r--; //create a circular map, divided into regions
} for (int q = 0; q < gridSize; q++) {
else { for (int r = 0; r < gridSize; r++) {
r++; double x = 1.5 * q;
} double y = sqrt3 * (r + 0.5f * (q & 1));
double dx = x - centerX;
double dy = y - centerY;
double dist = Math.sqrt(dx * dx + dy * dy);
if (dist > maxDist) {
continue;
} }
else if (q > startQ) { double angle = Math.atan2(dy, dx) + Math.PI;
q--; int regionIndex = (int)Math.floor(angle / regionAngle);
} if (regionIndex >= regionCount) {
else if (q < startQ) { regionIndex = 0;
q++;
}
else if (r > startR) {
r--;
}
else {
r++;
} }
addTile(q, r, regions.get(regionIndex));
} }
colorIndex = Aggregates.randomInt(0, 4); //pick a random color for the next set of tiles
} }
} }
private boolean addTile(int q, int r, int colorIndex) { private boolean addTile(int q, int r, Region region) {
if (grid[q][r] == null) { if (grid[q][r] == null) {
grid[q][r] = new HexagonTile(q, r, colorIndex); grid[q][r] = new HexagonTile(q, r, region);
tileCount++; tileCount++;
return true; return true;
} }
@@ -146,12 +147,39 @@ public class ConquestPlaneMap {
public class HexagonTile { public class HexagonTile {
private final int q, r; private final int q, r;
private final Region region;
private final int colorIndex; private final int colorIndex;
private HexagonTile(int q0, int r0, int colorIndex0) { private HexagonTile(int q0, int r0, Region region0) {
q = q0; q = q0;
r = r0; r = r0;
colorIndex = colorIndex0; region = region0;
if (region == null) {
colorIndex = 0;
}
else if (region.getColorSet().isColorless()) {
colorIndex = 0;
}
else if (region.getColorSet().isMonoColor()) {
int index;
byte color = region.getColorSet().getColor();
for (index = 0; index < 5; index++) {
if (MagicColor.WUBRG[index] == color) {
break;
}
}
colorIndex = index;
}
else { //for multicolor regions, choose one of the colors at random
int index;
while (true) {
index = Aggregates.randomInt(0, 4);
if (region.getColorSet().hasAnyColor(MagicColor.WUBRG[index])) {
break;
}
}
colorIndex = index;
}
} }
public int getColorIndex() { public int getColorIndex() {