Search in sources :

Example 6 with ManaType

use of mage.constants.ManaType in project mage by magefree.

the class ManaPool method emptyPool.

public int emptyPool(Game game) {
    int total = 0;
    Iterator<ManaPoolItem> it = manaItems.iterator();
    while (it.hasNext()) {
        ManaPoolItem item = it.next();
        ConditionalMana conditionalItem = item.getConditionalMana();
        for (ManaType manaType : ManaType.values()) {
            if (doNotEmptyManaTypes.contains(manaType)) {
                continue;
            }
            if (item.get(manaType) > 0) {
                total += emptyItem(item, item, game, manaType);
            }
            if (conditionalItem != null && conditionalItem.get(manaType) > 0) {
                total += emptyItem(item, conditionalItem, game, manaType);
            }
        }
        if (item.count() == 0) {
            it.remove();
        }
    }
    return total;
}
Also used : ConditionalMana(mage.ConditionalMana) ManaType(mage.constants.ManaType)

Aggregations

ManaType (mage.constants.ManaType)6 Mana (mage.Mana)2 Permanent (mage.game.permanent.Permanent)2 ArrayList (java.util.ArrayList)1 ConditionalMana (mage.ConditionalMana)1 ManaOptions (mage.abilities.mana.ManaOptions)1 FilterControlledLandPermanent (mage.filter.common.FilterControlledLandPermanent)1 FilterControlledPermanent (mage.filter.common.FilterControlledPermanent)1 GameEvent (mage.game.events.GameEvent)1 ManaPaidEvent (mage.game.events.ManaPaidEvent)1 Spell (mage.game.stack.Spell)1 TargetControlledPermanent (mage.target.common.TargetControlledPermanent)1