diff --git a/Mage.Sets/src/mage/cards/m/MerfolkWindrobber.java b/Mage.Sets/src/mage/cards/m/MerfolkWindrobber.java new file mode 100644 index 0000000000..eeebde115b --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/MerfolkWindrobber.java @@ -0,0 +1,96 @@ +package mage.cards.m; + +import java.util.UUID; + +import mage.MageInt; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.ActivateIfConditionActivatedAbility; +import mage.abilities.condition.common.CardsInOpponentGraveCondition; +import mage.abilities.costs.common.SacrificeSourceCost; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect; +import mage.constants.SubType; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.DamagedPlayerEvent; +import mage.game.events.GameEvent; +import mage.target.targetpointer.FixedTarget; + +/** + * @author TheElk801 + */ +public final class MerfolkWindrobber extends CardImpl { + + public MerfolkWindrobber(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{U}"); + + this.subtype.add(SubType.MERFOLK); + this.subtype.add(SubType.ROGUE); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Whenever Merfolk Windrobber deals combat damage to a player, that player mills a card. + this.addAbility(new MerfolkWindrobberTriggeredAbility()); + + // Sacrifice Merfolk Windrobber: Draw a card. Activate this ability only if an opponent has eight or more cards in their graveyard. + this.addAbility(new ActivateIfConditionActivatedAbility( + Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), + new SacrificeSourceCost(), CardsInOpponentGraveCondition.EIGHT + ).addHint(CardsInOpponentGraveCondition.EIGHT.getHint())); + } + + private MerfolkWindrobber(final MerfolkWindrobber card) { + super(card); + } + + @Override + public MerfolkWindrobber copy() { + return new MerfolkWindrobber(this); + } +} + +class MerfolkWindrobberTriggeredAbility extends TriggeredAbilityImpl { + + public MerfolkWindrobberTriggeredAbility() { + super(Zone.BATTLEFIELD, new PutLibraryIntoGraveTargetEffect(1)); + } + + public MerfolkWindrobberTriggeredAbility(final MerfolkWindrobberTriggeredAbility ability) { + super(ability); + } + + @Override + public MerfolkWindrobberTriggeredAbility copy() { + return new MerfolkWindrobberTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event; + if (damageEvent.isCombatDamage() && event.getSourceId().equals(this.getSourceId())) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getPlayerId())); + } + return true; + } + return false; + } + + @Override + public String getRule() { + return "Whenever {this} deals combat damage to a player, that player mills a card."; + } +} diff --git a/Mage.Sets/src/mage/sets/ZendikarRising.java b/Mage.Sets/src/mage/sets/ZendikarRising.java index efc244130e..844f71e807 100644 --- a/Mage.Sets/src/mage/sets/ZendikarRising.java +++ b/Mage.Sets/src/mage/sets/ZendikarRising.java @@ -113,6 +113,7 @@ public final class ZendikarRising extends ExpansionSet { cards.add(new SetCardInfo("Legion Angel", 23, Rarity.RARE, mage.cards.l.LegionAngel.class)); cards.add(new SetCardInfo("Linvala, Shield of Sea Gate", 226, Rarity.RARE, mage.cards.l.LinvalaShieldOfSeaGate.class)); cards.add(new SetCardInfo("Lotus Cobra", 193, Rarity.RARE, mage.cards.l.LotusCobra.class)); + cards.add(new SetCardInfo("Merfolk Windrobber", 70, Rarity.UNCOMMON, mage.cards.m.MerfolkWindrobber.class)); cards.add(new SetCardInfo("Might of Murasa", 194, Rarity.COMMON, mage.cards.m.MightOfMurasa.class)); cards.add(new SetCardInfo("Mind Carver", 113, Rarity.UNCOMMON, mage.cards.m.MindCarver.class)); cards.add(new SetCardInfo("Mountain", 275, Rarity.LAND, mage.cards.basiclands.Mountain.class, FULL_ART_BFZ_VARIOUS));