From c3ca3cfd68c2f1f700c854882aeedbf80555e18a Mon Sep 17 00:00:00 2001 From: emerald000 Date: Tue, 15 Jul 2014 04:46:46 -0400 Subject: [PATCH] [NEW] Added Patagia Viper and Arcanum Wings + Ulasht, the Hate Seed fix. --- .../mage/sets/dissension/PatagiaViper.java | 92 ++++++++++++++ .../mage/sets/futuresight/ArcanumWings.java | 83 ++++++++++++ .../sets/guildpact/UlashtTheHateSeed.java | 4 +- .../abilities/keyword/AuraSwapAbility.java | 118 ++++++++++++++++++ 4 files changed, 295 insertions(+), 2 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/dissension/PatagiaViper.java create mode 100644 Mage.Sets/src/mage/sets/futuresight/ArcanumWings.java create mode 100644 Mage/src/mage/abilities/keyword/AuraSwapAbility.java diff --git a/Mage.Sets/src/mage/sets/dissension/PatagiaViper.java b/Mage.Sets/src/mage/sets/dissension/PatagiaViper.java new file mode 100644 index 00000000000..5c492ed8472 --- /dev/null +++ b/Mage.Sets/src/mage/sets/dissension/PatagiaViper.java @@ -0,0 +1,92 @@ +/* + * 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.dissension; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.condition.common.ManaWasSpentCondition; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.SacrificeSourceUnlessConditionEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.ColoredManaSymbol; +import mage.constants.Rarity; +import mage.game.permanent.token.Token; +import mage.watchers.common.ManaSpentToCastWatcher; + +/** + * + * @author emerald000 + */ +public class PatagiaViper extends CardImpl { + + public PatagiaViper(UUID ownerId) { + super(ownerId, 89, "Patagia Viper", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{G}"); + this.expansionSetCode = "DIS"; + this.subtype.add("Snake"); + + this.color.setGreen(true); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // When Patagia Viper enters the battlefield, put two 1/1 green and blue Snake creature tokens onto the battlefield. + this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new PatagiaViperSnakeToken(), 2), false)); + + // When Patagia Viper enters the battlefield, sacrifice it unless {U} was spent to cast it. + this.addAbility(new EntersBattlefieldTriggeredAbility(new SacrificeSourceUnlessConditionEffect(new ManaWasSpentCondition(ColoredManaSymbol.U)), false)); + this.addWatcher(new ManaSpentToCastWatcher()); + } + + public PatagiaViper(final PatagiaViper card) { + super(card); + } + + @Override + public PatagiaViper copy() { + return new PatagiaViper(this); + } +} + +class PatagiaViperSnakeToken extends Token { + + PatagiaViperSnakeToken() { + super("Snake", "1/1 green and blue Snake creature token"); + cardType.add(CardType.CREATURE); + color.setGreen(true); + color.setBlue(true); + subtype.add("Snake"); + power = new MageInt(1); + toughness = new MageInt(1); + } + +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/futuresight/ArcanumWings.java b/Mage.Sets/src/mage/sets/futuresight/ArcanumWings.java new file mode 100644 index 00000000000..d3f81fb1b48 --- /dev/null +++ b/Mage.Sets/src/mage/sets/futuresight/ArcanumWings.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.sets.futuresight; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.continious.GainAbilityAttachedEffect; +import mage.abilities.keyword.AuraSwapAbility; +import mage.abilities.keyword.EnchantAbility; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.AttachmentType; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author emerald000 + */ +public class ArcanumWings extends CardImpl { + + public ArcanumWings(UUID ownerId) { + super(ownerId, 48, "Arcanum Wings", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}"); + this.expansionSetCode = "FUT"; + this.subtype.add("Aura"); + + this.color.setBlue(true); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.AddAbility)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // Enchanted creature has flying. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(FlyingAbility.getInstance(), AttachmentType.AURA))); + + // Aura swap {2}{U} + this.addAbility(new AuraSwapAbility(new ManaCostsImpl("{2}{U}"))); + } + + public ArcanumWings(final ArcanumWings card) { + super(card); + } + + @Override + public ArcanumWings copy() { + return new ArcanumWings(this); + } +} diff --git a/Mage.Sets/src/mage/sets/guildpact/UlashtTheHateSeed.java b/Mage.Sets/src/mage/sets/guildpact/UlashtTheHateSeed.java index 175b7826be4..c7dfb337dd1 100644 --- a/Mage.Sets/src/mage/sets/guildpact/UlashtTheHateSeed.java +++ b/Mage.Sets/src/mage/sets/guildpact/UlashtTheHateSeed.java @@ -125,8 +125,8 @@ class UlashtTheHateSeedEffect extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null && player != null) { - int amount = game.getBattlefield().countAll(filterRed, source.getControllerId(), game) - 1; - amount += game.getBattlefield().countAll(filterGreen, source.getControllerId(), game) - 1; + int amount = game.getBattlefield().count(filterRed, source.getSourceId(), source.getControllerId(), game); + amount += game.getBattlefield().count(filterGreen, source.getSourceId(), source.getControllerId(), game); if (amount > 0) { permanent.addCounters(CounterType.P1P1.createInstance(amount), game); } diff --git a/Mage/src/mage/abilities/keyword/AuraSwapAbility.java b/Mage/src/mage/abilities/keyword/AuraSwapAbility.java new file mode 100644 index 00000000000..7e35d2b7de5 --- /dev/null +++ b/Mage/src/mage/abilities/keyword/AuraSwapAbility.java @@ -0,0 +1,118 @@ +/* +* 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.keyword; + +import mage.abilities.Ability; +import mage.abilities.ActivatedAbilityImpl; +import mage.abilities.costs.mana.ManaCost; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetCardInHand; + +/** + * + * @author Mael + */ +public class AuraSwapAbility extends ActivatedAbilityImpl { + + public AuraSwapAbility(ManaCost manaCost) { + super(Zone.BATTLEFIELD, new AuraSwapEffect(), manaCost); + + } + + public AuraSwapAbility(final AuraSwapAbility ability) { + super(ability); + } + + @Override + public AuraSwapAbility copy() { + return new AuraSwapAbility(this); + } + + @Override + public String getRule() { + return new StringBuilder("Aura swap ").append(getManaCostsToPay().getText()).append(" (") + .append(getManaCostsToPay().getText()) + .append(": Exchange this Aura with an Aura card in your hand.)").toString(); + } +} + +class AuraSwapEffect extends OneShotEffect { + + private static final FilterCard filter = new FilterCard(); + + static { + filter.add(new SubtypePredicate("Aura")); + } + + AuraSwapEffect() { + super(Outcome.PutCardInPlay); + this.staticText = "Exchange this Aura with an Aura card in your hand."; + } + + AuraSwapEffect(final AuraSwapEffect effect) { + super(effect); + } + + @Override + public AuraSwapEffect copy() { + return new AuraSwapEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player != null) { + Permanent auraPermanent = game.getPermanent(source.getSourceId()); + if (auraPermanent != null && auraPermanent.getSubtype().contains("Aura") && auraPermanent.getOwnerId().equals(source.getControllerId())) { + if (player.getHand().count(filter, game) > 0) { + TargetCardInHand target = new TargetCardInHand(0, 1, filter); + if (player.choose(Outcome.PutCardInPlay, target, source.getSourceId(), game)) { + Card auraInHand = game.getCard(target.getFirstTarget()); + Permanent enchantedPermanent = game.getPermanent(auraPermanent.getAttachedTo()); + if (auraInHand != null && !enchantedPermanent.cantBeEnchantedBy(auraInHand, game) && auraInHand.getSpellAbility().getTargets().get(0).canTarget(enchantedPermanent.getId(), source, game)) { + player.putOntoBattlefieldWithInfo(auraInHand, game, Zone.HAND, source.getSourceId()); + enchantedPermanent.addAttachment(auraInHand.getId(), game); + player.moveCardToHandWithInfo(auraPermanent, source.getSourceId(), game, Zone.BATTLEFIELD); + return true; + } + } + } + } + } + return false; + } +}