Added Sundering Titan, Spellstutter Sprite, Waethered Wayfarer, Sulfure Elemental, Mistveil Plains.

This commit is contained in:
LevelX2 2013-03-11 19:04:51 +01:00
parent beafbe1aea
commit 787288c879
6 changed files with 627 additions and 0 deletions

View file

@ -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.darksteel;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.LeavesBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.mageobject.SupertypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.Target;
import mage.target.common.TargetLandPermanent;
/**
*
* @author LevelX2
*/
public class SunderingTitan extends CardImpl<SunderingTitan> {
public SunderingTitan(UUID ownerId) {
super(ownerId, 146, "Sundering Titan", Rarity.RARE, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{8}");
this.expansionSetCode = "DST";
this.subtype.add("Golem");
this.power = new MageInt(7);
this.toughness = new MageInt(10);
// When Sundering Titan enters the battlefield or leaves the battlefield, choose a land of each basic land type, then destroy those lands.
this.addAbility(new EntersBattlefieldTriggeredAbility(new SunderingTitanDestroyLandEffect(), false));
this.addAbility(new LeavesBattlefieldTriggeredAbility(new SunderingTitanDestroyLandEffect(), false));
}
public SunderingTitan(final SunderingTitan card) {
super(card);
}
@Override
public SunderingTitan copy() {
return new SunderingTitan(this);
}
}
class SunderingTitanDestroyLandEffect extends OneShotEffect<SunderingTitanDestroyLandEffect> {
public SunderingTitanDestroyLandEffect() {
super(Outcome.DestroyPermanent);
this.staticText = "choose a land of each basic land type, then destroy those lands";
}
public SunderingTitanDestroyLandEffect(final SunderingTitanDestroyLandEffect effect) {
super(effect);
}
@Override
public SunderingTitanDestroyLandEffect copy() {
return new SunderingTitanDestroyLandEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
Set<UUID> lands = new HashSet<UUID>();
if (controller != null && sourcePermanent != null) {
for (String landName : new String[] {"Forest","Island","Mountain","Plains","Swamp"}) {
FilterLandPermanent filter = new FilterLandPermanent(new StringBuilder(landName).append(" to destroy").toString());
filter.add(new SupertypePredicate("Basic"));
filter.add(new SubtypePredicate(landName));
Target target = new TargetLandPermanent(1,1, filter, true);
target.setRequired(true);
if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
controller.chooseTarget(outcome, target, source, game);
lands.add(target.getFirstTarget());
}
}
if (!lands.isEmpty()) {
int destroyedLands = 0;
for (UUID landId: lands) {
Permanent land = game.getPermanent(landId);
if (land != null) {
if (land.destroy(source.getSourceId(), game, false)) {
destroyedLands++;
}
}
}
game.informPlayers(new StringBuilder(sourcePermanent.getName()).append(": ").append(destroyedLands).append(destroyedLands > 1 ? " lands were destroyed":"land was destroyed").toString());
}
}
return false;
}
}

View file

@ -0,0 +1,144 @@
/*
* 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.lorwyn;
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.Mode;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlashAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.filter.Filter;
import mage.filter.FilterSpell;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.stack.StackObject;
import mage.target.TargetSpell;
/**
*
* @author LevelX2
*/
public class SpellstutterSprite extends CardImpl<SpellstutterSprite> {
public static final FilterCreaturePermanent filter = new FilterCreaturePermanent("number of Faeries you control");
static {
filter.add(new ControllerPredicate(Constants.TargetController.YOU));
filter.add(new SubtypePredicate("Faerie"));
}
public SpellstutterSprite(UUID ownerId) {
super(ownerId, 89, "Spellstutter Sprite", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{U}");
this.expansionSetCode = "LRW";
this.subtype.add("Faerie");
this.subtype.add("Wizard");
this.color.setBlue(true);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// Flash
this.addAbility(FlashAbility.getInstance());
// Flying
this.addAbility(FlyingAbility.getInstance());
// When Spellstutter Sprite enters the battlefield, counter target spell with converted mana cost X or less, where X is the number of Faeries you control.
this.addAbility(new EntersBattlefieldTriggeredAbility(new SpellstutterSpriteCounterTargetEffect()));
}
public SpellstutterSprite(final SpellstutterSprite card) {
super(card);
}
@Override
public void adjustTargets(Ability ability, Game game) {
if (ability instanceof EntersBattlefieldTriggeredAbility) {
int numberFaeries = game.getState().getBattlefield().countAll(filter, ability.getControllerId(), game);
FilterSpell xFilter = new FilterSpell(new StringBuilder("spell with converted mana cost ").append(numberFaeries).append(" or less").toString());
xFilter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, numberFaeries + 1));
ability.getTargets().clear();
ability.addTarget(new TargetSpell(xFilter));
}
}
@Override
public SpellstutterSprite copy() {
return new SpellstutterSprite(this);
}
}
class SpellstutterSpriteCounterTargetEffect extends OneShotEffect<SpellstutterSpriteCounterTargetEffect> {
public SpellstutterSpriteCounterTargetEffect() {
super(Outcome.Detriment);
}
public SpellstutterSpriteCounterTargetEffect(final SpellstutterSpriteCounterTargetEffect effect) {
super(effect);
}
@Override
public SpellstutterSpriteCounterTargetEffect copy() {
return new SpellstutterSpriteCounterTargetEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
/*
* The value of X needs to be determined both when the ability triggers (so you can choose
* a target) and again when the ability resolves (to check if that target is still legal).
* If the number of Faeries you control has decreased enough in that time to make the target
* illegal, Spellstutter Sprite's ability will be countered (and the targeted spell will
* resolve as normal).
*/
int numberFaeries = game.getState().getBattlefield().countAll(SpellstutterSprite.filter, source.getControllerId(), game);
StackObject stackObject = game.getStack().getStackObject(source.getFirstTarget());
if (stackObject.getManaCost().convertedManaCost() <= numberFaeries) {
if (game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game)) {
game.informPlayers(new StringBuilder(stackObject.getName()).append(" was countered").toString());
return true;
}
}
return false;
}
@Override
public String getText(Mode mode) {
return "counter target spell with converted mana cost X or less, where X is the number of Faeries you control";
}
}

View file

@ -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.ninthedition;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class WeatheredWayfarer extends mage.sets.onslaught.WeatheredWayfarer {
public WeatheredWayfarer(UUID ownerId) {
super(ownerId);
this.cardNumber = 54;
this.expansionSetCode = "9ED";
}
public WeatheredWayfarer(final WeatheredWayfarer card) {
super(card);
}
@Override
public WeatheredWayfarer copy() {
return new WeatheredWayfarer(this);
}
}

View file

