[MH2] Implemented Foundry Helix (#7881)

This commit is contained in:
Daniel Bomar 2021-06-03 18:49:53 -05:00 committed by GitHub
parent bff38a195d
commit 11a19a8fc1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 70 additions and 0 deletions

View file

@ -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";
}
}

View file

@ -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));