Package mage.abilities.costs.mana

Examples of mage.abilities.costs.mana.GenericManaCost.pay()


            if (player != null && controller != null && sourceObject != null) {
                int amount = new greatestPowerCountCreatureYouControl().calculate(game, source, this);
                GenericManaCost cost = new GenericManaCost(amount);
                StringBuilder sb = new StringBuilder("Pay {").append(amount).append("}? (otherwise ").append(spell.getName()).append(" will be countered)");
                if (player.chooseUse(Outcome.Benefit, sb.toString(), game)) {
                    cost.pay(source, game, source.getSourceId(), player.getId(), false);
                }
                if (!cost.isPaid()) {
                    if (game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game)) {
                        game.informPlayers(new StringBuilder(sourceObject.getName()).append(": cost wasn't payed - countering ").append(spell.getName()).toString());
                        return true;
View Full Code Here


        Permanent permanent = game.getPermanent(source.getSourceId());
        if (player != null && permanent != null) {
            int cmc = permanent.getManaCost().convertedManaCost();
            if (player.chooseUse(Outcome.Benefit, "Pay {" + cmc + "} for " + permanent.getName() + "?", game)) {
                Cost cost = new GenericManaCost(cmc);
                if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false))
                {
                    return true;
                }
            }
            permanent.sacrifice(source.getSourceId(), game);
View Full Code Here

        boolean payed = false;
        while (player.isInGame() && !payed) {
            xValue = player.announceXMana(0, Integer.MAX_VALUE, "How much mana will you pay?", game, source);
            if (xValue > 0) {
                Cost cost = new GenericManaCost(xValue);
                payed = cost.pay(source, game, source.getSourceId(), player.getId(), false);
            } else {
                payed = true;
            }
        }
        game.informPlayers(new StringBuilder(player.getName()).append(" pays {").append(xValue).append("}.").toString());
View Full Code Here

        boolean payed = false;
        while (!payed) {
            xValue = player.announceXMana(0, Integer.MAX_VALUE, "How much mana will you pay?", game, source);
            if (xValue > 0) {
                Cost cost = new GenericManaCost(xValue);
                payed = cost.pay(source, game, source.getSourceId(), player.getId(), false);
            } else {
                payed = true;
            }
        }
        game.informPlayers(new StringBuilder(player.getName()).append(" pays {").append(xValue).append("}.").toString());
View Full Code Here

        Cost cost = new GenericManaCost(2);
        if (spell != null) {
            Player player = game.getPlayer(spell.getControllerId());
            if (player != null) {
                cost.clearPaid();
                if (!cost.pay(source, game, spell.getControllerId(),
                        spell.getControllerId(), false)) {
                    return spell.chooseNewTargets(game, source.getControllerId(), true, true);
                }
            }
        }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Cost cost = new GenericManaCost(1);
        cost.clearPaid();
        if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) {
            Player player = game.getPlayer(source.getControllerId());
            if (player != null) {
                player.gainLife(3, game);
                return true;
            }
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(targetPointer.getFirst(game, source));
        if (player != null) {
            Cost cost = new GenericManaCost(2);
            if (!cost.pay(source, game, player.getId(), player.getId(), false)) {
                player.damage(2, source.getSourceId(), game, false, true);
            }
            return true;
        }
        return false;
View Full Code Here

            if (player != null && controller != null) {
               
                int amount = source.getManaCostsToPay().getX();
                if (amount > 0) {
                    GenericManaCost cost = new GenericManaCost(amount);
                    if (!cost.pay(source, game, spell.getControllerId(), spell.getControllerId(), false)) {
                       
                        StackObject stackObject = game.getStack().getStackObject(source.getFirstTarget());
                        if (stackObject != null && !game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER, source.getFirstTarget(), source.getSourceId(), stackObject.getControllerId()))) {
                            game.informPlayers("Syncopate: cost wasn't payed - countering " + stackObject.getName());
                            if (stackObject instanceof Spell) {
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Cost cost = new GenericManaCost(1);
        cost.clearPaid();
        if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) {
            Permanent permanent = game.getPermanent(source.getFirstTarget());
            if (permanent != null) {
                permanent.damage(1, source.getSourceId(), game, false, true);
                return true;
            }
View Full Code Here

        StackObject spell = game.getStack().getStackObject(targetPointer.getFirst(game, source));
        if (spell != null) {
            Player player = game.getPlayer(spell.getControllerId());
            if (player != null) {
                GenericManaCost cost = new GenericManaCost(spell.getManaCost().convertedManaCost());
                if (!cost.pay(source, game, source.getSourceId(), player.getId(), false)) {
                    game.getStack().counter(spell.getId(), source.getSourceId(), game);
                }
                return true;
            }
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.