diff --git a/Mage.Sets/src/mage/sets/avacynrestored/Defang.java b/Mage.Sets/src/mage/sets/avacynrestored/Defang.java index 7f4a7519d1a..f0bba472d70 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/Defang.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/Defang.java @@ -27,22 +27,21 @@ */ package mage.sets.avacynrestored; -import mage.constants.*; +import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.PreventionEffectImpl; import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.PreventAllDamageByAttachedEffect; import mage.abilities.keyword.EnchantAbility; import mage.cards.CardImpl; -import mage.game.Game; -import mage.game.events.DamageEvent; -import mage.game.events.GameEvent; -import mage.game.permanent.Permanent; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.target.TargetPermanent; import mage.target.common.TargetCreaturePermanent; -import java.util.UUID; - /** * @author noxx */ @@ -63,7 +62,7 @@ public class Defang extends CardImpl { this.addAbility(ability); // Prevent all damage that would be dealt by enchanted creature. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new DefangEffect())); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PreventAllDamageByAttachedEffect(Duration.WhileOnBattlefield, "enchanted creature", false))); } public Defang(final Defang card) { @@ -75,50 +74,3 @@ public class Defang extends CardImpl { return new Defang(this); } } - -class DefangEffect extends PreventionEffectImpl { - - public DefangEffect() { - super(Duration.WhileOnBattlefield); - staticText = "Prevent all damage that would be dealt by enchanted creature"; - } - - public DefangEffect(final DefangEffect effect) { - super(effect); - } - - @Override - public DefangEffect copy() { - return new DefangEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - return true; - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - GameEvent preventEvent = new GameEvent(GameEvent.EventType.PREVENT_DAMAGE, source.getFirstTarget(), source.getId(), source.getControllerId(), event.getAmount(), false); - if (!game.replaceEvent(preventEvent)) { - int damage = event.getAmount(); - event.setAmount(0); - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getId(), source.getControllerId(), damage)); - } - return false; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - if (super.applies(event, source, game) && event instanceof DamageEvent) { - Permanent aura = game.getPermanent(source.getSourceId()); - if (aura != null && aura.getAttachedTo() != null) { - if (event.getSourceId().equals(aura.getAttachedTo())) { - return true; - } - } - } - return false; - } - -} diff --git a/Mage.Sets/src/mage/sets/commander2013/UnexpectedlyAbsent.java b/Mage.Sets/src/mage/sets/commander2013/UnexpectedlyAbsent.java index 5ae5a40a64d..d0fa4212bde 100644 --- a/Mage.Sets/src/mage/sets/commander2013/UnexpectedlyAbsent.java +++ b/Mage.Sets/src/mage/sets/commander2013/UnexpectedlyAbsent.java @@ -106,7 +106,7 @@ class UnexpectedlyAbsentEffect extends OneShotEffect { if (owner != null) { int xValue = Math.min(source.getManaCostsToPay().getX(), owner.getLibrary().size()); Cards cards = new CardsImpl(Zone.PICK); - List cardIds = new ArrayList(); + List cardIds = new ArrayList<>(); for (int i = 0; i < xValue; i++) { Card card = owner.getLibrary().getFromTop(game); cards.add(card); diff --git a/Mage.Sets/src/mage/sets/gatecrash/ShieldedPassage.java b/Mage.Sets/src/mage/sets/gatecrash/ShieldedPassage.java index f363059dd8d..1d447af9271 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/ShieldedPassage.java +++ b/Mage.Sets/src/mage/sets/gatecrash/ShieldedPassage.java @@ -49,7 +49,7 @@ public class ShieldedPassage extends CardImpl { // Prevent all damage that would be dealt to target creature this turn. this.getSpellAbility().addEffect(new PreventDamageTargetEffect(Duration.EndOfTurn, Integer.MAX_VALUE)); - this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + this.getSpellAbility().addTarget(new TargetCreaturePermanent(true)); } public ShieldedPassage(final ShieldedPassage card) { diff --git a/Mage.Sets/src/mage/sets/ravnika/SuppressionField.java b/Mage.Sets/src/mage/sets/ravnika/SuppressionField.java index 611ec8c286a..4b4732b711e 100644 --- a/Mage.Sets/src/mage/sets/ravnika/SuppressionField.java +++ b/Mage.Sets/src/mage/sets/ravnika/SuppressionField.java @@ -33,10 +33,7 @@ import mage.abilities.ActivatedAbility; import mage.abilities.SpellAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.CostModificationEffectImpl; -import mage.abilities.keyword.FlashbackAbility; -import mage.abilities.keyword.RetraceAbility; import mage.abilities.mana.ManaAbility; -import mage.cards.Card; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.CostModificationType; diff --git a/Mage.Sets/src/mage/sets/shadowmoor/OrderOfWhiteclay.java b/Mage.Sets/src/mage/sets/shadowmoor/OrderOfWhiteclay.java index ca9f51a8309..9f341871f18 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/OrderOfWhiteclay.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/OrderOfWhiteclay.java @@ -42,7 +42,7 @@ import mage.filter.Filter.ComparisonType; import mage.filter.common.FilterCreatureCard; import mage.filter.predicate.mageobject.ConvertedManaCostPredicate; import mage.target.Target; -import mage.target.common.TargetCardInGraveyard; +import mage.target.common.TargetCardInYourGraveyard; /** * @@ -70,7 +70,7 @@ public class OrderOfWhiteclay extends CardImpl { // {1}{W}{W}, {untap}: Return target creature card with converted mana cost 3 or less from your graveyard to the battlefield. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnFromGraveyardToBattlefieldTargetEffect(), new ManaCostsImpl("{1}{W}{W}")); ability.addCost(new UntapSourceCost()); - Target target = new TargetCardInGraveyard(filter); + Target target = new TargetCardInYourGraveyard(filter); target.setRequired(true); ability.addTarget(target); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/sets/tempest/Propaganda.java b/Mage.Sets/src/mage/sets/tempest/Propaganda.java index 84aeb413011..f98f9d38ff3 100644 --- a/Mage.Sets/src/mage/sets/tempest/Propaganda.java +++ b/Mage.Sets/src/mage/sets/tempest/Propaganda.java @@ -93,7 +93,7 @@ class PropagandaReplacementEffect extends ReplacementEffectImpl { +public class PreventAllDamageToAttachedEffect extends PreventionEffectImpl { - private String attachedDescription; - private boolean combatOnly; + private final String attachedDescription; + private final boolean combatOnly; - public PreventAllDamageAttachedEffect(Duration duration, String attachedDescription, boolean combatOnly) { + public PreventAllDamageToAttachedEffect(Duration duration, String attachedDescription, boolean combatOnly) { super(duration); this.attachedDescription = attachedDescription; this.combatOnly = combatOnly; staticText = setText(); } - public PreventAllDamageAttachedEffect(final PreventAllDamageAttachedEffect effect) { + public PreventAllDamageToAttachedEffect(final PreventAllDamageToAttachedEffect effect) { super(effect); this.attachedDescription = effect.attachedDescription; this.combatOnly = effect.combatOnly; } @Override - public PreventAllDamageAttachedEffect copy() { - return new PreventAllDamageAttachedEffect(this); + public PreventAllDamageToAttachedEffect copy() { + return new PreventAllDamageToAttachedEffect(this); } @Override