Fixed cards granting indestructibility.

This commit is contained in:
North 2012-09-05 16:26:54 +03:00
parent 2a50ace7b5
commit e9b441ed9e
12 changed files with 252 additions and 85 deletions

View file

@ -27,14 +27,13 @@
*/
package mage.sets.avacynrestored;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.continious.GainAbilityAllEffect;
import mage.abilities.effects.common.IndestructibleAllEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.IndestructibleAbility;
import mage.abilities.keyword.VigilanceAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterControlledPermanent;
@ -60,7 +59,8 @@ public class AvacynAngelOfHope extends CardImpl<AvacynAngelOfHope> {
this.addAbility(VigilanceAbility.getInstance());
// Avacyn, Angel of Hope and other permanents you control are indestructible.
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityAllEffect(new IndestructibleAbility(), Constants.Duration.WhileInGraveyard, new FilterControlledPermanent())));
FilterControlledPermanent filter = new FilterControlledPermanent("Avacyn, Angel of Hope and other permanents you control");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new IndestructibleAllEffect(filter)));
}
public AvacynAngelOfHope(final AvacynAngelOfHope card) {

View file

@ -28,15 +28,13 @@
package mage.sets.darkascension;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.abilities.condition.common.FatefulHourCondition;
import mage.abilities.decorator.ConditionalContinousEffect;
import mage.abilities.effects.common.IndestructibleAllEffect;
import mage.abilities.effects.common.continious.BoostControlledEffect;
import mage.abilities.effects.common.continious.GainAbilityControlledEffect;
import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
@ -54,10 +52,12 @@ public class BreakOfDay extends CardImpl<BreakOfDay> {
this.color.setWhite(true);
// Creatures you control get +1/+1 until end of turn.
this.getSpellAbility().addEffect(new BoostControlledEffect(1, 1, Constants.Duration.EndOfTurn));
this.getSpellAbility().addEffect(new BoostControlledEffect(1, 1, Duration.EndOfTurn));
// Fateful hour - If you have 5 or less life, those creatures also are indestructible this turn.
this.getSpellAbility().addEffect(new ConditionalContinousEffect(new GainAbilityControlledEffect(new IndestructibleAbility(), Constants.Duration.EndOfTurn, new FilterCreaturePermanent()),
FatefulHourCondition.getInstance(), "If you have 5 or less life, those creatures also are indestructible this turn."));
this.getSpellAbility().addEffect(new ConditionalContinousEffect(
new IndestructibleAllEffect(new FilterCreaturePermanent("creatures you control"), Duration.EndOfTurn),
FatefulHourCondition.getInstance(),
"If you have 5 or less life, those creatures also are indestructible this turn."));
}
public BreakOfDay(final BreakOfDay card) {

View file

@ -30,12 +30,11 @@ package mage.sets.darksteel;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.continious.GainAbilityControlledEffect;
import mage.abilities.keyword.IndestructibleAbility;
import mage.abilities.effects.common.IndestructibleAllEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
@ -45,7 +44,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
*/
public class DarksteelForge extends CardImpl<DarksteelForge> {
private final static FilterControlledPermanent filter = new FilterControlledPermanent("Artifacts");
private final static FilterControlledPermanent filter = new FilterControlledPermanent("Artifacts you control");
static {
filter.add(new CardTypePredicate(CardType.ARTIFACT));
@ -54,7 +53,9 @@ public class DarksteelForge extends CardImpl<DarksteelForge> {
public DarksteelForge(UUID ownerId) {
super(ownerId, 110, "Darksteel Forge", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{9}");
this.expansionSetCode = "DST";
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityControlledEffect(new IndestructibleAbility(), Constants.Duration.WhileOnBattlefield, filter, false)));
// Artifacts you control are indestructible.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new IndestructibleAllEffect(filter)));
}

View file

@ -27,35 +27,37 @@
*/
package mage.sets.lorwyn;
import mage.Constants;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.IndestructibleAllEffect;
import mage.abilities.effects.common.continious.BoostControlledEffect;
import mage.abilities.effects.common.continious.GainAbilityControlledEffect;
import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate;
import java.util.UUID;
import mage.filter.predicate.permanent.AnotherPredicate;
/**
*
* @author anonymous
* @author Loki
*/
public class TimberProtector extends CardImpl<TimberProtector> {
private final static FilterCreaturePermanent filterTreefolk = new FilterCreaturePermanent("Treefolk creatures");
private final static FilterControlledPermanent filterBoth = new FilterControlledPermanent("Treefolk and Forests");
private final static FilterControlledPermanent filterBoth = new FilterControlledPermanent("Other Treefolk and Forests you control");
static {
filterTreefolk.add(new SubtypePredicate("Treefolk"));
filterBoth.add(Predicates.or(new SubtypePredicate("Treefolk"),new SubtypePredicate("Forest")));
filterBoth.add(Predicates.or(
new SubtypePredicate("Treefolk"),
new SubtypePredicate("Forest")));
filterBoth.add(new AnotherPredicate());
}
public TimberProtector(UUID ownerId) {
@ -66,10 +68,11 @@ public class TimberProtector extends CardImpl<TimberProtector> {
this.color.setGreen(true);
this.power = new MageInt(4);
this.toughness = new MageInt(6);
// Other Treefolk creatures you control get +1/+1.
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Constants.Duration.WhileOnBattlefield, filterTreefolk, true)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, filterTreefolk, true)));
// Other Treefolk and Forests you control are indestructible.
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityControlledEffect(new IndestructibleAbility(), Constants.Duration.WhileOnBattlefield, filterBoth, true)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new IndestructibleAllEffect(filterBoth)));
}
public TimberProtector(final TimberProtector card) {

View file

@ -33,12 +33,10 @@ import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continious.GainAbilityAttachedEffect;
import mage.abilities.effects.common.IndestructibleAttachedEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl;
import mage.target.TargetPermanent;
@ -59,10 +57,9 @@ public class Indestructibility extends CardImpl<Indestructibility> {
TargetPermanent auraTarget = new TargetPermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Benefit));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
this.addAbility(new EnchantAbility(auraTarget.getTargetName()));
// Enchanted permanent is indestructible.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(new IndestructibleAbility(), AttachmentType.AURA)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new IndestructibleAttachedEffect(AttachmentType.AURA)));
}
public Indestructibility(final Indestructibility card) {

View file

@ -35,13 +35,13 @@ import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.IndestructibleAllEffect;
import mage.abilities.effects.common.continious.BoostControlledEffect;
import mage.abilities.effects.common.continious.GainAbilityControlledEffect;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.AnotherPredicate;
/**
*
@ -53,6 +53,7 @@ public class KnightExemplar extends CardImpl<KnightExemplar> {
static {
filter.add(new SubtypePredicate("Knight"));
filter.add(new AnotherPredicate());
}
public KnightExemplar(UUID ownerId) {
@ -64,9 +65,13 @@ public class KnightExemplar extends CardImpl<KnightExemplar> {
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// First strike
this.addAbility(FirstStrikeAbility.getInstance());
// Other Knight creatures you control get +1/+1 and are indestructible.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, filter, true)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(new IndestructibleAbility(), Duration.WhileOnBattlefield, filter, true)));
FilterCreaturePermanent indestructibleFilter = filter.copy();
indestructibleFilter.setMessage("Other Knight creatures you control");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new IndestructibleAllEffect(indestructibleFilter)));
}
public KnightExemplar(final KnightExemplar card) {

View file

@ -30,12 +30,14 @@ package mage.sets.mirrodinbesieged;
import java.util.UUID;
import mage.Constants;
import mage.Constants.AttachmentType;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.continious.GainAbilityAttachedEffect;
import mage.abilities.effects.common.IndestructibleAttachedEffect;
import mage.abilities.keyword.EquipAbility;
import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl;
@ -50,9 +52,13 @@ public class DarksteelPlate extends CardImpl<DarksteelPlate> {
super(ownerId, 104, "Darksteel Plate", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{3}");
this.expansionSetCode = "MBS";
this.subtype.add("Equipment");
this.addAbility(new EquipAbility(Constants.Outcome.AddAbility, new GenericManaCost(2)));
// Darksteel Plate is indestructible.
this.addAbility(new IndestructibleAbility());
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityAttachedEffect(new IndestructibleAbility(), Constants.AttachmentType.EQUIPMENT)));
// Equipped creature is indestructible.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new IndestructibleAttachedEffect(AttachmentType.EQUIPMENT)));
// Equip {2}
this.addAbility(new EquipAbility(Outcome.BoostCreature, new GenericManaCost(2)));
}
public DarksteelPlate (final DarksteelPlate card) {

View file

@ -31,28 +31,25 @@ package mage.sets.shardsofalara;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Layer;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.SubLayer;
import mage.abilities.Ability;
import mage.Constants.Zone;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effects;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.GetEmblemEffect;
import mage.abilities.effects.common.IndestructibleAllEffect;
import mage.abilities.effects.common.continious.BoostTargetEffect;
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.command.Emblem;
import mage.game.permanent.token.SoldierToken;
import mage.target.common.TargetCreaturePermanent;
@ -62,17 +59,18 @@ import mage.target.common.TargetCreaturePermanent;
*/
public class ElspethKnightErrant extends CardImpl<ElspethKnightErrant> {
private static SoldierToken soldierToken = new SoldierToken();
public ElspethKnightErrant(UUID ownerId) {
super(ownerId, 9, "Elspeth, Knight-Errant", Rarity.MYTHIC, new CardType[]{CardType.PLANESWALKER}, "{2}{W}{W}");
this.expansionSetCode = "ALA";
this.subtype.add("Elspeth");
this.color.setWhite(true);
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(4)), ""));
this.addAbility(new LoyaltyAbility(new CreateTokenEffect(soldierToken), 1));
// +1: Put a 1/1 white Soldier creature token onto the battlefield.
this.addAbility(new LoyaltyAbility(new CreateTokenEffect(new SoldierToken()), 1));
// +1: Target creature gets +3/+3 and gains flying until end of turn.
Effects effects1 = new Effects();
effects1.add(new BoostTargetEffect(3, 3, Duration.EndOfTurn));
effects1.add(new GainAbilityTargetEffect(FlyingAbility.getInstance(), Duration.EndOfTurn));
@ -80,8 +78,8 @@ public class ElspethKnightErrant extends CardImpl<ElspethKnightErrant> {
ability1.addTarget(new TargetCreaturePermanent());
this.addAbility(ability1);
this.addAbility(new LoyaltyAbility(new ElspethKnightErrantEffect(), -8));
// -8: You get an emblem with "Artifacts, creatures, enchantments, and lands you control are indestructible."
this.addAbility(new LoyaltyAbility(new GetEmblemEffect(new ElspethKnightErrantEmblem()), -8));
}
public ElspethKnightErrant(final ElspethKnightErrant card) {
@ -95,38 +93,15 @@ public class ElspethKnightErrant extends CardImpl<ElspethKnightErrant> {
}
class ElspethKnightErrantEffect extends ContinuousEffectImpl<ElspethKnightErrantEffect> {
class ElspethKnightErrantEmblem extends Emblem {
private static final FilterPermanent filter = new FilterPermanent("artifacts, creatures, enchantments and lands");
static {
public ElspethKnightErrantEmblem() {
FilterControlledPermanent filter = new FilterControlledPermanent("Artifacts, creatures, enchantments, and lands you control");
filter.add(Predicates.or(
new CardTypePredicate(CardType.ARTIFACT),
new CardTypePredicate(CardType.CREATURE),
new CardTypePredicate(CardType.ENCHANTMENT),
new CardTypePredicate(CardType.LAND)));
this.getAbilities().add(new SimpleStaticAbility(Zone.COMMAND, new IndestructibleAllEffect(filter)));
}
public ElspethKnightErrantEffect() {
super(Duration.EndOfGame, Layer.RulesEffects, SubLayer.NA, Outcome.AddAbility);
staticText = "For the rest of the game artifacts, creature, enchantments and lands you control are indestructible";
}
public ElspethKnightErrantEffect(final ElspethKnightErrantEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
perm.addAbility(new IndestructibleAbility(), game);
}
return true;
}
@Override
public ElspethKnightErrantEffect copy() {
return new ElspethKnightErrantEffect(this);
}
}
}

View file

@ -38,11 +38,12 @@ import mage.abilities.Ability;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.IndestructibleAllEffect;
import mage.abilities.effects.common.continious.BoostControlledEffect;
import mage.abilities.effects.common.continious.GainAbilityControlledEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.events.GameEvent.EventType;
@ -60,9 +61,12 @@ public class EldraziMonument extends CardImpl<EldraziMonument> {
public EldraziMonument(UUID ownerId) {
super(ownerId, 199, "Eldrazi Monument", Rarity.MYTHIC, new CardType[]{CardType.ARTIFACT}, "{5}");
this.expansionSetCode = "ZEN";
// Creatures you control get +1/+1, have flying, and are indestructible.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, new FilterCreaturePermanent(), false)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(FlyingAbility.getInstance(), Duration.WhileOnBattlefield, new FilterCreaturePermanent())));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(new IndestructibleAbility(), Duration.WhileOnBattlefield, new FilterCreaturePermanent())));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new IndestructibleAllEffect(new FilterControlledCreaturePermanent("Creatures you control"))));
// At the beginning of your upkeep, sacrifice a creature. If you can't, sacrifice Eldrazi Monument.
this.addAbility(new OnEventTriggeredAbility(EventType.UPKEEP_STEP_PRE, "beginning of your upkeep", new EldraziMonumentEffect()));
}