From 3216593868b9aa1f6ec03cfb941143ccb56059bf Mon Sep 17 00:00:00 2001 From: jeffwadsworth <> Date: Tue, 18 Dec 2012 15:37:07 -0600 Subject: [PATCH] - Added Bala Ged Thief, Shoal Serpent, and Whiplash. --- .../mage/sets/planechase/WhiplashTrap.java | 52 ++++++ .../src/mage/sets/zendikar/BalaGedThief.java | 158 ++++++++++++++++++ .../src/mage/sets/zendikar/ShoalSerpent.java | 129 ++++++++++++++ .../src/mage/sets/zendikar/WhiplashTrap.java | 149 +++++++++++++++++ 4 files changed, 488 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/planechase/WhiplashTrap.java create mode 100644 Mage.Sets/src/mage/sets/zendikar/BalaGedThief.java create mode 100644 Mage.Sets/src/mage/sets/zendikar/ShoalSerpent.java create mode 100644 Mage.Sets/src/mage/sets/zendikar/WhiplashTrap.java diff --git a/Mage.Sets/src/mage/sets/planechase/WhiplashTrap.java b/Mage.Sets/src/mage/sets/planechase/WhiplashTrap.java new file mode 100644 index 0000000000..6159a0cb6f --- /dev/null +++ b/Mage.Sets/src/mage/sets/planechase/WhiplashTrap.java @@ -0,0 +1,52 @@ +/* + * 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.planechase; + +import java.util.UUID; + +/** + * + * @author jeffwadsworth + */ +public class WhiplashTrap extends mage.sets.zendikar.WhiplashTrap { + + public WhiplashTrap(UUID ownerId) { + super(ownerId); + this.cardNumber = 16; + this.expansionSetCode = "HOP"; + } + + public WhiplashTrap(final WhiplashTrap card) { + super(card); + } + + @Override + public WhiplashTrap copy() { + return new WhiplashTrap(this); + } +} diff --git a/Mage.Sets/src/mage/sets/zendikar/BalaGedThief.java b/Mage.Sets/src/mage/sets/zendikar/BalaGedThief.java new file mode 100644 index 0000000000..916a3e6f6c --- /dev/null +++ b/Mage.Sets/src/mage/sets/zendikar/BalaGedThief.java @@ -0,0 +1,158 @@ +/* + * 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.zendikar; + +import java.util.List; +import java.util.UUID; +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldAllTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.filter.FilterCard; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.CardIdPredicate; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetCard; +import mage.target.TargetPlayer; + +/** + * + * @author jeffwadsworth + */ +public class BalaGedThief extends CardImpl { + + public BalaGedThief(UUID ownerId) { + super(ownerId, 79, "Bala Ged Thief", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{B}"); + this.expansionSetCode = "ZEN"; + this.subtype.add("Human"); + this.subtype.add("Rogue"); + this.subtype.add("Ally"); + + this.color.setBlack(true); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + FilterPermanent filter = new FilterPermanent("Bala Ged Thief or another Ally"); + filter.add(Predicates.or( + new CardIdPredicate(this.getId()), + new SubtypePredicate("Ally"))); + + // Whenever Bala Ged Thief or another Ally enters the battlefield under your control, target player reveals a number of cards from his or her hand equal to the number of Allies you control. You choose one of them. That player discards that card. + Ability ability = new EntersBattlefieldAllTriggeredAbility(Constants.Zone.BATTLEFIELD, new BalaGedThiefEffect(), filter, false); + TargetPlayer target = new TargetPlayer(); + target.setRequired(true); + ability.addTarget(target); + this.addAbility(ability); + } + + public BalaGedThief(final BalaGedThief card) { + super(card); + } + + @Override + public BalaGedThief copy() { + return new BalaGedThief(this); + } +} + +class BalaGedThiefEffect extends OneShotEffect { + + public BalaGedThiefEffect() { + super(Constants.Outcome.Discard); + this.staticText = "target player reveals a number of cards from his or her hand equal to the number of Allies you control. You choose one of them. That player discards that card"; + } + + public BalaGedThiefEffect(final BalaGedThiefEffect effect) { + super(effect); + } + + @Override + public BalaGedThiefEffect copy() { + return new BalaGedThiefEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player targetPlayer = game.getPlayer(source.getFirstTarget()); + + if (targetPlayer == null) { + return false; + } + + Player you = game.getPlayer(source.getControllerId()); + + FilterControlledPermanent filter = new FilterControlledPermanent(); + filter.add(new SubtypePredicate("Ally")); + + int numberOfAllies = game.getBattlefield().countAll(filter, you.getId(), game); + + Cards cardsInHand = new CardsImpl(Constants.Zone.PICK); + cardsInHand.addAll(targetPlayer.getHand()); + + int count = Math.min(cardsInHand.size(), numberOfAllies); + + TargetCard target = new TargetCard(count, Constants.Zone.PICK, new FilterCard()); + target.setRequired(true); + Cards revealedCards = new CardsImpl(); + + if (targetPlayer.choose(Constants.Outcome.DrawCard, cardsInHand, target, game)) { + List targets = target.getTargets(); + for (UUID targetId : targets) { + Card card = game.getCard(targetId); + if (card != null) { + revealedCards.add(card); + } + } + } + + TargetCard targetInHand = new TargetCard(Constants.Zone.PICK, new FilterCard("card to discard")); + targetInHand.setRequired(true); + + if (!revealedCards.isEmpty()) { + targetPlayer.revealCards("Bala Ged Thief", revealedCards, game); + you.choose(Constants.Outcome.Neutral, revealedCards, targetInHand, game); + Card card = revealedCards.get(target.getFirstTarget(), game); + if (card != null) { + targetPlayer.discard(card, source, game); + game.informPlayers(targetPlayer + "discarded " + card.getName()); + } + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/zendikar/ShoalSerpent.java b/Mage.Sets/src/mage/sets/zendikar/ShoalSerpent.java new file mode 100644 index 0000000000..e11c212004 --- /dev/null +++ b/Mage.Sets/src/mage/sets/zendikar/ShoalSerpent.java @@ -0,0 +1,129 @@ +/* + * 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.zendikar; + +import java.util.Iterator; +import java.util.UUID; +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Duration; +import mage.Constants.Layer; +import mage.Constants.Outcome; +import mage.Constants.Rarity; +import mage.Constants.SubLayer; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.LandfallAbility; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.keyword.DefenderAbility; +import mage.cards.CardImpl; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author jeffwadsworth + */ +public class ShoalSerpent extends CardImpl { + + static String rule = "Landfall - Whenever a land enters the battlefield under your control, Shoal Serpent loses defender until end of turn"; + + public ShoalSerpent(UUID ownerId) { + super(ownerId, 65, "Shoal Serpent", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{5}{U}"); + this.expansionSetCode = "ZEN"; + this.subtype.add("Serpent"); + + this.color.setBlue(true); + this.power = new MageInt(5); + this.toughness = new MageInt(5); + + // Defender + this.addAbility(DefenderAbility.getInstance()); + + // Landfall - Whenever a land enters the battlefield under your control, Shoal Serpent loses defender until end of turn. + Ability ability = new LandfallAbility(Constants.Zone.BATTLEFIELD, new ShoalSerpentEffect(), false); + this.addAbility(ability); + } + + public ShoalSerpent(final ShoalSerpent card) { + super(card); + } + + @Override + public ShoalSerpent copy() { + return new ShoalSerpent(this); + } +} + +class ShoalSerpentEffect extends ContinuousEffectImpl { + + public ShoalSerpentEffect() { + super(Duration.EndOfTurn, Outcome.AddAbility); + staticText = "Until end of turn, {this} loses defender"; + } + + public ShoalSerpentEffect(final ShoalSerpentEffect effect) { + super(effect); + } + + @Override + public ShoalSerpentEffect copy() { + return new ShoalSerpentEffect(this); + } + + @Override + public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { + Permanent permanent = game.getPermanent(source.getSourceId()); + if (permanent != null) { + switch (layer) { + case AbilityAddingRemovingEffects_6: + if (sublayer == SubLayer.NA) { + for (Iterator i = permanent.getAbilities().iterator(); i.hasNext();) { + Ability entry = i.next(); + if (entry.getId().equals(DefenderAbility.getInstance().getId())) + i.remove(); + } + } + break; + } + return true; + } + return false; + } + + @Override + public boolean apply(Game game, Ability source) { + return false; + } + + @Override + public boolean hasLayer(Layer layer) { + return layer == Layer.AbilityAddingRemovingEffects_6; + } + +} diff --git a/Mage.Sets/src/mage/sets/zendikar/WhiplashTrap.java b/Mage.Sets/src/mage/sets/zendikar/WhiplashTrap.java new file mode 100644 index 0000000000..7a70db3d7e --- /dev/null +++ b/Mage.Sets/src/mage/sets/zendikar/WhiplashTrap.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.zendikar; + +import java.util.UUID; +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.Ability; +import mage.abilities.costs.AlternativeCostImpl; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.ReturnToHandTargetEffect; +import mage.cards.CardImpl; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeEvent; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCreaturePermanent; +import mage.watchers.WatcherImpl; + +/** + * + * @author jeffwadsworth + */ +public class WhiplashTrap extends CardImpl { + + public WhiplashTrap(UUID ownerId) { + super(ownerId, 77, "Whiplash Trap", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{3}{U}{U}"); + this.expansionSetCode = "ZEN"; + this.subtype.add("Trap"); + + this.color.setBlue(true); + + // If an opponent had two or more creatures enter the battlefield under his or her control this turn, you may pay {U} rather than pay Whiplash Trap's mana cost. + this.getSpellAbility().addAlternativeCost(new WhiplashAlternativeCost()); + this.addWatcher(new WhiplashTrapWatcher()); + + // Return two target creatures to their owners' hands. + this.getSpellAbility().addEffect(new ReturnToHandTargetEffect()); + this.getSpellAbility().addTarget(new TargetCreaturePermanent(2)); + + } + + public WhiplashTrap(final WhiplashTrap card) { + super(card); + } + + @Override + public WhiplashTrap copy() { + return new WhiplashTrap(this); + } +} + +class WhiplashTrapWatcher extends WatcherImpl { + + int creatureCount; + + public WhiplashTrapWatcher() { + super("WhiplashTrapWatcher", Constants.WatcherScope.GAME); + } + + public WhiplashTrapWatcher(final WhiplashTrapWatcher watcher) { + super(watcher); + } + + @Override + public WhiplashTrapWatcher copy() { + return new WhiplashTrapWatcher(this); + } + + @Override + public void watch(GameEvent event, Game game) { + if (condition == true) { // no need to check - condition has already occured + return; + } + if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).getToZone() == Constants.Zone.BATTLEFIELD) { + Permanent perm = game.getPermanent(event.getTargetId()); + if (perm.getCardType().contains(CardType.CREATURE) && !perm.getControllerId().equals(controllerId)) { + creatureCount += 1; + if (creatureCount >= 2) { + condition = true; + } + } + } + } + + @Override + public void reset() { + super.reset(); + condition = false; + creatureCount = 0; + } +} + +class WhiplashAlternativeCost extends AlternativeCostImpl { + + public WhiplashAlternativeCost() { + super("you may pay {U} rather than pay Whiplash Trap's mana cost"); + this.add(new ManaCostsImpl("{U}")); + } + + public WhiplashAlternativeCost(final WhiplashAlternativeCost cost) { + super(cost); + } + + @Override + public WhiplashAlternativeCost copy() { + return new WhiplashAlternativeCost(this); + } + + @Override + public boolean isAvailable(Game game, Ability source) { + WhiplashTrapWatcher watcher = (WhiplashTrapWatcher) game.getState().getWatchers().get("WhiplashTrapWatcher"); + if (watcher != null && watcher.conditionMet()) { + return true; + } + return false; + } + + @Override + public String getText() { + return "If an opponent had two or more creatures enter the battlefield under his or her control this turn, you may pay {U} rather than pay Whiplash Trap's mana cost"; + } +} \ No newline at end of file