[AER] Refactored some similar abilities and effects

This commit is contained in:
Styxo 2017-01-18 14:25:58 +01:00
parent 6d0eb49ac8
commit d690926cef
29 changed files with 312 additions and 596 deletions

View file

@ -29,7 +29,6 @@ package mage.cards.a;
import mage.abilities.LoyaltyAbility; import mage.abilities.LoyaltyAbility;
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility; import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.abilities.effects.common.RevealLibraryPutIntoHandEffect; import mage.abilities.effects.common.RevealLibraryPutIntoHandEffect;
import mage.abilities.effects.common.SwordsToPlowsharesEffect; import mage.abilities.effects.common.SwordsToPlowsharesEffect;
import mage.abilities.effects.common.counter.AddCountersAllEffect; import mage.abilities.effects.common.counter.AddCountersAllEffect;
@ -38,7 +37,6 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.common.FilterPermanentCard; import mage.filter.common.FilterPermanentCard;
import mage.filter.common.FilterPlaneswalkerPermanent; import mage.filter.common.FilterPlaneswalkerPermanent;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
@ -49,6 +47,7 @@ import mage.target.common.TargetCreaturePermanent;
import java.util.UUID; import java.util.UUID;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.common.FilterControlledCreaturePermanent;
/** /**
* @author JRHerlehy * @author JRHerlehy
@ -56,12 +55,10 @@ import mage.constants.Zone;
public class AjaniUnyielding extends CardImpl { public class AjaniUnyielding extends CardImpl {
private static final FilterPermanentCard nonlandPermanentFilter = new FilterPermanentCard("nonland permanent cards"); private static final FilterPermanentCard nonlandPermanentFilter = new FilterPermanentCard("nonland permanent cards");
private static final FilterCreaturePermanent creatureFilter = new FilterCreaturePermanent("creature you control");
private static final FilterPlaneswalkerPermanent planeswalkerFilter = new FilterPlaneswalkerPermanent("other planeswalker you control"); private static final FilterPlaneswalkerPermanent planeswalkerFilter = new FilterPlaneswalkerPermanent("other planeswalker you control");
static { static {
nonlandPermanentFilter.add(Predicates.not(new CardTypePredicate(CardType.LAND))); nonlandPermanentFilter.add(Predicates.not(new CardTypePredicate(CardType.LAND)));
creatureFilter.add(new ControllerPredicate(TargetController.YOU));
planeswalkerFilter.add(new ControllerPredicate(TargetController.YOU)); planeswalkerFilter.add(new ControllerPredicate(TargetController.YOU));
planeswalkerFilter.add(new AnotherPredicate()); planeswalkerFilter.add(new AnotherPredicate());
} }
@ -77,12 +74,11 @@ public class AjaniUnyielding extends CardImpl {
// -2: Exile target creature. Its controller gains life equal to its power. // -2: Exile target creature. Its controller gains life equal to its power.
LoyaltyAbility ajaniAbility2 = new LoyaltyAbility(new SwordsToPlowsharesEffect(), -2); LoyaltyAbility ajaniAbility2 = new LoyaltyAbility(new SwordsToPlowsharesEffect(), -2);
ajaniAbility2.addEffect(new ExileTargetEffect());
ajaniAbility2.addTarget(new TargetCreaturePermanent()); ajaniAbility2.addTarget(new TargetCreaturePermanent());
this.addAbility(ajaniAbility2); this.addAbility(ajaniAbility2);
// -9: Put five +1/+1 counters on each creature you control and five loyalty counters on each other planeswalker you control. // -9: Put five +1/+1 counters on each creature you control and five loyalty counters on each other planeswalker you control.
LoyaltyAbility ajaniAbility3 = new LoyaltyAbility(new AddCountersAllEffect(CounterType.P1P1.createInstance(5), creatureFilter), -9); LoyaltyAbility ajaniAbility3 = new LoyaltyAbility(new AddCountersAllEffect(CounterType.P1P1.createInstance(5), new FilterControlledCreaturePermanent()), -9);
ajaniAbility3.addEffect(new AddCountersAllEffect(CounterType.LOYALTY.createInstance(5), planeswalkerFilter)); ajaniAbility3.addEffect(new AddCountersAllEffect(CounterType.LOYALTY.createInstance(5), planeswalkerFilter));
this.addAbility(ajaniAbility3); this.addAbility(ajaniAbility3);
} }

View file

@ -29,8 +29,8 @@ package mage.cards.b;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.SpellCounteredControllerTriggeredAbility;
import mage.abilities.effects.common.DrawDiscardControllerEffect; import mage.abilities.effects.common.DrawDiscardControllerEffect;
import mage.abilities.effects.common.cost.SpellsCostReductionControllerEffect; import mage.abilities.effects.common.cost.SpellsCostReductionControllerEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -40,11 +40,6 @@ import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.stack.Spell;
import mage.game.stack.StackObject;
/** /**
* *
@ -74,7 +69,7 @@ public class BaralChiefOfCompliance extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostReductionControllerEffect(filter, 1))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostReductionControllerEffect(filter, 1)));
// Whenever a spell or ability you control counters a spell, you may draw a card. If you do, discard a card. // Whenever a spell or ability you control counters a spell, you may draw a card. If you do, discard a card.
this.addAbility(new BaralChiefOfComplianceTriggeredAbility()); this.addAbility(new SpellCounteredControllerTriggeredAbility(new DrawDiscardControllerEffect(), true));
} }
public BaralChiefOfCompliance(final BaralChiefOfCompliance card) { public BaralChiefOfCompliance(final BaralChiefOfCompliance card) {
@ -86,42 +81,3 @@ public class BaralChiefOfCompliance extends CardImpl {
return new BaralChiefOfCompliance(this); return new BaralChiefOfCompliance(this);
} }
} }
class BaralChiefOfComplianceTriggeredAbility extends TriggeredAbilityImpl {
public BaralChiefOfComplianceTriggeredAbility() {
super(Zone.BATTLEFIELD, new DrawDiscardControllerEffect(), true);
}
public BaralChiefOfComplianceTriggeredAbility(final BaralChiefOfComplianceTriggeredAbility ability) {
super(ability);
}
@Override
public BaralChiefOfComplianceTriggeredAbility copy() {
return new BaralChiefOfComplianceTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.COUNTERED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
StackObject stackObjectThatCountered = (StackObject) game.getStack().getStackObject(event.getSourceId());
if (stackObjectThatCountered == null) {
stackObjectThatCountered = (StackObject) game.getLastKnownInformation(event.getSourceId(), Zone.STACK);
}
if (stackObjectThatCountered != null && stackObjectThatCountered.getControllerId().equals(getControllerId())) {
StackObject counteredStackObject = (StackObject) game.getLastKnownInformation(event.getTargetId(), Zone.STACK);
return counteredStackObject != null && (counteredStackObject instanceof Spell);
}
return false;
}
@Override
public String getRule() {
return "Whenever a spell or ability you control counters a spell, " + super.getRule();
}
}

View file

@ -36,10 +36,8 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.filter.common.FilterLandPermanent;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.Target;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import mage.target.common.TargetLandPermanent; import mage.target.common.TargetLandPermanent;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
@ -53,13 +51,9 @@ public class ChandrasRevolution extends CardImpl {
public ChandrasRevolution(UUID ownerId, CardSetInfo setInfo) { public ChandrasRevolution(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{R}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{R}");
// Chandra's Revolution deals 4 damage to target creature. // Chandra's Revolution deals 4 damage to target creature. Tap target land. That land doesn't untap during its controller's next untap step.
Target target = new TargetCreaturePermanent(); this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.getSpellAbility().addTarget(target); this.getSpellAbility().addTarget(new TargetLandPermanent());
// Tap target land. That land doesn't untap during its controller's next untap step.
Target target2 = new TargetLandPermanent(new FilterLandPermanent());
this.getSpellAbility().addTarget(target2);
this.getSpellAbility().addEffect(new ChandrasRevolutionEffect()); this.getSpellAbility().addEffect(new ChandrasRevolutionEffect());
} }

View file

@ -28,22 +28,12 @@
package mage.cards.c; package mage.cards.c;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.effects.common.search.SearchLibraryWithLessCMCPutInPlayEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.ConvokeAbility; import mage.abilities.keyword.ConvokeAbility;
import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.filter.common.FilterCreatureCard;
import mage.constants.Zone;
import mage.filter.Filter;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInLibrary;
/** /**
* *
@ -52,13 +42,13 @@ import mage.target.common.TargetCardInLibrary;
public class ChordOfCalling extends CardImpl { public class ChordOfCalling extends CardImpl {
public ChordOfCalling(UUID ownerId, CardSetInfo setInfo) { public ChordOfCalling(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{X}{G}{G}{G}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{X}{G}{G}{G}");
// Convoke (Your creatures can help cast this spell. Each creature you tap while casting this spell pays for {1} or one mana of that creature's color.) // Convoke (Your creatures can help cast this spell. Each creature you tap while casting this spell pays for {1} or one mana of that creature's color.)
this.addAbility(new ConvokeAbility()); this.addAbility(new ConvokeAbility());
// Search your library for a creature card with converted mana cost X or less and put it onto the battlefield. Then shuffle your library. // Search your library for a creature card with converted mana cost X or less and put it onto the battlefield. Then shuffle your library.
this.getSpellAbility().addEffect(new ChordofCallingSearchEffect()); this.getSpellAbility().addEffect(new SearchLibraryWithLessCMCPutInPlayEffect(new FilterCreatureCard()));
} }
public ChordOfCalling(final ChordOfCalling card) { public ChordOfCalling(final ChordOfCalling card) {
@ -70,48 +60,3 @@ public class ChordOfCalling extends CardImpl {
return new ChordOfCalling(this); return new ChordOfCalling(this);
} }
} }
class ChordofCallingSearchEffect extends OneShotEffect {
ChordofCallingSearchEffect() {
super(Outcome.PutCreatureInPlay);
staticText = "Search your library for a creature card with converted mana cost X or less, put it onto the battlefield, then shuffle your library";
}
ChordofCallingSearchEffect(final ChordofCallingSearchEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Card sourceCard = game.getCard(source.getSourceId());
if (player == null || sourceCard == null) {
return false;
}
int xCost = source.getManaCostsToPay().getX();
FilterCard filter = new FilterCard(new StringBuilder("creature card with converted mana cost ").append(xCost).append(" or less").toString());
filter.add(new CardTypePredicate(CardType.CREATURE));
//Set the mana cost one higher to 'emulate' a less than or equal to comparison.
filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, xCost + 1));
TargetCardInLibrary target = new TargetCardInLibrary(0, 1, filter);
if (player.searchLibrary(target, game)) {
if (target.getTargets().size() > 0) {
Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
if (card != null) {
game.informPlayers(new StringBuilder(sourceCard.getName()).append(": Put ").append(card.getName()).append(" onto the battlefield").toString());
card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), source.getControllerId());
}
}
player.shuffleLibrary(source, game);
return true;
}
player.shuffleLibrary(source, game);
return false;
}
@Override
public ChordofCallingSearchEffect copy() {
return new ChordofCallingSearchEffect(this);
}
}

View file

@ -42,13 +42,11 @@ import mage.game.permanent.token.ThopterColorlessToken;
*/ */
public class EfficientConstruction extends CardImpl { public class EfficientConstruction extends CardImpl {
private static final FilterArtifactSpell filter = new FilterArtifactSpell("an artifact spell");
public EfficientConstruction(UUID ownerId, CardSetInfo setInfo) { public EfficientConstruction(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}");
// Whenever you cast an artifact spell, create a 1/1 colorless Thopter artifact creature token with flying. // Whenever you cast an artifact spell, create a 1/1 colorless Thopter artifact creature token with flying.
this.addAbility(new SpellCastControllerTriggeredAbility(new CreateTokenEffect(new ThopterColorlessToken()), filter, false)); this.addAbility(new SpellCastControllerTriggeredAbility(new CreateTokenEffect(new ThopterColorlessToken()), new FilterArtifactSpell("an artifact spell"), false));
} }
public EfficientConstruction(final EfficientConstruction card) { public EfficientConstruction(final EfficientConstruction card) {

View file

@ -47,6 +47,12 @@ import mage.target.common.TargetControlledPermanent;
*/ */
public class FelidarGuardian extends CardImpl { public class FelidarGuardian extends CardImpl {
private static final FilterControlledPermanent filter = new FilterControlledPermanent("another target permanent you control");
static {
filter.add(new AnotherPredicate());
}
public FelidarGuardian(UUID ownerId, CardSetInfo setInfo) { public FelidarGuardian(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}");
@ -60,8 +66,6 @@ public class FelidarGuardian extends CardImpl {
effect.setApplyEffectsAfter(); effect.setApplyEffectsAfter();
Ability ability = new EntersBattlefieldTriggeredAbility(effect, true); Ability ability = new EntersBattlefieldTriggeredAbility(effect, true);
ability.addEffect(new ReturnToBattlefieldUnderOwnerControlTargetEffect(false, true)); ability.addEffect(new ReturnToBattlefieldUnderOwnerControlTargetEffect(false, true));
FilterControlledPermanent filter = new FilterControlledPermanent("another target permanent you control");
filter.add(new AnotherPredicate());
ability.addTarget(new TargetControlledPermanent(filter)); ability.addTarget(new TargetControlledPermanent(filter));
this.addAbility(ability); this.addAbility(ability);

View file

@ -29,36 +29,34 @@ package mage.cards.g;
import java.util.UUID; import java.util.UUID;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ShuffleSpellEffect; import mage.abilities.effects.common.ShuffleSpellEffect;
import mage.cards.Card; import mage.abilities.effects.common.search.SearchLibraryWithLessCMCPutInPlayEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.Filter;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.ColorPredicate;
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInLibrary;
/** /**
* @author Loki * @author Loki
*/ */
public class GreenSunsZenith extends CardImpl { public class GreenSunsZenith extends CardImpl {
public GreenSunsZenith(UUID ownerId, CardSetInfo setInfo) { private static final FilterCard filter = new FilterCard("green creature");
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{X}{G}");
static {
filter.add(new ColorPredicate(ObjectColor.GREEN));
filter.add(new CardTypePredicate(CardType.CREATURE));
}
public GreenSunsZenith(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{G}");
// Search your library for a green creature card with converted mana cost X or less, put it onto the battlefield, then shuffle your library.
this.getSpellAbility().addEffect(new SearchLibraryWithLessCMCPutInPlayEffect(filter));
// Search your library for a green creature card with converted mana cost X or less,
// put it onto the battlefield, then shuffle your library.
// Shuffle Green Sun's Zenith into its owner's library. // Shuffle Green Sun's Zenith into its owner's library.
this.getSpellAbility().addEffect(new GreenSunsZenithSearchEffect());
this.getSpellAbility().addEffect(ShuffleSpellEffect.getInstance()); this.getSpellAbility().addEffect(ShuffleSpellEffect.getInstance());
} }
@ -72,48 +70,3 @@ public class GreenSunsZenith extends CardImpl {
} }
} }
class GreenSunsZenithSearchEffect extends OneShotEffect {
GreenSunsZenithSearchEffect() {
super(Outcome.PutCreatureInPlay);
staticText = "Search your library for a green creature card with converted mana cost X or less, put it onto the battlefield, then shuffle your library";
}
GreenSunsZenithSearchEffect(final GreenSunsZenithSearchEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
//Set the mana cost one higher to 'emulate' a less than or equal to comparison.
int xValue = source.getManaCostsToPay().getX() + 1;
FilterCard filter = new FilterCard("green creature card with converted mana cost " + xValue + " or less");
filter.add(new ColorPredicate(ObjectColor.GREEN));
filter.add(new CardTypePredicate(CardType.CREATURE));
filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, xValue));
TargetCardInLibrary target = new TargetCardInLibrary(filter);
if (controller.searchLibrary(target, game)) {
if (target.getTargets().size() > 0) {
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
if (card != null) {
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}
}
controller.shuffleLibrary(source, game);
return true;
}
controller.shuffleLibrary(source, game);
return false;
}
@Override
public GreenSunsZenithSearchEffect copy() {
return new GreenSunsZenithSearchEffect(this);
}
}

View file

@ -28,7 +28,6 @@
package mage.cards.g; package mage.cards.g;
import java.util.UUID; import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility; import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.common.DiesAttachedTriggeredAbility; import mage.abilities.common.DiesAttachedTriggeredAbility;
@ -42,7 +41,7 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.game.permanent.token.Token; import mage.game.permanent.token.GremlinToken;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetArtifactPermanent; import mage.target.common.TargetArtifactPermanent;
@ -70,7 +69,7 @@ public class GremlinInfestation extends CardImpl {
this.addAbility(new BeginningOfEndStepTriggeredAbility(new DamageAttachedControllerEffect(2), TargetController.YOU, false)); this.addAbility(new BeginningOfEndStepTriggeredAbility(new DamageAttachedControllerEffect(2), TargetController.YOU, false));
// When enchanted artifact is put into a graveyard, create a 2/2 red Gremlin creature token. // When enchanted artifact is put into a graveyard, create a 2/2 red Gremlin creature token.
this.addAbility(new DiesAttachedTriggeredAbility(new CreateTokenEffect(new GremlinInfestationToken()), "enchanted artifact", false, false)); this.addAbility(new DiesAttachedTriggeredAbility(new CreateTokenEffect(new GremlinToken()), "enchanted artifact", false, false));
} }
public GremlinInfestation(final GremlinInfestation card) { public GremlinInfestation(final GremlinInfestation card) {
@ -82,17 +81,3 @@ public class GremlinInfestation extends CardImpl {
return new GremlinInfestation(this); return new GremlinInfestation(this);
} }
} }
class GremlinInfestationToken extends Token {
GremlinInfestationToken() {
super("Gremlin", "2/2 red Gremlin creature token");
this.setOriginalExpansionSetCode("AER");
cardType.add(CardType.CREATURE);
color.setRed(true);
subtype.add("Gremlin");
power = new MageInt(2);
toughness = new MageInt(2);
}
}

View file

@ -27,48 +27,41 @@
*/ */
package mage.cards.l; package mage.cards.l;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SpellCounteredControllerTriggeredAbility;
import mage.abilities.costs.common.TapTargetCost; import mage.abilities.costs.common.TapTargetCost;
import mage.abilities.effects.common.CounterTargetEffect; import mage.abilities.effects.common.CounterTargetEffect;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.WatcherScope;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate; import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.TappedPredicate; import mage.filter.predicate.permanent.TappedPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.token.Token; import mage.game.permanent.token.Token;
import mage.game.stack.StackObject;
import mage.target.Target;
import mage.target.TargetSpell; import mage.target.TargetSpell;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import mage.watchers.Watcher;
/** /**
* *
* @author LevelX2 * @author LevelX2
*/ */
public class LullmageMentor extends CardImpl { public class LullmageMentor extends CardImpl {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped Merfolk you control"); private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped Merfolk you control");
static { static {
filter.add(new SubtypePredicate("Merfolk")); filter.add(new SubtypePredicate("Merfolk"));
filter.add(Predicates.not(new TappedPredicate())); filter.add(Predicates.not(new TappedPredicate()));
} }
public LullmageMentor(UUID ownerId, CardSetInfo setInfo) { public LullmageMentor(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}{U}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}{U}");
this.subtype.add("Merfolk"); this.subtype.add("Merfolk");
this.subtype.add("Wizard"); this.subtype.add("Wizard");
@ -76,7 +69,8 @@ public class LullmageMentor extends CardImpl {
this.toughness = new MageInt(2); this.toughness = new MageInt(2);
// Whenever a spell or ability you control counters a spell, you may create a 1/1 blue Merfolk creature token. // Whenever a spell or ability you control counters a spell, you may create a 1/1 blue Merfolk creature token.
this.addAbility(new LullmageMentorTriggeredAbility(), new CastedSpellsWithSpellTarget()); this.addAbility(new SpellCounteredControllerTriggeredAbility(new CreateTokenEffect(new MerfolkToken()), true));
// Tap seven untapped Merfolk you control: Counter target spell. // Tap seven untapped Merfolk you control: Counter target spell.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CounterTargetEffect(), new TapTargetCost(new TargetControlledCreaturePermanent(7, 7, filter, true))); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CounterTargetEffect(), new TapTargetCost(new TargetControlledCreaturePermanent(7, 7, filter, true)));
ability.addTarget(new TargetSpell()); ability.addTarget(new TargetSpell());
@ -94,39 +88,6 @@ public class LullmageMentor extends CardImpl {
} }
} }
class LullmageMentorTriggeredAbility extends TriggeredAbilityImpl {
public LullmageMentorTriggeredAbility() {
super(Zone.BATTLEFIELD, new CreateTokenEffect(new MerfolkToken()), false);
}
public LullmageMentorTriggeredAbility(final LullmageMentorTriggeredAbility ability) {
super(ability);
}
@Override
public LullmageMentorTriggeredAbility copy() {
return new LullmageMentorTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.COUNTERED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
CastedSpellsWithSpellTarget watcher = (CastedSpellsWithSpellTarget) game.getState().getWatchers().get("CastedSpellsWithSpellTarget");
UUID controllerIdCounter = watcher.getControllerSpell(event.getSourceId(), event.getTargetId());
return controllerIdCounter != null && controllerIdCounter.equals(controllerId);
}
@Override
public String getRule() {
return new StringBuilder("Whenever a spell or ability you control counters a spell, ").append(super.getRule()).toString();
}
}
class MerfolkToken extends Token { class MerfolkToken extends Token {
public MerfolkToken() { public MerfolkToken() {
@ -138,59 +99,3 @@ class MerfolkToken extends Token {
toughness = new MageInt(1); toughness = new MageInt(1);
} }
} }
class CastedSpellsWithSpellTarget extends Watcher {
private final Map<String, UUID> casted = new HashMap<>();
public CastedSpellsWithSpellTarget() {
super("CastedSpellsWithSpellTarget", WatcherScope.GAME);
}
public CastedSpellsWithSpellTarget(final CastedSpellsWithSpellTarget watcher) {
super(watcher);
for (Map.Entry<String, UUID> entry: watcher.casted.entrySet()) {
casted.put(entry.getKey(), entry.getValue());
}
}
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SPELL_CAST || event.getType() == GameEvent.EventType.ACTIVATED_ABILITY) {
StackObject stackObject = game.getStack().getStackObject(event.getTargetId());
if (stackObject == null) {
stackObject = (StackObject) game.getLastKnownInformation(event.getTargetId(), Zone.STACK);
}
if (stackObject != null && stackObject.getStackAbility() != null) {
for (Target target: stackObject.getStackAbility().getTargets()) {
if (target instanceof TargetSpell && target.getFirstTarget() != null) {
casted.put(getKey(target.getFirstTarget(), stackObject.getSourceId()), stackObject.getControllerId());
}
}
}
}
}
private String getKey(UUID targetId, UUID sourceId) {
return new StringBuilder(targetId.toString()).append("_").append(sourceId.toString()).toString();
}
public UUID getControllerSpell(UUID sourceId, UUID counteredSpell) {
if (sourceId != null && counteredSpell != null){
return casted.get(getKey(counteredSpell, sourceId));
}
return null;
}
@Override
public void reset() {
super.reset();
casted.clear();
}
@Override
public CastedSpellsWithSpellTarget copy() {
return new CastedSpellsWithSpellTarget(this);
}
}

