diff --git a/Mage.Sets/src/mage/cards/e/EerieInterference.java b/Mage.Sets/src/mage/cards/e/EerieInterference.java new file mode 100644 index 00000000000..7a47d56812e --- /dev/null +++ b/Mage.Sets/src/mage/cards/e/EerieInterference.java @@ -0,0 +1,74 @@ +package mage.cards.e; + +import mage.abilities.Ability; +import mage.abilities.effects.PreventionEffectImpl; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; + +import java.util.UUID; + +/** + * @author Susucr + */ +public final class EerieInterference extends CardImpl { + + public EerieInterference(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{W}"); + + // Prevent all damage that would be dealt to you and creatures you control by creatures this turn. + this.getSpellAbility().addEffect(new EerieInterferenceEffect()); + } + + private EerieInterference(final EerieInterference card) { + super(card); + } + + @Override + public EerieInterference copy() { + return new EerieInterference(this); + } +} + +class EerieInterferenceEffect extends PreventionEffectImpl { + + EerieInterferenceEffect() { + super(Duration.EndOfTurn, Integer.MAX_VALUE, false, false); + staticText = "prevent all damage that would be dealt to you and creatures you control by creatures this turn"; + } + + private EerieInterferenceEffect(final EerieInterferenceEffect effect) { + super(effect); + } + + @Override + public EerieInterferenceEffect copy() { + return new EerieInterferenceEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + if (!super.applies(event, source, game)) { + return false; + } + Permanent targetPermanent = game.getPermanent(event.getTargetId()); + boolean isTargetYou = event.getTargetId().equals(source.getControllerId()); + boolean isTargetCreatureYouControl = targetPermanent != null + && targetPermanent.isCreature(game) + && targetPermanent.isControlledBy(source.getControllerId()); + + Permanent permanentSource = game.getPermanentOrLKIBattlefield(event.getSourceId()); + return (isTargetYou || isTargetCreatureYouControl) + && permanentSource != null + && permanentSource.isCreature(game); + } +} diff --git a/Mage.Sets/src/mage/sets/WildsOfEldraine.java b/Mage.Sets/src/mage/sets/WildsOfEldraine.java index 9d16258efe7..135a3ef50ac 100644 --- a/Mage.Sets/src/mage/sets/WildsOfEldraine.java +++ b/Mage.Sets/src/mage/sets/WildsOfEldraine.java @@ -55,6 +55,7 @@ public final class WildsOfEldraine extends ExpansionSet { cards.add(new SetCardInfo("Disdainful Stroke", 47, Rarity.UNCOMMON, mage.cards.d.DisdainfulStroke.class)); cards.add(new SetCardInfo("Dutiful Griffin", 11, Rarity.UNCOMMON, mage.cards.d.DutifulGriffin.class)); cards.add(new SetCardInfo("Edgewall Inn", 255, Rarity.UNCOMMON, mage.cards.e.EdgewallInn.class)); + cards.add(new SetCardInfo("Eerie Interference", 12, Rarity.UNCOMMON, mage.cards.e.EerieInterference.class)); cards.add(new SetCardInfo("Elvish Archivist", 168, Rarity.RARE, mage.cards.e.ElvishArchivist.class)); cards.add(new SetCardInfo("Embereth Veteran", 127, Rarity.UNCOMMON, mage.cards.e.EmberethVeteran.class)); cards.add(new SetCardInfo("Eriette of the Charmed Apple", 202, Rarity.MYTHIC, mage.cards.e.ErietteOfTheCharmedApple.class));