diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/BurnAway.java b/Mage.Sets/src/mage/sets/khansoftarkir/BurnAway.java new file mode 100644 index 0000000000..73492cda7a --- /dev/null +++ b/Mage.Sets/src/mage/sets/khansoftarkir/BurnAway.java @@ -0,0 +1,110 @@ +/* + * 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.sets.khansoftarkir; + +import java.util.UUID; +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.abilities.effects.common.ExileGraveyardAllTargetPlayerEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeEvent; +import mage.target.Target; +import mage.target.TargetPlayer; +import mage.target.common.TargetCreaturePermanent; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author LevelX2 + */ +public class BurnAway extends CardImpl { + + public BurnAway(UUID ownerId) { + super(ownerId, 104, "Burn Away", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{4}{R}"); + this.expansionSetCode = "KTK"; + + this.color.setRed(true); + + // Burn Away deals 6 damage to target creature. When that creature dies this turn, exile all cards from its controller's graveyard. + this.getSpellAbility().addEffect(new DamageTargetEffect(6)); + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + this.getSpellAbility().addEffect(new CreateDelayedTriggeredAbilityEffect(new BurnAwayDelayedTriggeredAbility(), true)); + } + + public BurnAway(final BurnAway card) { + super(card); + } + + @Override + public BurnAway copy() { + return new BurnAway(this); + } +} + +class BurnAwayDelayedTriggeredAbility extends DelayedTriggeredAbility { + + public BurnAwayDelayedTriggeredAbility() { + super(new ExileGraveyardAllTargetPlayerEffect(), Duration.EndOfTurn, false); + } + + public BurnAwayDelayedTriggeredAbility(BurnAwayDelayedTriggeredAbility ability) { + super(ability); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType().equals(GameEvent.EventType.ZONE_CHANGE)) { + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + if (zEvent.isDiesEvent() && zEvent.getTarget() != null && zEvent.getTargetId().equals(getTargets().getFirstTarget())) { + this.getTargets().clear(); // else spell fizzels because target creature died + Target target = new TargetPlayer(); + target.add(zEvent.getTarget().getControllerId(), game); + this.addTarget(target); + return true; + } + } + return false; + } + + @Override + public BurnAwayDelayedTriggeredAbility copy() { + return new BurnAwayDelayedTriggeredAbility(this); + } + + @Override + public String getRule() { + return "When that creature dies this turn, exile all cards from its controller's graveyard."; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/RetributionOfTheAncients.java b/Mage.Sets/src/mage/sets/khansoftarkir/RetributionOfTheAncients.java new file mode 100644 index 0000000000..abc76fba5a --- /dev/null +++ b/Mage.Sets/src/mage/sets/khansoftarkir/RetributionOfTheAncients.java @@ -0,0 +1,84 @@ +/* + * 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.sets.khansoftarkir; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.RemoveVariableCountersTargetCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.GetXValue; +import mage.abilities.dynamicvalue.common.SignInversionDynamicValue; +import mage.abilities.effects.common.continious.BoostTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.permanent.CounterPredicate; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public class RetributionOfTheAncients extends CardImpl { + + private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("creatures you control"); + + static { + filter.add(new CounterPredicate(CounterType.P1P1)); + } + + public RetributionOfTheAncients(UUID ownerId) { + super(ownerId, 85, "Retribution of the Ancients", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{B}"); + this.expansionSetCode = "KTK"; + + this.color.setBlack(true); + + DynamicValue xValue = new SignInversionDynamicValue(new GetXValue()); + // {B}, Remove X +1/+1 counters from among creatures you control: Target creature gets -X/-X until end of turn. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostTargetEffect(xValue,xValue,Duration.EndOfTurn, true), new ManaCostsImpl("{B}")); + ability.addCost(new RemoveVariableCountersTargetCost(filter, CounterType.P1P1, "X", 0)); + ability.addTarget(new TargetCreaturePermanent()); + this.addAbility(ability); + } + + public RetributionOfTheAncients(final RetributionOfTheAncients card) { + super(card); + } + + @Override + public RetributionOfTheAncients copy() { + return new RetributionOfTheAncients(this); + } +} + diff --git a/Mage/src/mage/abilities/costs/common/RemoveVariableCountersTargetCost.java b/Mage/src/mage/abilities/costs/common/RemoveVariableCountersTargetCost.java index 85828c8ee6..ff9bb65ce6 100644 --- a/Mage/src/mage/abilities/costs/common/RemoveVariableCountersTargetCost.java +++ b/Mage/src/mage/abilities/costs/common/RemoveVariableCountersTargetCost.java @@ -73,55 +73,6 @@ public class RemoveVariableCountersTargetCost extends VariableCostImpl { @Override public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { -// paid = false; -// Player controller = game.getPlayer(controllerId); -// if (target.choose(Outcome.UnboostCreature, controllerId, sourceId, game)) { -// for (UUID targetId: (List)target.getTargets()) { -// Permanent permanent = game.getPermanent(targetId); -// if (permanent != null) { -// if (permanent.getCounters().size() > 0 && (counterTypeToRemove == null || permanent.getCounters().containsKey(counterTypeToRemove))) { -// String counterName = null; -// if (counterTypeToRemove != null) { -// counterName = counterTypeToRemove.getName(); -// } else { -// if (permanent.getCounters().size() > 1 && counterTypeToRemove == null) { -// Choice choice = new ChoiceImpl(true); -// Set choices = new HashSet<>(); -// for (Counter counter : permanent.getCounters().values()) { -// if (permanent.getCounters().getCount(counter.getName()) > 0) { -// choices.add(counter.getName()); -// } -// } -// choice.setChoices(choices); -// choice.setMessage("Choose a counter to remove from " + permanent.getName()); -// controller.choose(Outcome.UnboostCreature, choice, game); -// counterName = choice.getChoice(); -// } else { -// for (Counter counter : permanent.getCounters().values()) { -// if (counter.getCount() > 0) { -// counterName = counter.getName(); -// } -// } -// } -// } -// if (counterName != null) { -// int countersToRemove = 1; -// if (permanent.getCounters().getCount(counterName) > 1) { -// countersToRemove = controller.getAmount(1, permanent.getCounters().getCount(counterName),"Remove how many counters from " + permanent.getName(), game); -// } -// permanent.removeCounters(counterName, countersToRemove, game); -// if (permanent.getCounters().getCount(counterName) == 0 ){ -// permanent.getCounters().removeCounter(counterName); -// } -// this.amountPaid += countersToRemove; -// this.paid = true; -// game.informPlayers(new StringBuilder(controller.getName()).append(" removes ").append(countersToRemove).append(" ").append(counterName).append(" counter from ").append(permanent.getName()).toString()); -// } -// } -// } -// } -// } -// target.clearChosen(); return paid; } @@ -156,7 +107,7 @@ public class RemoveVariableCountersTargetCost extends VariableCostImpl { @Override public Cost getFixedCostsFromAnnouncedValue(int xValue) { - return new RemoveCounterCost(new TargetPermanent(1,Integer.MAX_VALUE, filter, true), counterTypeToRemove, xValue); + return new RemoveCounterCost(new TargetPermanent(minValue,Integer.MAX_VALUE, filter, true), counterTypeToRemove, xValue); } }