diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/PatronOfTheKitsune.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/PatronOfTheKitsune.java index ce698669b1d..9d5c0563752 100644 --- a/Mage.Sets/src/mage/sets/betrayersofkamigawa/PatronOfTheKitsune.java +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/PatronOfTheKitsune.java @@ -84,10 +84,7 @@ class PatronOfTheKitsuneTriggeredAbility extends TriggeredAbilityImpl 0) { - Player player = game .getPlayer(source.getControllerId()); - if(player != null){ - player.gainLife(prevented, game); - } + PreventionEffectData preventEffectData = preventDamageAction(event, source, game); + if (preventEffectData.getPreventedDamage() > 0) { + Player player = game .getPlayer(source.getControllerId()); + if(player != null){ + player.gainLife(preventEffectData.getPreventedDamage(), game); } } return false; diff --git a/Mage.Sets/src/mage/sets/gatecrash/ArmoredTransport.java b/Mage.Sets/src/mage/sets/gatecrash/ArmoredTransport.java index 7b5c86303f7..f71b7f62e03 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/ArmoredTransport.java +++ b/Mage.Sets/src/mage/sets/gatecrash/ArmoredTransport.java @@ -88,23 +88,6 @@ class ArmoredTransportPreventCombatDamageSourceEffect extends PreventionEffectIm return new ArmoredTransportPreventCombatDamageSourceEffect(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 true; - } - return false; - } - @Override public boolean applies(GameEvent event, Ability source, Game game) { if (super.applies(event, source, game)) { diff --git a/Mage.Sets/src/mage/sets/gatecrash/Skullcrack.java b/Mage.Sets/src/mage/sets/gatecrash/Skullcrack.java index 9833e9d5489..8a2de1c49a0 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/Skullcrack.java +++ b/Mage.Sets/src/mage/sets/gatecrash/Skullcrack.java @@ -100,7 +100,7 @@ class DamageCantBePreventedEffect extends ReplacementEffectImpl { - - public CircleOfProtectionBlack(UUID ownerId) { super(ownerId, 236, "Circle of Protection: Black", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}"); @@ -73,10 +71,12 @@ public class CircleOfProtectionBlack extends CardImpl { class CircleOfProtectionBlackEffect extends PreventionEffectImpl { private static final FilterObject filter = new FilterObject("black source"); + static{ filter.add(new ColorPredicate(ObjectColor.BLACK)); } - private TargetSource target; + + private final TargetSource target; public CircleOfProtectionBlackEffect() { super(Duration.EndOfTurn); @@ -95,11 +95,6 @@ class CircleOfProtectionBlackEffect extends PreventionEffectImpl { class CircleOfProtectionRedEffect extends PreventionEffectImpl { private static final FilterObject filter = new FilterObject("red source"); + static{ filter.add(new ColorPredicate(ObjectColor.RED)); - } - private TargetSource target; + } + + private final TargetSource target; public CircleOfProtectionRedEffect() { super(Duration.EndOfTurn); @@ -94,11 +96,6 @@ class CircleOfProtectionRedEffect extends PreventionEffectImpl { class GhostlyPossessionEffect extends PreventionEffectImpl { public GhostlyPossessionEffect() { - super(Duration.WhileOnBattlefield); + super(Duration.WhileOnBattlefield, Integer.MAX_VALUE, true); staticText = "Prevent all combat damage that would be dealt to and dealt by enchanted creature"; } @@ -102,17 +102,6 @@ class GhostlyPossessionEffect extends PreventionEffectImpl exile = exile.copy(); for (UUID cardId: exile) { Card card = game.getCard(cardId); - card.moveToZone(zone, source.getSourceId(), game, tapped); - game.informPlayers(new StringBuilder(controller.getName()).append(" moves ").append(card.getName()).append(" to ").append(zone.toString()).toString()); + switch (zone) { + case BATTLEFIELD: + controller.putOntoBattlefieldWithInfo(card, game, Zone.EXILED, source.getSourceId(), tapped); + break; + case HAND: + controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.EXILED); + break; + case GRAVEYARD: + controller.moveCardToGraveyardWithInfo(card, source.getSourceId(), game, Zone.EXILED); + break; + case LIBRARY: + controller.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.EXILED, true); + break; + default: + card.moveToZone(zone, source.getSourceId(), game, tapped); + game.informPlayers(new StringBuilder(controller.getName()).append(" moves ").append(card.getName()).append(" to ").append(zone.toString()).toString()); + } + } game.getExile().getExileZone(exileId).clear(); return true; diff --git a/Mage/src/mage/cards/SplitCard.java b/Mage/src/mage/cards/SplitCard.java index 1716f417934..d3cfc499d29 100644 --- a/Mage/src/mage/cards/SplitCard.java +++ b/Mage/src/mage/cards/SplitCard.java @@ -120,7 +120,7 @@ public abstract class SplitCard> extends CardImpl { @Override public List getRules() { - List rules = new ArrayList(); + List rules = new ArrayList<>(); // rules.addAll(leftHalfCard.getRules()); // rules.addAll(rightHalfCard.getRules()); if (getSpellAbility().getSpellAbilityType().equals(SpellAbilityType.SPLIT_FUSED)) { @@ -149,7 +149,7 @@ public abstract class SplitCard> extends CardImpl { @Override public List getWatchers() { - List allWatchers = new ArrayList(); + List allWatchers = new ArrayList<>(); allWatchers.addAll(super.getWatchers()); allWatchers.addAll(leftHalfCard.getWatchers()); allWatchers.addAll(rightHalfCard.getWatchers());