- 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(){
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();
}
}