fixed several of my old implementations

This commit is contained in:
Evan Kranzler 2019-01-26 14:19:19 -05:00
parent bd652632f9
commit 9a5ac6a848
20 changed files with 228 additions and 221 deletions

View file

@ -1,11 +1,11 @@
package mage.cards.a; package mage.cards.a;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.ActivateAsSorceryActivatedAbility; import mage.abilities.common.ActivateAsSorceryActivatedAbility;
import mage.abilities.costs.common.ExileSourceCost;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ColorlessManaCost; import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.ExileTargetEffect; import mage.abilities.effects.common.ExileTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
@ -16,27 +16,32 @@ import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class AmuletOfUnmaking extends CardImpl { public final class AmuletOfUnmaking extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("artifact, creature, or enchantment"); private static final FilterPermanent filter = new FilterPermanent("artifact, creature, or land");
static { static {
filter.add(Predicates.or( filter.add(Predicates.or(
new CardTypePredicate(CardType.ARTIFACT), new CardTypePredicate(CardType.ARTIFACT),
new CardTypePredicate(CardType.CREATURE), new CardTypePredicate(CardType.CREATURE),
new CardTypePredicate(CardType.ENCHANTMENT))); new CardTypePredicate(CardType.LAND)
));
} }
public AmuletOfUnmaking(UUID ownerId, CardSetInfo setInfo) { public AmuletOfUnmaking(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{5}"); super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{5}");
// {5}, {tap}, Exile Amulet of Unmaking: Exile target artifact, creature, or land. Activate this ability only any time you could cast a sorcery. // {5}, {tap}, Exile Amulet of Unmaking: Exile target artifact, creature, or land. Activate this ability only any time you could cast a sorcery.
Ability ability = new ActivateAsSorceryActivatedAbility(Zone.BATTLEFIELD, new ExileTargetEffect("Exile target artifact, creature or land"), new ColorlessManaCost(5)); Ability ability = new ActivateAsSorceryActivatedAbility(
Zone.BATTLEFIELD, new ExileTargetEffect(), new GenericManaCost(5)
);
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
ability.addCost(new ExileSourceCost());
ability.addTarget(new TargetPermanent(filter)); ability.addTarget(new TargetPermanent(filter));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -1,23 +1,24 @@
package mage.cards.b; package mage.cards.b;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility; import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.RemoveAllCountersSourceEffect; import mage.abilities.effects.common.RemoveAllCountersSourceEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class BloodHound extends CardImpl { public final class BloodHound extends CardImpl {
@ -33,10 +34,12 @@ public final class BloodHound extends CardImpl {
this.addAbility(new BloodHoundTriggeredAbility()); this.addAbility(new BloodHoundTriggeredAbility());
// At the beginning of your end step, remove all +1/+1 counters from Blood Hound. // At the beginning of your end step, remove all +1/+1 counters from Blood Hound.
this.addAbility(new BeginningOfEndStepTriggeredAbility(new RemoveAllCountersSourceEffect(CounterType.P1P1), TargetController.YOU, false)); this.addAbility(new BeginningOfEndStepTriggeredAbility(
new RemoveAllCountersSourceEffect(CounterType.P1P1), TargetController.YOU, false
));
} }
public BloodHound(final BloodHound card) { private BloodHound(final BloodHound card) {
super(card); super(card);
} }
@ -48,11 +51,11 @@ public final class BloodHound extends CardImpl {
class BloodHoundTriggeredAbility extends TriggeredAbilityImpl { class BloodHoundTriggeredAbility extends TriggeredAbilityImpl {
public BloodHoundTriggeredAbility() { BloodHoundTriggeredAbility() {
super(Zone.BATTLEFIELD, new BloodHoundEffect(), true); super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance()), true);
} }
public BloodHoundTriggeredAbility(final BloodHoundTriggeredAbility ability) { private BloodHoundTriggeredAbility(final BloodHoundTriggeredAbility ability) {
super(ability); super(ability);
} }
@ -68,8 +71,9 @@ class BloodHoundTriggeredAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (event.getTargetId().equals(this.getControllerId())) { if (event.getTargetId().equals(this.getControllerId()) && event.getAmount() > 0) {
this.getEffects().get(0).setValue("damageAmount", event.getAmount()); this.getEffects().clear();
this.addEffect(new AddCountersSourceEffect(CounterType.P1P1.createInstance(event.getAmount())));
return true; return true;
} }
return false; return false;
@ -77,31 +81,6 @@ class BloodHoundTriggeredAbility extends TriggeredAbilityImpl {
@Override @Override
public String getRule() { public String getRule() {
return "Whenever you are dealt damage, you may put that many +1/+1 counters on {this}."; return "Whenever you're dealt damage, you may put that many +1/+1 counters on {this}.";
}
}
class BloodHoundEffect extends OneShotEffect {
public BloodHoundEffect() {
super(Outcome.Benefit);
}
public BloodHoundEffect(final BloodHoundEffect effect) {
super(effect);
}
@Override
public BloodHoundEffect copy() {
return new BloodHoundEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
permanent.addCounters(CounterType.P1P1.createInstance((Integer) this.getValue("damageAmount")), source, game);
}
return true;
} }
} }

View file

@ -1,7 +1,6 @@
package mage.cards.b; package mage.cards.b;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
@ -13,31 +12,21 @@ import mage.abilities.effects.common.continuous.BoostTargetEffect;
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.Duration;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import static mage.filter.StaticFilters.FILTER_CONTROLLED_CREATURE_SHORT_TEXT;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.target.TargetSpell; import mage.target.TargetSpell;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
import static mage.filter.StaticFilters.FILTER_CONTROLLED_CREATURE_SHORT_TEXT;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class BrineShaman extends CardImpl { public final class BrineShaman extends CardImpl {
private static final FilterSpell filter = new FilterSpell("creature spell");
static {
filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE)));
}
public BrineShaman(UUID ownerId, CardSetInfo setInfo) { public BrineShaman(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}");
@ -46,16 +35,14 @@ public final class BrineShaman extends CardImpl {
this.toughness = new MageInt(1); this.toughness = new MageInt(1);
// {tap}, Sacrifice a creature: Target creature gets +2/+2 until end of turn. // {tap}, Sacrifice a creature: Target creature gets +2/+2 until end of turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostTargetEffect(2, 2, Duration.EndOfTurn), Ability ability = new SimpleActivatedAbility(new BoostTargetEffect(2, 2), new TapSourceCost());
new SacrificeTargetCost(new TargetControlledCreaturePermanent(FILTER_CONTROLLED_CREATURE_SHORT_TEXT))); ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(FILTER_CONTROLLED_CREATURE_SHORT_TEXT)));
ability.addCost(new TapSourceCost());
ability.addTarget(new TargetCreaturePermanent()); ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability); this.addAbility(ability);
// {1}{U}{U}, Sacrifice a creature: Counter target creature spell. // {1}{U}{U}, Sacrifice a creature: Counter target creature spell.
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CounterTargetEffect(), ability = new SimpleActivatedAbility(new CounterTargetEffect(), new ManaCostsImpl("{1}{U}{U}"));
new SacrificeTargetCost(new TargetControlledCreaturePermanent(FILTER_CONTROLLED_CREATURE_SHORT_TEXT))); ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(FILTER_CONTROLLED_CREATURE_SHORT_TEXT)));
ability.addCost(new ManaCostsImpl("{1}{U}{U}"));
ability.addTarget(new TargetSpell(StaticFilters.FILTER_SPELL_CREATURE)); ability.addTarget(new TargetSpell(StaticFilters.FILTER_SPELL_CREATURE));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -1,7 +1,6 @@
package mage.cards.c; package mage.cards.c;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
@ -12,30 +11,35 @@ import mage.abilities.keyword.ShroudAbility;
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.SubType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Zone; import mage.constants.SubType;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class CephalidInkshrouder extends CardImpl { public final class CephalidInkshrouder extends CardImpl {
public CephalidInkshrouder(UUID ownerId, CardSetInfo setInfo) { public CephalidInkshrouder(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}");
this.subtype.add(SubType.CEPHALID); this.subtype.add(SubType.CEPHALID);
this.power = new MageInt(2); this.power = new MageInt(2);
this.toughness = new MageInt(1); this.toughness = new MageInt(1);
// Discard a card: Cephalid Inkshrouder gains shroud until end of turn and is unblockable this turn. // Discard a card: Cephalid Inkshrouder gains shroud until end of turn and is unblockable this turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilitySourceEffect(ShroudAbility.getInstance(),Duration.EndOfTurn), new DiscardCardCost()); Ability ability = new SimpleActivatedAbility(
ability.addEffect(new CantBeBlockedSourceEffect(Duration.EndOfTurn)); new GainAbilitySourceEffect(
ShroudAbility.getInstance(),
Duration.EndOfTurn
), new DiscardCardCost()
);
ability.addEffect(new CantBeBlockedSourceEffect(Duration.EndOfTurn).setText("and can't be blocked this turn"));
this.addAbility(ability); this.addAbility(ability);
} }
public CephalidInkshrouder(final CephalidInkshrouder card) { private CephalidInkshrouder(final CephalidInkshrouder card) {
super(card); super(card);
} }

