From 8ff6368aaf5bc54ed4a3fd1aed82fd736b5cd78b Mon Sep 17 00:00:00 2001 From: Faxn Date: Thu, 26 Oct 2017 16:27:16 -0400 Subject: [PATCH 1/3] #4130 Changed Decree of Justice to attach it's mana cost to the CycleTriggeredAbility instead handling the cost in the card. --- Mage.Sets/src/mage/cards/d/DecreeOfJustice.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Mage.Sets/src/mage/cards/d/DecreeOfJustice.java b/Mage.Sets/src/mage/cards/d/DecreeOfJustice.java index a812b8ff22..7a5cc0a9e8 100644 --- a/Mage.Sets/src/mage/cards/d/DecreeOfJustice.java +++ b/Mage.Sets/src/mage/cards/d/DecreeOfJustice.java @@ -34,6 +34,7 @@ import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.costs.mana.ManaCost; import mage.abilities.costs.mana.ManaCosts; import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.costs.mana.VariableManaCost; import mage.abilities.dynamicvalue.common.ManacostVariableValue; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.CreateTokenEffect; @@ -66,6 +67,7 @@ public class DecreeOfJustice extends CardImpl { // When you cycle Decree of Justice, you may pay {X}. If you do, create X 1/1 white Soldier creature tokens. Ability ability = new CycleTriggeredAbility(new DecreeOfJusticeCycleEffect(), true); + ability.addCost(new ManaCostsImpl<>("{X}")); this.addAbility(ability); } @@ -98,14 +100,12 @@ class DecreeOfJusticeCycleEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); - ManaCosts cost = new ManaCostsImpl<>("{X}"); if (player != null) { - int costX = player.announceXMana(0, Integer.MAX_VALUE, "Announce the value for {X}", game, source); - cost.add(new GenericManaCost(costX)); - if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { - Token token = new SoldierToken(); - token.putOntoBattlefield(costX, game, source.getSourceId(), source.getControllerId()); - } + Token token = new SoldierToken(); + int X = new ManacostVariableValue().calculate(game, source, this); + token.putOntoBattlefield(X, game, source.getSourceId(), source.getControllerId()); + return true; + } return false; } From df2da656d214b24cd086facda97e2bbf92eaf413 Mon Sep 17 00:00:00 2001 From: Faxn Date: Thu, 26 Oct 2017 19:58:10 -0400 Subject: [PATCH 2/3] #4130 Fixing the fix to be more reasonable. --- Mage.Sets/src/mage/cards/d/DecreeOfJustice.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Mage.Sets/src/mage/cards/d/DecreeOfJustice.java b/Mage.Sets/src/mage/cards/d/DecreeOfJustice.java index 7a5cc0a9e8..6adb06403a 100644 --- a/Mage.Sets/src/mage/cards/d/DecreeOfJustice.java +++ b/Mage.Sets/src/mage/cards/d/DecreeOfJustice.java @@ -30,6 +30,7 @@ package mage.cards.d; import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.CycleTriggeredAbility; +import mage.abilities.costs.Cost; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.costs.mana.ManaCost; import mage.abilities.costs.mana.ManaCosts; @@ -67,7 +68,6 @@ public class DecreeOfJustice extends CardImpl { // When you cycle Decree of Justice, you may pay {X}. If you do, create X 1/1 white Soldier creature tokens. Ability ability = new CycleTriggeredAbility(new DecreeOfJusticeCycleEffect(), true); - ability.addCost(new ManaCostsImpl<>("{X}")); this.addAbility(ability); } @@ -101,12 +101,14 @@ class DecreeOfJusticeCycleEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { - Token token = new SoldierToken(); - int X = new ManacostVariableValue().calculate(game, source, this); - token.putOntoBattlefield(X, game, source.getSourceId(), source.getControllerId()); - return true; - + int X = player.announceXMana(0, Integer.MAX_VALUE, "Announce the value for {X}", game, source); + Cost cost = new GenericManaCost(X); + if(cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)){ + Token token = new SoldierToken(); + token.putOntoBattlefield(X, game, source.getSourceId(), source.getControllerId()); + return true; + } } - return false; + return false; } } From 80923dbce0745140e2cac98e3316733eb4b7212c Mon Sep 17 00:00:00 2001 From: Faxn Date: Fri, 27 Oct 2017 12:16:58 -0400 Subject: [PATCH 3/3] Clean up unused imports. --- Mage.Sets/src/mage/cards/d/DecreeOfJustice.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Mage.Sets/src/mage/cards/d/DecreeOfJustice.java b/Mage.Sets/src/mage/cards/d/DecreeOfJustice.java index 6adb06403a..b033167814 100644 --- a/Mage.Sets/src/mage/cards/d/DecreeOfJustice.java +++ b/Mage.Sets/src/mage/cards/d/DecreeOfJustice.java @@ -32,10 +32,7 @@ import mage.abilities.Ability; import mage.abilities.common.CycleTriggeredAbility; import mage.abilities.costs.Cost; import mage.abilities.costs.mana.GenericManaCost; -import mage.abilities.costs.mana.ManaCost; -import mage.abilities.costs.mana.ManaCosts; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.costs.mana.VariableManaCost; import mage.abilities.dynamicvalue.common.ManacostVariableValue; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.CreateTokenEffect; @@ -109,6 +106,6 @@ class DecreeOfJusticeCycleEffect extends OneShotEffect { return true; } } - return false; + return false; } }