Package mage.abilities.mana

Examples of mage.abilities.mana.ManaOptions


    protected ManaOptions options;
    protected Filter sourceFilter;

    public ManaCostImpl() {
        payment = new Mana();
        options = new ManaOptions();
    }
View Full Code Here


        return sbText.toString();
    }

    @Override
    public ManaOptions getOptions() {
        ManaOptions options = new ManaOptions();
        for (ManaCost cost : this) {
            options.addMana(cost.getOptions());
        }
        return options;
    }
View Full Code Here

        playableInstant.clear();
        playableNonInstant.clear();
        unplayable.clear();
        playableAbilities.clear();
        Set<Card> nonLands = hand.getCards(new FilterNonlandCard(), game);
        ManaOptions available = getManaAvailable(game);
        available.addMana(manaPool.getMana());

        for (Card card: nonLands) {
            ManaOptions options = card.getManaCost().getOptions();
            if (card.getManaCost().getVariableCosts().size() > 0) {
                //don't use variable mana costs unless there is at least 3 extra mana for X
                for (Mana option: options) {
                    option.add(Mana.ColorlessMana(3));
                }
            }
            for (Mana mana: options) {
                for (Mana avail: available) {
                    if (mana.enough(avail)) {
                        SpellAbility ability = card.getSpellAbility();
                        if (ability != null && ability.canActivate(playerId, game) &&
                                game.getContinuousEffects().preventedByRuleModification(GameEvent.getEvent(GameEvent.EventType.CAST_SPELL, ability.getSourceId(), ability.getSourceId(), playerId), ability, game, true)) {
                            if (card.getCardType().contains(CardType.INSTANT)
                                    || card.hasAbility(FlashAbility.getInstance().getId(), game)) {
                                playableInstant.add(card);
                            }
                            else {
                                playableNonInstant.add(card);
                            }
                        }
                    }
                    else {
                        if (!playableInstant.contains(card) && !playableNonInstant.contains(card)) {
                            unplayable.put(mana.needed(avail), card);
                        }
                    }
                }
            }
        }
        for (Permanent permanent: game.getBattlefield().getAllActivePermanents(playerId)) {
            for (ActivatedAbility ability: permanent.getAbilities().getActivatedAbilities(Zone.BATTLEFIELD)) {
                if (!(ability instanceof ManaAbility) && ability.canActivate(playerId, game)) {
                    if (ability instanceof EquipAbility && permanent.getAttachedTo() != null) {
                        continue;
                    }
                    ManaOptions abilityOptions = ability.getManaCosts().getOptions();
                    if (ability.getManaCosts().getVariableCosts().size() > 0) {
                        //don't use variable mana costs unless there is at least 3 extra mana for X
                        for (Mana option: abilityOptions) {
                            option.add(Mana.ColorlessMana(3));
                        }
                    }
                    if (abilityOptions.size() == 0) {
                        playableAbilities.add(ability);
                    }
                    else {
                        for (Mana mana: abilityOptions) {
                            for (Mana avail: available) {
                                if (mana.enough(avail)) {
                                    playableAbilities.add(ability);
                                }
                            }
                        }
                    }
                }
            }
        }
        for (Card card: graveyard.getCards(game)) {
            for (ActivatedAbility ability: card.getAbilities().getActivatedAbilities(Zone.GRAVEYARD)) {
                if (ability.canActivate(playerId, game)) {
                    ManaOptions abilityOptions = ability.getManaCosts().getOptions();
                    if (abilityOptions.size() == 0) {
                        playableAbilities.add(ability);
                    }
                    else {
                        for (Mana mana: abilityOptions) {
                            for (Mana avail: available) {
View Full Code Here

TOP

Related Classes of mage.abilities.mana.ManaOptions

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.