Implemented Stolen by the Fae

This commit is contained in:
Evan Kranzler 2019-09-12 16:59:38 -04:00
parent 181722f733
commit 57ff0a814d
2 changed files with 58 additions and 0 deletions

View file

@ -0,0 +1,57 @@
package mage.cards.s;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
import mage.game.Game;
import mage.game.permanent.token.FaerieToken;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetadjustment.TargetAdjuster;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class StolenByTheFae extends CardImpl {
public StolenByTheFae(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{U}{U}");
// Return target creature with converted mana cost X to its owner's hand. You create X 1/1 blue Faerie creature tokens with flying.
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect()
.setText("Return target creature with converted mana cost X to its owner's hand."));
this.getSpellAbility().addEffect(new CreateTokenEffect(new FaerieToken(), ManacostVariableValue.instance)
.setText("You create X 1/1 blue Faerie creature tokens with flying."));
this.getSpellAbility().setTargetAdjuster(StolenByTheFaeAdjuster.instance);
}
private StolenByTheFae(final StolenByTheFae card) {
super(card);
}
@Override
public StolenByTheFae copy() {
return new StolenByTheFae(this);
}
}
enum StolenByTheFaeAdjuster implements TargetAdjuster {
instance;
@Override
public void adjustTargets(Ability ability, Game game) {
ability.getTargets().clear();
int xValue = ability.getManaCostsToPay().getX();
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with converted mana cost " + xValue);
filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
ability.addTarget(new TargetCreaturePermanent(filter));
}
}

View file

@ -142,6 +142,7 @@ public final class ThroneOfEldraine extends ExpansionSet {
cards.add(new SetCardInfo("Spinning Wheel", 234, Rarity.UNCOMMON, mage.cards.s.SpinningWheel.class));
cards.add(new SetCardInfo("Steelbane Hydra", 322, Rarity.RARE, mage.cards.s.SteelbaneHydra.class));
cards.add(new SetCardInfo("Steelclaw Lance", 202, Rarity.UNCOMMON, mage.cards.s.SteelclawLance.class));
cards.add(new SetCardInfo("Stolen by the Fae", 66, Rarity.RARE, mage.cards.s.StolenByTheFae.class));
cards.add(new SetCardInfo("Syr Carah, the Bold", 145, Rarity.UNCOMMON, mage.cards.s.SyrCarahTheBold.class));
cards.add(new SetCardInfo("Syr Elenora, the Discerning", 67, Rarity.UNCOMMON, mage.cards.s.SyrElenoraTheDiscerning.class));
cards.add(new SetCardInfo("Syr Gwyn, Hero of Ashvale", 330, Rarity.MYTHIC, mage.cards.s.SyrGwynHeroOfAshvale.class));