- Clear Frozen Stack if an Ability is canceled during targeting.

- SpellAbility_Requirement ready to handle Spells and Copied Spells.
This commit is contained in:
jendave
2011-08-06 08:46:38 +00:00
parent 3a4eacfd65
commit 6bd9a9ede2

View File

@@ -15,12 +15,14 @@ public class SpellAbility_Requirements {
} }
public void fillRequirements(){ public void fillRequirements(){
if (ability instanceof Spell && !bCasting && !ability.getSourceCard().isCopiedSpell()){ if (ability instanceof Spell && !bCasting){
// remove from hand, todo(sol) be careful of spell copies if spells start using this // remove from hand
bCasting = true; bCasting = true;
Card c = ability.getSourceCard(); if (!ability.getSourceCard().isCopiedSpell()){
fromZone = AllZone.getZone(c); Card c = ability.getSourceCard();
fromZone.remove(c); fromZone = AllZone.getZone(c);
fromZone.remove(c);
}
} }
// freeze Stack. No abilities should go onto the stack while I'm filling requirements. // 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(){ public void finishedTargeting(){
if (select.isCanceled()){ if (select.isCanceled()){
// cancel ability during target choosing // cancel ability during target choosing
if (bCasting){ // and not a copy if (bCasting && !ability.getSourceCard().isCopiedSpell()){ // and not a copy
// add back to hand // add back to hand
fromZone.add(ability.getSourceCard()); fromZone.add(ability.getSourceCard());
} }
select.resetTargets(); select.resetTargets();
AllZone.Stack.clearFrozen();
return; return;
} }
startPaying(); startPaying();
@@ -70,9 +73,9 @@ public class SpellAbility_Requirements {
} }
public void addAbilityToStack(){ public void addAbilityToStack(){
AllZone.ManaPool.clearPay(false); AllZone.ManaPool.clearPay(false);
AllZone.Stack.addAndUnfreeze(ability); AllZone.Stack.addAndUnfreeze(ability);
if (select != null) if (select != null)
select.resetTargets(); select.resetTargets();
} }
} }