diff --git a/Mage.Sets/src/mage/sets/legions/DarkSupplicant.java b/Mage.Sets/src/mage/sets/legions/DarkSupplicant.java new file mode 100644 index 00000000000..969656a239d --- /dev/null +++ b/Mage.Sets/src/mage/sets/legions/DarkSupplicant.java @@ -0,0 +1,156 @@ +/* + * 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.legions; + +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.SimpleActivatedAbility; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.Cards; +import mage.filter.FilterCard; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.predicate.mageobject.NamePredicate; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCardInLibrary; +import mage.target.common.TargetControlledPermanent; + +/** + * + * @author jeffwadsworth + */ +public class DarkSupplicant extends CardImpl { + + final static private FilterControlledPermanent filter = new FilterControlledPermanent("three Clerics you control"); + + static { + filter.add(new SubtypePredicate("Cleric")); + } + + public DarkSupplicant(UUID ownerId) { + super(ownerId, 64, "Dark Supplicant", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{B}"); + this.expansionSetCode = "LGN"; + this.subtype.add("Human"); + this.subtype.add("Cleric"); + + this.color.setBlack(true); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // {tap}, Sacrifice three Clerics: Search your graveyard, hand, and/or library for a card named Scion of Darkness and put it onto the battlefield. If you search your library this way, shuffle it. + Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new DarkSupplicantEffect(), new TapSourceCost()); + ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(3, 3, filter, true))); + this.addAbility(ability); + } + + public DarkSupplicant(final DarkSupplicant card) { + super(card); + } + + @Override + public DarkSupplicant copy() { + return new DarkSupplicant(this); + } +} + +class DarkSupplicantEffect extends OneShotEffect { + + public DarkSupplicantEffect() { + super(Constants.Outcome.Benefit); + this.staticText = "Search your graveyard, hand, and/or library for a card named Scion of Darkness and put it onto the battlefield. If you search your library this way, shuffle it"; + } + + public DarkSupplicantEffect(final DarkSupplicantEffect effect) { + super(effect); + } + + @Override + public DarkSupplicantEffect copy() { + return new DarkSupplicantEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + FilterCard filter = new FilterCard("card named Scion of Darkness"); + filter.add(new NamePredicate("Scion of Darkness")); + TargetCardInLibrary target = new TargetCardInLibrary(filter); + if (player == null) { + return false; + } + // Library check + if (player.chooseUse(Constants.Outcome.Benefit, "Do you want to search your library for Scion of Darkness?", game)) { + if (player.searchLibrary(target, game)) { + if (target.getTargets().size() > 0) { + for (UUID cardId : (List) target.getTargets()) { + Card card = player.getLibrary().getCard(cardId, game); + if (card != null) { + if (card.putOntoBattlefield(game, Constants.Zone.LIBRARY, source.getId(), source.getControllerId())) { + return true; + } + } + } + } + } + player.shuffleLibrary(game); + } + // Graveyard check + if (player.chooseUse(Constants.Outcome.Benefit, "Do you want to search your graveyard for Scion of Darkness?", game)) { + Cards graveyard = player.getGraveyard().copy(); + for (UUID card : graveyard) { + Card checkCard = game.getCard(card); + if (checkCard.getName().equals("Scion of Darkness")) { + checkCard.putOntoBattlefield(game, Constants.Zone.GRAVEYARD, source.getId(), source.getControllerId()); + return true; + } + } + } + // Hand check + if (player.chooseUse(Constants.Outcome.Benefit, "Do you want to search your hand for Scion of Darkness?", game)) { + Cards hand = player.getHand().copy(); + for (UUID card : hand) { + Card checkCard = game.getCard(card); + if (checkCard.getName().equals("Scion of Darkness")) { + checkCard.putOntoBattlefield(game, Constants.Zone.HAND, source.getId(), source.getControllerId()); + return true; + } + } + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/legions/ScionOfDarkness.java b/Mage.Sets/src/mage/sets/legions/ScionOfDarkness.java new file mode 100644 index 00000000000..f55bfbb47da --- /dev/null +++ b/Mage.Sets/src/mage/sets/legions/ScionOfDarkness.java @@ -0,0 +1,122 @@ +/* + * 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.legions; + +import java.util.UUID; +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Outcome; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; +import mage.abilities.keyword.TrampleAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.CyclingAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.filter.FilterCard; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.predicate.other.OwnerIdPredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCardInGraveyard; + +/** + * + * @author jeffwadsworth + */ +public class ScionOfDarkness extends CardImpl { + + public ScionOfDarkness(UUID ownerId) { + super(ownerId, 79, "Scion of Darkness", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{5}{B}{B}{B}"); + this.expansionSetCode = "LGN"; + this.subtype.add("Avatar"); + + this.color.setBlack(true); + this.power = new MageInt(6); + this.toughness = new MageInt(6); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + + // Whenever Scion of Darkness deals combat damage to a player, you may put target creature card from that player's graveyard onto the battlefield under your control. + Ability ability = new DealsCombatDamageToAPlayerTriggeredAbility(new ScionOfDarknessEffect(), true, true); + this.addAbility(ability); + + // Cycling {3} + this.addAbility(new CyclingAbility(new ManaCostsImpl("{3}"))); + } + + public ScionOfDarkness(final ScionOfDarkness card) { + super(card); + } + + @Override + public ScionOfDarkness copy() { + return new ScionOfDarkness(this); + } +} + +class ScionOfDarknessEffect extends OneShotEffect { + + public ScionOfDarknessEffect() { + super(Constants.Outcome.PutCreatureInPlay); + this.staticText = "you may put target creature card from that player's graveyard onto the battlefield under your control"; + } + + public ScionOfDarknessEffect(final ScionOfDarknessEffect effect) { + super(effect); + } + + @Override + public ScionOfDarknessEffect copy() { + return new ScionOfDarknessEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player damagedPlayer = game.getPlayer(targetPointer.getFirst(game, source)); + Player you = game.getPlayer(source.getControllerId()); + FilterCard filter = new FilterCard("creature in that player's graveyard"); + filter.add(new CardTypePredicate(CardType.CREATURE)); + filter.add(new OwnerIdPredicate(damagedPlayer.getId())); + TargetCardInGraveyard target = new TargetCardInGraveyard(filter); + if (target.canChoose(source.getSourceId(), you.getId(), game)) { + if (you.chooseTarget(Outcome.PutCreatureInPlay, target, source, game)) { + Card card = game.getCard(target.getFirstTarget()); + if (card != null) { + card.putOntoBattlefield(game, Constants.Zone.GRAVEYARD, id, you.getId()); + return true; + } + } + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/shardsofalara/PrinceOfThralls.java b/Mage.Sets/src/mage/sets/shardsofalara/PrinceOfThralls.java new file mode 100644 index 00000000000..04a1376a78b --- /dev/null +++ b/Mage.Sets/src/mage/sets/shardsofalara/PrinceOfThralls.java @@ -0,0 +1,155 @@ +/* + * 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.shardsofalara; + +import java.util.UUID; +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.Constants.Zone; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.costs.common.PayLifeCost; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +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.players.Player; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author jeffwadsworth + */ +public class PrinceOfThralls extends CardImpl { + + public PrinceOfThralls(UUID ownerId) { + super(ownerId, 182, "Prince of Thralls", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{4}{U}{B}{B}{R}"); + this.expansionSetCode = "ALA"; + this.subtype.add("Demon"); + + this.color.setRed(true); + this.color.setBlue(true); + this.color.setBlack(true); + this.power = new MageInt(7); + this.toughness = new MageInt(7); + + // Whenever a permanent an opponent controls is put into a graveyard, put that card onto the battlefield under your control unless that opponent pays 3 life. + this.addAbility(new PrinceOfThrallsTriggeredAbility(new PrinceOfThrallsEffect())); + } + + public PrinceOfThralls(final PrinceOfThralls card) { + super(card); + } + + @Override + public PrinceOfThralls copy() { + return new PrinceOfThralls(this); + } +} + +class PrinceOfThrallsTriggeredAbility extends TriggeredAbilityImpl { + + PrinceOfThrallsTriggeredAbility(Effect effect) { + super(Constants.Zone.BATTLEFIELD, effect, false); + } + + PrinceOfThrallsTriggeredAbility(final PrinceOfThrallsTriggeredAbility ability) { + super(ability); + } + + @Override + public PrinceOfThrallsTriggeredAbility copy() { + return new PrinceOfThrallsTriggeredAbility(this); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + if (zEvent.getToZone() == Zone.GRAVEYARD) { + if (zEvent.getFromZone() == Zone.BATTLEFIELD) { + Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Constants.Zone.BATTLEFIELD); + if (game.getOpponents(this.getControllerId()).contains(permanent.getControllerId())) { + for (Effect effect : getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getTargetId())); + } + return true; + } + } + } + } + return false; + } + + @Override + public String getRule() { + return "Whenever a permanent an opponent controls is put into a graveyard, " + super.getRule(); + } +} + +class PrinceOfThrallsEffect extends OneShotEffect { + + public PrinceOfThrallsEffect() { + super(Constants.Outcome.Neutral); + this.staticText = "put that card onto the battlefield under your control unless that opponent pays 3 life"; + } + + public PrinceOfThrallsEffect(final PrinceOfThrallsEffect effect) { + super(effect); + } + + @Override + public PrinceOfThrallsEffect copy() { + return new PrinceOfThrallsEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Card card = game.getCard(targetPointer.getFirst(game, source)); + Permanent permanent = (Permanent) game.getLastKnownInformation(card.getId(), Constants.Zone.BATTLEFIELD); + Player opponent = game.getPlayer(permanent.getControllerId()); + if (opponent != null && card != null && permanent != null && source.getControllerId() != null) { + PayLifeCost cost = new PayLifeCost(3); + if (opponent.chooseUse(Constants.Outcome.Neutral, cost.getText() + " or " + permanent.getName() + " comes back into the battlefield under opponents control", game)) { + cost.clearPaid(); + if (cost.pay(source, game, source.getId(), opponent.getId(), true)) { + return true; + } + } + card.putOntoBattlefield(game, Zone.GRAVEYARD, id, source.getControllerId()); + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/zendikar/DevoutLightcaster.java b/Mage.Sets/src/mage/sets/zendikar/DevoutLightcaster.java index 6fa3e5b5902..f5f7ad595ec 100644 --- a/Mage.Sets/src/mage/sets/zendikar/DevoutLightcaster.java +++ b/Mage.Sets/src/mage/sets/zendikar/DevoutLightcaster.java @@ -48,7 +48,7 @@ import mage.target.TargetPermanent; public class DevoutLightcaster extends CardImpl { private static final FilterCard filterProtection = new FilterCard("Black"); - private static final FilterPermanent filterTarget = new FilterPermanent("Black"); + private static final FilterPermanent filterTarget = new FilterPermanent("black permanent"); static { filterProtection.add(new ColorPredicate(ObjectColor.BLACK));