From e5a3bc3f45118ba7ce50636857b448ddc78f51d6 Mon Sep 17 00:00:00 2001 From: Sloth Date: Sun, 17 Mar 2013 20:52:25 +0000 Subject: [PATCH] - Fixed UnlessResolveSubs parameter freezing the game. --- res/cardsfolder/p/power_sink.txt | 2 +- src/main/java/forge/card/ability/AbilityUtils.java | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/res/cardsfolder/p/power_sink.txt b/res/cardsfolder/p/power_sink.txt index c23dca9aeae..20b2a64893c 100644 --- a/res/cardsfolder/p/power_sink.txt +++ b/res/cardsfolder/p/power_sink.txt @@ -2,7 +2,7 @@ Name:Power Sink ManaCost:X U Types:Instant A:SP$ Counter | Cost$ X U | References$ X | UnlessCost$ X | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | SubAbility$ TapLands | UnlessResolveSubs$ WhenNotPaid | SpellDescription$ Counter target spell unless its controller pays X. If he or she doesn't, that player taps all lands with mana abilities he or she controls and empties his or her mana pool. | StackDescription$ Countering [{s:Targeted}] unless {p:TargetedController} pays X. -SVar:TapLands:DB$ TapAll | ValidCards$ Land.hasManaAbility | Defined$ TargetedController | SubAbility$ ManaLose| StackDescription$ If {p:TargetedController} doesn't, that player taps all lands with mana abilities he or she controls and +SVar:TapLands:DB$ TapAll | ValidCards$ Land.hasManaAbility | Defined$ TargetedController | SubAbility$ ManaLose | StackDescription$ If {p:TargetedController} doesn't, that player taps all lands with mana abilities he or she controls and SVar:ManaLose:DB$ DrainMana | Defined$ TargetedController SVar:X:Count$xPaid SVar:Picture:http://www.wizards.com/global/images/magic/general/power_sink.jpg diff --git a/src/main/java/forge/card/ability/AbilityUtils.java b/src/main/java/forge/card/ability/AbilityUtils.java index c466e5318bd..f6d3fff3d7e 100644 --- a/src/main/java/forge/card/ability/AbilityUtils.java +++ b/src/main/java/forge/card/ability/AbilityUtils.java @@ -1079,6 +1079,9 @@ public class AbilityUtils { public void execute() { if (isSwitched && execSubsWhenNotPaid || execSubsWhenPaid) { resolveSubAbilities(sa, usedStack, game); + } else if (usedStack) { + SpellAbility root = sa.getRootAbility(); + game.getStack().finishResolving(root, false); } } }; @@ -1091,6 +1094,9 @@ public class AbilityUtils { sa.resolve(); if (isSwitched && execSubsWhenPaid || execSubsWhenNotPaid) { resolveSubAbilities(sa, usedStack, game); + } else if (usedStack) { + SpellAbility root = sa.getRootAbility(); + game.getStack().finishResolving(root, false); } } }; @@ -1112,8 +1118,8 @@ public class AbilityUtils { boolean paid = false; for (Player payer : payers) { if (payer.isComputer()) { + ability.setActivatingPlayer(payer); if (AbilityUtils.willAIPayForAbility(sa, payer, ability, paid, payers)) { - ability.setActivatingPlayer(payer); ability.setTarget(sa.getTarget()); ComputerUtil.playNoStack((AIPlayer) payer, ability, game); // Unless cost was payed - no resolve paid = true;