mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
[AER] Refactored some similar abilities and effects
This commit is contained in:
parent
6d0eb49ac8
commit
d690926cef
29 changed files with 312 additions and 596 deletions
|
@ -29,7 +29,6 @@ package mage.cards.a;
|
|||
|
||||
import mage.abilities.LoyaltyAbility;
|
||||
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
|
||||
import mage.abilities.effects.common.ExileTargetEffect;
|
||||
import mage.abilities.effects.common.RevealLibraryPutIntoHandEffect;
|
||||
import mage.abilities.effects.common.SwordsToPlowsharesEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersAllEffect;
|
||||
|
@ -38,7 +37,6 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.TargetController;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.common.FilterPermanentCard;
|
||||
import mage.filter.common.FilterPlaneswalkerPermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
|
@ -49,6 +47,7 @@ import mage.target.common.TargetCreaturePermanent;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
|
||||
/**
|
||||
* @author JRHerlehy
|
||||
|
@ -56,12 +55,10 @@ import mage.constants.Zone;
|
|||
public class AjaniUnyielding extends CardImpl {
|
||||
|
||||
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");
|
||||
|
||||
static {
|
||||
nonlandPermanentFilter.add(Predicates.not(new CardTypePredicate(CardType.LAND)));
|
||||
creatureFilter.add(new ControllerPredicate(TargetController.YOU));
|
||||
planeswalkerFilter.add(new ControllerPredicate(TargetController.YOU));
|
||||
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.
|
||||
LoyaltyAbility ajaniAbility2 = new LoyaltyAbility(new SwordsToPlowsharesEffect(), -2);
|
||||
ajaniAbility2.addEffect(new ExileTargetEffect());
|
||||
ajaniAbility2.addTarget(new TargetCreaturePermanent());
|
||||
this.addAbility(ajaniAbility2);
|
||||
|
||||
// -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));
|
||||
this.addAbility(ajaniAbility3);
|
||||
}
|
||||
|
|
|
@ -29,8 +29,8 @@ package mage.cards.b;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.common.SpellCounteredControllerTriggeredAbility;
|
||||
import mage.abilities.effects.common.DrawDiscardControllerEffect;
|
||||
import mage.abilities.effects.common.cost.SpellsCostReductionControllerEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -40,11 +40,6 @@ import mage.constants.Zone;
|
|||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.Predicates;
|
||||
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)));
|
||||
|
||||
// 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) {
|
||||
|
@ -86,42 +81,3 @@ public class BaralChiefOfCompliance extends CardImpl {
|
|||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,10 +36,8 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.common.FilterLandPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.common.TargetLandPermanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
@ -53,13 +51,9 @@ public class ChandrasRevolution extends CardImpl {
|
|||
public ChandrasRevolution(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{R}");
|
||||
|
||||
// Chandra's Revolution deals 4 damage to target creature.
|
||||
Target target = new TargetCreaturePermanent();
|
||||
this.getSpellAbility().addTarget(target);
|
||||
|
||||
// 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);
|
||||
// Chandra's Revolution deals 4 damage to target creature. Tap target land. That land doesn't untap during its controller's next untap step.
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
this.getSpellAbility().addTarget(new TargetLandPermanent());
|
||||
this.getSpellAbility().addEffect(new ChandrasRevolutionEffect());
|
||||
}
|
||||
|
||||
|
|
|
@ -28,22 +28,12 @@
|
|||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.search.SearchLibraryWithLessCMCPutInPlayEffect;
|
||||
import mage.abilities.keyword.ConvokeAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
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;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -52,13 +42,13 @@ import mage.target.common.TargetCardInLibrary;
|
|||
public class ChordOfCalling extends CardImpl {
|
||||
|
||||
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.)
|
||||
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.
|
||||
this.getSpellAbility().addEffect(new ChordofCallingSearchEffect());
|
||||
this.getSpellAbility().addEffect(new SearchLibraryWithLessCMCPutInPlayEffect(new FilterCreatureCard()));
|
||||
}
|
||||
|
||||
public ChordOfCalling(final ChordOfCalling card) {
|
||||
|
@ -70,48 +60,3 @@ public class ChordOfCalling extends CardImpl {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,13 +42,11 @@ import mage.game.permanent.token.ThopterColorlessToken;
|
|||
*/
|
||||
public class EfficientConstruction extends CardImpl {
|
||||
|
||||
private static final FilterArtifactSpell filter = new FilterArtifactSpell("an artifact spell");
|
||||
|
||||
public EfficientConstruction(UUID ownerId, CardSetInfo setInfo) {
|
||||
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.
|
||||
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) {
|
||||
|
|
|
@ -47,6 +47,12 @@ import mage.target.common.TargetControlledPermanent;
|
|||
*/
|
||||
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) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}");
|
||||
|
||||
|
@ -60,8 +66,6 @@ public class FelidarGuardian extends CardImpl {
|
|||
effect.setApplyEffectsAfter();
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(effect, 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));
|
||||
this.addAbility(ability);
|
||||
|
||||
|
|
|
@ -29,36 +29,34 @@ package mage.cards.g;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.ShuffleSpellEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.abilities.effects.common.search.SearchLibraryWithLessCMCPutInPlayEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.Filter;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
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
|
||||
*/
|
||||
public class GreenSunsZenith extends CardImpl {
|
||||
|
||||
public GreenSunsZenith(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{X}{G}");
|
||||
private static final FilterCard filter = new FilterCard("green creature");
|
||||
|
||||
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.
|
||||
this.getSpellAbility().addEffect(new GreenSunsZenithSearchEffect());
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
package mage.cards.g;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.common.DiesAttachedTriggeredAbility;
|
||||
|
@ -42,7 +41,7 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetController;
|
||||
import mage.game.permanent.token.Token;
|
||||
import mage.game.permanent.token.GremlinToken;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetArtifactPermanent;
|
||||
|
||||
|
@ -70,7 +69,7 @@ public class GremlinInfestation extends CardImpl {
|
|||
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.
|
||||
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) {
|
||||
|
@ -82,17 +81,3 @@ public class GremlinInfestation extends CardImpl {
|
|||
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);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,48 +27,41 @@
|
|||
*/
|
||||
package mage.cards.l;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.SpellCounteredControllerTriggeredAbility;
|
||||
import mage.abilities.costs.common.TapTargetCost;
|
||||
import mage.abilities.effects.common.CounterTargetEffect;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
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.stack.StackObject;
|
||||
import mage.target.Target;
|
||||
import mage.target.TargetSpell;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class LullmageMentor extends CardImpl {
|
||||
|
||||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped Merfolk you control");
|
||||
|
||||
static {
|
||||
filter.add(new SubtypePredicate("Merfolk"));
|
||||
filter.add(Predicates.not(new TappedPredicate()));
|
||||
}
|
||||
|
||||
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("Wizard");
|
||||
|
||||
|
@ -76,7 +69,8 @@ public class LullmageMentor extends CardImpl {
|
|||
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.
|
||||
this.addAbility(new LullmageMentorTriggeredAbility(), new CastedSpellsWithSpellTarget());
|
||||
this.addAbility(new SpellCounteredControllerTriggeredAbility(new CreateTokenEffect(new MerfolkToken()), true));
|
||||
|
||||
// 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.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 {
|
||||
|
||||
public MerfolkToken() {
|
||||
|
@ -138,59 +99,3 @@ class MerfolkToken extends Token {
|
|||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -46,19 +46,16 @@ import java.util.UUID;
|
|||
*/
|
||||
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) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{G}{W}");
|
||||
|
||||
this.supertype.add("Legendary");
|
||||
|
||||
// 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.
|
||||
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) {
|
||||
|
|
|
@ -28,9 +28,7 @@
|
|||
package mage.cards.p;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SpellCastControllerTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.UntapAllControllerEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -49,10 +47,7 @@ public class ParadoxEngine extends CardImpl {
|
|||
this.supertype.add("Legendary");
|
||||
|
||||
// Whenever you cast a spell, untap all nonland permanents you control.
|
||||
Effect effect = new UntapAllControllerEffect(new FilterNonlandPermanent());
|
||||
Ability ability = new SpellCastControllerTriggeredAbility(effect, false);
|
||||
ability.addEffect(effect);
|
||||
this.addAbility(ability);
|
||||
this.addAbility(new SpellCastControllerTriggeredAbility(new UntapAllControllerEffect(new FilterNonlandPermanent()), false));
|
||||
}
|
||||
|
||||
public ParadoxEngine(final ParadoxEngine card) {
|
||||
|
|
|
@ -52,8 +52,11 @@ public class PlanarBridge extends CardImpl {
|
|||
this.supertype.add("Legendary");
|
||||
|
||||
// {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(Zone.BATTLEFIELD, new SearchLibraryPutInPlayEffect(target), new GenericManaCost(8));
|
||||
Ability ability = new SimpleActivatedAbility(
|
||||
Zone.BATTLEFIELD,
|
||||
new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(new FilterPermanentCard())),
|
||||
new GenericManaCost(8)
|
||||
);
|
||||
ability.addCost(new TapSourceCost());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
package mage.cards.r;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
|
||||
|
@ -38,7 +37,7 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.token.Token;
|
||||
import mage.game.permanent.token.GremlinToken;
|
||||
import mage.target.common.TargetArtifactPermanent;
|
||||
|
||||
/**
|
||||
|
@ -77,15 +76,3 @@ public class ReleaseTheGremlins extends CardImpl {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,13 +50,15 @@ public class RenegadeMap extends CardImpl {
|
|||
public RenegadeMap(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}");
|
||||
|
||||
|
||||
// Renegade Map enters the battlefield tapped.
|
||||
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.
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(new FilterBasicLandCard());
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInHandEffect(target, true), new TapSourceCost());
|
||||
Ability ability = new SimpleActivatedAbility(
|
||||
Zone.BATTLEFIELD,
|
||||
new SearchLibraryPutInHandEffect(new TargetCardInLibrary(new FilterBasicLandCard()), true),
|
||||
new TapSourceCost()
|
||||
);
|
||||
ability.addCost(new SacrificeSourceCost());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
|
|
@ -28,23 +28,13 @@
|
|||
package mage.cards.r;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.abilities.effects.common.search.SearchLibraryWithLessCMCPutInPlayEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
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.filter.common.FilterArtifactCard;
|
||||
import mage.filter.common.FilterControlledArtifactPermanent;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
|
||||
/**
|
||||
|
@ -53,19 +43,14 @@ import mage.target.common.TargetControlledPermanent;
|
|||
*/
|
||||
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) {
|
||||
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.
|
||||
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.
|
||||
this.getSpellAbility().addEffect(new ReshapeSearchEffect());
|
||||
this.getSpellAbility().addEffect(new SearchLibraryWithLessCMCPutInPlayEffect(new FilterArtifactCard()));
|
||||
}
|
||||
|
||||
public Reshape(final Reshape card) {
|
||||
|
@ -77,46 +62,3 @@ public class Reshape extends CardImpl {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,16 +29,13 @@ package mage.cards.s;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksTriggeredAbility;
|
||||
import mage.abilities.effects.common.ReturnToHandTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Zone;
|
||||
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;
|
||||
|
||||
/**
|
||||
|
@ -55,7 +52,9 @@ public class SalvageScuttler extends CardImpl {
|
|||
this.toughness = new MageInt(4);
|
||||
|
||||
// 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) {
|
||||
|
@ -67,39 +66,3 @@ public class SalvageScuttler extends CardImpl {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,6 +46,12 @@ import mage.game.permanent.token.ServoToken;
|
|||
*/
|
||||
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) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}");
|
||||
|
||||
|
@ -56,9 +62,8 @@ public class SlyRequisitioner extends CardImpl {
|
|||
|
||||
// Improvise
|
||||
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.
|
||||
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));
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ package mage.cards.s;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.TriggeredAbility;
|
||||
import mage.abilities.common.BeginningOfYourEndStepTriggeredAbility;
|
||||
import mage.abilities.condition.common.RevoltCondition;
|
||||
import mage.abilities.decorator.ConditionalTriggeredAbility;
|
||||
|
@ -47,9 +46,6 @@ import mage.watchers.common.RevoltWatcher;
|
|||
*/
|
||||
public class SolemnRecruit extends CardImpl {
|
||||
|
||||
private static final String ruleText = "<i>Revolt</i> — 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) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}{W}");
|
||||
|
||||
|
@ -62,8 +58,14 @@ public class SolemnRecruit extends CardImpl {
|
|||
this.addAbility(DoubleStrikeAbility.getInstance());
|
||||
|
||||
// <i>Revolt</i> — 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(ability, RevoltCondition.getInstance(), ruleText), new RevoltWatcher());
|
||||
this.addAbility(new ConditionalTriggeredAbility(
|
||||
new BeginningOfYourEndStepTriggeredAbility(
|
||||
new AddCountersSourceEffect(CounterType.P1P1.createInstance()),
|
||||
false
|
||||
),
|
||||
RevoltCondition.getInstance(),
|
||||
"<i>Revolt</i> — 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) {
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
*/
|
||||
package mage.cards.s;
|
||||
|
||||
import mage.abilities.effects.common.ExileTargetEffect;
|
||||
import mage.abilities.effects.common.SwordsToPlowsharesEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -43,13 +42,10 @@ import java.util.UUID;
|
|||
public class SwordsToPlowshares extends CardImpl {
|
||||
|
||||
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.
|
||||
// Exile target creature. Its controller gains life equal to its power.
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
this.getSpellAbility().addEffect(new ExileTargetEffect());
|
||||
// Its controller gains life equal to its power.
|
||||
this.getSpellAbility().addEffect(new SwordsToPlowsharesEffect());
|
||||
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ package mage.cards.t;
|
|||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.SearchEffect;
|
||||
import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -63,9 +62,7 @@ public class TrophyMage extends CardImpl {
|
|||
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.
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(0, 1, filter);
|
||||
SearchEffect effect = new SearchLibraryPutInHandEffect(target, true, true);
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(effect, true));
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInHandEffect(new TargetCardInLibrary(0, 1, filter), true, true), true));
|
||||
}
|
||||
|
||||
public TrophyMage(final TrophyMage card) {
|
||||
|
|
|
@ -39,10 +39,7 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.AbilityWord;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.common.TargetOpponentsCreaturePermanent;
|
||||
import mage.watchers.common.RevoltWatcher;
|
||||
|
||||
/**
|
||||
|
@ -51,12 +48,6 @@ import mage.watchers.common.RevoltWatcher;
|
|||
*/
|
||||
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) {
|
||||
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),
|
||||
RevoltCondition.getInstance(),
|
||||
"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");
|
||||
ability.addTarget(new TargetCreaturePermanent(filter));
|
||||
+ "target creature an opponent controls gets -3/-3 until end of turn"
|
||||
);
|
||||
ability.addTarget(new TargetOpponentsCreaturePermanent());
|
||||
ability.setAbilityWord(AbilityWord.REVOLT);
|
||||
this.addAbility(ability, new RevoltWatcher());
|
||||
}
|
||||
|
|
|
@ -28,20 +28,11 @@
|
|||
package mage.cards.w;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.abilities.effects.common.search.SearchLibraryWithLessCMCPutInPlayEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.Filter;
|
||||
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 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.
|
||||
this.getSpellAbility().addEffect(new WargateEffect());
|
||||
this.getSpellAbility().addEffect(new SearchLibraryWithLessCMCPutInPlayEffect(new FilterPermanentCard()));
|
||||
}
|
||||
|
||||
public Wargate(final Wargate card) {
|
||||
|
@ -65,43 +56,3 @@ public class Wargate extends CardImpl {
|
|||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -47,6 +47,12 @@ import mage.target.common.TargetControlledPermanent;
|
|||
*/
|
||||
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) {
|
||||
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.
|
||||
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));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
|
|
@ -28,22 +28,12 @@
|
|||
package mage.cards.w;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.search.SearchLibraryWithLessCMCPutInPlayEffect;
|
||||
import mage.abilities.keyword.ImproviseAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
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;
|
||||
import mage.filter.common.FilterArtifactCard;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -58,7 +48,7 @@ public class WhirOfInvention extends CardImpl {
|
|||
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.
|
||||
this.getSpellAbility().addEffect(new WhirOfInventionSearchEffect());
|
||||
this.getSpellAbility().addEffect(new SearchLibraryWithLessCMCPutInPlayEffect(new FilterArtifactCard()));
|
||||
}
|
||||
|
||||
public WhirOfInvention(final WhirOfInvention card) {
|
||||
|
@ -70,48 +60,3 @@ public class WhirOfInvention extends CardImpl {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,13 +40,11 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
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.ControllerPredicate;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
|
||||
/**
|
||||
|
@ -55,15 +53,12 @@ import mage.target.common.TargetControlledPermanent;
|
|||
*/
|
||||
public class YahenniUndyingPartisan extends CardImpl {
|
||||
|
||||
private static final FilterCreaturePermanent opponentFilter = new FilterCreaturePermanent("a creature an opponent controls");
|
||||
private static final FilterControlledCreaturePermanent ownFilter = new FilterControlledCreaturePermanent("another creature");
|
||||
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature");
|
||||
|
||||
static {
|
||||
opponentFilter.add(new ControllerPredicate(TargetController.OPPONENT));
|
||||
ownFilter.add(new AnotherPredicate());
|
||||
filter.add(new AnotherPredicate());
|
||||
}
|
||||
|
||||
|
||||
public YahenniUndyingPartisan(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}");
|
||||
|
||||
|
@ -77,11 +72,14 @@ public class YahenniUndyingPartisan extends CardImpl {
|
|||
this.addAbility(HasteAbility.getInstance());
|
||||
|
||||
// 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.
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn),
|
||||
new SacrificeTargetCost(new TargetControlledPermanent(ownFilter))));
|
||||
this.addAbility(new SimpleActivatedAbility(
|
||||
Zone.BATTLEFIELD,
|
||||
new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn),
|
||||
new SacrificeTargetCost(new TargetControlledPermanent(filter)))
|
||||
);
|
||||
}
|
||||
|
||||
public YahenniUndyingPartisan(final YahenniUndyingPartisan card) {
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -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.abilities.effects.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
|
@ -42,7 +41,7 @@ public class SwordsToPlowsharesEffect extends OneShotEffect {
|
|||
|
||||
public SwordsToPlowsharesEffect() {
|
||||
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) {
|
||||
|
@ -60,7 +59,9 @@ public class SwordsToPlowsharesEffect extends OneShotEffect {
|
|||
if (permanent != null) {
|
||||
Player player = game.getPlayer(permanent.getControllerId());
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue