From aa7231bec0472824781b970e76caa618bcd4fcdc Mon Sep 17 00:00:00 2001 From: Zzooouhh Date: Sun, 17 Dec 2017 19:41:22 +0100 Subject: [PATCH] Expanded DoUnlessTargetPlayerOrTargetsControllerPaysEffect --- ...sTargetPlayerOrTargetsControllerPaysEffect.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Mage/src/main/java/mage/abilities/effects/common/DoUnlessTargetPlayerOrTargetsControllerPaysEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DoUnlessTargetPlayerOrTargetsControllerPaysEffect.java index 12d698b527..5876210895 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DoUnlessTargetPlayerOrTargetsControllerPaysEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DoUnlessTargetPlayerOrTargetsControllerPaysEffect.java @@ -50,6 +50,7 @@ import mage.util.CardUtil; public class DoUnlessTargetPlayerOrTargetsControllerPaysEffect extends OneShotEffect { protected Effects executingEffects = new Effects(); + private Effect otherwiseEffect; private Cost cost; private DynamicValue genericMana; private String chooseUseText; @@ -59,8 +60,13 @@ public class DoUnlessTargetPlayerOrTargetsControllerPaysEffect extends OneShotEf } public DoUnlessTargetPlayerOrTargetsControllerPaysEffect(Effect effect, Cost cost, String chooseUseText) { + this(effect, null, cost, chooseUseText); + } + + public DoUnlessTargetPlayerOrTargetsControllerPaysEffect(Effect effect, Effect otherwiseEffect, Cost cost, String chooseUseText) { super(Outcome.Detriment); this.executingEffects.add(effect); + this.otherwiseEffect = otherwiseEffect; this.cost = cost; this.chooseUseText = chooseUseText; } @@ -74,6 +80,7 @@ public class DoUnlessTargetPlayerOrTargetsControllerPaysEffect extends OneShotEf public DoUnlessTargetPlayerOrTargetsControllerPaysEffect(final DoUnlessTargetPlayerOrTargetsControllerPaysEffect effect) { super(effect); this.executingEffects = effect.executingEffects.copy(); + this.otherwiseEffect = effect.otherwiseEffect; if (effect.cost != null) { this.cost = effect.cost.copy(); } @@ -135,6 +142,13 @@ public class DoUnlessTargetPlayerOrTargetsControllerPaysEffect extends OneShotEf game.addEffect((ContinuousEffect) effect, source); } } + } else if (otherwiseEffect != null) { + otherwiseEffect.setTargetPointer(this.targetPointer); + if (otherwiseEffect instanceof OneShotEffect) { + result &= otherwiseEffect.apply(game, source); + } else { + game.addEffect((ContinuousEffect) otherwiseEffect, source); + } } return result; }