Package mage.abilities.costs.common

Examples of mage.abilities.costs.common.DiscardTargetCost.pay()


    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(targetPointer.getFirst(game, source));
        if (player != null) {
            Cost cost = new DiscardTargetCost(new TargetCardInHand());
            if (cost.canPay(source, player.getId(), player.getId(), game)) {
                if (!cost.pay(source, game, player.getId(), player.getId(), false)) {
                    player.loseLife(5, game);
                }
                return true;
            }
        }
View Full Code Here


        if (player != null && mageObject != null) {
            Cost cost = new DiscardTargetCost(new TargetCardInHand(new FilterNonlandCard()));
            String message = "Discard a nonland card to search your library?";
            if (cost.canPay(source, source.getSourceId(), source.getControllerId(), game)
                    && player.chooseUse(Outcome.Detriment, message, game)) {
                if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) {
                    Card card = game.getCard(cost.getTargets().getFirstTarget());
                    if (card == null) {
                        return false;
                    }
                    String targetName = new StringBuilder("card with converted mana cost of ").append(card.getManaCost().convertedManaCost()).toString();
View Full Code Here

        if (you != null
                && you.getHand().count(filter, game) > 0
                && you.chooseUse(Outcome.Discard, "Do you want to discard an artifact?  If you don't, you must discard 2 cards", game)) {
            Cost cost = new DiscardTargetCost(new TargetCardInHand(filter));
            if (cost.canPay(source, source.getSourceId(), you.getId(), game)) {
                if (cost.pay(source, game, source.getSourceId(), you.getId(), false)) {
                    return true;
                }
            }
        }
        if (you != null) {
View Full Code Here

        if(spell != null){
            for(UUID uuid : game.getPlayerList()){
                Player player = game.getPlayer(uuid);
                if(player.chooseUse(Outcome.Detriment, "Discard three cards to counter " + spell.getName() + "?", game)){
                    DiscardTargetCost cost = new DiscardTargetCost(new TargetCardInHand(3, 3, new FilterCard()));
                    if(cost.pay(source, game, source.getSourceId(), uuid, false)){
                        game.informPlayers(player.getName() + " discards 3 cards to counter " + spell.getName() + ".");
                        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.