forked from External/mage
Fixed that Commander and Tiny leader decks were not checked for valid sets.
This commit is contained in:
parent
3f882b73c4
commit
5090eaee0d
2 changed files with 57 additions and 17 deletions
|
|
@ -34,9 +34,12 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import mage.abilities.common.CanBeYourCommanderAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.ExpansionSet;
|
||||
import mage.cards.Sets;
|
||||
import mage.cards.decks.Constructed;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.cards.decks.DeckValidator;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SetType;
|
||||
import mage.filter.FilterMana;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
|
|
@ -44,13 +47,17 @@ import mage.util.CardUtil;
|
|||
*
|
||||
* @author Plopman
|
||||
*/
|
||||
public class Commander extends DeckValidator {
|
||||
public class Commander extends Constructed {
|
||||
|
||||
protected List<String> banned = new ArrayList<>();
|
||||
protected List<String> bannedCommander = new ArrayList<>();
|
||||
|
||||
public Commander() {
|
||||
this("Commander");
|
||||
for (ExpansionSet set : Sets.getInstance().values()) {
|
||||
if (set.getSetType() != SetType.CUSTOM_SET) {
|
||||
setCodes.add(set.getCode());
|
||||
}
|
||||
}
|
||||
banned.add("Ancestral Recall");
|
||||
banned.add("Balance");
|
||||
banned.add("Biorhythm");
|
||||
|
|
@ -153,19 +160,32 @@ public class Commander extends DeckValidator {
|
|||
invalid.put("Commander", "Sideboard must contain only the commander");
|
||||
}
|
||||
|
||||
for (Card card : deck.getCards()) {
|
||||
if (!isSetAllowed(card.getExpansionSetCode())) {
|
||||
if (!legalSets(card)) {
|
||||
invalid.put(card.getName(), "Not allowed Set: " + card.getExpansionSetCode());
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Card card : deck.getSideboard()) {
|
||||
if (!isSetAllowed(card.getExpansionSetCode())) {
|
||||
if (!legalSets(card)) {
|
||||
invalid.put(card.getName(), "Not allowed Set: " + card.getExpansionSetCode());
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
public boolean cardHasValidColor(FilterMana commander, Card card) {
|
||||
FilterMana cardColor = CardUtil.getColorIdentity(card);
|
||||
if (cardColor.isBlack() && !commander.isBlack()
|
||||
return !(cardColor.isBlack() && !commander.isBlack()
|
||||
|| cardColor.isBlue() && !commander.isBlue()
|
||||
|| cardColor.isGreen() && !commander.isGreen()
|
||||
|| cardColor.isRed() && !commander.isRed()
|
||||
|| cardColor.isWhite() && !commander.isWhite()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|| cardColor.isWhite() && !commander.isWhite());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,10 +34,13 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import mage.abilities.common.CanBeYourCommanderAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.ExpansionSet;
|
||||
import mage.cards.Sets;
|
||||
import mage.cards.SplitCard;
|
||||
import mage.cards.decks.Constructed;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.cards.decks.DeckValidator;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SetType;
|
||||
import mage.filter.FilterMana;
|
||||
import mage.game.GameTinyLeadersImpl;
|
||||
import mage.util.CardUtil;
|
||||
|
|
@ -46,13 +49,17 @@ import mage.util.CardUtil;
|
|||
*
|
||||
* @author JRHerlehy
|
||||
*/
|
||||
public class TinyLeaders extends DeckValidator {
|
||||
public class TinyLeaders extends Constructed {
|
||||
|
||||
protected List<String> banned = new ArrayList<>();
|
||||
protected List<String> bannedCommander = new ArrayList<>();
|
||||
|
||||
public TinyLeaders() {
|
||||
this("Tiny Leaders");
|
||||
for (ExpansionSet set : Sets.getInstance().values()) {
|
||||
if (set.getSetType() != SetType.CUSTOM_SET) {
|
||||
setCodes.add(set.getCode());
|
||||
}
|
||||
}
|
||||
//Banned list from tinyleaders.blodspot.ca/p/ban-list.html
|
||||
//Ban list updated as of 11/08/14
|
||||
banned.add("Ancestral Recall");
|
||||
|
|
@ -193,7 +200,22 @@ public class TinyLeaders extends DeckValidator {
|
|||
invalid.put("Commander", "Sideboard must contain only a maximum of 10 sideboard cards (the Tiny Leader name must be written to the deck name)");
|
||||
valid = false;
|
||||
}
|
||||
|
||||
for (Card card : deck.getCards()) {
|
||||
if (!isSetAllowed(card.getExpansionSetCode())) {
|
||||
if (!legalSets(card)) {
|
||||
invalid.put(card.getName(), "Not allowed Set " + card.getExpansionSetCode());
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Card card : deck.getSideboard()) {
|
||||
if (!isSetAllowed(card.getExpansionSetCode())) {
|
||||
if (!legalSets(card)) {
|
||||
invalid.put(card.getName(), "Not allowed Set " + card.getExpansionSetCode());
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
|
@ -213,11 +235,9 @@ public class TinyLeaders extends DeckValidator {
|
|||
invalid.put(card.getName(), "Invalid cost (" + ((SplitCard) card).getRightHalfCard().getManaCost().convertedManaCost() + ")");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (card.getManaCost().convertedManaCost() > 3) {
|
||||
invalid.put(card.getName(), "Invalid cost (" + card.getManaCost().convertedManaCost() + ")");
|
||||
return false;
|
||||
}
|
||||
} else if (card.getManaCost().convertedManaCost() > 3) {
|
||||
invalid.put(card.getName(), "Invalid cost (" + card.getManaCost().convertedManaCost() + ")");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue