From 0c0f7a0bc57032ff06cb8bf5bb8a2452cd6a8739 Mon Sep 17 00:00:00 2001 From: North Date: Wed, 28 Sep 2011 23:04:36 +0300 Subject: [PATCH] [ISD] cards --- .../sets/innistrad/CharmbreakerDevils.java | 124 ++++++++++++++++++ .../mage/sets/innistrad/DesperateRavings.java | 103 +++++++++++++++ .../mage/sets/innistrad/FalkenrathNoble.java | 118 +++++++++++++++++ .../src/mage/sets/innistrad/Ghoulraiser.java | 109 +++++++++++++++ .../src/mage/sets/innistrad/MakeAWish.java | 100 ++++++++++++++ .../mage/sets/innistrad/SelhoffOccultist.java | 114 ++++++++++++++++ 6 files changed, 668 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/innistrad/CharmbreakerDevils.java create mode 100644 Mage.Sets/src/mage/sets/innistrad/DesperateRavings.java create mode 100644 Mage.Sets/src/mage/sets/innistrad/FalkenrathNoble.java create mode 100644 Mage.Sets/src/mage/sets/innistrad/Ghoulraiser.java create mode 100644 Mage.Sets/src/mage/sets/innistrad/MakeAWish.java create mode 100644 Mage.Sets/src/mage/sets/innistrad/SelhoffOccultist.java diff --git a/Mage.Sets/src/mage/sets/innistrad/CharmbreakerDevils.java b/Mage.Sets/src/mage/sets/innistrad/CharmbreakerDevils.java new file mode 100644 index 00000000000..6a641ea6b3c --- /dev/null +++ b/Mage.Sets/src/mage/sets/innistrad/CharmbreakerDevils.java @@ -0,0 +1,124 @@ +/* + * 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.Random; +import java.util.UUID; +import mage.Constants.CardType; +import mage.Constants.Duration; +import mage.Constants.Outcome; +import mage.Constants.Rarity; +import mage.Constants.Zone; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.OnEventTriggeredAbility; +import mage.abilities.common.SpellCastTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continious.BoostSourceEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.filter.Filter.ComparisonScope; +import mage.filter.FilterCard; +import mage.game.Game; +import mage.game.events.GameEvent.EventType; +import mage.players.Player; + +/** + * + * @author North + */ +public class CharmbreakerDevils extends CardImpl { + + private static final FilterCard filter = new FilterCard("instant or sorcery card"); + + static { + filter.getCardType().add(CardType.INSTANT); + filter.getCardType().add(CardType.SORCERY); + filter.setScopeSubtype(ComparisonScope.Any); + } + + public CharmbreakerDevils(UUID ownerId) { + super(ownerId, 134, "Charmbreaker Devils", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{5}{R}"); + this.expansionSetCode = "ISD"; + this.subtype.add("Devil"); + + this.color.setRed(true); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // At the beginning of your upkeep, return an instant or sorcery card at random from your graveyard to your hand. + this.addAbility(new OnEventTriggeredAbility(EventType.UPKEEP_STEP_PRE, "beginning of your upkeep", new CharmbreakerDevilsEffect(), false)); + // Whenever you cast an instant or sorcery spell, Charmbreaker Devils gets +4/+0 until end of turn. + this.addAbility(new SpellCastTriggeredAbility(new BoostSourceEffect(4, 0, Duration.EndOfTurn), filter, false)); + } + + public CharmbreakerDevils(final CharmbreakerDevils card) { + super(card); + } + + @Override + public CharmbreakerDevils copy() { + return new CharmbreakerDevils(this); + } +} + +class CharmbreakerDevilsEffect extends OneShotEffect { + + public CharmbreakerDevilsEffect() { + super(Outcome.ReturnToHand); + this.staticText = "return an instant or sorcery card at random from your graveyard to your hand"; + } + + public CharmbreakerDevilsEffect(final CharmbreakerDevilsEffect effect) { + super(effect); + } + + @Override + public CharmbreakerDevilsEffect copy() { + return new CharmbreakerDevilsEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player != null) { + FilterCard filter = new FilterCard("instant or sorcery card"); + filter.getCardType().add(CardType.INSTANT); + filter.getCardType().add(CardType.SORCERY); + filter.setScopeSubtype(ComparisonScope.Any); + Card[] cards = player.getGraveyard().getCards(filter, game).toArray(new Card[0]); + if (cards.length > 0) { + Random rnd = new Random(); + Card card = cards[rnd.nextInt(cards.length)]; + card.moveToZone(Zone.HAND, source.getId(), game, true); + return true; + } + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/innistrad/DesperateRavings.java b/Mage.Sets/src/mage/sets/innistrad/DesperateRavings.java new file mode 100644 index 00000000000..bc8ad5be75e --- /dev/null +++ b/Mage.Sets/src/mage/sets/innistrad/DesperateRavings.java @@ -0,0 +1,103 @@ +/* + * 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.Outcome; +import mage.Constants.Rarity; +import mage.Constants.TimingRule; +import mage.abilities.Ability; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.FlashbackAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.Cards; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author North + */ +public class DesperateRavings extends CardImpl { + + public DesperateRavings(UUID ownerId) { + super(ownerId, 139, "Desperate Ravings", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{1}{R}"); + this.expansionSetCode = "ISD"; + + this.color.setRed(true); + + // Draw two cards, then discard a card at random. + this.getSpellAbility().addEffect(new DesperateRavingsEffect()); + // Flashback {2}{U} + this.addAbility(new FlashbackAbility(new ManaCostsImpl("{2}{U}"), TimingRule.INSTANT)); + } + + public DesperateRavings(final DesperateRavings card) { + super(card); + } + + @Override + public DesperateRavings copy() { + return new DesperateRavings(this); + } +} + +class DesperateRavingsEffect extends OneShotEffect { + + public DesperateRavingsEffect() { + super(Outcome.DrawCard); + this.staticText = "Draw two cards, then discard a card at random"; + } + + public DesperateRavingsEffect(final DesperateRavingsEffect effect) { + super(effect); + } + + @Override + public DesperateRavingsEffect copy() { + return new DesperateRavingsEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player != null) { + player.drawCards(2, game); + Cards hand = player.getHand(); + Card card = hand.getRandom(game); + if (card != null) { + player.discard(card, source, game); + } + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/innistrad/FalkenrathNoble.java b/Mage.Sets/src/mage/sets/innistrad/FalkenrathNoble.java new file mode 100644 index 00000000000..97183d4915b --- /dev/null +++ b/Mage.Sets/src/mage/sets/innistrad/FalkenrathNoble.java @@ -0,0 +1,118 @@ +/* + * 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.Zone; +import mage.MageInt; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.GainLifeEffect; +import mage.abilities.effects.common.LoseLifeTargetEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeEvent; +import mage.game.permanent.Permanent; +import mage.target.TargetPlayer; + +/** + * + * @author North + */ +public class FalkenrathNoble extends CardImpl { + + public FalkenrathNoble(UUID ownerId) { + super(ownerId, 100, "Falkenrath Noble", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{B}"); + this.expansionSetCode = "ISD"; + this.subtype.add("Vampire"); + + this.color.setBlack(true); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + this.addAbility(FlyingAbility.getInstance()); + // Whenever Falkenrath Noble or another creature dies, target player loses 1 life and you gain 1 life. + this.addAbility(new FalkenrathNobleTriggeredAbility()); + } + + public FalkenrathNoble(final FalkenrathNoble card) { + super(card); + } + + @Override + public FalkenrathNoble copy() { + return new FalkenrathNoble(this); + } +} + +class FalkenrathNobleTriggeredAbility extends TriggeredAbilityImpl { + + public FalkenrathNobleTriggeredAbility() { + super(Zone.BATTLEFIELD, new LoseLifeTargetEffect(1), false); + this.addEffect(new GainLifeEffect(1)); + this.addTarget(new TargetPlayer()); + } + + public FalkenrathNobleTriggeredAbility(final FalkenrathNobleTriggeredAbility ability) { + super(ability); + } + + @Override + public FalkenrathNobleTriggeredAbility copy() { + return new FalkenrathNobleTriggeredAbility(this); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) { + Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); + if (permanent != null) { + if (permanent.getId().equals(this.getSourceId())) { + return true; + } else { + if (permanent.getCardType().contains(CardType.CREATURE)) { + return true; + } + } + } + } + } + return false; + } + + @Override + public String getRule() { + return "Whenever {this} or another creature dies, target player loses 1 life and you gain 1 life."; + } +} diff --git a/Mage.Sets/src/mage/sets/innistrad/Ghoulraiser.java b/Mage.Sets/src/mage/sets/innistrad/Ghoulraiser.java new file mode 100644 index 00000000000..3f6a27e1795 --- /dev/null +++ b/Mage.Sets/src/mage/sets/innistrad/Ghoulraiser.java @@ -0,0 +1,109 @@ +/* + * 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.Random; +import java.util.UUID; +import mage.Constants.CardType; +import mage.Constants.Outcome; +import mage.Constants.Rarity; +import mage.Constants.Zone; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.filter.Filter.ComparisonScope; +import mage.filter.FilterCard; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author North + */ +public class Ghoulraiser extends CardImpl { + + public Ghoulraiser(UUID ownerId) { + super(ownerId, 102, "Ghoulraiser", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{B}{B}"); + this.expansionSetCode = "ISD"; + this.subtype.add("Zombie"); + + this.color.setBlack(true); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // When Ghoulraiser enters the battlefield, return a Zombie card at random from your graveyard to your hand. + this.addAbility(new EntersBattlefieldTriggeredAbility(new GhoulraiserEffect(), false)); + } + + public Ghoulraiser(final Ghoulraiser card) { + super(card); + } + + @Override + public Ghoulraiser copy() { + return new Ghoulraiser(this); + } +} + +class GhoulraiserEffect extends OneShotEffect { + + public GhoulraiserEffect() { + super(Outcome.ReturnToHand); + this.staticText = "return a Zombie card at random from your graveyard to your hand"; + } + + public GhoulraiserEffect(final GhoulraiserEffect effect) { + super(effect); + } + + @Override + public GhoulraiserEffect copy() { + return new GhoulraiserEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player != null) { + FilterCard filter = new FilterCard("Zombie card"); + filter.getSubtype().add("Zombie"); + filter.setScopeSubtype(ComparisonScope.Any); + Card[] cards = player.getGraveyard().getCards(filter, game).toArray(new Card[0]); + if (cards.length > 0) { + Random rnd = new Random(); + Card card = cards[rnd.nextInt(cards.length)]; + card.moveToZone(Zone.HAND, source.getId(), game, true); + return true; + } + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/innistrad/MakeAWish.java b/Mage.Sets/src/mage/sets/innistrad/MakeAWish.java new file mode 100644 index 00000000000..ff495e08370 --- /dev/null +++ b/Mage.Sets/src/mage/sets/innistrad/MakeAWish.java @@ -0,0 +1,100 @@ +/* + * 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.Outcome; +import mage.Constants.Rarity; +import mage.Constants.Zone; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.Cards; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author North + */ +public class MakeAWish extends CardImpl { + + public MakeAWish(UUID ownerId) { + super(ownerId, 192, "Make a Wish", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{3}{G}"); + this.expansionSetCode = "ISD"; + + this.color.setGreen(true); + + // Return two cards at random from your graveyard to your hand. + this.getSpellAbility().addEffect(new MakeAWishEffect()); + } + + public MakeAWish(final MakeAWish card) { + super(card); + } + + @Override + public MakeAWish copy() { + return new MakeAWish(this); + } +} + +class MakeAWishEffect extends OneShotEffect { + + public MakeAWishEffect() { + super(Outcome.ReturnToHand); + this.staticText = "Return two cards at random from your graveyard to your hand"; + } + + public MakeAWishEffect(final MakeAWishEffect effect) { + super(effect); + } + + @Override + public MakeAWishEffect copy() { + return new MakeAWishEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player != null) { + Cards cards = player.getGraveyard(); + for (int i = 0; i < 2 && !cards.isEmpty(); i++) { + Card card = cards.getRandom(game); + if (card != null) { + card.moveToZone(Zone.HAND, source.getId(), game, true); + } + } + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/innistrad/SelhoffOccultist.java b/Mage.Sets/src/mage/sets/innistrad/SelhoffOccultist.java new file mode 100644 index 00000000000..451ae6461d5 --- /dev/null +++ b/Mage.Sets/src/mage/sets/innistrad/SelhoffOccultist.java @@ -0,0 +1,114 @@ +/* + * 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.Zone; +import mage.MageInt; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect; +import mage.cards.CardImpl; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeEvent; +import mage.game.permanent.Permanent; +import mage.target.TargetPlayer; + +/** + * + * @author North + */ +public class SelhoffOccultist extends CardImpl { + + public SelhoffOccultist(UUID ownerId) { + super(ownerId, 73, "Selhoff Occultist", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{U}"); + this.expansionSetCode = "ISD"; + this.subtype.add("Human"); + this.subtype.add("Rogue"); + + this.color.setBlue(true); + this.power = new MageInt(2); + this.toughness = new MageInt(3); + + // Whenever Selhoff Occultist or another creature dies, target player puts the top card of his or her library into his or her graveyard. + this.addAbility(new SelhoffOccultistTriggeredAbility()); + } + + public SelhoffOccultist(final SelhoffOccultist card) { + super(card); + } + + @Override + public SelhoffOccultist copy() { + return new SelhoffOccultist(this); + } +} + +class SelhoffOccultistTriggeredAbility extends TriggeredAbilityImpl { + + public SelhoffOccultistTriggeredAbility() { + super(Zone.BATTLEFIELD, new PutLibraryIntoGraveTargetEffect(1), false); + this.addTarget(new TargetPlayer()); + } + + public SelhoffOccultistTriggeredAbility(final SelhoffOccultistTriggeredAbility ability) { + super(ability); + } + + @Override + public SelhoffOccultistTriggeredAbility copy() { + return new SelhoffOccultistTriggeredAbility(this); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) { + Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); + if (permanent != null) { + if (permanent.getId().equals(this.getSourceId())) { + return true; + } else { + if (permanent.getCardType().contains(CardType.CREATURE)) { + return true; + } + } + } + } + } + return false; + } + + @Override + public String getRule() { + return "Whenever {this} or another creature dies, target player puts the top card of his or her library into his or her graveyard."; + } +}