forked from External/mage
Changed logic of adding basic lands in deck generation and the add land function in limited deck editor to use lands from the sets of the cards in the decks. Added missing attributes to set definitions.
This commit is contained in:
parent
a0d0fc8b7e
commit
5f3a8eb360
48 changed files with 190 additions and 52 deletions
|
|
@ -22,9 +22,12 @@ import java.awt.event.ActionEvent;
|
|||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
import mage.Constants;
|
||||
import mage.cards.ExpansionSet;
|
||||
|
||||
/**
|
||||
* Generates random card pool and builds a deck.
|
||||
|
|
@ -39,7 +42,7 @@ public class DeckGenerator {
|
|||
|
||||
private static final int SPELL_CARD_POOL_SIZE = 180;
|
||||
|
||||
private static final int DECK_LANDS = 16;
|
||||
private static final int DECK_LANDS = 17;
|
||||
private static final int MAX_NON_BASIC_SOURCE = DECK_LANDS / 2;
|
||||
|
||||
private static final int MAX_TRIES = 4096;
|
||||
|
|
@ -159,21 +162,15 @@ public class DeckGenerator {
|
|||
|
||||
final List<String> setsToUseFinal = setsToUse;
|
||||
|
||||
deck = DeckBuilder.buildDeck(spellCardPool, allowedColors, landCardPool, new RateCallback() {
|
||||
deck = DeckBuilder.buildDeck(spellCardPool, allowedColors, setsToUseFinal, landCardPool, new RateCallback() {
|
||||
@Override
|
||||
public int rateCard(Card card) {
|
||||
return 6;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Card getBestBasicLand(ColoredManaSymbol color) {
|
||||
int tries = 100;
|
||||
Card land;
|
||||
do {
|
||||
land = DeckGenerator.getBestBasicLand(color);
|
||||
tries--;
|
||||
} while (!setsToUseFinal.contains(land.getExpansionSetCode()) && tries >= 0);
|
||||
return land;
|
||||
public Card getBestBasicLand(ColoredManaSymbol color, List<String> setsToUse) {
|
||||
return DeckGenerator.getBestBasicLand(color, setsToUseFinal);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -336,29 +333,52 @@ public class DeckGenerator {
|
|||
* @param color
|
||||
* @return
|
||||
*/
|
||||
private static Card getBestBasicLand(ColoredManaSymbol color) {
|
||||
if (color.equals(ColoredManaSymbol.G)) {
|
||||
CardInfo cardInfo = CardRepository.instance.findCard("Forest");
|
||||
return cardInfo != null ? cardInfo.getCard() : null;
|
||||
}
|
||||
if (color.equals(ColoredManaSymbol.R)) {
|
||||
CardInfo cardInfo = CardRepository.instance.findCard("Mountain");
|
||||
return cardInfo != null ? cardInfo.getCard() : null;
|
||||
}
|
||||
if (color.equals(ColoredManaSymbol.B)) {
|
||||
CardInfo cardInfo = CardRepository.instance.findCard("Swamp");
|
||||
return cardInfo != null ? cardInfo.getCard() : null;
|
||||
}
|
||||
if (color.equals(ColoredManaSymbol.U)) {
|
||||
CardInfo cardInfo = CardRepository.instance.findCard("Island");
|
||||
return cardInfo != null ? cardInfo.getCard() : null;
|
||||
}
|
||||
if (color.equals(ColoredManaSymbol.W)) {
|
||||
CardInfo cardInfo = CardRepository.instance.findCard("Plains");
|
||||
return cardInfo != null ? cardInfo.getCard() : null;
|
||||
private static Card getBestBasicLand(ColoredManaSymbol color, List<String> setsToUse) {
|
||||
String cardName = "";
|
||||
switch(color) {
|
||||
case G:
|
||||
cardName = "Forest";
|
||||
break;
|
||||
case W:
|
||||
cardName = "Plains";
|
||||
break;
|
||||
case R:
|
||||
cardName = "Mountain";
|
||||
break;
|
||||
case B:
|
||||
cardName = "Swamp";
|
||||
break;
|
||||
case U:
|
||||
cardName = "Island";
|
||||
break;
|
||||
}
|
||||
|
||||
return null;
|
||||
List<String> landSets = new LinkedList<String>();
|
||||
if (!setsToUse.isEmpty()) {
|
||||
// Add parent sets with the basic lands if the setlist don't include them
|
||||
for (String setCode: setsToUse) {
|
||||
ExpansionSet expansionSet = Sets.findSet(setCode);
|
||||
if (expansionSet.hasBasicLands()) {
|
||||
landSets.add(setCode);
|
||||
} else if (expansionSet.getParentSet() != null && !landSets.contains(expansionSet.getParentSet().getCode())) {
|
||||
landSets.add(expansionSet.getParentSet().getCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
CardCriteria criteria = new CardCriteria();
|
||||
if (!landSets.isEmpty()) {
|
||||
criteria.setCodes(landSets.toArray(new String[landSets.size()]));
|
||||
}
|
||||
criteria.rarities(Constants.Rarity.LAND).name(cardName);
|
||||
List<CardInfo> cards = CardRepository.instance.findCards(criteria);
|
||||
|
||||
if (cards.isEmpty() && !setsToUse.isEmpty()) {
|
||||
cards = CardRepository.instance.findCards(cardName);
|
||||
}
|
||||
|
||||
int randomInt = new Random().nextInt(cards.size());
|
||||
return cards.get(randomInt).getCard();
|
||||
|
||||
}
|
||||
|
||||
protected static boolean isColoredMana(String symbol) {
|
||||
|
|
|
|||
|
|
@ -34,11 +34,16 @@
|
|||
|
||||
package mage.client.dialog;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import javax.swing.JLayeredPane;
|
||||
import mage.Constants;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.ExpansionSet;
|
||||
import mage.cards.Sets;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.cards.repository.CardCriteria;
|
||||
import mage.cards.repository.CardInfo;
|
||||
import mage.cards.repository.CardRepository;
|
||||
import mage.client.MageFrame;
|
||||
|
|
@ -50,6 +55,7 @@ import mage.client.MageFrame;
|
|||
public class AddLandDialog extends MageDialog {
|
||||
|
||||
private Deck deck;
|
||||
private List<String> setCodesland;
|
||||
|
||||
/** Creates new form AddLandDialog */
|
||||
public AddLandDialog() {
|
||||
|
|
@ -59,13 +65,46 @@ public class AddLandDialog extends MageDialog {
|
|||
|
||||
public void showDialog(Deck deck) {
|
||||
this.deck = deck;
|
||||
|
||||
// find setCodes with basic lands from cards of the deck
|
||||
List<String> setCodes = new LinkedList<String>();
|
||||
for (Card card: this.deck.getCards()) {
|
||||
if (!setCodes.contains(card.getExpansionSetCode())) {
|
||||
setCodes.add(card.getExpansionSetCode());
|
||||
}
|
||||
}
|
||||
for (Card card: this.deck.getSideboard()) {
|
||||
if (!setCodes.contains(card.getExpansionSetCode())) {
|
||||
setCodes.add(card.getExpansionSetCode());
|
||||
}
|
||||
}
|
||||
List<String> landSets = new LinkedList<String>();
|
||||
if (!setCodes.isEmpty()) {
|
||||
// Add parent sets with the basic lands if the setlist don't include them
|
||||
for (String setCode: setCodes) {
|
||||
ExpansionSet expansionSet = Sets.findSet(setCode);
|
||||
if (expansionSet.hasBasicLands()) {
|
||||
landSets.add(setCode);
|
||||
} else if (expansionSet.getParentSet() != null && !landSets.contains(expansionSet.getParentSet().getCode())) {
|
||||
landSets.add(expansionSet.getParentSet().getCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
this.setCodesland = landSets;
|
||||
|
||||
|
||||
MageFrame.getDesktop().add(this, JLayeredPane.PALETTE_LAYER);
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
private void addLands(String landName, int number) {
|
||||
Random random = new Random();
|
||||
List<CardInfo> cards = CardRepository.instance.findCards(landName);
|
||||
CardCriteria criteria = new CardCriteria();
|
||||
if (!setCodesland.isEmpty()) {
|
||||
criteria.setCodes(setCodesland.toArray(new String[setCodesland.size()]));
|
||||
}
|
||||
criteria.rarities(Constants.Rarity.LAND).name(landName);
|
||||
List<CardInfo> cards = CardRepository.instance.findCards(criteria);
|
||||
if (cards.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package mage.interfaces.rate;
|
||||
|
||||
import java.util.List;
|
||||
import mage.Constants;
|
||||
import mage.cards.Card;
|
||||
|
||||
|
|
@ -10,5 +11,5 @@ import mage.cards.Card;
|
|||
*/
|
||||
public interface RateCallback {
|
||||
int rateCard(Card card);
|
||||
Card getBestBasicLand(Constants.ColoredManaSymbol color);
|
||||
Card getBestBasicLand(Constants.ColoredManaSymbol color, List<String> setsToUse);
|
||||
}
|
||||
|
|
@ -22,8 +22,8 @@ public class DeckBuilder {
|
|||
|
||||
private static final int DECK_COUNT[] = {3, 6, 6, 4, 3, 2};
|
||||
private static final int DECK_COST[] = {1, 2, 3, 4, 6, 10};
|
||||
private static final int DECK_SPELLS = 24;
|
||||
private static final int DECK_LANDS = 16;
|
||||
private static final int DECK_SPELLS = 23;
|
||||
private static final int DECK_LANDS = 17;
|
||||
private static final int DECK_SIZE = DECK_SPELLS + DECK_LANDS;
|
||||
private static final int MIN_CARD_SCORE = 25;
|
||||
private static final int MIN_SOURCE = 16;
|
||||
|
|
@ -35,7 +35,7 @@ public class DeckBuilder {
|
|||
private DeckBuilder() {
|
||||
}
|
||||
|
||||
public synchronized static Deck buildDeck(List<Card> spellCardPool, List<ColoredManaSymbol> allowedColors, List<Card> landCardPool, RateCallback callback) {
|
||||
public synchronized static Deck buildDeck(List<Card> spellCardPool, List<ColoredManaSymbol> allowedColors, List<String> setsToUse, List<Card> landCardPool, RateCallback callback) {
|
||||
deck = new Deck();
|
||||
|
||||
final Collection<MageScoredCard> remainingCards = new ArrayList<MageScoredCard>();
|
||||
|
|
@ -55,7 +55,7 @@ public class DeckBuilder {
|
|||
}
|
||||
addCardsToDeck(remainingCards, 0, 4, DECK_SPELLS - deck.getCards().size());
|
||||
addCardsToDeck(remainingCards, 5, 10, DECK_SPELLS - deck.getCards().size());
|
||||
addLandsToDeck(allowedColors, landCardPool, callback);
|
||||
addLandsToDeck(allowedColors, setsToUse, landCardPool, callback);
|
||||
|
||||
return deck;
|
||||
}
|
||||
|
|
@ -121,7 +121,7 @@ public class DeckBuilder {
|
|||
* @param landCardPool
|
||||
* @param callback
|
||||
*/
|
||||
private static void addLandsToDeck(List<ColoredManaSymbol> allowedColors, List<Card> landCardPool, RateCallback callback) {
|
||||
private static void addLandsToDeck(List<ColoredManaSymbol> allowedColors, List<String> setsToUse, List<Card> landCardPool, RateCallback callback) {
|
||||
|
||||
// Calculate statistics per color.
|
||||
final Map<String, Integer> colorCount = new HashMap<String, Integer>();
|
||||
|
|
@ -190,7 +190,7 @@ public class DeckBuilder {
|
|||
}
|
||||
}
|
||||
}
|
||||
final Card landCard = callback.getBestBasicLand(bestColor);
|
||||
final Card landCard = callback.getBestBasicLand(bestColor, setsToUse);
|
||||
Integer count = colorSource.get(bestColor.toString());
|
||||
count++;
|
||||
colorSource.put(bestColor.toString(), count);
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ public class AlaraReborn extends ExpansionSet {
|
|||
super("Alara Reborn", "ARB", "seticon_mtgarb", "mage.sets.alarareborn", new GregorianCalendar(2009, 3, 25).getTime(), SetType.EXPANSION);
|
||||
this.blockName = "Shards of Alara";
|
||||
this.parentSet = ShardsOfAlara.getInstance();
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 0;
|
||||
this.numBoosterCommon = 11;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ public class Alliances extends ExpansionSet {
|
|||
private Alliances() {
|
||||
super("Alliances", "ALL", "", "mage.sets.alliances", new GregorianCalendar(1996, 6, 10).getTime(), Constants.SetType.EXPANSION);
|
||||
this.blockName = "Ice Age";
|
||||
this.parentSet = IceAge.getInstance();
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 0;
|
||||
this.numBoosterCommon = 8;
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ public class Antiquities extends ExpansionSet {
|
|||
|
||||
private Antiquities() {
|
||||
super("Antiquities", "ATQ", "", "mage.sets.antiquities", new GregorianCalendar(1994, 2, 1).getTime(), Constants.SetType.EXPANSION);
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 1;
|
||||
this.numBoosterCommon = 10;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
package mage.sets;
|
||||
|
||||
import java.util.GregorianCalendar;
|
||||
import mage.Constants;
|
||||
import mage.cards.ExpansionSet;
|
||||
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
public class Apocalypse extends ExpansionSet {
|
||||
private static final Apocalypse fINSTANCE = new Apocalypse();
|
||||
|
|
@ -15,6 +15,8 @@ public class Apocalypse extends ExpansionSet {
|
|||
private Apocalypse() {
|
||||
super("Apocalypse", "APC", "", "mage.sets.apocalypse", new GregorianCalendar(2001, 5, 1).getTime(), Constants.SetType.EXPANSION);
|
||||
this.blockName = "Invasion";
|
||||
this.parentSet = Invasion.getInstance();
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 0;
|
||||
this.numBoosterCommon = 11;
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ public class ArabianNights extends ExpansionSet {
|
|||
|
||||
private ArabianNights() {
|
||||
super("Arabian Nights", "ARN", "", "mage.sets.arabiannights", new GregorianCalendar(1993, 11, 1).getTime(), Constants.SetType.EXPANSION);
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 1;
|
||||
this.numBoosterCommon = 10;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ public class AvacynRestored extends ExpansionSet {
|
|||
private AvacynRestored() {
|
||||
super("Avacyn Restored", "AVR", "seticon_mtgavr", "mage.sets.avacynrestored", new GregorianCalendar(2012, 4, 4).getTime(), SetType.EXPANSION);
|
||||
this.blockName = "Innistrad";
|
||||
this.parentSet = Innistrad.getInstance();
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 1;
|
||||
this.numBoosterCommon = 10;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ public class BetrayersOfKamigawa extends ExpansionSet {
|
|||
private BetrayersOfKamigawa() {
|
||||
super("Betrayers of Kamigawa", "BOK", "", "mage.sets.betrayersofkamigawa", new GregorianCalendar(2005, 1, 4).getTime(), SetType.EXPANSION);
|
||||
this.blockName = "Kamigawa";
|
||||
this.parentSet = ChampionsOfKamigawa.getInstance();
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 0;
|
||||
this.numBoosterCommon = 11;
|
||||
|
|
|
|||
|
|
@ -52,5 +52,7 @@ public class Coldsnap extends ExpansionSet {
|
|||
this.numBoosterUncommon = 3;
|
||||
this.numBoosterRare = 1;
|
||||
this.ratioBoosterMythic = 8;
|
||||
this.parentSet = IceAge.getInstance();
|
||||
this.hasBasicLands = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ public class Conflux extends ExpansionSet {
|
|||
super("Conflux", "CON", "seticon_conflux", "mage.sets.conflux", new GregorianCalendar(2009, 0, 31).getTime(), SetType.EXPANSION);
|
||||
this.blockName = "Shards of Alara";
|
||||
this.parentSet = ShardsOfAlara.getInstance();
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 0;
|
||||
this.numBoosterCommon = 11;
|
||||
|
|
|
|||
|
|
@ -52,5 +52,7 @@ public class DarkAscension extends ExpansionSet {
|
|||
this.numBoosterUncommon = 3;
|
||||
this.numBoosterRare = 1;
|
||||
this.ratioBoosterMythic = 8;
|
||||
this.parentSet = Innistrad.getInstance();
|
||||
this.hasBasicLands = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -17,6 +17,7 @@ public class Darksteel extends ExpansionSet {
|
|||
super("Darksteel", "DST", "", "mage.sets.darksteel", new GregorianCalendar(2004, 1, 6).getTime(), Constants.SetType.EXPANSION);
|
||||
this.blockName = "Mirrodin";
|
||||
this.parentSet = Mirrodin.getInstance();
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 0;
|
||||
this.numBoosterCommon = 11;
|
||||
|
|
|
|||
|
|
@ -49,6 +49,8 @@ public class Dissension extends ExpansionSet {
|
|||
private Dissension() {
|
||||
super("Dissension", "DIS", "", "mage.sets.dissension", new GregorianCalendar(2006, 4, 5).getTime(), Constants.SetType.EXPANSION);
|
||||
this.blockName = "Ravnika";
|
||||
this.parentSet = RavnicaCityOfGuilds.getInstance();
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 0;
|
||||
this.numBoosterCommon = 11;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ public class Eventide extends ExpansionSet {
|
|||
private Eventide() {
|
||||
super("Eventide", "EVE", "", "mage.sets.eventide", new GregorianCalendar(2008, 6, 25).getTime(), Constants.SetType.EXPANSION);
|
||||
this.blockName = "Shadowmoor";
|
||||
this.parentSet = Shadowmoor.getInstance();
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 0;
|
||||
this.numBoosterCommon = 11;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ public class Exodus extends ExpansionSet {
|
|||
private Exodus() {
|
||||
super("Exodus", "EXO", "", "mage.sets.exodus", new GregorianCalendar(1998, 5, 6).getTime(), Constants.SetType.EXPANSION);
|
||||
this.blockName = "Tempest";
|
||||
this.parentSet = Tempest.getInstance();
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 0;
|
||||
this.numBoosterCommon = 11;
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ public class FallenEmpires extends ExpansionSet {
|
|||
|
||||
private FallenEmpires() {
|
||||
super("Fallen Empires", "FEM", "", "mage.sets.fallenempires", new GregorianCalendar(1994, 10, 1).getTime(), Constants.SetType.EXPANSION);
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 1;
|
||||
this.numBoosterCommon = 10;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ public class FifthDawn extends ExpansionSet {
|
|||
private FifthDawn() {
|
||||
super("Fifth Dawn", "5DN", "", "mage.sets.fifthdawn", new GregorianCalendar(2004, 5, 4).getTime(), SetType.EXPANSION);
|
||||
this.blockName = "Mirrodin";
|
||||
this.parentSet = Mirrodin.getInstance();
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 0;
|
||||
this.numBoosterCommon = 11;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ public class FutureSight extends ExpansionSet {
|
|||
private FutureSight() {
|
||||
super("Future Sight", "FUT", "", "mage.sets.futuresight", new GregorianCalendar(2007, 4, 4).getTime(), SetType.EXPANSION);
|
||||
this.blockName = "Time Spiral";
|
||||
this.parentSet = TimeSpiral.getInstance();
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 1;
|
||||
this.numBoosterCommon = 10;
|
||||
|
|
|
|||
|
|
@ -52,5 +52,7 @@ public class Gatecrash extends ExpansionSet {
|
|||
this.numBoosterUncommon = 3;
|
||||
this.numBoosterRare = 1;
|
||||
this.ratioBoosterMythic = 8;
|
||||
this.parentSet = ReturnToRavnica.getInstance();
|
||||
this.hasBasicLands = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,6 +49,8 @@ public class Guildpact extends ExpansionSet {
|
|||
private Guildpact() {
|
||||
super("Guildpact", "GPT", "", "mage.sets.guildpact", new GregorianCalendar(2006, 1, 3).getTime(), Constants.SetType.EXPANSION);
|
||||
this.blockName = "Ravnika";
|
||||
this.parentSet = RavnicaCityOfGuilds.getInstance();
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 0;
|
||||
this.numBoosterCommon = 11;
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ public class Homelands extends ExpansionSet {
|
|||
|
||||
private Homelands() {
|
||||
super("Homelands", "HML", "", "mage.sets.homelands", new GregorianCalendar(1995, 9, 1).getTime(), Constants.SetType.EXPANSION);
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 1;
|
||||
this.numBoosterCommon = 10;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ public class Judgment extends ExpansionSet {
|
|||
private Judgment() {
|
||||
super("Judgment", "JUD", "exp_symbol_mtgjud", "mage.sets.judgment", new GregorianCalendar(2002, 5, 27).getTime(), SetType.EXPANSION);
|
||||
this.blockName = "Odyssey";
|
||||
this.parentSet = Odyssey.getInstance();
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 1;
|
||||
this.numBoosterCommon = 10;
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ public class Legends extends ExpansionSet {
|
|||
|
||||
private Legends() {
|
||||
super("Legends", "LEG", "", "mage.sets.legends", new GregorianCalendar(1994, 5, 1).getTime(), Constants.SetType.EXPANSION);
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 1;
|
||||
this.numBoosterCommon = 10;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ public class Legions extends ExpansionSet {
|
|||
private Legions() {
|
||||
super("Legions", "LGN", "", "mage.sets.legions", new GregorianCalendar(2003, 0, 25).getTime(), Constants.SetType.EXPANSION);
|
||||
this.blockName = "Onslaught";
|
||||
this.parentSet = Onslaught.getInstance();
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 0;
|
||||
this.numBoosterCommon = 11;
|
||||
|
|
|
|||
|
|
@ -28,10 +28,11 @@
|
|||
|
||||
package mage.sets;
|
||||
|
||||
import java.util.GregorianCalendar;
|
||||
import mage.Constants.SetType;
|
||||
import mage.cards.ExpansionSet;
|
||||
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -47,7 +48,9 @@ public class MirrodinBesieged extends ExpansionSet {
|
|||
|
||||
private MirrodinBesieged() {
|
||||
super("Mirrodin Besieged", "MBS", "seticon_mtgmbs", "mage.sets.mirrodinbesieged", new GregorianCalendar(2011, 1, 4).getTime(), SetType.EXPANSION);
|
||||
this.blockName = "Mirrodin Besieged";
|
||||
this.blockName = "Scars of Mirrodin";
|
||||
this.parentSet = ScarsOfMirrodin.getInstance();
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 1;
|
||||
this.numBoosterCommon = 10;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ public class Morningtide extends ExpansionSet {
|
|||
private Morningtide() {
|
||||
super("Morningtide", "MOR", "", "mage.sets.morningtide", new GregorianCalendar(2008, 1, 1).getTime(), SetType.EXPANSION);
|
||||
this.blockName = "Lorwyn";
|
||||
this.parentSet = Morningtide.getInstance();
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 0;
|
||||
this.numBoosterCommon = 11;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ public class Nemesis extends ExpansionSet {
|
|||
private Nemesis() {
|
||||
super("Nemesis", "NMS", "", "mage.sets.nemesis", new GregorianCalendar(2000, 1, 5).getTime(), Constants.SetType.EXPANSION);
|
||||
this.blockName = "Masques";
|
||||
this.parentSet = MercadianMasques.getInstance();
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 0;
|
||||
this.numBoosterCommon = 11;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
package mage.sets;
|
||||
|
||||
import java.util.GregorianCalendar;
|
||||
import mage.Constants;
|
||||
import mage.cards.ExpansionSet;
|
||||
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
public class NewPhyrexia extends ExpansionSet {
|
||||
private static final NewPhyrexia fINSTANCE = new NewPhyrexia();
|
||||
|
|
@ -14,7 +14,8 @@ public class NewPhyrexia extends ExpansionSet {
|
|||
|
||||
private NewPhyrexia() {
|
||||
super("New Phyrexia", "NPH", "", "mage.sets.newphyrexia", new GregorianCalendar(2011, 4, 4).getTime(), Constants.SetType.EXPANSION);
|
||||
this.blockName = "Mirrodin Besieged";
|
||||
this.blockName = "Scars of Mirrodin";
|
||||
this.parentSet = ScarsOfMirrodin.getInstance();
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 1;
|
||||
this.numBoosterCommon = 10;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ public class PlanarChaos extends ExpansionSet {
|
|||
private PlanarChaos() {
|
||||
super("Planar Chaos", "PLC", "", "mage.sets.planarchaos", new GregorianCalendar(2007, 1, 2).getTime(), SetType.EXPANSION);
|
||||
this.blockName = "Time Spiral";
|
||||
this.parentSet = TimeSpiral.getInstance();
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 0;
|
||||
this.numBoosterCommon = 10;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ public class Planeshift extends ExpansionSet {
|
|||
private Planeshift() {
|
||||
super("Planeshift", "PLS", "", "mage.sets.planeshift", new GregorianCalendar(2001, 1, 5).getTime(), SetType.EXPANSION);
|
||||
this.blockName = "Invasion";
|
||||
this.parentSet = Invasion.getInstance();
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 0;
|
||||
this.numBoosterCommon = 11;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ public class Prophecy extends ExpansionSet {
|
|||
private Prophecy() {
|
||||
super("Prophecy", "PCY", "", "mage.sets.prophecy", new GregorianCalendar(2000, 4, 27).getTime(), Constants.SetType.EXPANSION);
|
||||
this.blockName = "Masques";
|
||||
this.parentSet = MercadianMasques.getInstance();
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 0;
|
||||
this.numBoosterCommon = 11;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ public class SaviorsOfKamigawa extends ExpansionSet {
|
|||
private SaviorsOfKamigawa() {
|
||||
super("Saviors of Kamigawa", "SOK", "", "mage.sets.saviorsofkamigawa", new GregorianCalendar(2005, 5, 3).getTime(), SetType.EXPANSION);
|
||||
this.blockName = "Kamigawa";
|
||||
this.parentSet = ChampionsOfKamigawa.getInstance();
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 0;
|
||||
this.numBoosterCommon = 11;
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class ScarsOfMirrodin extends ExpansionSet {
|
|||
|
||||
private ScarsOfMirrodin() {
|
||||
super("Scars of Mirrodin", "SOM", "seticon_mtgsom", "mage.sets.scarsofmirrodin", new GregorianCalendar(2010, 10, 1).getTime(), SetType.EXPANSION);
|
||||
this.blockName = "Mirrodin Besieged";
|
||||
this.blockName = "Scars of Mirrodin";
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 1;
|
||||
this.numBoosterCommon = 10;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ public class Scourge extends ExpansionSet {
|
|||
private Scourge() {
|
||||
super("Scourge", "SCG", "", "mage.sets.scourge", new GregorianCalendar(2003, 5, 17).getTime(), Constants.SetType.EXPANSION);
|
||||
this.blockName = "Onslaught";
|
||||
this.parentSet = Onslaught.getInstance();
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 0;
|
||||
this.numBoosterCommon = 11;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ public class Stronghold extends ExpansionSet {
|
|||
private Stronghold() {
|
||||
super("Stronghold", "STH", "", "mage.sets.stronghold", new GregorianCalendar(1998, 1, 21).getTime(), Constants.SetType.EXPANSION);
|
||||
this.blockName = "Tempest";
|
||||
this.parentSet = Tempest.getInstance();
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 0;
|
||||
this.numBoosterCommon = 11;
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ public class TheDark extends ExpansionSet {
|
|||
|
||||
private TheDark() {
|
||||
super("The Dark", "DRK", "", "mage.sets.thedark", new GregorianCalendar(1994, 7, 1).getTime(), Constants.SetType.EXPANSION);
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 1;
|
||||
this.numBoosterCommon = 10;
|
||||
|
|
|
|||
|
|
@ -46,5 +46,7 @@ public class TimeSpiralTimeshifted extends ExpansionSet {
|
|||
private TimeSpiralTimeshifted() {
|
||||
super("Time Spiral \"Timeshifted\"", "TSB", "", "mage.sets.timeshifted", new GregorianCalendar(2006, 9, 9).getTime(), SetType.EXPANSION);
|
||||
this.blockName = "Time Spiral";
|
||||
this.parentSet = TimeSpiral.getInstance();
|
||||
this.hasBasicLands = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ public class Torment extends ExpansionSet {
|
|||
private Torment() {
|
||||
super("Torment", "TOR", "", "mage.sets.torment", new GregorianCalendar(2002, 0, 26).getTime(), Constants.SetType.EXPANSION);
|
||||
this.blockName = "Odyssey";
|
||||
this.parentSet = Odyssey.getInstance();
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 0;
|
||||
this.numBoosterCommon = 11;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ public class UrzasDestiny extends ExpansionSet {
|
|||
private UrzasDestiny() {
|
||||
super("Urza's Destiny", "UDS", "exp_symbol_mtguds", "mage.sets.urzasdestiny", new GregorianCalendar(1999, 6, 23).getTime(), SetType.EXPANSION);
|
||||
this.blockName = "Urza";
|
||||
this.parentSet = UrzasSaga.getInstance();
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 1;
|
||||
this.numBoosterCommon = 10;
|
||||
|
|
|
|||
|
|
@ -48,6 +48,8 @@ public class UrzasLegacy extends ExpansionSet {
|
|||
private UrzasLegacy() {
|
||||
super("Urza's Legacy", "ULG", "exp_symbol_mtgulg", "mage.sets.urzaslegacy", new GregorianCalendar(1999, 2, 6).getTime(), SetType.EXPANSION);
|
||||
this.blockName = "Urza";
|
||||
this.parentSet = UrzasSaga.getInstance();
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 1;
|
||||
this.numBoosterCommon = 10;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ public class Visions extends ExpansionSet {
|
|||
private Visions() {
|
||||
super("Visions", "VIS", "", "mage.sets.visions", new GregorianCalendar(1997, 0, 11).getTime(), Constants.SetType.EXPANSION);
|
||||
this.blockName = "Mirage";
|
||||
this.parentSet = Mirage.getInstance();
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 0;
|
||||
this.numBoosterCommon = 11;
|
||||
|
|
|
|||
|
|
@ -48,6 +48,8 @@ public class Weatherlight extends ExpansionSet {
|
|||
private Weatherlight() {
|
||||
super("Weatherlight", "WTH", "exp_symbol_mtgwth", "mage.sets.weatherlight", new GregorianCalendar(1997, 5, 31).getTime(), SetType.EXPANSION);
|
||||
this.blockName = "Mirage";
|
||||
this.parentSet = Mirage.getInstance();
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 1;
|
||||
this.numBoosterCommon = 10;
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ public class Worldwake extends ExpansionSet {
|
|||
super("Worldwake", "WWK", "seticon_WWK", "mage.sets.worldwake", new GregorianCalendar(2010, 0, 30).getTime(), SetType.EXPANSION);
|
||||
this.blockName = "Zendikar";
|
||||
this.parentSet = Zendikar.getInstance();
|
||||
this.hasBasicLands = false;
|
||||
this.hasBoosters = true;
|
||||
this.numBoosterLands = 0;
|
||||
this.numBoosterCommon = 11;
|
||||
|
|
|
|||
|
|
@ -33,18 +33,16 @@ import java.util.UUID;
|
|||
import mage.Constants;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.Zone;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.mana.*;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.filter.common.FilterArtifactPermanent;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.common.FilterControlledLandPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
|
@ -70,7 +68,7 @@ public class Realmwright extends CardImpl<Realmwright> {
|
|||
this.addAbility(new AsEntersBattlefieldAbility(new RealmwrightEffect()));
|
||||
|
||||
// Lands you control are the chosen type in addition to their other types.
|
||||
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new RealmwrightEffect2()));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new RealmwrightEffect2()));
|
||||
}
|
||||
|
||||
public Realmwright(final Realmwright card) {
|
||||
|
|
@ -143,8 +141,7 @@ class RealmwrightEffect2 extends ContinuousEffectImpl<RealmwrightEffect2> {
|
|||
String choice = (String) game.getState().getValue(source.getSourceId().toString() + "_Realmwright");
|
||||
if (you != null && choice != null) {
|
||||
for (Permanent land : lands) {
|
||||
if (land != null) {
|
||||
System.out.println("The land is " + land.getName());
|
||||
if (land != null && !land.getSubtype().contains(choice)) {
|
||||
switch (layer) {
|
||||
case TypeChangingEffects_4:
|
||||
if (sublayer == Constants.SubLayer.NA) {
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ public abstract class ExpansionSet implements Serializable {
|
|||
protected List<Card> cards;
|
||||
protected SetType setType;
|
||||
protected Map<Rarity, List<Card>> rarities;
|
||||
protected boolean hasBasicLands = true;
|
||||
|
||||
protected String blockName;
|
||||
protected boolean hasBoosters = false;
|
||||
|
|
@ -92,6 +93,10 @@ public abstract class ExpansionSet implements Serializable {
|
|||
return releaseDate;
|
||||
}
|
||||
|
||||
public ExpansionSet getParentSet() {
|
||||
return parentSet;
|
||||
}
|
||||
|
||||
public SetType getSetType() {
|
||||
return setType;
|
||||
}
|
||||
|
|
@ -112,7 +117,7 @@ public abstract class ExpansionSet implements Serializable {
|
|||
}
|
||||
|
||||
CardCriteria criteria = new CardCriteria();
|
||||
criteria.setCodes(parentSet != null ? parentSet.code : this.code).rarities(Rarity.LAND).doubleFaced(false);
|
||||
criteria.setCodes(!hasBasicLands && parentSet != null ? parentSet.code : this.code).rarities(Rarity.LAND).doubleFaced(false);
|
||||
List<CardInfo> basicLand = CardRepository.instance.findCards(criteria);
|
||||
|
||||
criteria = new CardCriteria();
|
||||
|
|
@ -173,4 +178,9 @@ public abstract class ExpansionSet implements Serializable {
|
|||
public boolean hasBoosters() {
|
||||
return hasBoosters;
|
||||
}
|
||||
|
||||
public boolean hasBasicLands() {
|
||||
return hasBasicLands;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue