forked from External/mage
[WOC] Implement Loamcrafter Faun (#11018)
This commit is contained in:
parent
6852786a10
commit
8b6863e6f3
2 changed files with 101 additions and 0 deletions
100
Mage.Sets/src/mage/cards/l/LoamcrafterFaun.java
Normal file
100
Mage.Sets/src/mage/cards/l/LoamcrafterFaun.java
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
package mage.cards.l;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.delayed.ReflexiveTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterPermanentCard;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
import mage.target.common.TargetDiscard;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Xanderhall
|
||||
*/
|
||||
public final class LoamcrafterFaun extends CardImpl {
|
||||
|
||||
public LoamcrafterFaun(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}");
|
||||
|
||||
this.subtype.add(SubType.SATYR);
|
||||
this.subtype.add(SubType.DRUID);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
// When Loamcrafter Faun enters the battlefield, you may discard one or more land cards. When you do, return up to that many target nonland permanent cards from your graveyard to your hand.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new LoamcrafterFaunDiscardEffect()));
|
||||
}
|
||||
|
||||
private LoamcrafterFaun(final LoamcrafterFaun card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoamcrafterFaun copy() {
|
||||
return new LoamcrafterFaun(this);
|
||||
}
|
||||
}
|
||||
|
||||
class LoamcrafterFaunDiscardEffect extends OneShotEffect {
|
||||
|
||||
private static FilterCard filter = new FilterPermanentCard("nonland permanent cards in your graveyard");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.not(CardType.LAND.getPredicate()));
|
||||
}
|
||||
|
||||
LoamcrafterFaunDiscardEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "you may discard one or more land cards. When you do, return up to that many target nonland permanent cards from your graveyard to your hand.";
|
||||
}
|
||||
|
||||
private LoamcrafterFaunDiscardEffect(final LoamcrafterFaunDiscardEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoamcrafterFaunDiscardEffect copy() {
|
||||
return new LoamcrafterFaunDiscardEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
TargetDiscard target = new TargetDiscard(
|
||||
0, Integer.MAX_VALUE,
|
||||
StaticFilters.FILTER_CARD_LANDS, player.getId()
|
||||
);
|
||||
player.choose(Outcome.Discard, target, source, game);
|
||||
Cards cards = player.discard(new CardsImpl(target.getTargets()), false, source, game);
|
||||
|
||||
// No cards discarded, effect still resolves
|
||||
if (cards.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(new ReturnFromGraveyardToHandTargetEffect(), false);
|
||||
ability.addTarget(new TargetCardInYourGraveyard(0, cards.size(), filter, false));
|
||||
game.fireReflexiveTriggeredAbility(ability, source);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -76,6 +76,7 @@ public final class WildsOfEldraineCommander extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Kindred Dominance", 113, Rarity.RARE, mage.cards.k.KindredDominance.class));
|
||||
cards.add(new SetCardInfo("Kor Spiritdancer", 69, Rarity.RARE, mage.cards.k.KorSpiritdancer.class));
|
||||
cards.add(new SetCardInfo("Krosan Verge", 163, Rarity.UNCOMMON, mage.cards.k.KrosanVerge.class));
|
||||
cards.add(new SetCardInfo("Loamcrafter Faun", 19, Rarity.RARE, mage.cards.l.LoamcrafterFaun.class));
|
||||
cards.add(new SetCardInfo("Mantle of the Ancients", 70, Rarity.RARE, mage.cards.m.MantleOfTheAncients.class));
|
||||
cards.add(new SetCardInfo("Midnight Clock", 99, Rarity.RARE, mage.cards.m.MidnightClock.class));
|
||||
cards.add(new SetCardInfo("Mind Stone", 148, Rarity.COMMON, mage.cards.m.MindStone.class));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue