[ZNR] Implemented Feed the Swarm

This commit is contained in:
Evan Kranzler 2020-09-04 16:47:23 -04:00
parent 853431d8f6
commit 0c2d0a7a17
2 changed files with 80 additions and 0 deletions

View file

@ -0,0 +1,79 @@
package mage.cards.f;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class FeedTheSwarm extends CardImpl {
private static final FilterPermanent filter
= new FilterPermanent("creature or enchantment an opponent controls");
static {
filter.add(Predicates.or(
CardType.ARTIFACT.getPredicate(),
CardType.ENCHANTMENT.getPredicate()
));
}
public FeedTheSwarm(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{B}");
// Destroy target creature or enchantment an opponent controls. You lose life equal to that permanent's converted mana cost.
this.getSpellAbility().addEffect(new FeedTheSwarmEffect());
this.getSpellAbility().addTarget(new TargetPermanent(filter));
}
private FeedTheSwarm(final FeedTheSwarm card) {
super(card);
}
@Override
public FeedTheSwarm copy() {
return new FeedTheSwarm(this);
}
}
class FeedTheSwarmEffect extends OneShotEffect {
FeedTheSwarmEffect() {
super(Outcome.Benefit);
staticText = "destroy target creature or enchantment an opponent controls. " +
"You lose life equal to that permanent's converted mana cost";
}
private FeedTheSwarmEffect(final FeedTheSwarmEffect effect) {
super(effect);
}
@Override
public FeedTheSwarmEffect copy() {
return new FeedTheSwarmEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
Player player = game.getPlayer(source.getControllerId());
if (permanent == null || player == null) {
return false;
}
player.loseLife(permanent.getConvertedManaCost(), game, false);
permanent.destroy(source.getSourceId(), game, false);
return true;
}
}

View file

@ -104,6 +104,7 @@ public final class ZendikarRising extends ExpansionSet {
cards.add(new SetCardInfo("Expedition Diviner", 57, Rarity.COMMON, mage.cards.e.ExpeditionDiviner.class));
cards.add(new SetCardInfo("Expedition Skulker", 101, Rarity.COMMON, mage.cards.e.ExpeditionSkulker.class));
cards.add(new SetCardInfo("Farsight Adept", 14, Rarity.COMMON, mage.cards.f.FarsightAdept.class));
cards.add(new SetCardInfo("Feed the Swarm", 102, Rarity.COMMON, mage.cards.f.FeedTheSwarm.class));
cards.add(new SetCardInfo("Fissure Wizard", 140, Rarity.COMMON, mage.cards.f.FissureWizard.class));
cards.add(new SetCardInfo("Forest", 278, Rarity.LAND, mage.cards.basiclands.Forest.class, FULL_ART_BFZ_VARIOUS));
cards.add(new SetCardInfo("Gnarlid Colony", 185, Rarity.COMMON, mage.cards.g.GnarlidColony.class));