Implemented Mutual Destruction

This commit is contained in:
Evan Kranzler 2020-04-11 21:54:53 -04:00
parent 63350177e7
commit 8a259456ff
2 changed files with 68 additions and 0 deletions

View file

@ -0,0 +1,67 @@
package mage.cards.m;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.keyword.FlashAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.target.TargetPermanent;
import mage.target.common.TargetControlledPermanent;
import java.util.UUID;
import static mage.filter.StaticFilters.FILTER_CONTROLLED_CREATURE_SHORT_TEXT;
/**
* @author TheElk801
*/
public final class MutualDestruction extends CardImpl {
private static final FilterPermanent filter = new FilterControlledPermanent();
private static final FilterPermanent filter2 = new FilterCreaturePermanent("creature (to destoy)");
static {
filter.add(new AbilityPredicate(FlashAbility.class));
}
private static final Condition condition = new PermanentsOnTheBattlefieldCondition(filter);
public MutualDestruction(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{B}");
// This spell has flash as long as you control a permanent with flash.
this.addAbility(new SimpleStaticAbility(Zone.ALL, new ConditionalContinuousEffect(
new GainAbilitySourceEffect(FlashAbility.getInstance(), Duration.Custom),
condition, "This spell has flash as long as you control a permanent with flash."
)));
// As an additional cost to cast this spell, sacrifice a creature.
this.getSpellAbility().addCost(new SacrificeTargetCost(
new TargetControlledPermanent(FILTER_CONTROLLED_CREATURE_SHORT_TEXT)
));
// Destroy target creature.
this.getSpellAbility().addEffect(new DestroyTargetEffect("Destroy target creature"));
this.getSpellAbility().addTarget(new TargetPermanent(filter2));
}
private MutualDestruction(final MutualDestruction card) {
super(card);
}
@Override
public MutualDestruction copy() {
return new MutualDestruction(this);
}
}

View file

@ -202,6 +202,7 @@ public final class IkoriaLairOfBehemoths extends ExpansionSet {
cards.add(new SetCardInfo("Mountain", 269, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Mountain", 270, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Mountain", 271, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Mutual Destruction", 96, Rarity.COMMON, mage.cards.m.MutualDestruction.class));
cards.add(new SetCardInfo("Mysterious Egg", 3, Rarity.COMMON, mage.cards.m.MysteriousEgg.class));
cards.add(new SetCardInfo("Mystic Subdual", 57, Rarity.UNCOMMON, mage.cards.m.MysticSubdual.class));
cards.add(new SetCardInfo("Mythos of Brokkos", 168, Rarity.RARE, mage.cards.m.MythosOfBrokkos.class));