diff --git a/Mage.Sets/src/mage/sets/eventide/Crackleburr.java b/Mage.Sets/src/mage/sets/eventide/Crackleburr.java new file mode 100644 index 00000000000..d038970e22e --- /dev/null +++ b/Mage.Sets/src/mage/sets/eventide/Crackleburr.java @@ -0,0 +1,106 @@ +/* + * 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.eventide; + +import java.util.UUID; +import mage.MageInt; +import mage.ObjectColor; +import mage.abilities.Ability; +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; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.filter.predicate.permanent.TappedPredicate; +import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.common.TargetCreatureOrPlayer; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author jeffwadsworth + + */ +public class Crackleburr extends CardImpl { + + private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("two untapped red creatures you control"); + private static final FilterControlledCreaturePermanent filter2 = new FilterControlledCreaturePermanent("two tapped blue creatures you control"); + + static { + filter.add(new ColorPredicate(ObjectColor.RED)); + filter.add(Predicates.not(new TappedPredicate())); + + filter2.add(new ColorPredicate(ObjectColor.BLUE)); + filter2.add(new TappedPredicate()); + } + + public Crackleburr(UUID ownerId) { + super(ownerId, 100, "Crackleburr", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{U/R}{U/R}"); + this.expansionSetCode = "EVE"; + this.subtype.add("Elemental"); + + this.color.setRed(true); + this.color.setBlue(true); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // {UR}{UR}, {tap}, Tap two untapped red creatures you control: Crackleburr deals 3 damage to target creature or player. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(3), new ManaCostsImpl("{U/R}{U/R}")); + ability.addCost(new TapSourceCost()); + ability.addCost(new TapTargetCost(new TargetControlledCreaturePermanent(2, 2, filter, true))); + ability.addTarget(new TargetCreatureOrPlayer(true)); + this.addAbility(ability); + + // {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 UntapTargetCost(new TargetControlledCreaturePermanent(2, 2, filter2, true))); + ability2.addTarget(new TargetCreaturePermanent(true)); + this.addAbility(ability2); + + } + + public Crackleburr(final Crackleburr card) { + super(card); + } + + @Override + public Crackleburr copy() { + return new Crackleburr(this); + } +} diff --git a/Mage.Sets/src/mage/sets/eventide/CragPuca.java b/Mage.Sets/src/mage/sets/eventide/CragPuca.java new file mode 100644 index 00000000000..42cb245e872 --- /dev/null +++ b/Mage.Sets/src/mage/sets/eventide/CragPuca.java @@ -0,0 +1,71 @@ +/* + * 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.eventide; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.continious.SwitchPowerToughnessSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; + +/** + * + * @author jeffwadsworth + + */ +public class CragPuca extends CardImpl { + + public CragPuca(UUID ownerId) { + super(ownerId, 101, "Crag Puca", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{U/R}{U/R}{U/R}"); + this.expansionSetCode = "EVE"; + this.subtype.add("Shapeshifter"); + + this.color.setRed(true); + this.color.setBlue(true); + this.power = new MageInt(2); + this.toughness = new MageInt(4); + + // {UR}: Switch Crag Puca's power and toughness until end of turn. + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new SwitchPowerToughnessSourceEffect(Duration.EndOfTurn), new ManaCostsImpl("{U/R}"))); + + } + + public CragPuca(final CragPuca card) { + super(card); + } + + @Override + public CragPuca copy() { + return new CragPuca(this); + } +} diff --git a/Mage.Sets/src/mage/sets/eventide/InsideOut.java b/Mage.Sets/src/mage/sets/eventide/InsideOut.java new file mode 100644 index 00000000000..234c3fe70ac --- /dev/null +++ b/Mage.Sets/src/mage/sets/eventide/InsideOut.java @@ -0,0 +1,70 @@ +/* + * 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.eventide; + +import java.util.UUID; +import mage.abilities.effects.common.DrawCardControllerEffect; +import mage.abilities.effects.common.continious.SwitchPowerToughnessTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author jeffwadsworth + + */ +public class InsideOut extends CardImpl { + + public InsideOut(UUID ownerId) { + super(ownerId, 103, "Inside Out", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{U/R}"); + this.expansionSetCode = "EVE"; + + this.color.setRed(true); + this.color.setBlue(true); + + // Switch target creature's power and toughness until end of turn. + this.getSpellAbility().addEffect(new SwitchPowerToughnessTargetEffect(Duration.EndOfTurn)); + this.getSpellAbility().addTarget(new TargetCreaturePermanent(true)); + + // Draw a card. + this.getSpellAbility().addEffect(new DrawCardControllerEffect(1)); + + } + + public InsideOut(final InsideOut card) { + super(card); + } + + @Override + public InsideOut copy() { + return new InsideOut(this); + } +} diff --git a/Mage.Sets/src/mage/sets/eventide/MindwrackLiege.java b/Mage.Sets/src/mage/sets/eventide/MindwrackLiege.java new file mode 100644 index 00000000000..88efaca1d4a --- /dev/null +++ b/Mage.Sets/src/mage/sets/eventide/MindwrackLiege.java @@ -0,0 +1,147 @@ +/* + * 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.eventide; + +import java.util.UUID; +import mage.MageInt; +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continious.BoostAllEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.filter.common.FilterCreatureCard; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.filter.predicate.permanent.ControllerPredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCardInHand; + +/** + * + * @author jeffwadsworth + + */ +public class MindwrackLiege extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("blue creatures you control"); + private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent("red creatures you control"); + static { + filter.add(new ColorPredicate(ObjectColor.BLUE)); + filter.add(new ControllerPredicate(TargetController.YOU)); + + filter2.add(new ColorPredicate(ObjectColor.RED)); + filter2.add(new ControllerPredicate(TargetController.YOU)); + } + + public MindwrackLiege(UUID ownerId) { + super(ownerId, 104, "Mindwrack Liege", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{U/R}{U/R}{U/R}"); + this.expansionSetCode = "EVE"; + this.subtype.add("Horror"); + + this.color.setRed(true); + this.color.setBlue(true); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // Other blue creatures you control get +1/+1. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, filter, true))); + + // Other red creatures you control get +1/+1. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, filter2, true))); + + // {UR}{UR}{UR}{UR}: You may put a blue or red creature card from your hand onto the battlefield. + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new MindwrackLiegeEffect(), new ManaCostsImpl("{U/R}{U/R}{U/R}{U/R}"))); + + } + + public MindwrackLiege(final MindwrackLiege card) { + super(card); + } + + @Override + public MindwrackLiege copy() { + return new MindwrackLiege(this); + } +} + +class MindwrackLiegeEffect extends OneShotEffect { + + private static final String choiceText = "Put a blue or red creature card from your hand onto the battlefield?"; + + private static final FilterCreatureCard filter = new FilterCreatureCard("a blue or red creature card"); + + static { + filter.add(Predicates.or( + new ColorPredicate(ObjectColor.BLUE), + new ColorPredicate(ObjectColor.RED))); + } + + public MindwrackLiegeEffect() { + super(Outcome.PutCreatureInPlay); + this.staticText = "You may put a blue or red creature card from your hand onto the battlefield"; + } + + public MindwrackLiegeEffect(final MindwrackLiegeEffect effect) { + super(effect); + } + + @Override + public MindwrackLiegeEffect copy() { + return new MindwrackLiegeEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null || !player.chooseUse(Outcome.PutCreatureInPlay, choiceText, game)) { + return false; + } + + TargetCardInHand target = new TargetCardInHand(filter); + if (player.choose(Outcome.PutCreatureInPlay, target, source.getSourceId(), game)) { + Card card = game.getCard(target.getFirstTarget()); + if (card != null) { + card.putOntoBattlefield(game, Zone.HAND, source.getId(), source.getControllerId()); + return true; + } + } + return false; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/eventide/MirrorSheen.java b/Mage.Sets/src/mage/sets/eventide/MirrorSheen.java new file mode 100644 index 00000000000..06a88c1e0e0 --- /dev/null +++ b/Mage.Sets/src/mage/sets/eventide/MirrorSheen.java @@ -0,0 +1,149 @@ +/* + * 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.eventide; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.FilterSpell; +import mage.filter.predicate.ObjectPlayer; +import mage.filter.predicate.ObjectPlayerPredicate; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.game.Game; +import mage.game.stack.Spell; +import mage.game.stack.StackObject; +import mage.players.Player; +import mage.target.Target; +import mage.target.TargetSpell; + +/** + * + * @author jeffwadsworth + + */ +public class MirrorSheen extends CardImpl { + + private static final FilterSpell filter = new FilterSpell(); + static { + filter.add(Predicates.or(new CardTypePredicate(CardType.INSTANT), new CardTypePredicate(CardType.SORCERY))); + filter.add(new TargetYouPredicate()); + } + + public MirrorSheen(UUID ownerId) { + super(ownerId, 105, "Mirror Sheen", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{1}{U/R}{U/R}"); + this.expansionSetCode = "EVE"; + + this.color.setRed(true); + this.color.setBlue(true); + + // {1}{UR}{UR}: Copy target instant or sorcery spell that targets you. You may choose new targets for the copy. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new MirrorSheenEffect(), new ManaCostsImpl("{1}{U/R}{U/R}")); + ability.addTarget(new TargetSpell(filter)); + this.addAbility(ability); + + } + + public MirrorSheen(final MirrorSheen card) { + super(card); + } + + @Override + public MirrorSheen copy() { + return new MirrorSheen(this); + } +} + +class MirrorSheenEffect extends OneShotEffect { + + public MirrorSheenEffect() { + super(Outcome.Copy); + staticText = "Copy target instant or sorcery spell that targets you. You may choose new targets for the copy"; + } + + public MirrorSheenEffect(final MirrorSheenEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Spell spell = game.getStack().getSpell(source.getFirstTarget()); + if (spell != null) { + Spell copy = spell.copySpell(); + copy.setControllerId(source.getControllerId()); + copy.setCopiedSpell(true); + game.getStack().push(copy); + copy.chooseNewTargets(game, source.getControllerId()); + Player player = game.getPlayer(source.getControllerId()); + String activateMessage = copy.getActivatedMessage(game); + if (activateMessage.startsWith(" casts ")) { + activateMessage = activateMessage.substring(6); + } + game.informPlayers(player.getName() + " copies " + activateMessage); + return true; + } + return false; + } + + @Override + public MirrorSheenEffect copy() { + return new MirrorSheenEffect(this); + } +} + +class TargetYouPredicate implements ObjectPlayerPredicate> { + + @Override + public boolean apply(ObjectPlayer input, Game game) { + UUID controllerId = input.getPlayerId(); + if (controllerId == null) { + return false; + } + + for (Target target : input.getObject().getStackAbility().getTargets()) { + for (UUID targetId : target.getTargets()) { + if (controllerId.equals(targetId)) { + return true; + } + } + } + return false; + } + + @Override + public String toString() { + return "spell that targets you"; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/eventide/NoggleBandit.java b/Mage.Sets/src/mage/sets/eventide/NoggleBandit.java new file mode 100644 index 00000000000..caafd99dcb8 --- /dev/null +++ b/Mage.Sets/src/mage/sets/eventide/NoggleBandit.java @@ -0,0 +1,81 @@ +/* + * 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.eventide; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect; +import mage.abilities.keyword.DefenderAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.AbilityPredicate; + +/** + * + * @author jeffwadsworth + + */ +public class NoggleBandit extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures with defender"); + + static { + filter.add(Predicates.not(new AbilityPredicate(DefenderAbility.class))); + } + + public NoggleBandit(UUID ownerId) { + super(ownerId, 106, "Noggle Bandit", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{U/R}{U/R}"); + this.expansionSetCode = "EVE"; + this.subtype.add("Noggle"); + this.subtype.add("Rogue"); + + this.color.setRed(true); + this.color.setBlue(true); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Noggle Bandit can't be blocked except by creatures with defender. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield))); + + } + + public NoggleBandit(final NoggleBandit card) { + super(card); + } + + @Override + public NoggleBandit copy() { + return new NoggleBandit(this); + } +} diff --git a/Mage.Sets/src/mage/sets/eventide/NoggleHedgeMage.java b/Mage.Sets/src/mage/sets/eventide/NoggleHedgeMage.java new file mode 100644 index 00000000000..64a9fd46ae3 --- /dev/null +++ b/Mage.Sets/src/mage/sets/eventide/NoggleHedgeMage.java @@ -0,0 +1,96 @@ +/* + * 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.eventide; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.condition.common.ControlsPermanentCondition; +import mage.abilities.condition.common.ControlsPermanentCondition.CountType; +import mage.abilities.decorator.ConditionalTriggeredAbility; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.abilities.effects.common.TapTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterLandPermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.target.TargetPermanent; +import mage.target.TargetPlayer; + +/** + * + * @author jeffwadsworth + + */ +public class NoggleHedgeMage extends CardImpl { + + private final static FilterLandPermanent filter = new FilterLandPermanent(); + private final static FilterLandPermanent filter2 = new FilterLandPermanent(); + + static { + filter.add(new SubtypePredicate("Island")); + filter2.add(new SubtypePredicate("Mountain")); + } + + private String rule = "When {this} enters the battlefield, if you control two or more Islands, you may tap two target permanents."; + private String rule2 = "When {this} enters the battlefield, if you control two or more Mountains, you may have {this} deal 2 damage to target player."; + + public NoggleHedgeMage(UUID ownerId) { + super(ownerId, 108, "Noggle Hedge-Mage", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{U/R}"); + this.expansionSetCode = "EVE"; + this.subtype.add("Noggle"); + this.subtype.add("Wizard"); + + this.color.setRed(true); + this.color.setBlue(true); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // When Noggle Hedge-Mage enters the battlefield, if you control two or more Islands, you may tap two target permanents. + Ability ability = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new TapTargetEffect(), true), new ControlsPermanentCondition(filter, CountType.MORE_THAN, 1), rule, true); + ability.addTarget(new TargetPermanent(2, new FilterPermanent())); + this.addAbility(ability); + + // When Noggle Hedge-Mage enters the battlefield, if you control two or more Mountains, you may have Noggle Hedge-Mage deal 2 damage to target player. + Ability ability2 = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new DamageTargetEffect(2), true), new ControlsPermanentCondition(filter2, CountType.MORE_THAN, 1), rule2, true); + ability2.addTarget(new TargetPlayer()); + this.addAbility(ability2); + } + + public NoggleHedgeMage(final NoggleHedgeMage card) { + super(card); + } + + @Override + public NoggleHedgeMage copy() { + return new NoggleHedgeMage(this); + } +} diff --git a/Mage.Sets/src/mage/sets/eventide/RiverfallMimic.java b/Mage.Sets/src/mage/sets/eventide/RiverfallMimic.java new file mode 100644 index 00000000000..2b77b2838d9 --- /dev/null +++ b/Mage.Sets/src/mage/sets/eventide/RiverfallMimic.java @@ -0,0 +1,85 @@ +/* + * 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.eventide; + +import java.util.UUID; +import mage.MageInt; +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.common.SpellCastControllerTriggeredAbility; +import mage.abilities.effects.common.continious.GainAbilitySourceEffect; +import mage.abilities.effects.common.continious.SetPowerToughnessSourceEffect; +import mage.abilities.keyword.UnblockableAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.filter.FilterSpell; +import mage.filter.predicate.mageobject.ColorPredicate; + +/** + * + * @author jeffwadsworth + + */ +public class RiverfallMimic extends CardImpl { + + private static final FilterSpell filter = new FilterSpell("a spell that's both blue and red"); + + static { + filter.add(new ColorPredicate(ObjectColor.BLUE)); + filter.add(new ColorPredicate(ObjectColor.RED)); + } + + private String rule = "Whenever you cast a spell that's both blue and red, {this} becomes 3/3 and is unblockable until end of turn."; + + public RiverfallMimic(UUID ownerId) { + super(ownerId, 111, "Riverfall Mimic", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{U/R}"); + this.expansionSetCode = "EVE"; + this.subtype.add("Shapeshifter"); + + this.color.setRed(true); + this.color.setBlue(true); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // Whenever you cast a spell that's both blue and red, Riverfall Mimic becomes 3/3 and is unblockable until end of turn. + Ability ability = new SpellCastControllerTriggeredAbility(new SetPowerToughnessSourceEffect(3, 3, Duration.EndOfTurn), filter, false, rule); + ability.addEffect(new GainAbilitySourceEffect(new UnblockableAbility(), Duration.EndOfTurn, false, true)); + this.addAbility(ability); + } + + public RiverfallMimic(final RiverfallMimic card) { + super(card); + } + + @Override + public RiverfallMimic copy() { + return new RiverfallMimic(this); + } +} diff --git a/Mage.Sets/src/mage/sets/eventide/ShrewdHatchling.java b/Mage.Sets/src/mage/sets/eventide/ShrewdHatchling.java new file mode 100644 index 00000000000..009c2ade37c --- /dev/null +++ b/Mage.Sets/src/mage/sets/eventide/ShrewdHatchling.java @@ -0,0 +1,139 @@ +/* + * 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.eventide; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SpellCastAllTriggeredAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.RestrictionEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.effects.common.counter.RemoveCounterSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.filter.FilterSpell; +import mage.filter.predicate.permanent.ControllerPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author jeffwadsworth + + */ +public class ShrewdHatchling extends CardImpl { + + private static final FilterSpell filter = new FilterSpell("blue spell"); + private static final FilterSpell filter2 = new FilterSpell("red spell"); + + static { + filter.add(new ControllerPredicate(TargetController.YOU)); + filter2.add(new ControllerPredicate(TargetController.YOU)); + } + + private String rule = "Whenever you cast a blue spell, remove a -1/-1 counter from Shrewd Hatchling."; + private String rule2 = "Whenever you cast a red spell, remove a -1/-1 counter from Shrewd Hatchling."; + + public ShrewdHatchling(UUID ownerId) { + super(ownerId, 112, "Shrewd Hatchling", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{U/R}"); + this.expansionSetCode = "EVE"; + this.subtype.add("Elemental"); + + this.color.setRed(true); + this.color.setBlue(true); + this.power = new MageInt(6); + this.toughness = new MageInt(6); + + // Shrewd Hatchling enters the battlefield with four -1/-1 counters on it. + this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.M1M1.createInstance(4)))); + + // {UR}: Target creature can't block Shrewd Hatchling this turn. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ShrewdHatchlingEffect(), new ManaCostsImpl("{U/R}")); + ability.addTarget(new TargetCreaturePermanent()); + this.addAbility(ability); + + // Whenever you cast a blue spell, remove a -1/-1 counter from Shrewd Hatchling. + this.addAbility(new SpellCastAllTriggeredAbility(new RemoveCounterSourceEffect(CounterType.M1M1.createInstance()), filter, false, rule)); + + // Whenever you cast a red spell, remove a -1/-1 counter from Shrewd Hatchling. + this.addAbility(new SpellCastAllTriggeredAbility(new RemoveCounterSourceEffect(CounterType.M1M1.createInstance()), filter2, false, rule2)); + + } + + public ShrewdHatchling(final ShrewdHatchling card) { + super(card); + } + + @Override + public ShrewdHatchling copy() { + return new ShrewdHatchling(this); + } +} + +class ShrewdHatchlingEffect extends RestrictionEffect { + + public ShrewdHatchlingEffect() { + super(Duration.EndOfTurn); + staticText = "Target creature can't block {this} this turn"; + } + + public ShrewdHatchlingEffect(final ShrewdHatchlingEffect effect) { + super(effect); + } + + @Override + public boolean applies(Permanent permanent, Ability source, Game game) { + if (permanent.getId().equals(source.getSourceId())) { + return true; + } + return false; + } + + @Override + public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) { + UUID targetId = source.getFirstTarget(); + if (targetId != null && blocker.getId().equals(targetId)) + return false; + return true; + } + + @Override + public ShrewdHatchlingEffect copy() { + return new ShrewdHatchlingEffect(this); + } + +} diff --git a/Mage.Sets/src/mage/sets/eventide/UnnervingAssault.java b/Mage.Sets/src/mage/sets/eventide/UnnervingAssault.java new file mode 100644 index 00000000000..c5ffd73037a --- /dev/null +++ b/Mage.Sets/src/mage/sets/eventide/UnnervingAssault.java @@ -0,0 +1,85 @@ +/* + * 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.eventide; + +import java.util.UUID; +import mage.abilities.condition.common.ManaWasSpentCondition; +import mage.abilities.decorator.ConditionalContinousEffect; +import mage.abilities.effects.common.continious.BoostAllEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.ManaType; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.ControllerPredicate; + +/** + * + * @author jeffwadsworth + + */ +public class UnnervingAssault extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures your opponents control"); + private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent("creatures you control"); + + static { + filter.add(new ControllerPredicate(TargetController.OPPONENT)); + filter2.add(new ControllerPredicate(TargetController.YOU)); + } + + public UnnervingAssault(UUID ownerId) { + super(ownerId, 114, "Unnerving Assault", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{2}{U/R}"); + this.expansionSetCode = "EVE"; + + this.color.setRed(true); + this.color.setBlue(true); + + // Creatures your opponents control get -1/-0 until end of turn if {U} was spent to cast Unnerving Assault, and creatures you control get +1/+0 until end of turn if {R} was spent to cast it. + this.getSpellAbility().addEffect(new ConditionalContinousEffect( + new BoostAllEffect(-1, 0, Duration.EndOfTurn, filter, false), + new ManaWasSpentCondition(ManaType.BLUE), "Creatures your opponents control get -1/0 until end of turn if {U} was spent to cast {this},")); + this.getSpellAbility().addEffect(new ConditionalContinousEffect( + new BoostAllEffect(1, 0, Duration.EndOfTurn, filter2, false), + new ManaWasSpentCondition(ManaType.RED), " and creatures you control get +1/0 until end of turn if {R} was spent to cast it")); + this.addInfo("Info1", "(Do both if {U}{R} was spent.)"); + + } + + public UnnervingAssault(final UnnervingAssault card) { + super(card); + } + + @Override + public UnnervingAssault copy() { + return new UnnervingAssault(this); + } +} + 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 00000000000..98b2b012773 --- /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); + } + + +}