Package mage.abilities.costs

Examples of mage.abilities.costs.Cost


                SpellAbility splicedAbility = spliceCard.getSpellAbility().copy();
                splicedAbility.setSpellAbilityType(SpellAbilityType.SPLICE);
                splicedAbility.setSourceId(abilityToModify.getSourceId());
                spell.addSpellAbility(splicedAbility);
                for (Iterator it = ((SpliceOntoArcaneAbility) source).getSpliceCosts().iterator(); it.hasNext();) {
                    Cost cost = (Cost) it.next();
                    if (cost instanceof ManaCostsImpl) {
                        spell.getSpellAbility().getManaCostsToPay().add((ManaCostsImpl) cost.copy());
                    } else {
                        spell.getSpellAbility().getCosts().add(cost.copy());
                    }
                }
            }
            return true;
        }
View Full Code Here


                        }
                        if (kickerCost.canPay(ability, sourceId, controllerId, game) &&
                                player.chooseUse(Outcome.Benefit, new StringBuilder("Pay ").append(times).append(kickerCost.getText(false)).append(" ?").toString(), game)) {
                            this.activateKicker(kickerCost, game);
                            for (Iterator it = ((Costs) kickerCost).iterator(); it.hasNext();) {
                                Cost cost = (Cost) it.next();
                                if (cost instanceof ManaCostsImpl) {
                                    List<VariableManaCost> varCosts = ((ManaCostsImpl)cost).getVariableCosts();
                                    if (!varCosts.isEmpty()) {
                                        // use only first variable cost
                                        xManaValue = game.getPlayer(this.controllerId).announceXMana(varCosts.get(0).getMinX(), Integer.MAX_VALUE, "Announce kicker value for " + varCosts.get(0).getText(), game, this);
                                        // kicker variable X costs handled internally as multikicker with {1} cost (no multikicker on card)
                                        game.informPlayers(new StringBuilder(game.getPlayer(this.controllerId).getName()).append(" announced a value of ").append(xManaValue).append(" for ").append(" kicker X ").toString());
                                        ability.getManaCostsToPay().add(new GenericManaCost(xManaValue));
                                    } else {
                                        ability.getManaCostsToPay().add((ManaCostsImpl) cost.copy());                                       
                                    }
                                } else {
                                    ability.getCosts().add(cost.copy());
                                }
                            }
                           
                            again = kickerCost.isRepeatable();
                        } else {
View Full Code Here

                        activateMorph(game);
                        // change mana costs
                        ability.getManaCostsToPay().clear();
                        ability.getCosts().clear();
                        for (Iterator it = this.alternateCosts.iterator(); it.hasNext();) {
                            Cost cost = (Cost) it.next();
                            if (cost instanceof ManaCost) {
                                ability.getManaCostsToPay().add((ManaCost)cost.copy());
                            } else {
                                ability.getCosts().add(cost.copy());
                            }
                        }
                        // change spell colors
                        ObjectColor spellColor = spell.getColor();
                        spellColor.setBlack(false);
View Full Code Here

    @Override
    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        if (player != null) {
            Cost cost = new ManaCostsImpl("{8}");
            if (player.chooseUse(Outcome.Tap, "Pay " + cost.getText() + " and " + staticText, game)) {
                cost.clearPaid();
                if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) {
                    for (UUID target : this.targetPointer.getTargets(game, source)) {
                        Permanent permanent = game.getPermanent(target);
                        if (permanent != null) {
                            permanent.tap(game);
                            ContinuousEffect effect = new SkipNextUntapTargetEffect();
View Full Code Here

            if (card != null) {
                if (card.putOntoBattlefield(game, Zone.HAND, source.getSourceId(), source.getControllerId())) {
                    Permanent permanent = game.getPermanent(card.getId());
                    if (permanent != null) {
                        permanent.addCounters(CounterType.LUCK.createInstance(), game);
                        Cost cost = new ExileFromHandCost(new TargetCardInHand());
                        if (cost.canPay(source, source.getSourceId(), source.getControllerId(), game)) {
                            cost.pay(source, game, source.getSourceId(), source.getControllerId(), true);
                        }
                    }
                }
            }
        }
View Full Code Here

                this.resetCosts();
                if (additionalCost != null) {
                    if (player.chooseUse(Outcome.Benefit,new StringBuilder("Pay ").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());
                            }
                        }
                        ability.getModes().setMinModes(2);
                        ability.getModes().setMaxModes(2);
                    }
View Full Code Here

    public boolean apply(Game game, Ability source) {
        Player player = game.getPlayer(source.getControllerId());
        Permanent permanent = game.getPermanent(source.getSourceId());
        if (player != null && permanent != null) {
            if (player.chooseUse(Outcome.Damage, new StringBuilder("Extort opponents? (").append(permanent.getName()).append(")").toString(), game)) {
                Cost cost = new ManaCostsImpl("{W/B}");
                if (cost.pay(source, game, source.getSourceId(), player.getId(), false)) {
                    int loseLife = 0;
                    for (UUID opponentId : game.getOpponents(source.getControllerId())) {
                        loseLife += game.getPlayer(opponentId).loseLife(1, game);
                    }
                    if (loseLife > 0) {
View Full Code Here

                          player.chooseUse(Outcome.Benefit, new StringBuilder("Cast for ").append(PROWL_KEYWORD).append(" cost ").append(prowlCost.getText(true)).append(" ?").toString(), game)) {
                        prowlCost.activate();
                        ability.getManaCostsToPay().clear();
                        ability.getCosts().clear();
                        for (Iterator it = ((Costs) prowlCost).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

                        player.chooseUse(Outcome.Benefit, new StringBuilder(EVOKE_KEYWORD).append(" the creature for ").append(evokeCost.getText(true)).append(" ?").toString(), game)) {
                        activateEvoke(evokeCost, game);
                        ability.getManaCostsToPay().clear();
                        ability.getCosts().clear();
                        for (Iterator it = ((Costs) evokeCost).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

    public boolean apply(Game game, Ability source) {
        StackObject spell = game.getStack().getStackObject(targetPointer.getFirst(game, source));
        if (spell != null) {
            Player player = game.getPlayer(spell.getControllerId());
            if (player != null) {
                Cost costToPay;
                if (cost != null) {
                    costToPay = cost.copy();
                } else  {
                    costToPay = new GenericManaCost(genericMana.calculate(game, source, this));
                }
                String message;
                if (costToPay instanceof ManaCost) {
                    message = "Would you like to pay " + costToPay.getText() + " to prevent counter effect?";
                } else {
                    message = costToPay.getText() + " to prevent counter effect?";
                }
                costToPay.clearPaid();
                if (!(player.chooseUse(Outcome.Benefit, message, game) && costToPay.pay(source, game, spell.getSourceId(), spell.getControllerId(), false))) {
                    return game.getStack().counter(spell.getId(), source.getSourceId(), game);
                }
                return true;
            }
        }
View Full Code Here

TOP

Related Classes of mage.abilities.costs.Cost

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.