Package mage

Examples of mage.Mana


}

class EverflowingChaliceEffect extends ManaEffect {

  public EverflowingChaliceEffect() {
    super(new Mana());
  }
View Full Code Here


    }

    class KnotvineMysticManaAbility extends BasicManaAbility<KnotvineMysticManaAbility> {

        public KnotvineMysticManaAbility() {
            super(new ManaEffect(new Mana(1, 1, 0, 1, 0, 0, 0)));
            this.netMana.setGreen(1);
            this.netMana.setRed(1);
            this.netMana.setWhite(1);
        }
View Full Code Here

        if (source.getAbilityType().equals(AbilityType.SPELL)) {
            return (source.getManaCostsToPay().getPayment().getColor(coloredManaSymbol) > 0);
        }
        ManaSpentToCastWatcher watcher = (ManaSpentToCastWatcher) game.getState().getWatchers().get("ManaSpentToCast", source.getSourceId());
        if (watcher != null) {
            Mana payment = watcher.getAndResetLastPayment();
            if (payment != null) {
                return payment.getColor(coloredManaSymbol) > 0;
            }
        }
        return false;
    }
View Full Code Here

    public ManaSpentToCastWatcher copy() {
        return new ManaSpentToCastWatcher(this);
    }

    public Mana getAndResetLastPayment() {
        Mana returnPayment = null;
        if (payment != null) {
            returnPayment = payment.copy();
            // reset payment for next check
            payment = null;
        }
View Full Code Here

    public ConditionalMana getConditionalMana() {
        return conditionalMana;
    }

    public Mana getMana() {
        return new Mana(red, green, blue, white, black, colorless, 0);
    }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        if (player != null){
            Mana mana = new Mana();
            int amountOfManaLeft = amount.calculate(game, source, this);

            while (amountOfManaLeft > 0 && player.isInGame()) {
                for (ColoredManaSymbol coloredManaSymbol: manaSymbols) {
                    int number = player.getAmount(0, amountOfManaLeft, new StringBuilder("How many ").append(coloredManaSymbol.name()).append(" mana?").toString(), game);
                    if (number > 0) {
                        for (int i = 0; i < number; i++) {
                            mana.add(new Mana(coloredManaSymbol));
                        }
                        amountOfManaLeft -= number;
                    }
                    if (amountOfManaLeft == 0) {
                        break;
View Full Code Here

    private String text = null;

    public DynamicManaEffect(Mana mana, DynamicValue amount) {
        super(mana);
        this.amount = amount;
        computedMana = new Mana();
    }
View Full Code Here

    }

    public DynamicManaEffect(Mana mana, DynamicValue amount, String text) {
        super(mana);
        this.amount = amount;
        computedMana = new Mana();
        this.text = text;
    }
View Full Code Here

        return true;
    }

    @Override
    public boolean replaceEvent(GameEvent event, Ability source, Game game) {
        Mana mana = ((ManaEvent) event).getMana().copy();
        if (mana.getBlack() > 0 && commanderMana.getBlack() == 0) {
            for (int i = 0; i < mana.getBlack(); i++) {
                mana.addColorless();
            }
            mana.setBlack(0);
        }
        if (mana.getBlue() > 0 && commanderMana.getBlue() == 0) {
            for (int i = 0; i < mana.getBlue(); i++) {
                mana.addColorless();
            }
            mana.setBlue(0);
        }
        if (mana.getGreen() > 0 && commanderMana.getGreen() == 0) {
            for (int i = 0; i < mana.getGreen(); i++) {
                mana.addColorless();
            }
            mana.setGreen(0);
        }
        if (mana.getRed() > 0 && commanderMana.getRed() == 0) {
            for (int i = 0; i < mana.getRed(); i++) {
                mana.addColorless();
            }
            mana.setRed(0);
        }
        if (mana.getWhite() > 0 && commanderMana.getWhite()== 0) {
            for (int i = 0; i < mana.getWhite(); i++) {
                mana.addColorless();
            }
            mana.setWhite(0);
        }
        return false;
    }
View Full Code Here

    public int calculate(Game game, Ability source, Effect effect) {
        int count = 0;
        if (!game.getStack().isEmpty()) {
            StackObject spell = game.getStack().getFirst();
            if (spell != null &&  spell instanceof Spell && ((Spell)spell).getSourceId().equals(source.getSourceId())) {
                Mana mana = ((Spell)spell).getSpellAbility().getManaCostsToPay().getPayment();
                if(mana.getBlack() > 0) {
                    count++;
                }
                if(mana.getBlue() > 0) {
                    count++;
                }
                if(mana.getGreen() > 0) {
                    count++;
                }
                if(mana.getRed() > 0) {
                    count++;
                }
                if(mana.getWhite() > 0) {
                    count++;
                }
            }
        }
        return count;
View Full Code Here

TOP

Related Classes of mage.Mana

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.