diff --git a/Mage.Sets/src/mage/cards/p/PollenLullaby.java b/Mage.Sets/src/mage/cards/p/PollenLullaby.java index 5f5c5c410a1..e7e390995f9 100644 --- a/Mage.Sets/src/mage/cards/p/PollenLullaby.java +++ b/Mage.Sets/src/mage/cards/p/PollenLullaby.java @@ -32,7 +32,7 @@ public final class PollenLullaby extends CardImpl { // Prevent all combat damage that would be dealt this turn. Clash with an opponent. If you win, creatures that player controls don't untap during the player's next untap step. this.getSpellAbility().addEffect(new PreventAllDamageByAllPermanentsEffect(Duration.EndOfTurn, true)); - this.getSpellAbility().addEffect(new DoIfClashWonEffect(new PollenLullabyEffect(), true, null)); + this.getSpellAbility().addEffect(new DoIfClashWonEffect(new PollenLullabyEffect(), true)); } private PollenLullaby(final PollenLullaby card) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/DoIfClashWonEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DoIfClashWonEffect.java index cd7ad0f4cc5..3ff4bf4c5a1 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DoIfClashWonEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DoIfClashWonEffect.java @@ -1,5 +1,3 @@ - - package mage.abilities.effects.common; import mage.MageObject; @@ -12,7 +10,6 @@ import mage.constants.Outcome; import mage.game.Game; import mage.players.Player; import mage.target.targetpointer.FixedTarget; -import mage.util.CardUtil; import java.util.UUID; @@ -22,62 +19,47 @@ import java.util.UUID; public class DoIfClashWonEffect extends OneShotEffect { protected final Effect executingEffect; - private String chooseUseText; - private boolean setTargetPointerToClashedOpponent; + private final boolean setTargetPointerToClashedOpponent; public DoIfClashWonEffect(Effect effect) { - this(effect, false, null); + this(effect, false); } - public DoIfClashWonEffect(Effect effect, boolean setTargetPointerToClashedOpponent, String chooseUseText) { + public DoIfClashWonEffect(Effect effect, boolean setTargetPointerToClashedOpponent) { super(Outcome.Benefit); this.executingEffect = effect; - this.chooseUseText = chooseUseText; this.setTargetPointerToClashedOpponent = setTargetPointerToClashedOpponent; } public DoIfClashWonEffect(final DoIfClashWonEffect effect) { super(effect); this.executingEffect = effect.executingEffect.copy(); - this.chooseUseText = effect.chooseUseText; this.setTargetPointerToClashedOpponent = effect.setTargetPointerToClashedOpponent; } @Override public boolean apply(Game game, Ability source) { - Player player = getPayingPlayer(game, source); + Player player = game.getPlayer(source.getControllerId()); MageObject mageObject = game.getObject(source); - if (player != null && mageObject != null) { - String message = null; - if (chooseUseText != null) { - message = chooseUseText; - message = CardUtil.replaceSourceName(message, mageObject.getLogName()); - } - - if (chooseUseText == null || player.chooseUse(executingEffect.getOutcome(), message, source, game)) { - if (new ClashEffect().apply(game, source)) { - if (setTargetPointerToClashedOpponent) { - Player opponent = game.getPlayer((UUID) getValue("clashOpponent")); - if (opponent != null) { - executingEffect.setTargetPointer(new FixedTarget(opponent.getId())); - } - } else { - executingEffect.setTargetPointer(this.targetPointer); - } - if (executingEffect instanceof OneShotEffect) { - return executingEffect.apply(game, source); - } else { - game.addEffect((ContinuousEffect) executingEffect, source); - } - } - } - return true; + if (player == null || mageObject == null) { + return false; } - return false; - } - - protected Player getPayingPlayer(Game game, Ability source) { - return game.getPlayer(source.getControllerId()); + if (new ClashEffect().apply(game, source)) { + if (setTargetPointerToClashedOpponent) { + Player opponent = game.getPlayer((UUID) getValue("clashOpponent")); + if (opponent != null) { + executingEffect.setTargetPointer(new FixedTarget(opponent.getId())); + } + } else { + executingEffect.setTargetPointer(this.targetPointer); + } + if (executingEffect instanceof OneShotEffect) { + return executingEffect.apply(game, source); + } else { + game.addEffect((ContinuousEffect) executingEffect, source); + } + } + return true; } @Override @@ -85,7 +67,7 @@ public class DoIfClashWonEffect extends OneShotEffect { if (!staticText.isEmpty()) { return staticText; } - return new StringBuilder("clash with an opponent. If you win, ").append(executingEffect.getText(mode)).toString(); + return "clash with an opponent. If you win, " + executingEffect.getText(mode); } @Override