diff --git a/Mage.Sets/src/mage/cards/f/FoundryHelix.java b/Mage.Sets/src/mage/cards/f/FoundryHelix.java new file mode 100644 index 00000000000..6460d9aadfa --- /dev/null +++ b/Mage.Sets/src/mage/cards/f/FoundryHelix.java @@ -0,0 +1,69 @@ +package mage.cards.f; + +import java.util.UUID; + +import mage.abilities.Ability; +import mage.abilities.condition.Condition; +import mage.abilities.costs.Cost; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.abilities.effects.common.GainLifeEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetAnyTarget; +import mage.target.common.TargetControlledPermanent; + +/** + * + * @author weirddan455 + */ +public final class FoundryHelix extends CardImpl { + + public FoundryHelix(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{R}{W}"); + + // As an additional cost to cast this spell, sacrifice a permanent. + this.getSpellAbility().addCost(new SacrificeTargetCost(new TargetControlledPermanent())); + + // Foundry Helix deals 4 damage to any target. If the sacrificed permanent was an artifact, you gain 4 life. + this.getSpellAbility().addEffect(new DamageTargetEffect(4)); + this.getSpellAbility().addEffect(new ConditionalOneShotEffect(new GainLifeEffect(4), FoundryHelixCondition.instance)); + this.getSpellAbility().addTarget(new TargetAnyTarget()); + } + + private FoundryHelix(final FoundryHelix card) { + super(card); + } + + @Override + public FoundryHelix copy() { + return new FoundryHelix(this); + } +} + +enum FoundryHelixCondition implements Condition { + instance; + + @Override + public boolean apply(Game game, Ability source) { + for (Cost cost : source.getCosts()) { + if (cost instanceof SacrificeTargetCost) { + for (Permanent permanent : ((SacrificeTargetCost) cost).getPermanents()) { + if (permanent.isArtifact()) { + return true; + } + } + } + } + return false; + } + + @Override + public String toString() { + return "the sacrificed permanent was an artifact"; + } +} diff --git a/Mage.Sets/src/mage/sets/ModernHorizons2.java b/Mage.Sets/src/mage/sets/ModernHorizons2.java index 41336bd2248..0b77e819c04 100644 --- a/Mage.Sets/src/mage/sets/ModernHorizons2.java +++ b/Mage.Sets/src/mage/sets/ModernHorizons2.java @@ -113,6 +113,7 @@ public final class ModernHorizons2 extends ExpansionSet { cards.add(new SetCardInfo("Forest", 489, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Foul Watcher", 43, Rarity.COMMON, mage.cards.f.FoulWatcher.class)); cards.add(new SetCardInfo("Foundation Breaker", 160, Rarity.UNCOMMON, mage.cards.f.FoundationBreaker.class)); + cards.add(new SetCardInfo("Foundry Helix", 196, Rarity.COMMON, mage.cards.f.FoundryHelix.class)); cards.add(new SetCardInfo("Fractured Sanity", 44, Rarity.RARE, mage.cards.f.FracturedSanity.class)); cards.add(new SetCardInfo("Funnel-Web Recluse", 161, Rarity.COMMON, mage.cards.f.FunnelWebRecluse.class)); cards.add(new SetCardInfo("Fury", 126, Rarity.MYTHIC, mage.cards.f.Fury.class));