Merge pull request #1015 from jgod/master

Added new Filter type - FilterArtifactSpell
This commit is contained in:
Justin Godesky 2015-06-05 09:23:31 -04:00
commit e46439aa47
13 changed files with 77 additions and 120 deletions

View file

@ -32,27 +32,20 @@ import mage.abilities.effects.common.CounterTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.target.TargetSpell;
import mage.filter.common.FilterArtifactSpell;
/**
*
* @author Jgod
*/
public class ArtifactBlast extends CardImpl {
private static final FilterSpell filter = new FilterSpell("artifact spell");
static {
filter.add(new CardTypePredicate(CardType.ARTIFACT));
}
public ArtifactBlast(UUID ownerId) {
super(ownerId, 87, "Artifact Blast", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{R}");
this.expansionSetCode = "ATQ";
// Counter target artifact spell.
this.getSpellAbility().addTarget(new TargetSpell(filter));
this.getSpellAbility().addTarget(new TargetSpell(new FilterArtifactSpell()));
this.getSpellAbility().addEffect(new CounterTargetEffect());
}

View file

@ -34,22 +34,13 @@ import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.filter.FilterSpell;
import mage.filter.common.FilterArtifactCard;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.common.FilterArtifactSpell;
/**
*
* @author LevelX2
*/
public class VedalkenArchmage extends CardImpl {
private static final FilterSpell filter = new FilterSpell("an artifact spell");
static {
filter.add(new CardTypePredicate(CardType.ARTIFACT));
}
public VedalkenArchmage(UUID ownerId) {
super(ownerId, 55, "Vedalken Archmage", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{U}{U}");
this.expansionSetCode = "MRD";
@ -60,6 +51,7 @@ public class VedalkenArchmage extends CardImpl {
this.toughness = new MageInt(2);
// Whenever you cast an artifact spell, draw a card.
FilterArtifactSpell filter = new FilterArtifactSpell("an artifact spell");
this.addAbility(new SpellCastControllerTriggeredAbility(new DrawCardSourceControllerEffect(1), filter, false));
}

View file

@ -35,7 +35,7 @@ import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.filter.FilterSpell;
import mage.filter.common.FilterArtifactSpell;
import mage.target.common.TargetCreaturePermanent;
/**
@ -43,9 +43,7 @@ import mage.target.common.TargetCreaturePermanent;
* @author North
*/
public class MirranSpy extends CardImpl {
private static final FilterSpell filter = new FilterSpell("an artifact spell");
public MirranSpy(UUID ownerId) {
super(ownerId, 26, "Mirran Spy", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{U}");
this.expansionSetCode = "MBS";
@ -58,6 +56,7 @@ public class MirranSpy extends CardImpl {
this.addAbility(FlyingAbility.getInstance());
// Whenever you cast an artifact spell, you may untap target creature.
FilterArtifactSpell filter = new FilterArtifactSpell("an artifact spell");
SpellCastControllerTriggeredAbility ability = new SpellCastControllerTriggeredAbility(new UntapTargetEffect(), filter, true);
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);

View file

@ -34,31 +34,22 @@ import mage.abilities.Mode;
import mage.abilities.effects.common.CounterTargetEffect;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.cards.CardImpl;
import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.target.TargetSpell;
import mage.target.common.TargetArtifactPermanent;
import mage.filter.common.FilterArtifactSpell;
/**
*
* @author North
*/
public class SteelSabotage extends CardImpl {
private static final FilterSpell filter = new FilterSpell("artifact spell");
static {
filter.add(new CardTypePredicate(CardType.ARTIFACT));
}
public SteelSabotage(UUID ownerId) {
super(ownerId, 33, "Steel Sabotage", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{U}");
this.expansionSetCode = "MBS";
// Choose one - Counter target artifact spell; or return target artifact to its owner's hand.
this.getSpellAbility().addEffect(new CounterTargetEffect());
this.getSpellAbility().addTarget(new TargetSpell(filter));
this.getSpellAbility().addTarget(new TargetSpell(new FilterArtifactSpell()));
Mode mode = new Mode();
mode.getEffects().add(new ReturnToHandTargetEffect());
mode.getTargets().add(new TargetArtifactPermanent());

View file

@ -25,7 +25,6 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.scarsofmirrodin;
import java.util.UUID;
@ -40,8 +39,7 @@ import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.constants.Outcome;
import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.common.FilterArtifactSpell;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -51,12 +49,6 @@ import mage.target.common.TargetCreatureOrPlayer;
* @author Loki, North
*/
public class Embersmith extends CardImpl {
private static final FilterSpell filter = new FilterSpell("an artifact spell");
static {
filter.add(new CardTypePredicate(CardType.ARTIFACT));
}
public Embersmith(UUID ownerId) {
super(ownerId, 87, "Embersmith", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{R}");
this.expansionSetCode = "SOM";
@ -66,6 +58,7 @@ public class Embersmith extends CardImpl {
this.power = new MageInt(2);
this.toughness = new MageInt(1);
FilterArtifactSpell filter = new FilterArtifactSpell("an artifact spell");
SpellCastControllerTriggeredAbility ability = new SpellCastControllerTriggeredAbility(new EmbersmithEffect(), filter, false);
ability.addTarget(new TargetCreatureOrPlayer());
this.addAbility(ability);
@ -79,7 +72,6 @@ public class Embersmith extends CardImpl {
public Embersmith copy() {
return new Embersmith(this);
}
}
class EmbersmithEffect extends OneShotEffect {
@ -116,5 +108,4 @@ class EmbersmithEffect extends OneShotEffect {
public EmbersmithEffect copy() {
return new EmbersmithEffect(this);
}
}

View file

@ -25,14 +25,12 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.scarsofmirrodin;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.costs.common.RemoveCountersSourceCost;
@ -40,26 +38,22 @@ import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.permanent.token.Token;
import mage.filter.common.FilterArtifactSpell;
import mage.game.permanent.token.GolemToken;
/**
*
* @author Loki, North
*/
public class GolemFoundry extends CardImpl {
private static final FilterSpell filter = new FilterSpell("an artifact spell");
static {
filter.add(new CardTypePredicate(CardType.ARTIFACT));
}
public GolemFoundry (UUID ownerId) {
super(ownerId, 160, "Golem Foundry", Rarity.COMMON, new CardType[]{CardType.ARTIFACT}, "{3}");
this.expansionSetCode = "SOM";
// Whenever you cast an artifact spell,
FilterArtifactSpell filter = new FilterArtifactSpell("an artifact spell");
this.addAbility(new SpellCastControllerTriggeredAbility(new AddCountersSourceEffect(CounterType.CHARGE.createInstance()), filter, true));
// you may put a charge counter on Golem Foundry.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new GolemToken()), new RemoveCountersSourceCost(CounterType.CHARGE.createInstance(3))));
}
@ -71,16 +65,4 @@ public class GolemFoundry extends CardImpl {
public GolemFoundry copy() {
return new GolemFoundry(this);
}
}
class GolemToken extends Token {
public GolemToken() {
super("Golem", "a 3/3 colorless Golem artifact creature token");
cardType.add(CardType.ARTIFACT);
cardType.add(CardType.CREATURE);
subtype.add("Golem");
power = new MageInt(3);
toughness = new MageInt(3);
}
}

View file

@ -25,7 +25,6 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.scarsofmirrodin;
import java.util.UUID;
@ -34,8 +33,7 @@ import mage.constants.Rarity;
import mage.abilities.effects.common.CounterTargetEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.cards.CardImpl;
import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.common.FilterArtifactSpell;
import mage.target.TargetSpell;
/**
@ -43,18 +41,12 @@ import mage.target.TargetSpell;
* @author Loki
*/
public class HaltOrder extends CardImpl {
private static final FilterSpell filter = new FilterSpell("artifact spell");
static {
filter.add(new CardTypePredicate(CardType.ARTIFACT));
}
public HaltOrder (UUID ownerId) {
super(ownerId, 34, "Halt Order", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{2}{U}");
this.expansionSetCode = "SOM";
this.getSpellAbility().addTarget(new TargetSpell(filter));
// Counter target artifact spell. Draw a card.
this.getSpellAbility().addTarget(new TargetSpell(new FilterArtifactSpell()));
this.getSpellAbility().addEffect(new CounterTargetEffect());
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1));
}
@ -67,5 +59,4 @@ public class HaltOrder extends CardImpl {
public HaltOrder copy() {
return new HaltOrder(this);
}
}

View file

@ -25,7 +25,6 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.scarsofmirrodin;
import java.util.UUID;
@ -40,8 +39,7 @@ import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.constants.Outcome;
import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.common.FilterArtifactSpell;
import mage.game.Game;
import mage.players.Player;
@ -50,12 +48,6 @@ import mage.players.Player;
* @author Loki
*/
public class Lifesmith extends CardImpl {
private static final FilterSpell filter = new FilterSpell("an artifact spell");
static {
filter.add(new CardTypePredicate(CardType.ARTIFACT));
}
public Lifesmith (UUID ownerId) {
super(ownerId, 124, "Lifesmith", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{G}");
this.expansionSetCode = "SOM";
@ -65,6 +57,7 @@ public class Lifesmith extends CardImpl {
this.power = new MageInt(2);
this.toughness = new MageInt(1);
FilterArtifactSpell filter = new FilterArtifactSpell("an artifact spell");
this.addAbility(new SpellCastControllerTriggeredAbility(new LifesmithEffect(), filter, false));
}
@ -106,5 +99,4 @@ class LifesmithEffect extends OneShotEffect {
public LifesmithEffect copy() {
return new LifesmithEffect(this);
}
}

View file

@ -25,7 +25,6 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.scarsofmirrodin;
import java.util.UUID;
@ -40,8 +39,7 @@ import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.constants.Outcome;
import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.common.FilterArtifactSpell;
import mage.game.Game;
import mage.game.permanent.token.MyrToken;
@ -50,12 +48,6 @@ import mage.game.permanent.token.MyrToken;
* @author Loki, North
*/
public class Myrsmith extends CardImpl {
private static final FilterSpell filter = new FilterSpell("an artifact spell");
static {
filter.add(new CardTypePredicate(CardType.ARTIFACT));
}
public Myrsmith (UUID ownerId) {
super(ownerId, 16, "Myrsmith", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{W}");
this.expansionSetCode = "SOM";
@ -65,6 +57,7 @@ public class Myrsmith extends CardImpl {
this.power = new MageInt(2);
this.toughness = new MageInt(1);
FilterArtifactSpell filter = new FilterArtifactSpell("an artifact spell");
this.addAbility(new SpellCastControllerTriggeredAbility(new MyrsmithEffect(), filter, false));
}
@ -76,7 +69,6 @@ public class Myrsmith extends CardImpl {
public Myrsmith copy() {
return new Myrsmith(this);
}
}
class MyrsmithEffect extends OneShotEffect {
@ -103,5 +95,4 @@ class MyrsmithEffect extends OneShotEffect {
public MyrsmithEffect copy() {
return new MyrsmithEffect(this);
}
}

View file

@ -38,8 +38,7 @@ import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.keyword.DeathtouchAbility;
import mage.cards.CardImpl;
import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.common.FilterArtifactSpell;
import mage.target.common.TargetCreaturePermanent;
/**
@ -47,12 +46,6 @@ import mage.target.common.TargetCreaturePermanent;
* @author Loki, North
*/
public class Painsmith extends CardImpl {
private static final FilterSpell filter = new FilterSpell("an artifact spell");
static {
filter.add(new CardTypePredicate(CardType.ARTIFACT));
}
public Painsmith (UUID ownerId) {
super(ownerId, 74, "Painsmith", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{B}");
this.expansionSetCode = "SOM";
@ -62,6 +55,7 @@ public class Painsmith extends CardImpl {
this.power = new MageInt(2);
this.toughness = new MageInt(1);
FilterArtifactSpell filter = new FilterArtifactSpell("an artifact spell");
SpellCastControllerTriggeredAbility ability = new SpellCastControllerTriggeredAbility(new BoostTargetEffect(2, 0, Duration.EndOfTurn), filter, true);
ability.addEffect(new GainAbilityTargetEffect(DeathtouchAbility.getInstance(), Duration.EndOfTurn));
ability.addTarget(new TargetCreaturePermanent());

View file

@ -46,6 +46,7 @@ import java.util.UUID;
import mage.abilities.effects.common.CopySpellForEachItCouldTargetEffect;
import mage.filter.FilterInPlay;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.permanent.token.GolemToken;
import mage.util.TargetAddress;
/**
@ -140,7 +141,6 @@ class PrecursorGolemCopyTriggeredAbility extends TriggeredAbilityImpl {
}
}
class PrecursorGolemCopySpellEffect extends CopySpellForEachItCouldTargetEffect<Permanent> {
public PrecursorGolemCopySpellEffect() {

View file

@ -35,20 +35,13 @@ import mage.MageInt;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.effects.common.DrawDiscardControllerEffect;
import mage.cards.CardImpl;
import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.common.FilterArtifactSpell;
/**
*
* @author Loki, North
*/
public class Riddlesmith extends CardImpl {
private static final FilterSpell filter = new FilterSpell("an artifact spell");
static {
filter.add(new CardTypePredicate(CardType.ARTIFACT));
}
public Riddlesmith (UUID ownerId) {
super(ownerId, 40, "Riddlesmith", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{U}");
this.expansionSetCode = "SOM";
@ -58,7 +51,8 @@ public class Riddlesmith extends CardImpl {
this.power = new MageInt(2);
this.toughness = new MageInt(1);
this.addAbility(new SpellCastControllerTriggeredAbility(new DrawDiscardControllerEffect(), filter, true));
// Whenever you cast an artifact spell, you may draw a card. If you do, discard a card.
this.addAbility(new SpellCastControllerTriggeredAbility(new DrawDiscardControllerEffect(), new FilterArtifactSpell("an artifact spell"), true));
}
public Riddlesmith (final Riddlesmith card) {
@ -69,5 +63,4 @@ public class Riddlesmith extends CardImpl {
public Riddlesmith copy() {
return new Riddlesmith(this);
}
}

View file

@ -0,0 +1,48 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.filter.common;
import mage.constants.CardType;
import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.CardTypePredicate;
/**
*
* @author Jgod
*/
public class FilterArtifactSpell extends FilterSpell {
public FilterArtifactSpell() {
this("artifact spell");
}
public FilterArtifactSpell(String name) {
super(name);
this.add(new CardTypePredicate(CardType.ARTIFACT));
}
}