- Fixed UnlessResolveSubs parameter freezing the game.

This commit is contained in:
Sloth
2013-03-17 20:52:25 +00:00
parent fc495eee9d
commit e5a3bc3f45
2 changed files with 8 additions and 2 deletions

View File

@@ -2,7 +2,7 @@ Name:Power Sink
ManaCost:X U ManaCost:X U
Types:Instant 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. 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:ManaLose:DB$ DrainMana | Defined$ TargetedController
SVar:X:Count$xPaid SVar:X:Count$xPaid
SVar:Picture:http://www.wizards.com/global/images/magic/general/power_sink.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/power_sink.jpg

View File

@@ -1079,6 +1079,9 @@ public class AbilityUtils {
public void execute() { public void execute() {
if (isSwitched && execSubsWhenNotPaid || execSubsWhenPaid) { if (isSwitched && execSubsWhenNotPaid || execSubsWhenPaid) {
resolveSubAbilities(sa, usedStack, game); 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(); sa.resolve();
if (isSwitched && execSubsWhenPaid || execSubsWhenNotPaid) { if (isSwitched && execSubsWhenPaid || execSubsWhenNotPaid) {
resolveSubAbilities(sa, usedStack, game); 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; boolean paid = false;
for (Player payer : payers) { for (Player payer : payers) {
if (payer.isComputer()) { if (payer.isComputer()) {
ability.setActivatingPlayer(payer);
if (AbilityUtils.willAIPayForAbility(sa, payer, ability, paid, payers)) { if (AbilityUtils.willAIPayForAbility(sa, payer, ability, paid, payers)) {
ability.setActivatingPlayer(payer);
ability.setTarget(sa.getTarget()); ability.setTarget(sa.getTarget());
ComputerUtil.playNoStack((AIPlayer) payer, ability, game); // Unless cost was payed - no resolve ComputerUtil.playNoStack((AIPlayer) payer, ability, game); // Unless cost was payed - no resolve
paid = true; paid = true;