diff --git a/Mage.Sets/src/mage/sets/alliances/BalduvianDead.java b/Mage.Sets/src/mage/sets/alliances/BalduvianDead.java new file mode 100644 index 00000000000..750e798b8bd --- /dev/null +++ b/Mage.Sets/src/mage/sets/alliances/BalduvianDead.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.alliances; + +import java.util.UUID; + +/** + * + * @author jeffwadsworth + */ +public class BalduvianDead extends mage.sets.masterseditionii.BalduvianDead { + + public BalduvianDead(UUID ownerId) { + super(ownerId); + this.cardNumber = 1; + this.expansionSetCode = "ALL"; + } + + public BalduvianDead(final BalduvianDead card) { + super(card); + } + + @Override + public BalduvianDead copy() { + return new BalduvianDead(this); + } +} diff --git a/Mage.Sets/src/mage/sets/masterseditionii/BalduvianDead.java b/Mage.Sets/src/mage/sets/masterseditionii/BalduvianDead.java new file mode 100644 index 00000000000..177028e4360 --- /dev/null +++ b/Mage.Sets/src/mage/sets/masterseditionii/BalduvianDead.java @@ -0,0 +1,130 @@ +/* + * 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.masterseditionii; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility; +import mage.abilities.costs.common.ExileFromGraveCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.SacrificeTargetEffect; +import mage.abilities.keyword.HasteAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterCreatureCard; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.Token; +import mage.target.common.TargetCardInYourGraveyard; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author jeffwadsworth + */ +public class BalduvianDead extends CardImpl { + + public BalduvianDead(UUID ownerId) { + super(ownerId, 79, "Balduvian Dead", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{B}"); + this.expansionSetCode = "ME2"; + this.subtype.add("Zombie"); + this.power = new MageInt(2); + this.toughness = new MageInt(3); + + // {2}{R}, Exile a creature card from your graveyard: Put a 3/1 black and red Graveborn creature token with haste onto the battlefield. Sacrifice it at the beginning of the next end step. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BalduvianDeadEffect(), new ManaCostsImpl("{2}{R}")); + TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(new FilterCreatureCard()); + ability.addCost(new ExileFromGraveCost(target)); + this.addAbility(ability); + + } + + public BalduvianDead(final BalduvianDead card) { + super(card); + } + + @Override + public BalduvianDead copy() { + return new BalduvianDead(this); + } +} + +class BalduvianDeadEffect extends OneShotEffect { + + public BalduvianDeadEffect() { + super(Outcome.PutCreatureInPlay); + this.staticText = "Put a 3/1 black and red Graveborn creature token with haste onto the battlefield. Sacrifice it at the beginning of the next end step"; + } + + public BalduvianDeadEffect(final BalduvianDeadEffect effect) { + super(effect); + } + + @Override + public BalduvianDeadEffect copy() { + return new BalduvianDeadEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + CreateTokenEffect effect = new CreateTokenEffect(new BalduvianToken()); + effect.apply(game, source); + for (UUID tokenId : effect.getLastAddedTokenIds()) { + Permanent tokenPermanent = game.getPermanent(tokenId); + if (tokenPermanent != null) { + SacrificeTargetEffect sacrificeEffect = new SacrificeTargetEffect("Sacrifice the token at the beginning of the next end step", source.getControllerId()); + sacrificeEffect.setTargetPointer(new FixedTarget(tokenPermanent, game)); + DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect); + game.addDelayedTriggeredAbility(delayedAbility, source); + } + } + return true; + } +} + +class BalduvianToken extends Token { + + public BalduvianToken() { + super("Graveborn", "3/1 black and red Graveborn creature token with haste"); + cardType.add(CardType.CREATURE); + color.setBlack(true); + color.setRed(true); + power = new MageInt(3); + toughness = new MageInt(1); + subtype.add("Graveborn"); + addAbility(HasteAbility.getInstance()); + } +} diff --git a/Mage.Sets/src/mage/sets/morningtide/GracefulReprieve.java b/Mage.Sets/src/mage/sets/morningtide/GracefulReprieve.java new file mode 100644 index 00000000000..12ac0e3a2a2 --- /dev/null +++ b/Mage.Sets/src/mage/sets/morningtide/GracefulReprieve.java @@ -0,0 +1,177 @@ +/* + * 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.morningtide; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; +import mage.game.events.ZoneChangeEvent; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author jeffwadsworth + */ +public class GracefulReprieve extends CardImpl { + + public GracefulReprieve(UUID ownerId) { + super(ownerId, 11, "Graceful Reprieve", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{1}{W}"); + this.expansionSetCode = "MOR"; + + // When target creature dies this turn, return that card to the battlefield under its owner's control. + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + this.getSpellAbility().addEffect(new GracefulReprieveEffect()); + + } + + public GracefulReprieve(final GracefulReprieve card) { + super(card); + } + + @Override + public GracefulReprieve copy() { + return new GracefulReprieve(this); + } +} + +class GracefulReprieveEffect extends OneShotEffect { + + public GracefulReprieveEffect() { + super(Outcome.Benefit); + this.staticText = "When target creature dies this turn, return that card to the battlefield under its owner's control"; + } + + public GracefulReprieveEffect(final GracefulReprieveEffect effect) { + super(effect); + } + + @Override + public GracefulReprieveEffect copy() { + return new GracefulReprieveEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + DelayedTriggeredAbility delayedAbility = new GracefulReprieveDelayedTriggeredAbility(targetPointer.getFirst(game, source)); + game.addDelayedTriggeredAbility(delayedAbility, source); + return true; + } +} + +class GracefulReprieveDelayedTriggeredAbility extends DelayedTriggeredAbility { + + private UUID target; + + public GracefulReprieveDelayedTriggeredAbility(UUID target) { + super(new GracefulReprieveDelayedEffect(target), Duration.EndOfTurn); + this.target = target; + } + + public GracefulReprieveDelayedTriggeredAbility(GracefulReprieveDelayedTriggeredAbility ability) { + super(ability); + this.target = ability.target; + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.ZONE_CHANGE; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getTargetId().equals(target)) { + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) { + return true; + } + } + return false; + } + + @Override + public GracefulReprieveDelayedTriggeredAbility copy() { + return new GracefulReprieveDelayedTriggeredAbility(this); + } + + @Override + public String getRule() { + return "When target creature dies this turn, return that card to the battlefield under its owner's control."; + } +} + +class GracefulReprieveDelayedEffect extends OneShotEffect { + + private final UUID target; + + public GracefulReprieveDelayedEffect(UUID target) { + super(Outcome.PutCreatureInPlay); + this.target = target; + this.staticText = "return that card to the battlefield under its owner's control"; + } + + public GracefulReprieveDelayedEffect(final GracefulReprieveDelayedEffect effect) { + super(effect); + this.target = effect.target; + } + + @Override + public GracefulReprieveDelayedEffect copy() { + return new GracefulReprieveDelayedEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Permanent permanent = (Permanent) game.getLastKnownInformation(target, Zone.BATTLEFIELD); + if (controller != null + && permanent != null) { + Player player = game.getPlayer(permanent.getOwnerId()); + if (player != null) { + Card card = game.getCard(target); + if (card != null && game.getState().getZone(card.getId()).equals(Zone.GRAVEYARD)) { + return card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), player.getId()); + } + return true; + } + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/morningtide/SunflareShaman.java b/Mage.Sets/src/mage/sets/morningtide/SunflareShaman.java new file mode 100644 index 00000000000..99981f25d66 --- /dev/null +++ b/Mage.Sets/src/mage/sets/morningtide/SunflareShaman.java @@ -0,0 +1,115 @@ +/* + * 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.morningtide; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DamageSelfEffect; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCreatureOrPlayer; + +/** + * + * @author jeffwadsworth + */ +public class SunflareShaman extends CardImpl { + + public SunflareShaman(UUID ownerId) { + super(ownerId, 108, "Sunflare Shaman", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{R}"); + this.expansionSetCode = "MOR"; + this.subtype.add("Elemental"); + this.subtype.add("Shaman"); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // {1}{R}, {tap}: Sunflare Shaman deals X damage to target creature or player and X damage to itself, where X is the number of Elemental cards in your graveyard. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SunflareShamanEffect(), new ManaCostsImpl("{1}{R}")); + ability.addCost(new TapSourceCost()); + ability.addTarget(new TargetCreatureOrPlayer()); + this.addAbility(ability); + + } + + public SunflareShaman(final SunflareShaman card) { + super(card); + } + + @Override + public SunflareShaman copy() { + return new SunflareShaman(this); + } +} + +class SunflareShamanEffect extends OneShotEffect { + + private static final FilterCard filter = new FilterCard("Elemental"); + + static { + filter.add(new SubtypePredicate("Elemental")); + } + + public SunflareShamanEffect() { + super(Outcome.Damage); + this.staticText = "{this} deals X damage to target creature or player and X damage to itself, where X is the number of Elemental cards in your graveyard"; + } + + public SunflareShamanEffect(final SunflareShamanEffect effect) { + super(effect); + } + + @Override + public SunflareShamanEffect copy() { + return new SunflareShamanEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + int ElementalsInYourGraveyard = controller.getGraveyard().count(filter, game); + new DamageTargetEffect(ElementalsInYourGraveyard).apply(game, source); + new DamageSelfEffect(ElementalsInYourGraveyard).apply(game, source); + return true; + } + return false; + } +}