View file

@ -46,19 +46,16 @@ import java.util.UUID;
*/ */
public class OathOfAjani extends CardImpl { public class OathOfAjani extends CardImpl {
private static final FilterControlledCreaturePermanent creatureFilter = new FilterControlledCreaturePermanent();
private static final FilterPlaneswalkerCard planeswalkerFilter = new FilterPlaneswalkerCard("Planeswalker spells");
public OathOfAjani(UUID ownerId, CardSetInfo setInfo) { public OathOfAjani(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{G}{W}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{G}{W}");
this.supertype.add("Legendary"); this.supertype.add("Legendary");
// When Oath of Ajani enters the battlefield, put a +1/+1 counter on each creature you control. // When Oath of Ajani enters the battlefield, put a +1/+1 counter on each creature you control.
this.addAbility(new EntersBattlefieldTriggeredAbility(new AddCountersAllEffect(CounterType.P1P1.createInstance(), creatureFilter))); this.addAbility(new EntersBattlefieldTriggeredAbility(new AddCountersAllEffect(CounterType.P1P1.createInstance(), new FilterControlledCreaturePermanent())));
// Planeswalker spells you cast cost {1} less to cast. // Planeswalker spells you cast cost {1} less to cast.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostReductionControllerEffect(planeswalkerFilter, 1))); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostReductionControllerEffect(new FilterPlaneswalkerCard("Planeswalker spells"), 1)));
} }
public OathOfAjani(final OathOfAjani card) { public OathOfAjani(final OathOfAjani card) {

View file

@ -28,9 +28,7 @@
package mage.cards.p; package mage.cards.p;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SpellCastControllerTriggeredAbility; import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.UntapAllControllerEffect; import mage.abilities.effects.common.UntapAllControllerEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
@ -49,10 +47,7 @@ public class ParadoxEngine extends CardImpl {
this.supertype.add("Legendary"); this.supertype.add("Legendary");
// Whenever you cast a spell, untap all nonland permanents you control. // Whenever you cast a spell, untap all nonland permanents you control.
Effect effect = new UntapAllControllerEffect(new FilterNonlandPermanent()); this.addAbility(new SpellCastControllerTriggeredAbility(new UntapAllControllerEffect(new FilterNonlandPermanent()), false));
Ability ability = new SpellCastControllerTriggeredAbility(effect, false);
ability.addEffect(effect);
this.addAbility(ability);
} }
public ParadoxEngine(final ParadoxEngine card) { public ParadoxEngine(final ParadoxEngine card) {

View file

@ -52,8 +52,11 @@ public class PlanarBridge extends CardImpl {
this.supertype.add("Legendary"); this.supertype.add("Legendary");
// {8}, {T}: Search your library for a permanent card, put it onto the battlefield, then shuffle your library. // {8}, {T}: Search your library for a permanent card, put it onto the battlefield, then shuffle your library.
TargetCardInLibrary target = new TargetCardInLibrary(new FilterPermanentCard()); Ability ability = new SimpleActivatedAbility(
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(target), new GenericManaCost(8)); Zone.BATTLEFIELD,
new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(new FilterPermanentCard())),
new GenericManaCost(8)
);
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -28,7 +28,6 @@
package mage.cards.r; package mage.cards.r;
import java.util.UUID; import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.SpellAbility; import mage.abilities.SpellAbility;
import mage.abilities.dynamicvalue.common.ManacostVariableValue; import mage.abilities.dynamicvalue.common.ManacostVariableValue;
@ -38,7 +37,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.token.Token; import mage.game.permanent.token.GremlinToken;
import mage.target.common.TargetArtifactPermanent; import mage.target.common.TargetArtifactPermanent;
/** /**
@ -77,15 +76,3 @@ public class ReleaseTheGremlins extends CardImpl {
return new ReleaseTheGremlins(this); return new ReleaseTheGremlins(this);
} }
} }
class GremlinToken extends Token {
public GremlinToken() {
super("Gremlin", "2/2 red Gremlin creature token");
cardType.add(CardType.CREATURE);
subtype.add("Gremlin");
color.setRed(true);
power = new MageInt(2);
toughness = new MageInt(2);
}
}

View file

@ -50,13 +50,15 @@ public class RenegadeMap extends CardImpl {
public RenegadeMap(UUID ownerId, CardSetInfo setInfo) { public RenegadeMap(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}"); super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}");
// Renegade Map enters the battlefield tapped. // Renegade Map enters the battlefield tapped.
this.addAbility(new EntersBattlefieldTappedAbility()); this.addAbility(new EntersBattlefieldTappedAbility());
// {T}, Sacrifice Renegade Map: Search your library for a basic land card, reveal it, put it into your hand, then shuffle your library. // {T}, Sacrifice Renegade Map: Search your library for a basic land card, reveal it, put it into your hand, then shuffle your library.
TargetCardInLibrary target = new TargetCardInLibrary(new FilterBasicLandCard()); Ability ability = new SimpleActivatedAbility(
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInHandEffect(target, true), new TapSourceCost()); Zone.BATTLEFIELD,
new SearchLibraryPutInHandEffect(new TargetCardInLibrary(new FilterBasicLandCard()), true),
new TapSourceCost()
);
ability.addCost(new SacrificeSourceCost()); ability.addCost(new SacrificeSourceCost());
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -28,23 +28,13 @@
package mage.cards.r; package mage.cards.r;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.common.SacrificeTargetCost; import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.search.SearchLibraryWithLessCMCPutInPlayEffect;
import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.filter.common.FilterArtifactCard;
import mage.constants.Zone; import mage.filter.common.FilterControlledArtifactPermanent;
import mage.filter.Filter;
import mage.filter.FilterCard;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInLibrary;
import mage.target.common.TargetControlledPermanent; import mage.target.common.TargetControlledPermanent;
/** /**
@ -53,19 +43,14 @@ import mage.target.common.TargetControlledPermanent;
*/ */
public class Reshape extends CardImpl { public class Reshape extends CardImpl {
private static final FilterControlledPermanent filter = new FilterControlledPermanent("an artifact");
static {
filter.add(new CardTypePredicate(CardType.ARTIFACT));
}
public Reshape(UUID ownerId, CardSetInfo setInfo) { public Reshape(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{X}{U}{U}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{U}{U}");
// As an additional cost to cast Reshape, sacrifice an artifact. // As an additional cost to cast Reshape, sacrifice an artifact.
this.getSpellAbility().addCost(new SacrificeTargetCost(new TargetControlledPermanent(1, 1, filter, false))); this.getSpellAbility().addCost(new SacrificeTargetCost(new TargetControlledPermanent(1, 1, new FilterControlledArtifactPermanent("an artifact"), false)));
// Search your library for an artifact card with converted mana cost X or less and put it onto the battlefield. Then shuffle your library. // Search your library for an artifact card with converted mana cost X or less and put it onto the battlefield. Then shuffle your library.
this.getSpellAbility().addEffect(new ReshapeSearchEffect()); this.getSpellAbility().addEffect(new SearchLibraryWithLessCMCPutInPlayEffect(new FilterArtifactCard()));
} }
public Reshape(final Reshape card) { public Reshape(final Reshape card) {
@ -77,46 +62,3 @@ public class Reshape extends CardImpl {
return new Reshape(this); return new Reshape(this);
} }
} }
class ReshapeSearchEffect extends OneShotEffect {
ReshapeSearchEffect() {
super(Outcome.PutCardInPlay);
staticText = "Search your library for an artifact card with converted mana cost X or less and put it onto the battlefield. Then shuffle your library";
}
ReshapeSearchEffect(final ReshapeSearchEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
//Set the mana cost one higher to 'emulate' a less than or equal to comparison.
int xValue = source.getManaCostsToPay().getX() + 1;
FilterCard filter = new FilterCard("artifact card with converted mana cost " + xValue + " or less");
filter.add(new CardTypePredicate(CardType.ARTIFACT));
filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, xValue));
TargetCardInLibrary target = new TargetCardInLibrary(filter);
if (controller.searchLibrary(target, game)) {
if (target.getTargets().size() > 0) {
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
if (card != null) {
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}
}
controller.shuffleLibrary(source, game);
return true;
}
controller.shuffleLibrary(source, game);
return false;
}
@Override
public ReshapeSearchEffect copy() {
return new ReshapeSearchEffect(this);
}
}

View file

@ -29,16 +29,13 @@ package mage.cards.s;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.effects.common.ReturnToHandTargetEffect; import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Zone;
import mage.filter.common.FilterControlledArtifactPermanent; import mage.filter.common.FilterControlledArtifactPermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.target.common.TargetControlledPermanent; import mage.target.common.TargetControlledPermanent;
/** /**
@ -55,7 +52,9 @@ public class SalvageScuttler extends CardImpl {
this.toughness = new MageInt(4); this.toughness = new MageInt(4);
// Whenever Salvage Scuttler attacks, return an artifact you control to its owner's hand. // Whenever Salvage Scuttler attacks, return an artifact you control to its owner's hand.
this.addAbility(new SalvageScuttlerAbility()); Ability ability = new AttacksTriggeredAbility(new ReturnToHandTargetEffect(), false);
ability.addTarget(new TargetControlledPermanent(new FilterControlledArtifactPermanent("an artifact you control")));
this.addAbility(ability);
} }
public SalvageScuttler(final SalvageScuttler card) { public SalvageScuttler(final SalvageScuttler card) {
@ -67,39 +66,3 @@ public class SalvageScuttler extends CardImpl {
return new SalvageScuttler(this); return new SalvageScuttler(this);
} }
} }
class SalvageScuttlerAbility extends TriggeredAbilityImpl {
public SalvageScuttlerAbility() {
super(Zone.BATTLEFIELD, new ReturnToHandTargetEffect());
}
public SalvageScuttlerAbility(final SalvageScuttlerAbility ability) {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ATTACKER_DECLARED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getSourceId().equals(this.getSourceId())) {
TargetControlledPermanent target = new TargetControlledPermanent(1, 1, new FilterControlledArtifactPermanent("artifact you control"), false);
this.addTarget(target);
return true;
}
return false;
}
@Override
public String getRule() {
return "Whenever {this} attacks, return an artifact you control to its owner's hand.";
}
@Override
public SalvageScuttlerAbility copy() {
return new SalvageScuttlerAbility(this);
}
}

View file

@ -46,6 +46,12 @@ import mage.game.permanent.token.ServoToken;
*/ */
public class SlyRequisitioner extends CardImpl { public class SlyRequisitioner extends CardImpl {
private static final FilterControlledArtifactPermanent filter = new FilterControlledArtifactPermanent("a nontoken artifact you control");
static {
filter.add(Predicates.not(new TokenPredicate()));
}
public SlyRequisitioner(UUID ownerId, CardSetInfo setInfo) { public SlyRequisitioner(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}");
@ -56,9 +62,8 @@ public class SlyRequisitioner extends CardImpl {
// Improvise // Improvise
this.addAbility(new ImproviseAbility()); this.addAbility(new ImproviseAbility());
// Whenever a nontoken artifact you control is put into a graveyard from the battlefield, create a 1/1 colorless Servo artifact creature token. // Whenever a nontoken artifact you control is put into a graveyard from the battlefield, create a 1/1 colorless Servo artifact creature token.
FilterControlledArtifactPermanent filter = new FilterControlledArtifactPermanent("a nontoken artifact you control");
filter.add(Predicates.not(new TokenPredicate()));
this.addAbility(new PutIntoGraveFromBattlefieldAllTriggeredAbility(new CreateTokenEffect(new ServoToken()), false, filter, false)); this.addAbility(new PutIntoGraveFromBattlefieldAllTriggeredAbility(new CreateTokenEffect(new ServoToken()), false, filter, false));
} }

View file

@ -29,7 +29,6 @@ package mage.cards.s;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.BeginningOfYourEndStepTriggeredAbility; import mage.abilities.common.BeginningOfYourEndStepTriggeredAbility;
import mage.abilities.condition.common.RevoltCondition; import mage.abilities.condition.common.RevoltCondition;
import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.decorator.ConditionalTriggeredAbility;
@ -47,9 +46,6 @@ import mage.watchers.common.RevoltWatcher;
*/ */
public class SolemnRecruit extends CardImpl { public class SolemnRecruit extends CardImpl {
private static final String ruleText = "<i>Revolt</i> &mdash; At the beginning of your end step, if a permanent you controlled left the battlefield this turn, "
+ "put a +1/+1 counter on {this}.";
public SolemnRecruit(UUID ownerId, CardSetInfo setInfo) { public SolemnRecruit(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}{W}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}{W}");
@ -62,8 +58,14 @@ public class SolemnRecruit extends CardImpl {
this.addAbility(DoubleStrikeAbility.getInstance()); this.addAbility(DoubleStrikeAbility.getInstance());
// <i>Revolt</i> &mdash; At the beginning of your end step, if a permanent you controlled left the battlefield this turn, put a +1/+1 counter on Solemn Recruit. // <i>Revolt</i> &mdash; At the beginning of your end step, if a permanent you controlled left the battlefield this turn, put a +1/+1 counter on Solemn Recruit.
TriggeredAbility ability = new BeginningOfYourEndStepTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false); this.addAbility(new ConditionalTriggeredAbility(
this.addAbility(new ConditionalTriggeredAbility(ability, RevoltCondition.getInstance(), ruleText), new RevoltWatcher()); new BeginningOfYourEndStepTriggeredAbility(
new AddCountersSourceEffect(CounterType.P1P1.createInstance()),
false
),
RevoltCondition.getInstance(),
"<i>Revolt</i> &mdash; At the beginning of your end step, if a permanent you controlled left the battlefield this turn, put a +1/+1 counter on {this}."
), new RevoltWatcher());
} }
public SolemnRecruit(final SolemnRecruit card) { public SolemnRecruit(final SolemnRecruit card) {

View file

@ -27,7 +27,6 @@
*/ */
package mage.cards.s; package mage.cards.s;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.abilities.effects.common.SwordsToPlowsharesEffect; import mage.abilities.effects.common.SwordsToPlowsharesEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
@ -43,13 +42,10 @@ import java.util.UUID;
public class SwordsToPlowshares extends CardImpl { public class SwordsToPlowshares extends CardImpl {
public SwordsToPlowshares(UUID ownerId, CardSetInfo setInfo) { public SwordsToPlowshares(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{W}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{W}");
// Exile target creature. Its controller gains life equal to its power.
// Exile target creature.
this.getSpellAbility().addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.getSpellAbility().addEffect(new ExileTargetEffect());
// Its controller gains life equal to its power.
this.getSpellAbility().addEffect(new SwordsToPlowsharesEffect()); this.getSpellAbility().addEffect(new SwordsToPlowsharesEffect());
} }

View file

@ -30,7 +30,6 @@ package mage.cards.t;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.SearchEffect;
import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
@ -63,9 +62,7 @@ public class TrophyMage extends CardImpl {
this.toughness = new MageInt(2); this.toughness = new MageInt(2);
// When Trophy Mage enters the battlefield, you may search your library for an artifact card with converted mana cost 3, reveal it, put it into your hand, then shuffle your library. // When Trophy Mage enters the battlefield, you may search your library for an artifact card with converted mana cost 3, reveal it, put it into your hand, then shuffle your library.
TargetCardInLibrary target = new TargetCardInLibrary(0, 1, filter); this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInHandEffect(new TargetCardInLibrary(0, 1, filter), true, true), true));
SearchEffect effect = new SearchLibraryPutInHandEffect(target, true, true);
this.addAbility(new EntersBattlefieldTriggeredAbility(effect, true));
} }
public TrophyMage(final TrophyMage card) { public TrophyMage(final TrophyMage card) {

View file

@ -39,10 +39,7 @@ import mage.cards.CardSetInfo;
import mage.constants.AbilityWord; import mage.constants.AbilityWord;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.TargetController; import mage.target.common.TargetOpponentsCreaturePermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.target.common.TargetCreaturePermanent;
import mage.watchers.common.RevoltWatcher; import mage.watchers.common.RevoltWatcher;
/** /**
@ -51,12 +48,6 @@ import mage.watchers.common.RevoltWatcher;
*/ */
public class VengefulRebel extends CardImpl { public class VengefulRebel extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature an opponent controls");
static {
filter.add(new ControllerPredicate(TargetController.OPPONENT));
}
public VengefulRebel(UUID ownerId, CardSetInfo setInfo) { public VengefulRebel(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}");
@ -71,8 +62,9 @@ public class VengefulRebel extends CardImpl {
new EntersBattlefieldTriggeredAbility(new BoostTargetEffect(-3, -3, Duration.EndOfTurn), false), new EntersBattlefieldTriggeredAbility(new BoostTargetEffect(-3, -3, Duration.EndOfTurn), false),
RevoltCondition.getInstance(), RevoltCondition.getInstance(),
"When {this} enters the battlefield, if a permanent you controlled left the battlefield this turn, " "When {this} enters the battlefield, if a permanent you controlled left the battlefield this turn, "
+ "target creature an opponent controls gets -3/-3 until end of turn"); + "target creature an opponent controls gets -3/-3 until end of turn"
ability.addTarget(new TargetCreaturePermanent(filter)); );
ability.addTarget(new TargetOpponentsCreaturePermanent());
ability.setAbilityWord(AbilityWord.REVOLT); ability.setAbilityWord(AbilityWord.REVOLT);
this.addAbility(ability, new RevoltWatcher()); this.addAbility(ability, new RevoltWatcher());
} }

View file

@ -28,20 +28,11 @@
package mage.cards.w; package mage.cards.w;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.effects.common.search.SearchLibraryWithLessCMCPutInPlayEffect;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.Filter;
import mage.filter.common.FilterPermanentCard; import mage.filter.common.FilterPermanentCard;
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInLibrary;
/** /**
* *
@ -50,10 +41,10 @@ import mage.target.common.TargetCardInLibrary;
public class Wargate extends CardImpl { public class Wargate extends CardImpl {
public Wargate(UUID ownerId, CardSetInfo setInfo) { public Wargate(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{X}{G}{W}{U}"); super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{G}{W}{U}");
// Search your library for a permanent card with converted mana cost X or less, put it onto the battlefield, then shuffle your library. // Search your library for a permanent card with converted mana cost X or less, put it onto the battlefield, then shuffle your library.
this.getSpellAbility().addEffect(new WargateEffect()); this.getSpellAbility().addEffect(new SearchLibraryWithLessCMCPutInPlayEffect(new FilterPermanentCard()));
} }
public Wargate(final Wargate card) { public Wargate(final Wargate card) {
@ -65,43 +56,3 @@ public class Wargate extends CardImpl {
return new Wargate(this); return new Wargate(this);
} }
} }
class WargateEffect extends OneShotEffect {
WargateEffect() {
super(Outcome.PutCreatureInPlay);
staticText = "Search your library for a permanent card with converted mana cost X or less, put it onto the battlefield, then shuffle your library";
}
WargateEffect(final WargateEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
FilterPermanentCard filter = new FilterPermanentCard("permanent card with converted mana cost X or less");
//Set the mana cost one higher to 'emulate' a less than or equal to comparison.
filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, source.getManaCostsToPay().getX() + 1));
TargetCardInLibrary target = new TargetCardInLibrary(filter);
if (controller.searchLibrary(target, game)) {
if (target.getTargets().size() > 0) {
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
if (card != null) {
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}
}
}
controller.shuffleLibrary(source, game);
return false;
}
@Override
public WargateEffect copy() {
return new WargateEffect(this);
}
}

View file

@ -47,6 +47,12 @@ import mage.target.common.TargetControlledPermanent;
*/ */
public class WeldfastEngineer extends CardImpl { public class WeldfastEngineer extends CardImpl {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("artifact creature you control");
static {
filter.add(new CardTypePredicate(CardType.ARTIFACT));
}
public WeldfastEngineer(UUID ownerId, CardSetInfo setInfo) { public WeldfastEngineer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}{R}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}{R}");
@ -57,8 +63,6 @@ public class WeldfastEngineer extends CardImpl {
// At the beginning of combat on your turn, target artifact creature you control gets +2/+0 until end of turn. // At the beginning of combat on your turn, target artifact creature you control gets +2/+0 until end of turn.
Ability ability = new BeginningOfCombatTriggeredAbility(new BoostTargetEffect(2, 0, Duration.EndOfTurn), TargetController.YOU, false); Ability ability = new BeginningOfCombatTriggeredAbility(new BoostTargetEffect(2, 0, Duration.EndOfTurn), TargetController.YOU, false);
FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("artifact creature you control");
filter.add(new CardTypePredicate(CardType.ARTIFACT));
ability.addTarget(new TargetControlledPermanent(filter)); ability.addTarget(new TargetControlledPermanent(filter));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -28,22 +28,12 @@
package mage.cards.w; package mage.cards.w;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.effects.common.search.SearchLibraryWithLessCMCPutInPlayEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.ImproviseAbility; import mage.abilities.keyword.ImproviseAbility;
import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.filter.common.FilterArtifactCard;
import mage.constants.Zone;
import mage.filter.Filter;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInLibrary;
/** /**
* *
@ -58,7 +48,7 @@ public class WhirOfInvention extends CardImpl {
addAbility(new ImproviseAbility()); addAbility(new ImproviseAbility());
// Search your library for an artifact card with converted mana cost X or less, put it onto the battlefield, then shuffle your library. // Search your library for an artifact card with converted mana cost X or less, put it onto the battlefield, then shuffle your library.
this.getSpellAbility().addEffect(new WhirOfInventionSearchEffect()); this.getSpellAbility().addEffect(new SearchLibraryWithLessCMCPutInPlayEffect(new FilterArtifactCard()));
} }
public WhirOfInvention(final WhirOfInvention card) { public WhirOfInvention(final WhirOfInvention card) {
@ -70,48 +60,3 @@ public class WhirOfInvention extends CardImpl {
return new WhirOfInvention(this); return new WhirOfInvention(this);
} }
} }
class WhirOfInventionSearchEffect extends OneShotEffect {
WhirOfInventionSearchEffect() {
super(Outcome.PutCardInPlay);
staticText = "Search your library for an artifact card with converted mana cost X or less, put it onto the battlefield, then shuffle your library";
}
WhirOfInventionSearchEffect(final WhirOfInventionSearchEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Card sourceCard = game.getCard(source.getSourceId());
if (player == null || sourceCard == null) {
return false;
}
int xCost = source.getManaCostsToPay().getX();
FilterCard filter = new FilterCard(new StringBuilder("artifact card with converted mana cost ").append(xCost).append(" or less").toString());
filter.add(new CardTypePredicate(CardType.ARTIFACT));
//Set the mana cost one higher to 'emulate' a less than or equal to comparison.
filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, xCost + 1));
TargetCardInLibrary target = new TargetCardInLibrary(0, 1, filter);
if (player.searchLibrary(target, game)) {
if (target.getTargets().size() > 0) {
Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
if (card != null) {
game.informPlayers(new StringBuilder(sourceCard.getName()).append(": Put ").append(card.getName()).append(" onto the battlefield").toString());
card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), source.getControllerId());
}
}
player.shuffleLibrary(source, game);
return true;
}
player.shuffleLibrary(source, game);
return false;
}
@Override
public WhirOfInventionSearchEffect copy() {
return new WhirOfInventionSearchEffect(this);
}
}

View file

@ -40,13 +40,11 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterOpponentsCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate; import mage.filter.predicate.permanent.AnotherPredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.target.common.TargetControlledPermanent; import mage.target.common.TargetControlledPermanent;
/** /**
@ -55,15 +53,12 @@ import mage.target.common.TargetControlledPermanent;
*/ */
public class YahenniUndyingPartisan extends CardImpl { public class YahenniUndyingPartisan extends CardImpl {
private static final FilterCreaturePermanent opponentFilter = new FilterCreaturePermanent("a creature an opponent controls"); private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature");
private static final FilterControlledCreaturePermanent ownFilter = new FilterControlledCreaturePermanent("another creature");
static { static {
opponentFilter.add(new ControllerPredicate(TargetController.OPPONENT)); filter.add(new AnotherPredicate());
ownFilter.add(new AnotherPredicate());
} }
public YahenniUndyingPartisan(UUID ownerId, CardSetInfo setInfo) { public YahenniUndyingPartisan(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}");
@ -77,11 +72,14 @@ public class YahenniUndyingPartisan extends CardImpl {
this.addAbility(HasteAbility.getInstance()); this.addAbility(HasteAbility.getInstance());
// Whenever a creature an opponent controls dies, put a +1/+1 counter on Yahenni, Undying Partisan. // Whenever a creature an opponent controls dies, put a +1/+1 counter on Yahenni, Undying Partisan.
this.addAbility(new DiesCreatureTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false, opponentFilter)); this.addAbility(new DiesCreatureTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false, new FilterOpponentsCreaturePermanent()));
// Sacrifice another creature: Yahenni gains indestructible until end of turn. // Sacrifice another creature: Yahenni gains indestructible until end of turn.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn), this.addAbility(new SimpleActivatedAbility(
new SacrificeTargetCost(new TargetControlledPermanent(ownFilter)))); Zone.BATTLEFIELD,
new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn),
new SacrificeTargetCost(new TargetControlledPermanent(filter)))
);
} }
public YahenniUndyingPartisan(final YahenniUndyingPartisan card) { public YahenniUndyingPartisan(final YahenniUndyingPartisan card) {

View file

@ -0,0 +1,62 @@
/*
* 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.abilities.common;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.stack.Spell;
import mage.game.stack.StackObject;
/**
*
* @author fireshoes
*/
public class SpellCounteredControllerTriggeredAbility extends TriggeredAbilityImpl {
public SpellCounteredControllerTriggeredAbility(Effect effect) {
this(effect, false);
}
public SpellCounteredControllerTriggeredAbility(Effect effect, boolean optional) {
super(Zone.BATTLEFIELD, effect, optional);
}
public SpellCounteredControllerTriggeredAbility(final SpellCounteredControllerTriggeredAbility ability) {
super(ability);
}
@Override
public SpellCounteredControllerTriggeredAbility copy() {
return new SpellCounteredControllerTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.COUNTERED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
StackObject stackObjectThatCountered = (StackObject) game.getStack().getStackObject(event.getSourceId());
if (stackObjectThatCountered == null) {
stackObjectThatCountered = (StackObject) game.getLastKnownInformation(event.getSourceId(), Zone.STACK);
}
if (stackObjectThatCountered != null && stackObjectThatCountered.getControllerId().equals(getControllerId())) {
StackObject counteredStackObject = (StackObject) game.getLastKnownInformation(event.getTargetId(), Zone.STACK);
return counteredStackObject != null && (counteredStackObject instanceof Spell);
}
return false;
}
@Override
public String getRule() {
return "Whenever a spell or ability you control counters a spell, " + super.getRule();
}
}

View file

@ -25,7 +25,6 @@
* authors and should not be interpreted as representing official policies, either expressed * authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com. * or implied, of BetaSteward_at_googlemail.com.
*/ */
package mage.abilities.effects.common; package mage.abilities.effects.common;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -42,7 +41,7 @@ public class SwordsToPlowsharesEffect extends OneShotEffect {
public SwordsToPlowsharesEffect() { public SwordsToPlowsharesEffect() {
super(Outcome.GainLife); super(Outcome.GainLife);
staticText = "Its controller gains life equal to its power"; staticText = "Exile target creature. Its controller gains life equal to its power";
} }
public SwordsToPlowsharesEffect(final SwordsToPlowsharesEffect effect) { public SwordsToPlowsharesEffect(final SwordsToPlowsharesEffect effect) {
@ -60,7 +59,9 @@ public class SwordsToPlowsharesEffect extends OneShotEffect {
if (permanent != null) { if (permanent != null) {
Player player = game.getPlayer(permanent.getControllerId()); Player player = game.getPlayer(permanent.getControllerId());
if (player != null) { if (player != null) {
player.gainLife(permanent.getPower().getValue(), game); int creaturePower = permanent.getPower().getValue();
permanent.moveToExile(null, null, source.getSourceId(), game);
player.gainLife(creaturePower, game);
} }
return true; return true;
} }

View file

@ -0,0 +1,90 @@
/*
* 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.abilities.effects.common.search;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.Filter;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInLibrary;
/**
*
* @author Styxo
*/
public class SearchLibraryWithLessCMCPutInPlayEffect extends OneShotEffect {
private FilterCard filter;
public SearchLibraryWithLessCMCPutInPlayEffect() {
this(new FilterCard());
}
public SearchLibraryWithLessCMCPutInPlayEffect(FilterCard filter) {
super(Outcome.PutCreatureInPlay);
this.filter = filter;
staticText = "Search your library for a " + filter.getMessage() + " with converted mana cost X or less, put it onto the battlefield, then shuffle your library";
}
public SearchLibraryWithLessCMCPutInPlayEffect(final SearchLibraryWithLessCMCPutInPlayEffect effect) {
super(effect);
this.filter = effect.filter;
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, source.getManaCostsToPay().getX() + 1));
TargetCardInLibrary target = new TargetCardInLibrary(filter);
if (controller.searchLibrary(target, game)) {
if (target.getTargets().size() > 0) {
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
if (card != null) {
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}
}
controller.shuffleLibrary(source, game);
}
return true;
}
return false;
}
@Override
public SearchLibraryWithLessCMCPutInPlayEffect copy() {
return new SearchLibraryWithLessCMCPutInPlayEffect(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.game.permanent.token;
import mage.MageInt;
import mage.constants.CardType;
/**
*
* @author Styxo
*/
public class GremlinToken extends Token {
public GremlinToken() {
super("Gremlin", "2/2 red Gremlin creature token");
cardType.add(CardType.CREATURE);
this.setOriginalExpansionSetCode("AER");
subtype.add("Gremlin");
color.setRed(true);
power = new MageInt(2);
toughness = new MageInt(2);
}
}