Implemented ForcedMarch.java

This commit is contained in:
myersn024 2015-03-03 14:50:20 -06:00
parent 0c5fdb7301
commit ee224a391f

View file

@ -0,0 +1,68 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mage.sets.mercadianmasques;
import java.util.UUID;
import mage.abilities.Ability;
import mage.constants.CardType;
import mage.constants.Rarity;
/**
*
* @author nick.myers
*/
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
public class ForcedMarch extends CardImpl {
public ForcedMarch(UUID ownerId) {
super(ownerId, 136, "Forced March", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{X}{B}{B}{B}");
this.expansionSetCode = "MMQ";
// Destroy all creatures with converted mana cost X or less
this.getSpellAbility().addEffect(new ForcedMarchEffect());
}
public ForcedMarch(final ForcedMarch card) {
super(card);
}
@Override
public ForcedMarch copy() {
return new ForcedMarch(this);
}
}
class ForcedMarchEffect extends OneShotEffect {
public ForcedMarchEffect() {
super(Outcome.DestroyPermanent);
staticText = "Destroy all creatures with converted mana cost X or less";
}
public ForcedMarchEffect(final ForcedMarchEffect effect) {
super(effect);
}
@Override
public ForcedMarchEffect copy() {
return new ForcedMarchEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
for(Permanent permanent : game.getBattlefield().getAllActivePermanents(CardType.CREATURE)) {
if (permanent.getManaCost().convertedManaCost() <= source.getManaCostsToPay().getX()) {
permanent.destroy(source.getSourceId(), game, false);
}
}
return true;
}
}