Package mage.filter

Examples of mage.filter.FilterMana


        }
        return mana;
    }

    public boolean cardHasValideColor(FilterMana commander, Card card) {
        FilterMana cardColor = getColorIdentity(card);
        if (cardColor.isBlack() && !commander.isBlack()
                || cardColor.isBlue() && !commander.isBlue()
                || cardColor.isGreen() && !commander.isGreen()
                || cardColor.isRed() && !commander.isRed()
                || cardColor.isWhite() && !commander.isWhite()) {
            return false;
        }
        return true;
    }
View Full Code Here


                return false;
            }
            if ((commander.getCardType().contains(CardType.CREATURE) && commander.getSupertype().contains("Legendary")) ||
                    (commander.getCardType().contains(CardType.PLANESWALKER) && commander.getAbilities().contains(CanBeYourCommanderAbility.getInstance()))) {
                if (!bannedCommander.contains(commander.getName())) {
                    FilterMana color = getColorIdentity(commander);
                    for (Card card : deck.getCards()) {
                        if (!cardHasValideColor(color, card)) {
                            invalid.put(card.getName(), "Invalid color (" + commander.getName() +")");
                            valid = false;
                        }
View Full Code Here

        return valid;
    }

    public FilterMana getColorIdentity(Card card) {
        FilterMana mana = new FilterMana();
        mana.setBlack(card.getManaCost().getText().matches(regexBlack));
        mana.setBlue(card.getManaCost().getText().matches(regexBlue));
        mana.setGreen(card.getManaCost().getText().matches(regexGreen));
        mana.setRed(card.getManaCost().getText().matches(regexRed));
        mana.setWhite(card.getManaCost().getText().matches(regexWhite));

        for (String rule : card.getRules()) {
            rule = rule.replaceAll("(?i)<i.*?</i>", ""); // Ignoring reminder text in italic
            if (rule.matches(regexBlack)) {
                mana.setBlack(true);
            }
            if (rule.matches(regexBlue)) {
                mana.setBlue(true);
            }
            if (rule.matches(regexGreen)) {
                mana.setGreen(true);
            }
            if (rule.matches(regexRed)) {
                mana.setRed(true);
            }
            if (rule.matches(regexWhite)) {
                mana.setWhite(true);
            }
        }
        return mana;
    }
View Full Code Here

TOP

Related Classes of mage.filter.FilterMana

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.