mirror of
https://github.com/correl/mage.git
synced 2024-11-28 19:19:55 +00:00
* Tiny Leaders - Fixed wrong split cards converted mana costs check. Added check for sideboard card that was missing.
This commit is contained in:
parent
5c6629919f
commit
65401f1cbc
1 changed files with 32 additions and 8 deletions
|
@ -34,6 +34,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import mage.abilities.common.CanBeYourCommanderAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.SplitCard;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.cards.decks.DeckValidator;
|
||||
import mage.constants.CardType;
|
||||
|
@ -170,14 +171,12 @@ public class TinyLeaders extends DeckValidator {
|
|||
if (!bannedCommander.contains(commander.getName())) {
|
||||
FilterMana color = CardUtil.getColorIdentity(commander);
|
||||
for (Card card : deck.getCards()) {
|
||||
if (!cardHasValideColor(color, card)) {
|
||||
invalid.put(card.getName(), "Invalid color (" + commander.getName() + ")");
|
||||
if (!isCardFormatValid(card, commander, color)) {
|
||||
valid = false;
|
||||
}
|
||||
|
||||
//905.5b - Converted mana cost must be 3 or less
|
||||
if (card.getManaCost().convertedManaCost() > 3) {
|
||||
invalid.put(card.getName(), "Invalid cost (" + card.getManaCost().convertedManaCost() + ")");
|
||||
}
|
||||
for (Card card : deck.getSideboard()) {
|
||||
if (!isCardFormatValid(card, commander, color)) {
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
|
@ -197,6 +196,31 @@ public class TinyLeaders extends DeckValidator {
|
|||
return valid;
|
||||
}
|
||||
|
||||
private boolean isCardFormatValid(Card card, Card commander, FilterMana color) {
|
||||
if (!cardHasValideColor(color, card)) {
|
||||
invalid.put(card.getName(), "Invalid color (" + commander.getName() + ")");
|
||||
return false;
|
||||
}
|
||||
|
||||
//905.5b - Converted mana cost must be 3 or less
|
||||
if (card instanceof SplitCard) {
|
||||
if (((SplitCard) card).getLeftHalfCard().getManaCost().convertedManaCost() > 3) {
|
||||
invalid.put(card.getName(), "Invalid cost (" + ((SplitCard) card).getLeftHalfCard().getManaCost().convertedManaCost() + ")");
|
||||
return false;
|
||||
}
|
||||
if (((SplitCard) card).getRightHalfCard().getManaCost().convertedManaCost() > 3 ) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param commander FilterMana object with Color Identity of Commander set
|
||||
|
|
Loading…
Reference in a new issue