View file

@ -1,21 +1,20 @@
package mage.cards.c; package mage.cards.c;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility; import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.effects.common.continuous.GainAbilityAllEffect; import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
import mage.abilities.keyword.FirstStrikeAbility; import mage.abilities.keyword.FirstStrikeAbility;
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.SubType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.filter.common.FilterAttackingCreature; import mage.constants.SubType;
import mage.filter.StaticFilters;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class ChieftainEnDal extends CardImpl { public final class ChieftainEnDal extends CardImpl {
@ -29,11 +28,12 @@ public final class ChieftainEnDal extends CardImpl {
this.toughness = new MageInt(2); this.toughness = new MageInt(2);
// Whenever Chieftain en-Dal attacks, attacking creatures gain first strike until end of turn. // Whenever Chieftain en-Dal attacks, attacking creatures gain first strike until end of turn.
Ability ability = new AttacksTriggeredAbility(new GainAbilityAllEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn, new FilterAttackingCreature()), false); this.addAbility(new AttacksTriggeredAbility(new GainAbilityAllEffect(
this.addAbility(ability); FirstStrikeAbility.getInstance(), Duration.EndOfTurn, StaticFilters.FILTER_ATTACKING_CREATURES
), false));
} }
public ChieftainEnDal(final ChieftainEnDal card) { private ChieftainEnDal(final ChieftainEnDal card) {
super(card); super(card);
} }

