From 2859599045d642b233e445442eeab976df0241a5 Mon Sep 17 00:00:00 2001 From: Jeff Date: Thu, 24 Oct 2013 11:01:36 -0500 Subject: [PATCH] - Fixed cost of Crackleburr. --- .../src/mage/sets/eventide/Crackleburr.java | 3 +- .../costs/common/UntapTargetCost.java | 83 +++++++++++++++++++ 2 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 Mage/src/mage/abilities/costs/common/UntapTargetCost.java diff --git a/Mage.Sets/src/mage/sets/eventide/Crackleburr.java b/Mage.Sets/src/mage/sets/eventide/Crackleburr.java index 1bfd9a0e3d..d038970e22 100644 --- a/Mage.Sets/src/mage/sets/eventide/Crackleburr.java +++ b/Mage.Sets/src/mage/sets/eventide/Crackleburr.java @@ -35,6 +35,7 @@ import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapTargetCost; import mage.abilities.costs.common.UntapSourceCost; +import mage.abilities.costs.common.UntapTargetCost; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.ReturnToHandTargetEffect; @@ -88,7 +89,7 @@ public class Crackleburr extends CardImpl { // {UR}{UR}, {untap}, Untap two tapped blue creatures you control: Return target creature to its owner's hand. Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandTargetEffect(), new ManaCostsImpl("{U/R}{U/R}")); ability2.addCost(new UntapSourceCost()); - ability2.addCost(new TapTargetCost(new TargetControlledCreaturePermanent(2, 2, filter2, true))); + ability2.addCost(new UntapTargetCost(new TargetControlledCreaturePermanent(2, 2, filter2, true))); ability2.addTarget(new TargetCreaturePermanent(true)); this.addAbility(ability2); diff --git a/Mage/src/mage/abilities/costs/common/UntapTargetCost.java b/Mage/src/mage/abilities/costs/common/UntapTargetCost.java new file mode 100644 index 0000000000..98b2b01277 --- /dev/null +++ b/Mage/src/mage/abilities/costs/common/UntapTargetCost.java @@ -0,0 +1,83 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ + +package mage.abilities.costs.common; + +import mage.constants.Outcome; +import mage.abilities.Ability; +import mage.abilities.costs.CostImpl; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetControlledPermanent; + +import java.util.List; +import java.util.UUID; + +/** + * + * @author jeffwadsworth + */ +public class UntapTargetCost extends CostImpl { + + TargetControlledPermanent target; + + public UntapTargetCost(TargetControlledPermanent target) { + this.target = target; + this.text = "Untap " + target.getMaxNumberOfTargets() + " " + target.getTargetName(); + } + + public UntapTargetCost(final UntapTargetCost cost) { + super(cost); + this.target = cost.target.copy(); + } + + @Override + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + if (target.choose(Outcome.Untap, controllerId, sourceId, game)) { + for (UUID targetId: (List)target.getTargets()) { + Permanent permanent = game.getPermanent(targetId); + if (permanent == null) + return false; + paid |= permanent.untap(game); + } + } + return paid; + } + + @Override + public boolean canPay(UUID sourceId, UUID controllerId, Game game) { + return target.canChoose(controllerId, game); + } + + @Override + public UntapTargetCost copy() { + return new UntapTargetCost(this); + } + + +}