From 4e8bd0d2baa648b691aae90fb86fdfa0a5324339 Mon Sep 17 00:00:00 2001 From: Plopman Date: Mon, 25 Aug 2014 22:33:31 +0200 Subject: [PATCH] Added 6 cards --- .../src/mage/sets/iceage/AltarOfBone.java | 67 ++++++++ .../mage/sets/mirage/AsmiraHolyAvenger.java | 153 ++++++++++++++++++ .../mage/sets/odyssey/DiligentFarmhand.java | 79 +++++++++ .../src/mage/sets/portal/OwlFamiliar.java | 68 ++++++++ .../mage/sets/scourge/UnspeakableSymbol.java | 68 ++++++++ .../sets/timespiral/SaffiEriksdotter.java | 150 +++++++++++++++++ 6 files changed, 585 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/iceage/AltarOfBone.java create mode 100644 Mage.Sets/src/mage/sets/mirage/AsmiraHolyAvenger.java create mode 100644 Mage.Sets/src/mage/sets/odyssey/DiligentFarmhand.java create mode 100644 Mage.Sets/src/mage/sets/portal/OwlFamiliar.java create mode 100644 Mage.Sets/src/mage/sets/scourge/UnspeakableSymbol.java create mode 100644 Mage.Sets/src/mage/sets/timespiral/SaffiEriksdotter.java diff --git a/Mage.Sets/src/mage/sets/iceage/AltarOfBone.java b/Mage.Sets/src/mage/sets/iceage/AltarOfBone.java new file mode 100644 index 00000000000..a1546f4de19 --- /dev/null +++ b/Mage.Sets/src/mage/sets/iceage/AltarOfBone.java @@ -0,0 +1,67 @@ +/* + * 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.iceage; + +import java.util.UUID; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.common.FilterCreatureCard; +import mage.target.common.TargetCardInLibrary; +import mage.target.common.TargetControlledCreaturePermanent; + +/** + * + * @author Plopman + */ +public class AltarOfBone extends CardImpl { + + public AltarOfBone(UUID ownerId) { + super(ownerId, 359, "Altar of Bone", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{G}{W}"); + this.expansionSetCode = "ICE"; + + this.color.setGreen(true); + this.color.setWhite(true); + + // As an additional cost to cast Altar of Bone, sacrifice a creature. + this.getSpellAbility().addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent())); + // Search your library for a creature card, reveal that card, and put it into your hand. Then shuffle your library. + this.getSpellAbility().addEffect(new SearchLibraryPutInHandEffect(new TargetCardInLibrary(new FilterCreatureCard()))); + } + + public AltarOfBone(final AltarOfBone card) { + super(card); + } + + @Override + public AltarOfBone copy() { + return new AltarOfBone(this); + } +} diff --git a/Mage.Sets/src/mage/sets/mirage/AsmiraHolyAvenger.java b/Mage.Sets/src/mage/sets/mirage/AsmiraHolyAvenger.java new file mode 100644 index 00000000000..99ff6bbea57 --- /dev/null +++ b/Mage.Sets/src/mage/sets/mirage/AsmiraHolyAvenger.java @@ -0,0 +1,153 @@ +/* + * 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.mirage; + +import java.util.UUID; +import mage.MageInt; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfEndStepTriggeredAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.constants.WatcherScope; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeEvent; +import mage.watchers.Watcher; + +/** + * + * @author Plopman + */ +public class AsmiraHolyAvenger extends CardImpl { + + public AsmiraHolyAvenger(UUID ownerId) { + super(ownerId, 316, "Asmira, Holy Avenger", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{G}{W}"); + this.expansionSetCode = "MIR"; + this.supertype.add("Legendary"); + this.subtype.add("Human"); + this.subtype.add("Cleric"); + + this.color.setGreen(true); + this.color.setWhite(true); + this.power = new MageInt(2); + this.toughness = new MageInt(3); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + // At the beginning of each end step, put a +1/+1 counter on Asmira, Holy Avenger for each creature put into your graveyard from the battlefield this turn. + this.addWatcher(new AsmiraHolyAvengerWatcher()); + this.addAbility(new BeginningOfEndStepTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(0), new AsmiraHolyAvengerDynamicValue(), true), TargetController.ANY, false)); + } + + public AsmiraHolyAvenger(final AsmiraHolyAvenger card) { + super(card); + } + + @Override + public AsmiraHolyAvenger copy() { + return new AsmiraHolyAvenger(this); + } +} + + +class AsmiraHolyAvengerWatcher extends Watcher { + + private int creaturesCount = 0; + + public AsmiraHolyAvengerWatcher() { + super("YourCreaturesDied", WatcherScope.PLAYER); + condition = true; + } + + public AsmiraHolyAvengerWatcher(final AsmiraHolyAvengerWatcher watcher) { + super(watcher); + this.creaturesCount = watcher.creaturesCount; + } + + @Override + public AsmiraHolyAvengerWatcher copy() { + return new AsmiraHolyAvengerWatcher(this); + } + + public int getCreaturesCount() { + return creaturesCount; + } + + @Override + public void watch(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).isDiesEvent()) { + MageObject card = game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); + if (card != null && ((Card)card).getOwnerId().equals(this.controllerId) && card.getCardType().contains(CardType.CREATURE)) { + creaturesCount++; + } + } + } + + @Override + public void reset() { + super.reset(); + creaturesCount = 0; + } +} + +class AsmiraHolyAvengerDynamicValue implements DynamicValue { + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + AsmiraHolyAvengerWatcher watcher = (AsmiraHolyAvengerWatcher) game.getState().getWatchers().get("YourCreaturesDied", sourceAbility.getControllerId()); + if (watcher != null) { + return watcher.getCreaturesCount(); + } + return 0; + } + + @Override + public AsmiraHolyAvengerDynamicValue copy() { + return new AsmiraHolyAvengerDynamicValue(); + } + + @Override + public String toString() { + return "1"; + } + + @Override + public String getMessage() { + return "creature put into your graveyard from the battlefield this turn"; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/odyssey/DiligentFarmhand.java b/Mage.Sets/src/mage/sets/odyssey/DiligentFarmhand.java new file mode 100644 index 00000000000..3b65c8fbf2e --- /dev/null +++ b/Mage.Sets/src/mage/sets/odyssey/DiligentFarmhand.java @@ -0,0 +1,79 @@ +/* + * 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.odyssey; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EmptyEffect; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.common.SacrificeSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; +import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterBasicLandCard; +import mage.target.common.TargetCardInLibrary; + +/** + * + * @author Plopman + */ +public class DiligentFarmhand extends CardImpl { + + public DiligentFarmhand(UUID ownerId) { + super(ownerId, 237, "Diligent Farmhand", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{G}"); + this.expansionSetCode = "ODY"; + this.subtype.add("Human"); + this.subtype.add("Druid"); + + this.color.setGreen(true); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // {1}{G}, Sacrifice Diligent Farmhand: Search your library for a basic land card and put that card onto the battlefield tapped. Then shuffle your library. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(new FilterBasicLandCard()), true), new ManaCostsImpl("{1}{G}")); + ability.addCost(new SacrificeSourceCost()); + this.addAbility(ability); + // If Diligent Farmhand is in a graveyard, effects from spells named Muscle Burst count it as a card named Muscle Burst. + this.addAbility(new SimpleStaticAbility(Zone.ALL, new EmptyEffect("If Diligent Farmhand is in a graveyard, effects from spells named Muscle Burst count it as a card named Muscle Burst"))); + } + + public DiligentFarmhand(final DiligentFarmhand card) { + super(card); + } + + @Override + public DiligentFarmhand copy() { + return new DiligentFarmhand(this); + } +} diff --git a/Mage.Sets/src/mage/sets/portal/OwlFamiliar.java b/Mage.Sets/src/mage/sets/portal/OwlFamiliar.java new file mode 100644 index 00000000000..f770794ff09 --- /dev/null +++ b/Mage.Sets/src/mage/sets/portal/OwlFamiliar.java @@ -0,0 +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.portal; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.common.DrawDiscardControllerEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; + +/** + * + * @author Plopman + */ +public class OwlFamiliar extends CardImpl { + + public OwlFamiliar(UUID ownerId) { + super(ownerId, 64, "Owl Familiar", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{U}"); + this.expansionSetCode = "POR"; + this.subtype.add("Bird"); + + this.color.setBlue(true); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + // When Owl Familiar enters the battlefield, draw a card, then discard a card. + this.addAbility(new EntersBattlefieldTriggeredAbility(new DrawDiscardControllerEffect())); + } + + public OwlFamiliar(final OwlFamiliar card) { + super(card); + } + + @Override + public OwlFamiliar copy() { + return new OwlFamiliar(this); + } +} diff --git a/Mage.Sets/src/mage/sets/scourge/UnspeakableSymbol.java b/Mage.Sets/src/mage/sets/scourge/UnspeakableSymbol.java new file mode 100644 index 00000000000..505562e00c8 --- /dev/null +++ b/Mage.Sets/src/mage/sets/scourge/UnspeakableSymbol.java @@ -0,0 +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.scourge; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.PayLifeCost; +import mage.abilities.effects.common.counter.AddCountersTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author Plopman + */ +public class UnspeakableSymbol extends CardImpl { + + public UnspeakableSymbol(UUID ownerId) { + super(ownerId, 79, "Unspeakable Symbol", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}{B}"); + this.expansionSetCode = "SCG"; + + this.color.setBlack(true); + + // Pay 3 life: Put a +1/+1 counter on target creature. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersTargetEffect(CounterType.P1P1.createInstance()), new PayLifeCost(3)); + ability.addTarget(new TargetCreaturePermanent()); + this.addAbility(ability); + } + + public UnspeakableSymbol(final UnspeakableSymbol card) { + super(card); + } + + @Override + public UnspeakableSymbol copy() { + return new UnspeakableSymbol(this); + } +} diff --git a/Mage.Sets/src/mage/sets/timespiral/SaffiEriksdotter.java b/Mage.Sets/src/mage/sets/timespiral/SaffiEriksdotter.java new file mode 100644 index 00000000000..fe9b4f91a7d --- /dev/null +++ b/Mage.Sets/src/mage/sets/timespiral/SaffiEriksdotter.java @@ -0,0 +1,150 @@ +/* + * 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.timespiral; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.SacrificeSourceCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ReturnToBattlefieldUnderYourControlTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeEvent; +import mage.target.Target; +import mage.target.common.TargetCreaturePermanent; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author Plopman + */ +public class SaffiEriksdotter extends CardImpl { + + public SaffiEriksdotter(UUID ownerId) { + super(ownerId, 245, "Saffi Eriksdotter", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{G}{W}"); + this.expansionSetCode = "TSP"; + this.supertype.add("Legendary"); + this.subtype.add("Human"); + this.subtype.add("Scout"); + + this.color.setGreen(true); + this.color.setWhite(true); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Sacrifice Saffi Eriksdotter: When target creature is put into your graveyard from the battlefield this turn, return that card to the battlefield. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SaffiEriksdotterEffect(), new SacrificeSourceCost()); + Target target = new TargetCreaturePermanent(new FilterCreaturePermanent()); + ability.addTarget(target); + this.addAbility(ability); + } + + public SaffiEriksdotter(final SaffiEriksdotter card) { + super(card); + } + + @Override + public SaffiEriksdotter copy() { + return new SaffiEriksdotter(this); + } +} + +class SaffiEriksdotterEffect extends OneShotEffect { + + public SaffiEriksdotterEffect() { + super(Outcome.PutCreatureInPlay); + this.staticText = "When target creature other than Adarkar Valkyrie dies this turn, return that card to the battlefield under your control"; + } + + public SaffiEriksdotterEffect(final SaffiEriksdotterEffect effect) { + super(effect); + } + + @Override + public SaffiEriksdotterEffect copy() { + return new SaffiEriksdotterEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + DelayedTriggeredAbility delayedAbility = new SaffiEriksdotterDelayedTriggeredAbility(new FixedTarget(this.getTargetPointer().getFirst(game, source))); + delayedAbility.setSourceId(source.getSourceId()); + delayedAbility.setControllerId(source.getControllerId()); + game.addDelayedTriggeredAbility(delayedAbility); + return false; + } +} + + +class SaffiEriksdotterDelayedTriggeredAbility extends DelayedTriggeredAbility { + + protected FixedTarget fixedTarget; + + public SaffiEriksdotterDelayedTriggeredAbility(FixedTarget fixedTarget) { + super(new ReturnToBattlefieldUnderYourControlTargetEffect(), Duration.EndOfTurn); + this.getEffects().get(0).setTargetPointer(fixedTarget); + this.fixedTarget = fixedTarget; + } + + public SaffiEriksdotterDelayedTriggeredAbility(final SaffiEriksdotterDelayedTriggeredAbility ability) { + super(ability); + this.fixedTarget = ability.fixedTarget; + } + + @Override + public SaffiEriksdotterDelayedTriggeredAbility copy() { + return new SaffiEriksdotterDelayedTriggeredAbility(this); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).isDiesEvent()) { + if (fixedTarget.getFirst(game, this).equals(event.getTargetId())) { + return true; + } + } + return false; + } + + @Override + public String getRule() { + return "When target creature other than Adarkar Valkyrie dies this turn, " + super.getRule(); + } +} + +