View file

@ -1,7 +1,6 @@
package mage.cards.c; package mage.cards.c;
import java.util.UUID;
import mage.abilities.costs.common.ExileXFromYourGraveCost; import mage.abilities.costs.common.ExileXFromYourGraveCost;
import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.GetXValue; import mage.abilities.dynamicvalue.common.GetXValue;
@ -11,28 +10,30 @@ 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.filter.common.FilterCreatureCard; import mage.filter.StaticFilters;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class ChillHaunting extends CardImpl { public final class ChillHaunting extends CardImpl {
private static final DynamicValue xval = new SignInversionDynamicValue(GetXValue.instance);
public ChillHaunting(UUID ownerId, CardSetInfo setInfo) { public ChillHaunting(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{B}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{B}");
// As an additional cost to cast Chill Haunting, exile X creature cards from your graveyard. // As an additional cost to cast Chill Haunting, exile X creature cards from your graveyard.
this.getSpellAbility().addCost(new ExileXFromYourGraveCost(new FilterCreatureCard("creature cards from your graveyard"), true)); this.getSpellAbility().addCost(new ExileXFromYourGraveCost(StaticFilters.FILTER_CARD_CREATURES_YOUR_GRAVEYARD, true));
// Target creature gets -X/-X until end of turn. // Target creature gets -X/-X until end of turn.
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
DynamicValue xval = new SignInversionDynamicValue(GetXValue.instance);
this.getSpellAbility().addEffect(new BoostTargetEffect(xval, xval, Duration.EndOfTurn)); this.getSpellAbility().addEffect(new BoostTargetEffect(xval, xval, Duration.EndOfTurn));
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
} }
public ChillHaunting(final ChillHaunting card) { private ChillHaunting(final ChillHaunting card) {
super(card); super(card);
} }

View file

@ -1,9 +1,7 @@
package mage.cards.c; package mage.cards.c;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.ActivateIfConditionActivatedAbility; import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.condition.CompoundCondition; import mage.abilities.condition.CompoundCondition;
import mage.abilities.condition.Condition; import mage.abilities.condition.Condition;
@ -22,18 +20,28 @@ import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate; import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.target.common.TargetControlledPermanent; import mage.target.common.TargetControlledPermanent;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class CoffinPuppets extends CardImpl { public final class CoffinPuppets extends CardImpl {
private static final FilterControlledPermanent filter = new FilterControlledPermanent("you control a Swamp"); private static final FilterControlledPermanent filter
= new FilterControlledPermanent("you control a Swamp");
private static final FilterControlledPermanent filter2
= new FilterControlledLandPermanent("two lands");
static { static {
filter.add(new SubtypePredicate(SubType.SWAMP)); filter.add(new SubtypePredicate(SubType.SWAMP));
} }
private static final Condition condition = new CompoundCondition(
"during your upkeep and only if you control a Swamp",
new PermanentsOnTheBattlefieldCondition(filter),
new IsStepCondition(PhaseStep.UPKEEP)
);
public CoffinPuppets(UUID ownerId, CardSetInfo setInfo) { public CoffinPuppets(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}{B}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}{B}");
@ -42,12 +50,13 @@ public final class CoffinPuppets extends CardImpl {
this.toughness = new MageInt(3); this.toughness = new MageInt(3);
// Sacrifice two lands: Return Coffin Puppets from your graveyard to the battlefield. Activate this ability only during your upkeep and only if you control a Swamp. // Sacrifice two lands: Return Coffin Puppets from your graveyard to the battlefield. Activate this ability only during your upkeep and only if you control a Swamp.
Condition condition = new CompoundCondition("during your upkeep and only if you control a Swamp",new PermanentsOnTheBattlefieldCondition(filter), new IsStepCondition(PhaseStep.UPKEEP)); this.addAbility(new ActivateIfConditionActivatedAbility(
Ability ability = new ActivateIfConditionActivatedAbility(Zone.GRAVEYARD, Zone.GRAVEYARD,
new ReturnSourceFromGraveyardToBattlefieldEffect(), new ReturnSourceFromGraveyardToBattlefieldEffect(),
new SacrificeTargetCost(new TargetControlledPermanent(2, 2, new FilterControlledLandPermanent("two lands"), true)), new SacrificeTargetCost(
condition); new TargetControlledPermanent(2, 2, filter2, true)
this.addAbility(ability); ), condition
));
} }
public CoffinPuppets(final CoffinPuppets card) { public CoffinPuppets(final CoffinPuppets card) {

View file

@ -1,9 +1,9 @@
package mage.cards.c; package mage.cards.c;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.common.continuous.SetPowerSourceEffect; import mage.abilities.effects.common.continuous.SetPowerSourceEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -13,19 +13,17 @@ import mage.constants.Duration;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class CoilingWoodworm extends CardImpl { public final class CoilingWoodworm extends CardImpl {
final static FilterPermanent filterLands = new FilterPermanent("Forests you control"); private static final DynamicValue count = new PermanentsOnBattlefieldCount(
new FilterPermanent(SubType.FOREST, "Forests on the battlefield")
static { );
filterLands.add(new SubtypePredicate(SubType.FOREST));
}
public CoilingWoodworm(UUID ownerId, CardSetInfo setInfo) { public CoilingWoodworm(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}");
@ -36,10 +34,10 @@ public final class CoilingWoodworm extends CardImpl {
this.toughness = new MageInt(1); this.toughness = new MageInt(1);
// Coiling Woodworm's power is equal to the number of Forests on the battlefield. // Coiling Woodworm's power is equal to the number of Forests on the battlefield.
this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetPowerSourceEffect(new PermanentsOnBattlefieldCount(filterLands), Duration.EndOfGame))); this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetPowerSourceEffect(count, Duration.EndOfGame)));
} }
public CoilingWoodworm(final CoilingWoodworm card) { private CoilingWoodworm(final CoilingWoodworm card) {
super(card); super(card);
} }

View file

@ -1,7 +1,6 @@
package mage.cards.c; package mage.cards.c;
import java.util.UUID;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
@ -12,15 +11,15 @@ 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.Zone;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
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.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class CommonCause extends CardImpl { public final class CommonCause extends CardImpl {
@ -35,9 +34,11 @@ public final class CommonCause extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}");
// Nonartifact creatures get +2/+2 as long as they all share a color. // Nonartifact creatures get +2/+2 as long as they all share a color.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new BoostAllEffect(2, 2, Duration.WhileOnBattlefield, filter, false), this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect(
new AllColorCondition(), new BoostAllEffect(2, 2, Duration.WhileOnBattlefield, filter, false),
"nonartifact creatures get +2/+2 as long as they all share a color."))); AllColorCondition.instance,
"nonartifact creatures get +2/+2 as long as they all share a color.")
));
} }
public CommonCause(final CommonCause card) { public CommonCause(final CommonCause card) {
@ -50,7 +51,8 @@ public final class CommonCause extends CardImpl {
} }
} }
class AllColorCondition implements Condition { enum AllColorCondition implements Condition {
instance;
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
@ -58,7 +60,7 @@ class AllColorCondition implements Condition {
filter.add(Predicates.not(new CardTypePredicate(CardType.ARTIFACT))); filter.add(Predicates.not(new CardTypePredicate(CardType.ARTIFACT)));
ObjectColor allColor = new ObjectColor("WUBRG"); ObjectColor allColor = new ObjectColor("WUBRG");
for (Permanent thing : game.getBattlefield().getAllActivePermanents(filter, game)) { for (Permanent thing : game.getBattlefield().getAllActivePermanents(filter, game)) {
allColor = allColor.intersection(thing.getColor(game)); allColor = allColor.intersection(thing.getColor(game));
} }
return !allColor.isColorless(); return !allColor.isColorless();
} }

View file

@ -1,27 +1,31 @@
package mage.cards.c; package mage.cards.c;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.ReturnToHandSourceEffect; import mage.abilities.effects.common.ReturnToHandSourceEffect;
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.SubType;
import mage.constants.ComparisonType; import mage.constants.ComparisonType;
import mage.constants.SubType;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.filter.common.FilterControlledPermanent; import mage.filter.StaticFilters;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class ComplexAutomaton extends CardImpl { public final class ComplexAutomaton extends CardImpl {
private static final Condition condition = new PermanentsOnTheBattlefieldCondition(
StaticFilters.FILTER_CONTROLLED_PERMANENT, ComparisonType.MORE_THAN, 6
);
public ComplexAutomaton(UUID ownerId, CardSetInfo setInfo) { public ComplexAutomaton(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{4}"); super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{4}");
@ -30,12 +34,16 @@ public final class ComplexAutomaton extends CardImpl {
this.toughness = new MageInt(4); this.toughness = new MageInt(4);
// At the beginning of your upkeep, if you control seven or more permanents, return Complex Automaton to its owner's hand. // At the beginning of your upkeep, if you control seven or more permanents, return Complex Automaton to its owner's hand.
TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(new ReturnToHandSourceEffect(true), TargetController.YOU, false); this.addAbility(new ConditionalInterveningIfTriggeredAbility(
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability, new PermanentsOnTheBattlefieldCondition(new FilterControlledPermanent(), ComparisonType.MORE_THAN, 6), new BeginningOfUpkeepTriggeredAbility(
"At the beginning of your upkeep, if you control seven or more permanents, return Complex Automaton to its owner's hand.")); new ReturnToHandSourceEffect(true),
TargetController.YOU, false
), condition, "At the beginning of your upkeep, " +
"if you control seven or more permanents, return {this} to its owner's hand."
));
} }
public ComplexAutomaton(final ComplexAutomaton card) { private ComplexAutomaton(final ComplexAutomaton card) {
super(card); super(card);
} }

View file

@ -1,7 +1,6 @@
package mage.cards.c; package mage.cards.c;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
@ -14,28 +13,29 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.Predicate;
import mage.filter.predicate.Predicates; import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.TappedPredicate; import mage.filter.predicate.permanent.TappedPredicate;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class CrookclawElder extends CardImpl { public final class CrookclawElder extends CardImpl {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped Bird you control"); private static final FilterControlledCreaturePermanent filter
private static final FilterControlledCreaturePermanent filter2 = new FilterControlledCreaturePermanent("untapped Wizards you control"); = new FilterControlledCreaturePermanent(SubType.BIRD, "untapped Birds you control");
private static final FilterControlledCreaturePermanent filter2
= new FilterControlledCreaturePermanent(SubType.WIZARD, "untapped Wizards you control");
private static final Predicate pred = Predicates.not(TappedPredicate.instance);
static { static {
filter.add(new SubtypePredicate(SubType.BIRD)); filter.add(pred);
filter.add(Predicates.not(TappedPredicate.instance)); filter2.add(pred);
filter2.add(new SubtypePredicate(SubType.WIZARD));
filter2.add(Predicates.not(TappedPredicate.instance));
} }
public CrookclawElder(UUID ownerId, CardSetInfo setInfo) { public CrookclawElder(UUID ownerId, CardSetInfo setInfo) {
@ -50,16 +50,26 @@ public final class CrookclawElder extends CardImpl {
this.addAbility(FlyingAbility.getInstance()); this.addAbility(FlyingAbility.getInstance());
// Tap two untapped Birds you control: Draw a card. // Tap two untapped Birds you control: Draw a card.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), new TapTargetCost(new TargetControlledCreaturePermanent(2, 2, filter, true))); Ability ability = new SimpleActivatedAbility(
new DrawCardSourceControllerEffect(1),
new TapTargetCost(new TargetControlledCreaturePermanent(
2, 2, filter, true
))
);
this.addAbility(ability); this.addAbility(ability);
// Tap two untapped Wizards you control: Target creature gains flying until end of turn. // Tap two untapped Wizards you control: Target creature gains flying until end of turn.
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilityTargetEffect(FlyingAbility.getInstance(), Duration.EndOfTurn), new TapTargetCost(new TargetControlledCreaturePermanent(2, 2, filter2, true))); ability = new SimpleActivatedAbility(
new GainAbilityTargetEffect(FlyingAbility.getInstance(), Duration.EndOfTurn),
new TapTargetCost(new TargetControlledCreaturePermanent(
2, 2, filter2, true
))
);
ability.addTarget(new TargetCreaturePermanent()); ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability); this.addAbility(ability);
} }
public CrookclawElder(final CrookclawElder card) { private CrookclawElder(final CrookclawElder card) {
super(card); super(card);
} }

View file

@ -1,7 +1,7 @@
package mage.cards.d; package mage.cards.d;
import java.util.UUID; import mage.abilities.condition.Condition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.costs.AlternativeCostSourceAbility; import mage.abilities.costs.AlternativeCostSourceAbility;
import mage.abilities.costs.common.SacrificeTargetCost; import mage.abilities.costs.common.SacrificeTargetCost;
@ -11,30 +11,30 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.SubType; import mage.constants.SubType;
import static mage.filter.StaticFilters.FILTER_CONTROLLED_CREATURE_SHORT_TEXT; import mage.filter.FilterPermanent;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
import static mage.filter.StaticFilters.FILTER_CONTROLLED_CREATURE_SHORT_TEXT;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class DarkTriumph extends CardImpl { public final class DarkTriumph extends CardImpl {
private static final FilterLandPermanent filterSwamp = new FilterLandPermanent("If you control a Swamp"); private static final Condition condition = new PermanentsOnTheBattlefieldCondition(
new FilterPermanent(SubType.SWAMP, "If you control a Swamp")
static { );
filterSwamp.add(new SubtypePredicate(SubType.SWAMP));
}
public DarkTriumph(UUID ownerId, CardSetInfo setInfo) { public DarkTriumph(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{4}{B}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{4}{B}");
// If you control a Swamp, you may sacrifice a creature rather than pay Dark Triumph's mana cost. // If you control a Swamp, you may sacrifice a creature rather than pay Dark Triumph's mana cost.
this.addAbility(new AlternativeCostSourceAbility( this.addAbility(new AlternativeCostSourceAbility(
new SacrificeTargetCost(new TargetControlledCreaturePermanent(FILTER_CONTROLLED_CREATURE_SHORT_TEXT)), new SacrificeTargetCost(
new PermanentsOnTheBattlefieldCondition(filterSwamp), null new TargetControlledCreaturePermanent(FILTER_CONTROLLED_CREATURE_SHORT_TEXT)
), condition
)); ));
// Creatures you control get +2/+0 until end of turn. // Creatures you control get +2/+0 until end of turn.

View file

@ -1,7 +1,6 @@
package mage.cards.d; package mage.cards.d;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.costs.AlternativeCostSourceAbility; import mage.abilities.costs.AlternativeCostSourceAbility;
@ -15,13 +14,15 @@ import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.ColorPredicate;
import mage.target.common.TargetControlledPermanent; import mage.target.common.TargetControlledPermanent;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class Delraich extends CardImpl { public final class Delraich extends CardImpl {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("black creature"); private static final FilterControlledCreaturePermanent filter
= new FilterControlledCreaturePermanent("black creature");
static { static {
filter.add(new ColorPredicate(ObjectColor.BLACK)); filter.add(new ColorPredicate(ObjectColor.BLACK));
@ -34,15 +35,16 @@ public final class Delraich extends CardImpl {
this.power = new MageInt(6); this.power = new MageInt(6);
this.toughness = new MageInt(6); this.toughness = new MageInt(6);
// You may sacrifice three black creatures rather than pay Delraich's mana cost.
this.addAbility(new AlternativeCostSourceAbility(new SacrificeTargetCost(
new TargetControlledPermanent(3, 3, filter, false)
)));
// Trample // Trample
this.addAbility(TrampleAbility.getInstance()); this.addAbility(TrampleAbility.getInstance());
// You may sacrifice three black creatures rather than pay Delraich's mana cost.
AlternativeCostSourceAbility alternateCosts = new AlternativeCostSourceAbility(new SacrificeTargetCost(new TargetControlledPermanent(3, 3, filter, false)));
this.addAbility(alternateCosts);
} }
public Delraich(final Delraich card) { private Delraich(final Delraich card) {
super(card); super(card);
} }

View file

@ -1,23 +1,23 @@
package mage.cards.d; package mage.cards.d;
import java.util.UUID;
import mage.target.common.TargetCreaturePermanent;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.DealsDamageToAPlayerAttachedTriggeredAbility; import mage.abilities.common.DealsDamageToAPlayerAttachedTriggeredAbility;
import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.SacrificeEffect; import mage.abilities.effects.common.SacrificeEffect;
import mage.constants.Outcome;
import mage.target.TargetPermanent;
import mage.abilities.keyword.EnchantAbility; import mage.abilities.keyword.EnchantAbility;
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.SubType; import mage.constants.SubType;
import mage.filter.common.FilterLandPermanent; import mage.filter.StaticFilters;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class DestructiveUrge extends CardImpl { public final class DestructiveUrge extends CardImpl {
@ -35,8 +35,10 @@ public final class DestructiveUrge extends CardImpl {
this.addAbility(ability); this.addAbility(ability);
// Whenever enchanted creature deals combat damage to a player, that player sacrifices a land. // Whenever enchanted creature deals combat damage to a player, that player sacrifices a land.
ability = new DealsDamageToAPlayerAttachedTriggeredAbility(new SacrificeEffect(new FilterLandPermanent(), 1, "that player"), "enchanted", false, true); this.addAbility(new DealsDamageToAPlayerAttachedTriggeredAbility(
this.addAbility(ability); new SacrificeEffect(StaticFilters.FILTER_LAND, 1, "that player"),
"enchanted", false, true
));
} }
public DestructiveUrge(final DestructiveUrge card) { public DestructiveUrge(final DestructiveUrge card) {

View file

@ -1,7 +1,6 @@
package mage.cards.d; package mage.cards.d;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
@ -10,13 +9,14 @@ 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.FilterCreaturePermanent; import mage.filter.StaticFilters;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetPlayer; import mage.target.TargetPlayer;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class DivineCongregation extends CardImpl { public final class DivineCongregation extends CardImpl {
@ -32,7 +32,7 @@ public final class DivineCongregation extends CardImpl {
this.addAbility(new SuspendAbility(5, new ManaCostsImpl("{1}{W}"), this)); this.addAbility(new SuspendAbility(5, new ManaCostsImpl("{1}{W}"), this));
} }
public DivineCongregation(final DivineCongregation card) { private DivineCongregation(final DivineCongregation card) {
super(card); super(card);
} }
@ -44,12 +44,12 @@ public final class DivineCongregation extends CardImpl {
class DivineCongregationEffect extends OneShotEffect { class DivineCongregationEffect extends OneShotEffect {
public DivineCongregationEffect() { DivineCongregationEffect() {
super(Outcome.Benefit); super(Outcome.Benefit);
staticText = "You gain 2 life for each creature target player controls"; staticText = "You gain 2 life for each creature target player controls";
} }
public DivineCongregationEffect(final DivineCongregationEffect effect) { private DivineCongregationEffect(final DivineCongregationEffect effect) {
super(effect); super(effect);
} }
@ -63,7 +63,7 @@ class DivineCongregationEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
Player player = game.getPlayer(source.getFirstTarget()); Player player = game.getPlayer(source.getFirstTarget());
if (controller != null && player != null) { if (controller != null && player != null) {
int critters = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), player.getId(), game).size(); int critters = game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, player.getId(), game).size();
controller.gainLife(2 * critters, game, source); controller.gainLife(2 * critters, game, source);
} }
return true; return true;

View file

@ -1,8 +1,6 @@
package mage.cards.e; package mage.cards.e;
import java.util.Iterator;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.condition.InvertCondition; import mage.abilities.condition.InvertCondition;
import mage.abilities.condition.common.CardsInControllerGraveCondition; import mage.abilities.condition.common.CardsInControllerGraveCondition;
@ -18,8 +16,10 @@ import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.TargetPlayer; import mage.target.TargetPlayer;
import java.util.Iterator;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class Epicenter extends CardImpl { public final class Epicenter extends CardImpl {
@ -31,12 +31,15 @@ public final class Epicenter extends CardImpl {
this.getSpellAbility().addEffect(new ConditionalOneShotEffect( this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
new SacrificeEffect(StaticFilters.FILTER_LAND, 1, "Target player"), new SacrificeEffect(StaticFilters.FILTER_LAND, 1, "Target player"),
new InvertCondition(new CardsInControllerGraveCondition(7)), new InvertCondition(new CardsInControllerGraveCondition(7)),
"Target player sacrifices a land")); "Target player sacrifices a land"
));
// Threshold - Each player sacrifices all lands he or she controls instead if seven or more cards are in your graveyard. // Threshold - Each player sacrifices all lands he or she controls instead if seven or more cards are in your graveyard.
this.getSpellAbility().addEffect(new ConditionalOneShotEffect( this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
new EpicenterEffect(), new EpicenterEffect(),
new CardsInControllerGraveCondition(7), new CardsInControllerGraveCondition(7),
"<br/><br/><i>Threshold</i> &mdash; Each player sacrifices all lands he or she controls instead if seven or more cards are in your graveyard.")); "<br/><br/><i>Threshold</i> &mdash; Each player sacrifices all lands they control instead " +
"if seven or more cards are in your graveyard."
));
this.getSpellAbility().addTarget(new TargetPlayer()); this.getSpellAbility().addTarget(new TargetPlayer());
} }
@ -55,10 +58,9 @@ class EpicenterEffect extends OneShotEffect {
EpicenterEffect() { EpicenterEffect() {
super(Outcome.DestroyPermanent); super(Outcome.DestroyPermanent);
staticText = "Each player sacrifices all lands he or she controls";
} }
EpicenterEffect(final EpicenterEffect effect) { private EpicenterEffect(final EpicenterEffect effect) {
super(effect); super(effect);
} }

View file

@ -1,7 +1,6 @@
package mage.cards.i; package mage.cards.i;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.common.SpellCastOpponentTriggeredAbility; import mage.abilities.common.SpellCastOpponentTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
@ -11,22 +10,21 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.filter.FilterCard;
import mage.filter.FilterSpell; import mage.filter.FilterSpell;
import mage.filter.common.FilterArtifactCard; import mage.filter.common.FilterArtifactCard;
import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.common.FilterArtifactSpell;
import mage.game.permanent.token.InsectToken; import mage.game.permanent.token.InsectToken;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class InfestedRoothold extends CardImpl { public final class InfestedRoothold extends CardImpl {
private final static FilterSpell filter = new FilterSpell("an artifact spell"); private static final FilterCard filter = new FilterArtifactCard("artifacts");
private static final FilterSpell filter2 = new FilterArtifactSpell("an artifact spell");
static {
filter.add(new CardTypePredicate(CardType.ARTIFACT));
}
public InfestedRoothold(UUID ownerId, CardSetInfo setInfo) { public InfestedRoothold(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}");
@ -39,10 +37,12 @@ public final class InfestedRoothold extends CardImpl {
this.addAbility(DefenderAbility.getInstance()); this.addAbility(DefenderAbility.getInstance());
// Protection from artifacts // Protection from artifacts
this.addAbility(new ProtectionAbility(new FilterArtifactCard("artifacts"))); this.addAbility(new ProtectionAbility(filter));
// Whenever an opponent casts an artifact spell, you may create a 1/1 green Insect creature token. // Whenever an opponent casts an artifact spell, you may create a 1/1 green Insect creature token.
this.addAbility(new SpellCastOpponentTriggeredAbility(new CreateTokenEffect(new InsectToken()), filter, true)); this.addAbility(new SpellCastOpponentTriggeredAbility(
new CreateTokenEffect(new InsectToken()), filter2, true)
);
} }

View file

@ -1,35 +1,39 @@
package mage.cards.m; package mage.cards.m;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.AsEntersBattlefieldAbility; import mage.abilities.common.AsEntersBattlefieldAbility;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ChooseCreatureTypeEffect; import mage.abilities.effects.common.ChooseCreatureTypeEffect;
import mage.abilities.effects.common.continuous.AddCardTypeTargetEffect; import mage.abilities.effects.common.continuous.AddCardTypeSourceEffect;
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.Duration; import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Zone; import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.ChosenSubtypePredicate; import mage.filter.predicate.mageobject.ChosenSubtypePredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.targetpointer.FixedTarget;
import mage.util.functions.EmptyApplyToPermanent; import mage.util.functions.EmptyApplyToPermanent;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class MirrorOfTheForebears extends CardImpl { public final class MirrorOfTheForebears extends CardImpl {
private static final FilterPermanent filter = new FilterControlledCreaturePermanent();
static {
filter.add(new ChosenSubtypePredicate());
}
public MirrorOfTheForebears(UUID ownerId, CardSetInfo setInfo) { public MirrorOfTheForebears(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}"); super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
@ -37,14 +41,12 @@ public final class MirrorOfTheForebears extends CardImpl {
this.addAbility(new AsEntersBattlefieldAbility(new ChooseCreatureTypeEffect(Outcome.Copy))); this.addAbility(new AsEntersBattlefieldAbility(new ChooseCreatureTypeEffect(Outcome.Copy)));
// 1: Until end of turn, Mirror of the Forebears becomes a copy of target creature you control of the chosen type, except it's an artifact in addition to its other types. // 1: Until end of turn, Mirror of the Forebears becomes a copy of target creature you control of the chosen type, except it's an artifact in addition to its other types.
FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent(); Ability ability = new SimpleActivatedAbility(new MirrorOfTheForebearsCopyEffect(), new GenericManaCost(1));
filter.add(new ChosenSubtypePredicate());
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new MirrorOfTheForebearsCopyEffect(), new ManaCostsImpl("{1}"));
ability.addTarget(new TargetPermanent(filter)); ability.addTarget(new TargetPermanent(filter));
this.addAbility(ability); this.addAbility(ability);
} }
public MirrorOfTheForebears(final MirrorOfTheForebears card) { private MirrorOfTheForebears(final MirrorOfTheForebears card) {
super(card); super(card);
} }
@ -56,12 +58,12 @@ public final class MirrorOfTheForebears extends CardImpl {
class MirrorOfTheForebearsCopyEffect extends OneShotEffect { class MirrorOfTheForebearsCopyEffect extends OneShotEffect {
public MirrorOfTheForebearsCopyEffect() { MirrorOfTheForebearsCopyEffect() {
super(Outcome.Copy); super(Outcome.Copy);
this.staticText = "until end of turn, {this} becomes a copy of target creature you control of the chosen type, except it's an artifact in addition to its other types"; this.staticText = "until end of turn, {this} becomes a copy of target creature you control of the chosen type, except it's an artifact in addition to its other types";
} }
public MirrorOfTheForebearsCopyEffect(final MirrorOfTheForebearsCopyEffect effect) { private MirrorOfTheForebearsCopyEffect(final MirrorOfTheForebearsCopyEffect effect) {
super(effect); super(effect);
} }
@ -76,11 +78,7 @@ class MirrorOfTheForebearsCopyEffect extends OneShotEffect {
Permanent copyFromPermanent = game.getPermanent(getTargetPointer().getFirst(game, source)); Permanent copyFromPermanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (sourcePermanent != null && copyFromPermanent != null) { if (sourcePermanent != null && copyFromPermanent != null) {
game.copyPermanent(Duration.EndOfTurn, copyFromPermanent, sourcePermanent.getId(), source, new EmptyApplyToPermanent()); game.copyPermanent(Duration.EndOfTurn, copyFromPermanent, sourcePermanent.getId(), source, new EmptyApplyToPermanent());
if (!copyFromPermanent.isArtifact()) { game.addEffect(new AddCardTypeSourceEffect(Duration.EndOfTurn, CardType.ARTIFACT), source);
ContinuousEffect effect = new AddCardTypeTargetEffect(Duration.EndOfTurn, CardType.ARTIFACT);
effect.setTargetPointer(new FixedTarget(sourcePermanent, game));
game.addEffect(effect, source);
}
return true; return true;
} }
return false; return false;

View file

@ -1,10 +1,8 @@
package mage.cards.s; package mage.cards.s;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.Mode; import mage.abilities.Mode;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect; import mage.abilities.effects.common.LookLibraryControllerEffect;
import mage.abilities.keyword.EntwineAbility; import mage.abilities.keyword.EntwineAbility;
@ -18,8 +16,9 @@ import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetOpponent; import mage.target.common.TargetOpponent;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class SecondSight extends CardImpl { public final class SecondSight extends CardImpl {
@ -32,22 +31,17 @@ public final class SecondSight extends CardImpl {
this.getSpellAbility().getModes().setMaxModes(1); this.getSpellAbility().getModes().setMaxModes(1);
//Look at the top five cards of target opponent's library, then put them back in any order; //Look at the top five cards of target opponent's library, then put them back in any order;
Effect effect = new SecondSightEffect(); this.getSpellAbility().addEffect(new SecondSightEffect());
this.getSpellAbility().addEffect(effect);
this.getSpellAbility().addTarget(new TargetOpponent()); this.getSpellAbility().addTarget(new TargetOpponent());
//or look at the top five cards of your library, then put them back in any order. //or look at the top five cards of your library, then put them back in any order.
effect = new LookLibraryControllerEffect(5); this.getSpellAbility().getModes().addMode(new Mode(new LookLibraryControllerEffect(5)));
Mode mode = new Mode();
mode.addEffect(effect);
this.getSpellAbility().getModes().addMode(mode);
// Entwine {U} // Entwine {U}
this.addAbility(new EntwineAbility("{U}")); this.addAbility(new EntwineAbility("{U}"));
} }
public SecondSight(final SecondSight card) { private SecondSight(final SecondSight card) {
super(card); super(card);
} }
@ -59,12 +53,12 @@ public final class SecondSight extends CardImpl {
class SecondSightEffect extends OneShotEffect { class SecondSightEffect extends OneShotEffect {
public SecondSightEffect() { SecondSightEffect() {
super(Outcome.DrawCard); super(Outcome.DrawCard);
this.staticText = "look at the top five cards of target opponent's library, then put them back in any order"; this.staticText = "look at the top five cards of target opponent's library, then put them back in any order";
} }
public SecondSightEffect(final SecondSightEffect effect) { private SecondSightEffect(final SecondSightEffect effect) {
super(effect); super(effect);
} }

View file

@ -85,6 +85,12 @@ public final class StaticFilters {
FILTER_CARD_CREATURE_YOUR_GRAVEYARD.setLockedFilter(true); FILTER_CARD_CREATURE_YOUR_GRAVEYARD.setLockedFilter(true);
} }
public static final FilterCreatureCard FILTER_CARD_CREATURES_YOUR_GRAVEYARD = new FilterCreatureCard("creature cards from your graveyard");
static {
FILTER_CARD_CREATURES_YOUR_GRAVEYARD.setLockedFilter(true);
}
public static final FilterCard FILTER_CARD_FROM_YOUR_GRAVEYARD = new FilterCard("card from your graveyard"); public static final FilterCard FILTER_CARD_FROM_YOUR_GRAVEYARD = new FilterCard("card from your graveyard");
static { static {