[WOE] Implement Eerie Interference (#10953)

* [WOE] Implement Eerie Interference

* fix rarity
This commit is contained in:
Susucre 2023-08-23 01:48:05 +02:00 committed by GitHub
parent 6c2342c342
commit 70f620dbcf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 75 additions and 0 deletions

View file

@ -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);
}
}

View file

@ -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));