- Real fix for both ChangeTargets being able to change Counterspells to ChangeTarget SA that doesn't cause Multitargeting issues

This commit is contained in:
Sol
2013-04-10 00:35:14 +00:00
parent 5284503bd4
commit 1a89e4cce3
2 changed files with 22 additions and 6 deletions

View File

@@ -264,4 +264,11 @@ public class SpellAbilityStackInstance {
this.stackDescription = this.ability.getStackDescription(); this.stackDescription = this.ability.getStackDescription();
} }
} }
public boolean compareToSpellAbility(SpellAbility sa) {
// Compare my target choices to the SA passed in
// TODO? Compare other data points in the SI to the passed SpellAbility for confirmation
TargetChoices choices = sa.getTarget() != null ? sa.getTarget().getTargetChoices() : null;
return (sa.equals(this.ability) && (choices == null || choices.equals(this.tc)));
}
} }

View File

@@ -592,9 +592,8 @@ public class MagicStack extends MyObservable {
this.freezeStack(); this.freezeStack();
this.setResolving(true); this.setResolving(true);
final SpellAbility sa = this.pop(); // The SpellAbility isn't removed from the Stack until it finishes resolving
// Sol(2012/04/06) Temporarily changed to fix multiple activation bug final SpellAbility sa = this.top();
//final SpellAbility sa = this.top();
// ActivePlayer gains priority first after Resolve // ActivePlayer gains priority first after Resolve
game.getPhaseHandler().resetPriority(); game.getPhaseHandler().resetPriority();
@@ -723,8 +722,8 @@ public class MagicStack extends MyObservable {
// remove SA and card from the stack // remove SA and card from the stack
this.removeCardFromStack(sa, fizzle); this.removeCardFromStack(sa, fizzle);
// Sol(2012/04/06) Temporarily removed to fix multiple activation bug // SpellAbility is removed from the stack here
//this.remove(sa); this.remove(sa);
// After SA resolves we have to do a handful of things // After SA resolves we have to do a handful of things
this.setResolving(false); this.setResolving(false);
@@ -950,7 +949,17 @@ public class MagicStack extends MyObservable {
public final SpellAbilityStackInstance getInstanceFromSpellAbility(final SpellAbility sa) { public final SpellAbilityStackInstance getInstanceFromSpellAbility(final SpellAbility sa) {
// TODO: Confirm this works! // TODO: Confirm this works!
for (final SpellAbilityStackInstance si : this.getStack()) { for (final SpellAbilityStackInstance si : this.getStack()) {
if (si.getSpellAbility().equals(sa)) { if (si.compareToSpellAbility(sa)) {
return si;
}
}
return null;
}
public final SpellAbilityStackInstance getInstanceFromAbilityAndTarget(final SpellAbility sa, final Target tgt) {
// TODO: Confirm this works!
for (final SpellAbilityStackInstance si : this.getStack()) {
if (si.getSpellAbility().equals(sa) && tgt.equals(sa.getTarget())) {
return si; return si;
} }
} }