From 6bd9a9ede2da32389e55bbe169855d598e306ce2 Mon Sep 17 00:00:00 2001 From: jendave Date: Sat, 6 Aug 2011 08:46:38 +0000 Subject: [PATCH] - Clear Frozen Stack if an Ability is canceled during targeting. - SpellAbility_Requirement ready to handle Spells and Copied Spells. --- src/forge/SpellAbility_Requirements.java | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/forge/SpellAbility_Requirements.java b/src/forge/SpellAbility_Requirements.java index d49e05860d8..a69d810bf8c 100644 --- a/src/forge/SpellAbility_Requirements.java +++ b/src/forge/SpellAbility_Requirements.java @@ -15,12 +15,14 @@ public class SpellAbility_Requirements { } public void fillRequirements(){ - if (ability instanceof Spell && !bCasting && !ability.getSourceCard().isCopiedSpell()){ - // remove from hand, todo(sol) be careful of spell copies if spells start using this + if (ability instanceof Spell && !bCasting){ + // remove from hand bCasting = true; - Card c = ability.getSourceCard(); - fromZone = AllZone.getZone(c); - fromZone.remove(c); + if (!ability.getSourceCard().isCopiedSpell()){ + Card c = ability.getSourceCard(); + fromZone = AllZone.getZone(c); + fromZone.remove(c); + } } // freeze Stack. No abilities should go onto the stack while I'm filling requirements. @@ -37,12 +39,13 @@ public class SpellAbility_Requirements { public void finishedTargeting(){ if (select.isCanceled()){ // cancel ability during target choosing - if (bCasting){ // and not a copy + if (bCasting && !ability.getSourceCard().isCopiedSpell()){ // and not a copy // add back to hand fromZone.add(ability.getSourceCard()); } select.resetTargets(); + AllZone.Stack.clearFrozen(); return; } startPaying(); @@ -70,9 +73,9 @@ public class SpellAbility_Requirements { } public void addAbilityToStack(){ - AllZone.ManaPool.clearPay(false); - AllZone.Stack.addAndUnfreeze(ability); - if (select != null) - select.resetTargets(); + AllZone.ManaPool.clearPay(false); + AllZone.Stack.addAndUnfreeze(ability); + if (select != null) + select.resetTargets(); } }