@ -0,0 +1,101 @@
/*
* 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.onslaught;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.condition.Condition;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect;
import mage.cards.CardImpl;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterLandCard;
import mage.filter.common.FilterLandPermanent;
import mage.game.Game;
import mage.target.common.TargetCardInLibrary;
/**
*
* @author LevelX2
*/
public class WeatheredWayfarer extends CardImpl<WeatheredWayfarer> {
public WeatheredWayfarer(UUID ownerId) {
super(ownerId, 59, "Weathered Wayfarer", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{W}");
this.expansionSetCode = "ONS";
this.subtype.add("Human");
this.subtype.add("Nomad");
this.subtype.add("Cleric");
this.color.setWhite(true);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// {W}, {tap}: Search your library for a land card, reveal it, and put it into your hand. Then shuffle your library. Activate this ability only if an opponent controls more lands than you.
this.addAbility(new ActivateIfConditionActivatedAbility(
Zone.BATTLEFIELD,
new SearchLibraryPutInHandEffect(new TargetCardInLibrary(new FilterLandCard()), true, true),
new ManaCostsImpl("{W}"),
new OpponentControllsMoreLandCondition()));
}
public WeatheredWayfarer(final WeatheredWayfarer card) {
super(card);
}
@Override
public WeatheredWayfarer copy() {
return new WeatheredWayfarer(this);
}
}
class OpponentControllsMoreLandCondition implements Condition {
private static final FilterPermanent filter = new FilterLandPermanent();
@Override
public boolean apply(Game game, Ability source) {
int numLands = game.getBattlefield().countAll(filter, source.getControllerId(), game);
for (UUID opponentId: game.getOpponents(source.getControllerId())) {
if (numLands < game.getBattlefield().countAll(filter, opponentId, game)) {
return true;
}
}
return false;
}
@Override
public String toString() {
return "an opponent controls more lands than you";
}
}

View file

@ -0,0 +1,81 @@
/*
* 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.planarchaos;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.continious.BoostAllEffect;
import mage.abilities.keyword.FlashAbility;
import mage.abilities.keyword.SplitSecondAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.ColorPredicate;
/**
*
* @author LevelX2
*/
public class SulfurElemental extends CardImpl<SulfurElemental> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("white creatures");
static {
filter.add(new ColorPredicate(ObjectColor.WHITE));
}
public SulfurElemental(UUID ownerId) {
super(ownerId, 108, "Sulfur Elemental", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{R}");
this.expansionSetCode = "PLC";
this.subtype.add("Elemental");
this.color.setRed(true);
this.power = new MageInt(3);
this.toughness = new MageInt(2);
// Flash
this.addAbility(FlashAbility.getInstance());
// Split second
this.addAbility(SplitSecondAbility.getInstance());
// White creatures get +1/-1.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1,-1, Duration.WhileOnBattlefield, filter, false)));
}
public SulfurElemental(final SulfurElemental card) {
super(card);
}
@Override
public SulfurElemental copy() {
return new SulfurElemental(this);
}
}

View file

@ -0,0 +1,119 @@
/*
* 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.shadowmoor;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.common.EntersBattlefieldTappedAbility;
import mage.abilities.condition.common.ControlsPermanentCondition;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.mana.WhiteManaAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game;
import mage.target.common.TargetCardInYourGraveyard;
/**
*
* @author LevelX2
*/
public class MistveilPlains extends CardImpl<MistveilPlains> {
private static final FilterControlledPermanent filter = new FilterControlledPermanent("you control two or more white permanents");
static {
filter.add(new ColorPredicate(ObjectColor.WHITE));
}
public MistveilPlains(UUID ownerId) {
super(ownerId, 275, "Mistveil Plains", Rarity.UNCOMMON, new CardType[]{CardType.LAND}, "");
this.expansionSetCode = "SHM";
this.subtype.add("Plains");
// <i>({tap}: Add {W} to your mana pool.)</i>
this.addAbility(new WhiteManaAbility());
// Mistveil Plains enters the battlefield tapped.
this.addAbility(new EntersBattlefieldTappedAbility());
// {W}, {tap}: Put target card from your graveyard on the bottom of your library. Activate this ability only if you control two or more white permanents.
Ability ability = new ActivateIfConditionActivatedAbility(
Zone.BATTLEFIELD,
new MistveilPlainsGraveyardToLibraryEffect(),
new ManaCostsImpl("{W}"),
new ControlsPermanentCondition(filter, ControlsPermanentCondition.CountType.MORE_THAN, 1));
ability.addTarget(new TargetCardInYourGraveyard());
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}
public MistveilPlains(final MistveilPlains card) {
super(card);
}
@Override
public MistveilPlains copy() {
return new MistveilPlains(this);
}
}
class MistveilPlainsGraveyardToLibraryEffect extends OneShotEffect<MistveilPlainsGraveyardToLibraryEffect> {
public MistveilPlainsGraveyardToLibraryEffect() {
super(Outcome.Benefit);
this.staticText = "Put target card from your graveyard on the bottom of your library";
}
public MistveilPlainsGraveyardToLibraryEffect(final MistveilPlainsGraveyardToLibraryEffect effect) {
super(effect);
}
@Override
public MistveilPlainsGraveyardToLibraryEffect copy() {
return new MistveilPlainsGraveyardToLibraryEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Card card = game.getCard(getTargetPointer().getFirst(game, source));
if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD) {
return card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, false);
}
return false;
}
}