Examples of Cost


Examples of mage.abilities.costs.Cost

     */
    private void updateOptionalCosts(int index) {
        Ability abilityOrig = spellCards.get(index).getAbilities().get(spellAbilities.get(index).getId());
        if (abilityOrig != null) {
            for (Object object : spellAbilities.get(index).getOptionalCosts()) {
                Cost cost = (Cost) object;
                for (Cost costOrig : abilityOrig.getOptionalCosts()) {
                    if (cost.getId().equals(costOrig.getId())) {
                        if (cost.isPaid()) {
                            costOrig.setPaid();
                        } else {
                            costOrig.clearPaid();
                        }
                        break;
View Full Code Here

Examples of mage.abilities.costs.Cost

                this.resetBuyback();
                if (buybackCost != null) {
                    if (player.chooseUse(Outcome.Benefit,new StringBuilder("Pay ").append(buybackCost.getText(false)).append(" ?").toString(), game)) {
                        buybackCost.activate();
                        for (Iterator it = ((Costs) buybackCost).iterator(); it.hasNext();) {
                            Cost cost = (Cost) it.next();
                            if (cost instanceof ManaCostsImpl) {
                                ability.getManaCostsToPay().add((ManaCostsImpl) cost.copy());
                            } else {
                                ability.getCosts().add(cost.copy());
                            }
                        }
                    }
                }
            }
View Full Code Here

Examples of mage.abilities.costs.Cost

                    }
                    if (additionalCost.canPay(ability, sourceId, controllerId, game) &&
                            player.chooseUse(Outcome.Benefit, new StringBuilder("Pay ").append(times).append(additionalCost.getText(false)).append(" ?").toString(), game)) {
                        additionalCost.activate();
                        for (Iterator it = ((Costs) additionalCost).iterator(); it.hasNext();) {
                            Cost cost = (Cost) it.next();
                            if (cost instanceof ManaCostsImpl) {
                                ability.getManaCostsToPay().add((ManaCostsImpl) cost.copy());
                            } else {
                                ability.getCosts().add(cost.copy());
                            }
                        }
                    } else {
                        again = false;
                    }
View Full Code Here

Examples of mage.abilities.costs.Cost

    @Override
    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

Examples of mage.abilities.costs.Cost

        super(effect);
    }

    @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)) {
            new MyrToken().putOntoBattlefield(1, game, source.getControllerId(), source.getControllerId());
        }
        return true;
    }
View Full Code Here

Examples of mage.abilities.costs.Cost

        // You can't play lands.
        this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AggressiveMiningEffect()));
       
        // Sacrifice a land: Draw two cards.  Activate this ability only once each turn.
        Cost cost = new SacrificeTargetCost(new TargetControlledPermanent(new TargetControlledPermanent(new FilterControlledLandPermanent("a land"))));
        this.addAbility(new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(2), cost));
    }
View Full Code Here

Examples of mage.abilities.costs.Cost

    @Override
    public boolean apply(Game game, Ability source) {
        Permanent permanent = game.getPermanent(source.getSourceId());
        if (permanent != null) {
            Cost cost = new ManaCostsImpl("{2}{B}{B}");
            if (cost.pay(source, game, permanent.getControllerId(), permanent.getControllerId(), false)) {
                if (permanent.canTransform()) {
                    permanent.setTransformed(!permanent.isTransformed());
                }
            }
            return true;
View Full Code Here

Examples of mage.abilities.costs.Cost

   
    @Override
    public boolean apply(Game game, Ability source) {
        Player opponent = game.getPlayer(source.getFirstTarget());
        if (opponent != null) {
            Cost cost = new SacrificeTargetCost(new TargetControlledCreaturePermanent());
            if (cost.canPay(source, source.getSourceId(), opponent.getId(), game)
                    && opponent.chooseUse(outcome, "Sacrifice a creature to prevent the card draw?", game)) {
                if (cost.pay(source, game, source.getSourceId(), opponent.getId(), false)) {
                    return true;
                }
            }
            cost = new PayLifeCost(3);
            if (cost.canPay(source, source.getSourceId(), opponent.getId(), game)
                    && opponent.chooseUse(outcome, "Pay 3 life to prevent the card draw?", game)) {
                if (cost.pay(source, game, source.getSourceId(), opponent.getId(), false)) {
                    return true;
                }
            }
            game.getPlayer(source.getControllerId()).drawCards(1, game);
            return true;
View Full Code Here

Examples of mage.abilities.costs.Cost

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        MageObject mageObject = game.getObject(source.getSourceId());
        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();
                    FilterCard filter = new FilterCard(targetName);
View Full Code Here

Examples of mage.abilities.costs.Cost

            Permanent creature = game.getPermanentOrLKIBattlefield(creatureId);
            if (creature != null) {
                Player opponent = game.getPlayer(source.getFirstTarget());
                boolean paid = false;
                if (opponent != null) {
                    Cost cost = new PayLifeCost(3);
                    if (cost.canPay(source, source.getSourceId(), opponent.getId(), game)
                            && opponent.chooseUse(outcome, new StringBuilder("Pay 3 live to prevent that ").append(creature.getLogName()).append(" returns to ").append(controller.getName()).append("'s hand?").toString(), game)) {
                        if (cost.pay(source, game, source.getSourceId(), opponent.getId(), false)) {
                            paid = true;
                        }
                    }           
                }
                if (opponent == null || !paid) {
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.