diff --git a/Mage.Sets/src/mage/cards/l/LithoformBlight.java b/Mage.Sets/src/mage/cards/l/LithoformBlight.java new file mode 100644 index 00000000000..eeb49c5e836 --- /dev/null +++ b/Mage.Sets/src/mage/cards/l/LithoformBlight.java @@ -0,0 +1,109 @@ +package mage.cards.l; + +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.common.PayLifeCost; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.abilities.mana.AnyColorManaAbility; +import mage.abilities.mana.ColorlessManaAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.TargetPermanent; +import mage.target.common.TargetLandPermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class LithoformBlight extends CardImpl { + + public LithoformBlight(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}"); + + this.subtype.add(SubType.AURA); + + // Enchant land + TargetPermanent auraTarget = new TargetLandPermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // When Lithoform Blight enters the battlefield, draw a card. + this.addAbility(new EntersBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(1))); + + // Enchanted land loses all land types and abilities and has "{T}: Add {C}" and "{T}, Pay 1 life: Add one mana of any color." + this.addAbility(new SimpleStaticAbility(new BecomesCreatureAttachedEffect())); + } + + private LithoformBlight(final LithoformBlight card) { + super(card); + } + + @Override + public LithoformBlight copy() { + return new LithoformBlight(this); + } +} + +class BecomesCreatureAttachedEffect extends ContinuousEffectImpl { + + BecomesCreatureAttachedEffect() { + super(Duration.WhileOnBattlefield, Outcome.LoseAbility); + staticText = "Enchanted land loses all land types and abilities " + + "and has \"{T}: Add {C}\" and \"{T}, Pay 1 life: Add one mana of any color.\""; + } + + private BecomesCreatureAttachedEffect(final BecomesCreatureAttachedEffect effect) { + super(effect); + } + + @Override + public BecomesCreatureAttachedEffect copy() { + return new BecomesCreatureAttachedEffect(this); + } + + @Override + public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { + Permanent enchantment = game.getPermanent(source.getSourceId()); + if (enchantment == null) { + return false; + } + Permanent permanent = game.getPermanent(enchantment.getAttachedTo()); + if (permanent == null) { + return true; + } + switch (layer) { + case TypeChangingEffects_4: + permanent.getSubtype(game).removeAll(SubType.getLandTypes()); + break; + case AbilityAddingRemovingEffects_6: + permanent.removeAllAbilities(source.getSourceId(), game); + permanent.addAbility(new ColorlessManaAbility(), source.getSourceId(), game); + Ability ability = new AnyColorManaAbility(); + ability.addCost(new PayLifeCost(1)); + permanent.addAbility(ability, source.getSourceId(), game); + break; + } + return true; + } + + @Override + public boolean apply(Game game, Ability source) { + return false; + } + + @Override + public boolean hasLayer(Layer layer) { + return layer == Layer.AbilityAddingRemovingEffects_6 + || layer == Layer.TypeChangingEffects_4; + } +} diff --git a/Mage.Sets/src/mage/sets/ZendikarRising.java b/Mage.Sets/src/mage/sets/ZendikarRising.java index a36fe67950f..d837eaf61be 100644 --- a/Mage.Sets/src/mage/sets/ZendikarRising.java +++ b/Mage.Sets/src/mage/sets/ZendikarRising.java @@ -230,6 +230,7 @@ public final class ZendikarRising extends ExpansionSet { cards.add(new SetCardInfo("Legion Angel", 23, Rarity.RARE, mage.cards.l.LegionAngel.class)); cards.add(new SetCardInfo("Leyline Tyrant", 147, Rarity.MYTHIC, mage.cards.l.LeylineTyrant.class)); cards.add(new SetCardInfo("Linvala, Shield of Sea Gate", 226, Rarity.RARE, mage.cards.l.LinvalaShieldOfSeaGate.class)); + cards.add(new SetCardInfo("Lithoform Blight", 109, Rarity.UNCOMMON, mage.cards.l.LithoformBlight.class)); cards.add(new SetCardInfo("Living Tempest", 65, Rarity.COMMON, mage.cards.l.LivingTempest.class)); cards.add(new SetCardInfo("Lotus Cobra", 193, Rarity.RARE, mage.cards.l.LotusCobra.class)); cards.add(new SetCardInfo("Lullmage's Domination", 66, Rarity.UNCOMMON, mage.cards.l.LullmagesDomination.class));