From 4de4caad26274290ff2801d1ed18d604cbb6ab95 Mon Sep 17 00:00:00 2001 From: fireshoes Date: Sat, 7 Nov 2015 21:18:21 -0600 Subject: [PATCH] [C15] Implemented Shielded by Faith, Grasp of Fate, Arachnogenesis, and Great Oak Guardian. --- .../sets/commander2015/Arachnogenesis.java | 104 ++++++++ .../mage/sets/commander2015/GraspOfFate.java | 120 +++++++++ .../sets/commander2015/GreatOakGuardian.java | 128 ++++++++++ .../sets/commander2015/ShieldedByFaith.java | 86 +++++++ .../mage/sets/innistrad/SpiderSpawning.java | 150 +++++------ .../sets/shadowmoor/GloomwidowsFeast.java | 237 ++++++++---------- .../game/permanent/token/SpiderToken.java | 27 ++ 7 files changed, 644 insertions(+), 208 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/commander2015/Arachnogenesis.java create mode 100644 Mage.Sets/src/mage/sets/commander2015/GraspOfFate.java create mode 100644 Mage.Sets/src/mage/sets/commander2015/GreatOakGuardian.java create mode 100644 Mage.Sets/src/mage/sets/commander2015/ShieldedByFaith.java create mode 100644 Mage/src/mage/game/permanent/token/SpiderToken.java diff --git a/Mage.Sets/src/mage/sets/commander2015/Arachnogenesis.java b/Mage.Sets/src/mage/sets/commander2015/Arachnogenesis.java new file mode 100644 index 00000000000..3f500fc132e --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander2015/Arachnogenesis.java @@ -0,0 +1,104 @@ +/* + * 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.commander2015; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.PreventAllDamageByAllEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.game.Game; +import mage.game.combat.CombatGroup; +import mage.game.permanent.token.SpiderToken; + +/** + * + * @author fireshoes + */ +public class Arachnogenesis extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("non-Spider creatures"); + + static { + filter.add(Predicates.not(new SubtypePredicate("Spider"))); + } + + public Arachnogenesis(UUID ownerId) { + super(ownerId, 32, "Arachnogenesis", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{2}{G}"); + this.expansionSetCode = "C15"; + + // Put X 1/2 green Spider creature tokens with reach onto the battlefield, where X is the number of creatures attacking you. + Effect effect = new CreateTokenEffect(new SpiderToken(), new ArachnogenesisCount()); + effect.setText("Put X 1/2 green Spider creature tokens with reach onto the battlefield, where X is the number of creatures attacking you"); + this.getSpellAbility().addEffect(effect); + + // Prevent all combat damage that would be dealt this turn by non-Spider creatures. + this.getSpellAbility().addEffect(new PreventAllDamageByAllEffect(filter, Duration.EndOfTurn, true)); + } + + public Arachnogenesis(final Arachnogenesis card) { + super(card); + } + + @Override + public Arachnogenesis copy() { + return new Arachnogenesis(this); + } +} + +class ArachnogenesisCount implements DynamicValue { + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + int count = 0; + for (CombatGroup combatGroup : game.getCombat().getGroups()) { + if (combatGroup.getDefenderId().equals(sourceAbility.getControllerId())) { + count += combatGroup.getAttackers().size(); + } + } + return count; + } + + @Override + public DynamicValue copy() { + return this; + } + + @Override + public String getMessage() { + return "creatures attacking you"; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/commander2015/GraspOfFate.java b/Mage.Sets/src/mage/sets/commander2015/GraspOfFate.java new file mode 100644 index 00000000000..2849a7d5c53 --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander2015/GraspOfFate.java @@ -0,0 +1,120 @@ +/* + * 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.commander2015; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.delayed.OnLeaveReturnExiledToBattlefieldAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; +import mage.abilities.effects.common.ExileTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.filter.FilterPermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.CardTypePredicate; +import static mage.filter.predicate.permanent.ControllerControlsIslandPredicate.filter; +import mage.filter.predicate.permanent.ControllerIdPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetPermanent; +import mage.util.CardUtil; + +/** + * + * @author fireshoes + */ +public class GraspOfFate extends CardImpl { + + public GraspOfFate(UUID ownerId) { + super(ownerId, 3, "Grasp of Fate", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}{W}"); + this.expansionSetCode = "C15"; + + // When Grasp of Fate enters the battlefield, for each opponent, exile up to one target nonland permanent that player controls until Grasp of Fate leaves the battlefield. + Ability ability = new EntersBattlefieldTriggeredAbility(new GraspOfFateExileEffect()); + ability.addTarget(new TargetPermanent(filter)); + ability.addEffect(new CreateDelayedTriggeredAbilityEffect(new OnLeaveReturnExiledToBattlefieldAbility())); + this.addAbility(ability); + } + + public GraspOfFate(final GraspOfFate card) { + super(card); + } + + @Override + public void adjustTargets(Ability ability, Game game) { + if (ability instanceof EntersBattlefieldTriggeredAbility) { + ability.getTargets().clear(); + for(UUID opponentId : game.getOpponents(ability.getControllerId())) { + Player opponent = game.getPlayer(opponentId); + if (opponent != null) { + FilterPermanent filter = new FilterPermanent("nonland permanent from opponent " + opponent.getLogName()); + filter.add(new ControllerIdPredicate(opponentId)); + filter.add(Predicates.not(new CardTypePredicate(CardType.LAND))); + TargetPermanent target = new TargetPermanent(0, 1, filter,false); + ability.addTarget(target); + } + } + } + } + + @Override + public GraspOfFate copy() { + return new GraspOfFate(this); + } +} + +class GraspOfFateExileEffect extends OneShotEffect { + + public GraspOfFateExileEffect() { + super(Outcome.Benefit); + this.staticText = "exile up to one target nonland permanent that player controls until {this} leaves the battlefield"; + } + + public GraspOfFateExileEffect(final GraspOfFateExileEffect effect) { + super(effect); + } + + @Override + public GraspOfFateExileEffect copy() { + return new GraspOfFateExileEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(source.getSourceId()); + if (permanent != null) { + return new ExileTargetEffect(CardUtil.getCardExileZoneId(game, source), permanent.getIdName()).apply(game, source); + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/commander2015/GreatOakGuardian.java b/Mage.Sets/src/mage/sets/commander2015/GreatOakGuardian.java new file mode 100644 index 00000000000..3ed072bed0c --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander2015/GreatOakGuardian.java @@ -0,0 +1,128 @@ +/* + * 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.commander2015; + +import java.util.Iterator; +import java.util.List; +import java.util.UUID; +import mage.MageInt; +import mage.MageObjectReference; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.keyword.FlashAbility; +import mage.abilities.keyword.ReachAbility; +import mage.cards.CardImpl; +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.filter.common.FilterCreaturePermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.TargetPlayer; + +/** + * + * @author fireshoes + */ +public class GreatOakGuardian extends CardImpl { + + public GreatOakGuardian(UUID ownerId) { + super(ownerId, 37, "Great Oak Guardian", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{5}{G}"); + this.expansionSetCode = "C15"; + this.subtype.add("Treefolk"); + this.power = new MageInt(4); + this.toughness = new MageInt(5); + + // Flash + this.addAbility(FlashAbility.getInstance()); + + // Reach + this.addAbility(ReachAbility.getInstance()); + + // When Great Oak Guardian enters the battlefield, creatures target player controls get +2/+2 until end of turn. Untap them. + Ability ability = new EntersBattlefieldTriggeredAbility(new GreatOakGuardianEffect(), false); + ability.addTarget(new TargetPlayer()); + this.addAbility(ability); + } + + public GreatOakGuardian(final GreatOakGuardian card) { + super(card); + } + + @Override + public GreatOakGuardian copy() { + return new GreatOakGuardian(this); + } +} + +class GreatOakGuardianEffect extends ContinuousEffectImpl { + + public GreatOakGuardianEffect() { + super(Duration.EndOfTurn, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, Outcome.BoostCreature); + staticText = "creatures target player controls get +2/+2 until end of turn. Untap them"; + } + + public GreatOakGuardianEffect(final GreatOakGuardianEffect effect) { + super(effect); + } + + @Override + public GreatOakGuardianEffect copy() { + return new GreatOakGuardianEffect(this); + } + + @Override + public void init(Ability source, Game game) { + super.init(source, game); + if (this.affectedObjectsSet) { + List creatures = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getFirstTarget(), game); + for (Permanent creature : creatures) { + affectedObjectList.add(new MageObjectReference(creature, game)); + } + } + } + + @Override + public boolean apply(Game game, Ability source) { + for (Iterator it = affectedObjectList.iterator(); it.hasNext();) { + Permanent permanent = it.next().getPermanent(game); + if (permanent != null) { + permanent.addPower(2); + permanent.addToughness(2); + permanent.untap(game); + } else { + it.remove(); + } + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/commander2015/ShieldedByFaith.java b/Mage.Sets/src/mage/sets/commander2015/ShieldedByFaith.java new file mode 100644 index 00000000000..c88b135a944 --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander2015/ShieldedByFaith.java @@ -0,0 +1,86 @@ +/* + * 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.commander2015; + +import java.util.UUID; +import mage.abilities.common.EntersBattlefieldAllTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.abilities.keyword.IndestructibleAbility; +import mage.cards.CardImpl; +import mage.constants.AttachmentType; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.SetTargetPointer; +import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author fireshoes + */ +public class ShieldedByFaith extends CardImpl { + + public ShieldedByFaith(UUID ownerId) { + super(ownerId, 8, "Shielded by Faith", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}{W}"); + this.expansionSetCode = "C15"; + this.subtype.add("Aura"); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.Benefit)); + this.addAbility(new EnchantAbility(auraTarget.getTargetName())); + + // Enchanted creature has indestructible. + Effect effect = new GainAbilityAttachedEffect(IndestructibleAbility.getInstance(), AttachmentType.AURA, Duration.WhileOnBattlefield); + effect.setText("Enchanted creature has indestructible"); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); + + // Whenever a creature enters the battlefield, you may attach Shielded by Faith to that creature. + this.addAbility(new EntersBattlefieldAllTriggeredAbility( + Zone.BATTLEFIELD, new AttachEffect(Outcome.Neutral, "attach {source} to that creature"), + new FilterCreaturePermanent("a creature"), true, SetTargetPointer.PERMANENT, null, false)); + } + + public ShieldedByFaith(final ShieldedByFaith card) { + super(card); + } + + @Override + public ShieldedByFaith copy() { + return new ShieldedByFaith(this); + } +} diff --git a/Mage.Sets/src/mage/sets/innistrad/SpiderSpawning.java b/Mage.Sets/src/mage/sets/innistrad/SpiderSpawning.java index af915331c45..3b5ed551c26 100644 --- a/Mage.Sets/src/mage/sets/innistrad/SpiderSpawning.java +++ b/Mage.Sets/src/mage/sets/innistrad/SpiderSpawning.java @@ -1,82 +1,68 @@ -/* - * 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.innistrad; - -import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.TimingRule; -import mage.MageInt; -import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.dynamicvalue.common.CardsInControllerGraveyardCount; -import mage.abilities.effects.common.CreateTokenEffect; -import mage.abilities.keyword.FlashbackAbility; -import mage.abilities.keyword.ReachAbility; -import mage.cards.CardImpl; -import mage.filter.common.FilterCreatureCard; -import mage.game.permanent.token.Token; - -/** - * - * @author North - */ -public class SpiderSpawning extends CardImpl { - - public SpiderSpawning(UUID ownerId) { - super(ownerId, 203, "Spider Spawning", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{4}{G}"); - this.expansionSetCode = "ISD"; - - - // Put a 1/2 green Spider creature token with reach onto the battlefield for each creature card in your graveyard. - this.getSpellAbility().addEffect(new CreateTokenEffect(new SpiderToken(), new CardsInControllerGraveyardCount(new FilterCreatureCard()))); - // Flashback {6}{B} - this.addAbility(new FlashbackAbility(new ManaCostsImpl("{6}{B}"), TimingRule.SORCERY)); - } - - public SpiderSpawning(final SpiderSpawning card) { - super(card); - } - - @Override - public SpiderSpawning copy() { - return new SpiderSpawning(this); - } -} - -class SpiderToken extends Token { - - public SpiderToken() { - super("Spider", "1/2 green Spider creature token with reach"); - cardType.add(CardType.CREATURE); - color.setGreen(true); - subtype.add("Spider"); - power = new MageInt(1); - toughness = new MageInt(2); - addAbility(ReachAbility.getInstance()); - } -} +/* + * 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.innistrad; + +import java.util.UUID; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.dynamicvalue.common.CardsInControllerGraveyardCount; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.keyword.FlashbackAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.TimingRule; +import mage.filter.common.FilterCreatureCard; +import mage.game.permanent.token.SpiderToken; + +/** + * + * @author North + */ +public class SpiderSpawning extends CardImpl { + + public SpiderSpawning(UUID ownerId) { + super(ownerId, 203, "Spider Spawning", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{4}{G}"); + this.expansionSetCode = "ISD"; + + + // Put a 1/2 green Spider creature token with reach onto the battlefield for each creature card in your graveyard. + this.getSpellAbility().addEffect(new CreateTokenEffect(new SpiderToken(), new CardsInControllerGraveyardCount(new FilterCreatureCard()))); + // Flashback {6}{B} + this.addAbility(new FlashbackAbility(new ManaCostsImpl("{6}{B}"), TimingRule.SORCERY)); + } + + public SpiderSpawning(final SpiderSpawning card) { + super(card); + } + + @Override + public SpiderSpawning copy() { + return new SpiderSpawning(this); + } +} + diff --git a/Mage.Sets/src/mage/sets/shadowmoor/GloomwidowsFeast.java b/Mage.Sets/src/mage/sets/shadowmoor/GloomwidowsFeast.java index f2b8a590bef..018b0eebfd0 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/GloomwidowsFeast.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/GloomwidowsFeast.java @@ -1,126 +1,111 @@ -/* - * 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.shadowmoor; - -import java.util.UUID; -import mage.MageInt; -import mage.abilities.Ability; -import mage.abilities.effects.OneShotEffect; -import mage.abilities.keyword.FlyingAbility; -import mage.abilities.keyword.ReachAbility; -import mage.cards.CardImpl; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.filter.common.FilterCreaturePermanent; -import mage.filter.predicate.mageobject.AbilityPredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.game.permanent.token.Token; -import mage.target.TargetPermanent; - -/** - * - * @author jeffwadsworth - */ -public class GloomwidowsFeast extends CardImpl { - - private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("target creature with flying"); - - static { - filter.add(new AbilityPredicate(FlyingAbility.class)); - } - - public GloomwidowsFeast(UUID ownerId) { - super(ownerId, 118, "Gloomwidow's Feast", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{3}{G}"); - this.expansionSetCode = "SHM"; - - - // Destroy target creature with flying. If that creature was blue or black, put a 1/2 green Spider creature token with reach onto the battlefield. - this.getSpellAbility().addEffect(new GloomwidowsFeastEffect()); - this.getSpellAbility().addTarget(new TargetPermanent(filter)); - - } - - public GloomwidowsFeast(final GloomwidowsFeast card) { - super(card); - } - - @Override - public GloomwidowsFeast copy() { - return new GloomwidowsFeast(this); - } -} - -class GloomwidowsFeastEffect extends OneShotEffect { - - boolean applied = false; - - public GloomwidowsFeastEffect() { - super(Outcome.DestroyPermanent); - this.staticText = "Destroy target creature with flying. If that creature was blue or black, put a 1/2 green Spider creature token with reach onto the battlefield"; - } - - public GloomwidowsFeastEffect(final GloomwidowsFeastEffect effect) { - super(effect); - } - - @Override - public GloomwidowsFeastEffect copy() { - return new GloomwidowsFeastEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent targetCreature = game.getPermanent(source.getFirstTarget()); - if (targetCreature != null) { - targetCreature.destroy(source.getSourceId(), game, false); - Permanent destroyedCreature = game.getPermanentOrLKIBattlefield(source.getFirstTarget()); - if (destroyedCreature.getColor(game).isBlue() - || destroyedCreature.getColor(game).isBlack()) { - SpiderToken token = new SpiderToken(); - token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); - return true; - } - } - return false; - } -} - -class SpiderToken extends Token { - - public SpiderToken() { - super("Spider", "1/2 green Spider creature token with reach"); - cardType.add(CardType.CREATURE); - color.setGreen(true); - subtype.add("Spider"); - power = new MageInt(1); - toughness = new MageInt(2); - addAbility(ReachAbility.getInstance()); - } -} +/* + * 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.shadowmoor; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.AbilityPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.SpiderToken; +import mage.target.TargetPermanent; + +/** + * + * @author jeffwadsworth + */ +public class GloomwidowsFeast extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("target creature with flying"); + + static { + filter.add(new AbilityPredicate(FlyingAbility.class)); + } + + public GloomwidowsFeast(UUID ownerId) { + super(ownerId, 118, "Gloomwidow's Feast", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{3}{G}"); + this.expansionSetCode = "SHM"; + + + // Destroy target creature with flying. If that creature was blue or black, put a 1/2 green Spider creature token with reach onto the battlefield. + this.getSpellAbility().addEffect(new GloomwidowsFeastEffect()); + this.getSpellAbility().addTarget(new TargetPermanent(filter)); + + } + + public GloomwidowsFeast(final GloomwidowsFeast card) { + super(card); + } + + @Override + public GloomwidowsFeast copy() { + return new GloomwidowsFeast(this); + } +} + +class GloomwidowsFeastEffect extends OneShotEffect { + + boolean applied = false; + + public GloomwidowsFeastEffect() { + super(Outcome.DestroyPermanent); + this.staticText = "Destroy target creature with flying. If that creature was blue or black, put a 1/2 green Spider creature token with reach onto the battlefield"; + } + + public GloomwidowsFeastEffect(final GloomwidowsFeastEffect effect) { + super(effect); + } + + @Override + public GloomwidowsFeastEffect copy() { + return new GloomwidowsFeastEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent targetCreature = game.getPermanent(source.getFirstTarget()); + if (targetCreature != null) { + targetCreature.destroy(source.getSourceId(), game, false); + Permanent destroyedCreature = game.getPermanentOrLKIBattlefield(source.getFirstTarget()); + if (destroyedCreature.getColor(game).isBlue() + || destroyedCreature.getColor(game).isBlack()) { + SpiderToken token = new SpiderToken(); + token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + return true; + } + } + return false; + } +} diff --git a/Mage/src/mage/game/permanent/token/SpiderToken.java b/Mage/src/mage/game/permanent/token/SpiderToken.java new file mode 100644 index 00000000000..98333d8fc9a --- /dev/null +++ b/Mage/src/mage/game/permanent/token/SpiderToken.java @@ -0,0 +1,27 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.abilities.keyword.ReachAbility; +import mage.constants.CardType; + +/** + * + * @author fireshoes + */ +public class SpiderToken extends Token { + + public SpiderToken() { + super("Spider", "1/2 green Spider creature token with reach"); + cardType.add(CardType.CREATURE); + color.setGreen(true); + subtype.add("Spider"); + power = new MageInt(1); + toughness = new MageInt(2); + addAbility(ReachAbility.getInstance()); + } +}