mirror of
https://github.com/correl/mage.git
synced 2024-12-27 20:06:31 +00:00
Sanguine Praetor - some minor clean up.
This commit is contained in:
parent
3f576b3a1c
commit
054d3a2f9b
1 changed files with 16 additions and 26 deletions
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.s;
|
package mage.cards.s;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
|
@ -39,27 +40,18 @@ import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.filter.common.FilterControlledPermanent;
|
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.common.TargetControlledPermanent;
|
import mage.target.common.TargetControlledPermanent;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Pete Rossi
|
* @author Pete Rossi
|
||||||
*/
|
*/
|
||||||
public class SanguinePraetor extends CardImpl {
|
public class SanguinePraetor extends CardImpl {
|
||||||
|
|
||||||
private static final FilterControlledPermanent controlledCreatureFilter = new FilterControlledPermanent("creature");
|
|
||||||
|
|
||||||
static {
|
|
||||||
controlledCreatureFilter.add(new CardTypePredicate(CardType.CREATURE));
|
|
||||||
}
|
|
||||||
|
|
||||||
public SanguinePraetor(UUID ownerId, CardSetInfo setInfo) {
|
public SanguinePraetor(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{6}{B}{B}");
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{6}{B}{B}");
|
||||||
|
|
||||||
|
@ -68,14 +60,11 @@ public class SanguinePraetor extends CardImpl {
|
||||||
this.power = new MageInt(7);
|
this.power = new MageInt(7);
|
||||||
this.toughness = new MageInt(5);
|
this.toughness = new MageInt(5);
|
||||||
|
|
||||||
ManaCostsImpl blackManaCost = new ManaCostsImpl("{B}");
|
// {B}, Sacrifice a creature: Destroy each creature with the same converted mana cost as the sacrificed creature.
|
||||||
SacrificeTargetCost sacrificeCost = new SacrificeTargetCost(new TargetControlledPermanent(controlledCreatureFilter));
|
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SanguinePraetorEffect(), new ManaCostsImpl("{B}"));
|
||||||
|
ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(new FilterControlledCreaturePermanent())));
|
||||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SanguinePraetorEffect(), blackManaCost);
|
|
||||||
ability.addCost(sacrificeCost);
|
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
|
|
||||||
// {B}, Sacrifice a creature: Destroy each creature with the same converted mana cost as the sacrificed creature.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public SanguinePraetor(final SanguinePraetor card) {
|
public SanguinePraetor(final SanguinePraetor card) {
|
||||||
|
@ -90,34 +79,35 @@ public class SanguinePraetor extends CardImpl {
|
||||||
|
|
||||||
class SanguinePraetorEffect extends OneShotEffect {
|
class SanguinePraetorEffect extends OneShotEffect {
|
||||||
|
|
||||||
private static final FilterCreaturePermanent creatureFilter = new FilterCreaturePermanent();
|
|
||||||
|
|
||||||
public SanguinePraetorEffect() {
|
public SanguinePraetorEffect() {
|
||||||
super(Outcome.Damage);
|
super(Outcome.Damage);
|
||||||
staticText = "Destroy each creature with the same converted mana cost as the sacrificed creature.";
|
staticText = "Destroy each creature with the same converted mana cost as the sacrificed creature.";
|
||||||
}
|
}
|
||||||
|
|
||||||
public SanguinePraetorEffect(final SanguinePraetorEffect effect) { super(effect); }
|
public SanguinePraetorEffect(final SanguinePraetorEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
int cmc = 0;
|
int cmc = 0;
|
||||||
for (Cost cost: source.getCosts()) {
|
for (Cost cost : source.getCosts()) {
|
||||||
if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost)cost).getPermanents().size() > 0) {
|
if (cost instanceof SacrificeTargetCost && ((SacrificeTargetCost) cost).getPermanents().size() > 0) {
|
||||||
cmc = ((SacrificeTargetCost)cost).getPermanents().get(0).getConvertedManaCost();
|
cmc = ((SacrificeTargetCost) cost).getPermanents().get(0).getConvertedManaCost();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(creatureFilter, source.getControllerId(), source.getSourceId(), game)) {
|
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game)) {
|
||||||
if (permanent.getConvertedManaCost() == cmc) {
|
if (permanent.getConvertedManaCost() == cmc) {
|
||||||
permanent.destroy(source.getSourceId(), game, false);
|
permanent.destroy(source.getSourceId(), game, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SanguinePraetorEffect copy() { return new SanguinePraetorEffect(this); }
|
public SanguinePraetorEffect copy() {
|
||||||
|
return new SanguinePraetorEffect(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue