* Fixed some problems with filtering nonbasic lands (e.g. Fulminator Mage).

This commit is contained in:
LevelX2 2015-02-11 12:34:56 +01:00
parent 1cef92ef7a
commit 4fe5560222
10 changed files with 22 additions and 52 deletions

View file

@ -32,21 +32,13 @@ import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.effects.common.ExileTargetAndSearchGraveyardHandLibraryEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SupertypePredicate;
import mage.target.TargetPermanent;
import mage.target.common.TargetNonBasicLandPermanent;
/**
*
* @author LevelX2
*/
public class SowingSalt extends CardImpl {
private static final FilterLandPermanent filter = new FilterLandPermanent("nonbasic land");
static {
filter.add(Predicates.not(new SupertypePredicate("Basic")));
}
public SowingSalt(UUID ownerId) {
super(ownerId, 118, "Sowing Salt", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{2}{R}{R}");
@ -56,7 +48,7 @@ public class SowingSalt extends CardImpl {
// Exile target nonbasic land. Search its controller's graveyard, hand, and library for all cards with
// the same name as that land and exile them. Then that player shuffles his or her library.
this.getSpellAbility().addTarget(new TargetPermanent(filter));
this.getSpellAbility().addTarget(new TargetNonBasicLandPermanent());
this.getSpellAbility().addEffect(new ExileTargetAndSearchGraveyardHandLibraryEffect(false, "its controller's","all cards with the same name as that land"));
}

View file

@ -101,7 +101,7 @@ class FromTheAshesEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Map<UUID, Integer> playerAmount = new HashMap<UUID, Integer>();
Map<UUID, Integer> playerAmount = new HashMap<>();
for (UUID playerId : controller.getInRange()) {
Player player = game.getPlayer(playerId);
if (player != null) {
@ -110,16 +110,16 @@ class FromTheAshesEffect extends OneShotEffect {
amount++;
permanent.destroy(source.getSourceId(), game, false);
}
playerAmount.put(playerId, new Integer(amount));
playerAmount.put(playerId, amount);
}
}
for(Map.Entry<UUID, Integer> entry : playerAmount.entrySet()) {
Player player = game.getPlayer(entry.getKey());
if (player != null) {
TargetCardInLibrary target = new TargetCardInLibrary(0, entry.getValue().intValue(), new FilterBasicLandCard());
TargetCardInLibrary target = new TargetCardInLibrary(0, entry.getValue(), new FilterBasicLandCard());
if (player.searchLibrary(target, game)) {
if (target.getTargets().size() > 0) {
for (UUID cardId: (List<UUID>)target.getTargets()) {
for (UUID cardId: target.getTargets()) {
Card card = player.getLibrary().getCard(cardId, game);
if (card != null) {
card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), player.getId(), false);

View file

@ -40,7 +40,7 @@ import mage.filter.FilterPermanent;
import mage.filter.common.FilterBasicLandCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.NamePredicate;
import mage.filter.predicate.mageobject.SupertypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -84,11 +84,7 @@ class WaveOfVitriolEffect extends OneShotEffect {
new CardTypePredicate(CardType.ENCHANTMENT),
Predicates.and(
new CardTypePredicate(CardType.LAND),
Predicates.not(new NamePredicate("Island")),
Predicates.not(new NamePredicate("Mountain")),
Predicates.not(new NamePredicate("Plains")),
Predicates.not(new NamePredicate("Forest")),
Predicates.not(new NamePredicate("Swamp"))
Predicates.not(new SupertypePredicate("Basic"))
)
));

View file

@ -37,11 +37,8 @@ import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SupertypePredicate;
import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetLandPermanent;
import mage.target.common.TargetNonBasicLandPermanent;
/**
*
@ -49,12 +46,6 @@ import mage.target.common.TargetLandPermanent;
*/
public class ShivanHarvest extends CardImpl {
private static final FilterLandPermanent filter = new FilterLandPermanent("nonbasic land");
static {
filter.add(Predicates.not(new SupertypePredicate("Basic")));
}
public ShivanHarvest(UUID ownerId) {
super(ownerId, 167, "Shivan Harvest", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}");
this.expansionSetCode = "INV";
@ -62,7 +53,7 @@ public class ShivanHarvest extends CardImpl {
// {1}{R}, Sacrifice a creature: Destroy target nonbasic land.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{1}{R}"));
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent()));
ability.addTarget(new TargetLandPermanent(filter));
ability.addTarget(new TargetNonBasicLandPermanent());
this.addAbility(ability);
}

View file

@ -41,6 +41,7 @@ import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.filter.FilterCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.NamePredicate;
import mage.filter.predicate.mageobject.SupertypePredicate;
import mage.game.Game;
@ -58,6 +59,7 @@ public class SurgicalExtraction extends CardImpl {
private static final FilterCard filter = new FilterCard("card in a graveyard other than a basic land card");
static {
filter.add(Predicates.not(new CardTypePredicate(CardType.LAND)));
filter.add(Predicates.not(new SupertypePredicate("Basic")));
}

View file

@ -48,6 +48,7 @@ import mage.filter.FilterCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.NamePredicate;
import mage.filter.predicate.mageobject.SupertypePredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
@ -124,11 +125,7 @@ class NonBasicLandsInOpponentsGraveyards implements DynamicValue {
static {
filter.add(new CardTypePredicate(CardType.LAND));
filter.add(Predicates.not(new NamePredicate("Island")));
filter.add(Predicates.not(new NamePredicate("Forest")));
filter.add(Predicates.not(new NamePredicate("Mountain")));
filter.add(Predicates.not(new NamePredicate("Swamp")));
filter.add(Predicates.not(new NamePredicate("Plains")));
filter.add(Predicates.not(new SupertypePredicate("Basic")));
}

View file

@ -44,6 +44,7 @@ import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.common.FilterNonlandCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.NamePredicate;
import mage.filter.predicate.mageobject.SupertypePredicate;
import mage.game.Game;
@ -61,6 +62,7 @@ public class Extirpate extends CardImpl {
private static final FilterCard filter = new FilterCard("card in a graveyard other than a basic land card");
static {
filter.add(Predicates.not(new CardTypePredicate(CardType.LAND)));
filter.add(Predicates.not(new SupertypePredicate("Basic")));
}

View file

@ -43,6 +43,7 @@ import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.common.FilterNonlandCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.NamePredicate;
import mage.filter.predicate.mageobject.SupertypePredicate;
import mage.game.Game;
@ -85,6 +86,7 @@ class LobotomyEffect extends OneShotEffect {
private static final FilterCard filter = new FilterCard("card other than a basic land card");
static {
filter.add(Predicates.not(new CardTypePredicate(CardType.LAND)));
filter.add(Predicates.not(new SupertypePredicate("Basic")));
}

View file

@ -39,21 +39,13 @@ import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.mana.ColorlessManaAbility;
import mage.cards.CardImpl;
import mage.constants.Zone;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SupertypePredicate;
import mage.target.common.TargetLandPermanent;
import mage.target.common.TargetNonBasicLandPermanent;
/**
*
* @author Loki
*/
public class Wasteland extends CardImpl {
private static final FilterLandPermanent filter = new FilterLandPermanent("nonbasic land");
static {
filter.add(Predicates.not(new SupertypePredicate("Basic")));
}
public Wasteland(UUID ownerId) {
super(ownerId, 340, "Wasteland", Rarity.UNCOMMON, new CardType[]{CardType.LAND}, null);
@ -64,7 +56,7 @@ public class Wasteland extends CardImpl {
// {tap}, Sacrifice Wasteland: Destroy target nonbasic land.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new TapSourceCost());
ability.addCost(new SacrificeSourceCost());
ability.addTarget(new TargetLandPermanent(filter));
ability.addTarget(new TargetNonBasicLandPermanent());
this.addAbility(ability);
}

View file

@ -29,7 +29,7 @@
package mage.target.common;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.mageobject.SupertypePredicate;
/**
*
@ -38,11 +38,7 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
public class TargetNonBasicLandPermanent extends TargetLandPermanent {
public TargetNonBasicLandPermanent() {
filter.add(Predicates.not(new SubtypePredicate("Island")));
filter.add(Predicates.not(new SubtypePredicate("Forest")));
filter.add(Predicates.not(new SubtypePredicate("Mountain")));
filter.add(Predicates.not(new SubtypePredicate("Swamp")));
filter.add(Predicates.not(new SubtypePredicate("Plains")));
filter.add(Predicates.not(new SupertypePredicate("Basic")));
this.targetName = "nonbasic land";
}