mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Merge pull request #771 from myersn024/master
implemented ForcedMarch.java
This commit is contained in:
commit
b95e7a0954
1 changed files with 74 additions and 0 deletions
74
Mage.Sets/src/mage/sets/mercadianmasques/ForcedMarch.java
Normal file
74
Mage.Sets/src/mage/sets/mercadianmasques/ForcedMarch.java
Normal file
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* 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.filter.common.FilterCreaturePermanent;
|
||||
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)) {
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(),
|
||||
source.getControllerId(),
|
||||
source.getSourceId(),
|
||||
game)) {
|
||||
if (permanent.getManaCost().convertedManaCost() <= source.getManaCostsToPay().getX()) {
|
||||
permanent.destroy(source.getSourceId(), game, false);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue