- Some fixes for Possibility Storm.

This commit is contained in:
Sloth
2013-06-05 13:34:47 +00:00
parent 7e462c85e3
commit 956e7e9293
5 changed files with 18 additions and 11 deletions

View File

@@ -524,7 +524,9 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
for (SpellAbility spell : spells) {
if (tgtC.isInZone(ZoneType.Exile)) {
final SpellAbilityStackInstance si = game.getStack().getInstanceFromSpellAbility(spell);
game.getStack().remove(si);
if (si != null) {
game.getStack().remove(si);
}
}
}
}

View File

@@ -206,7 +206,7 @@ public class PlayEffect extends SpellAbilityEffect {
// get basic spells (no flashback, etc.)
ArrayList<SpellAbility> sas = new ArrayList<SpellAbility>();
for (SpellAbility s : tgtCard.getBasicSpells()) {
final SpellAbility newSA = s.copy();
final Spell newSA = (Spell) s.copy();
newSA.setActivatingPlayer(controller);
SpellAbilityRestriction res = new SpellAbilityRestriction();
// timing restrictions still apply
@@ -216,7 +216,7 @@ public class PlayEffect extends SpellAbilityEffect {
res.setZone(null);
newSA.setRestrictions(res);
// timing restrictions still apply
if (res.checkTimingRestrictions(tgtCard, newSA)) {
if (res.checkTimingRestrictions(tgtCard, newSA) && newSA.checkOtherRestrictions()) {
sas.add(newSA);
}
}

View File

@@ -101,20 +101,26 @@ public abstract class Spell extends SpellAbility implements java.io.Serializable
}
}
return checkOtherRestrictions();
} // canPlay()
public boolean checkOtherRestrictions() {
final Card source = this.getSourceCard();
Player activator = getActivatingPlayer();
final Game game = activator.getGame();
// CantBeCast static abilities
final List<Card> allp = new ArrayList<Card>(game.getCardsIn(ZoneType.listValueOf("Battlefield,Command")));
allp.add(card);
allp.add(source);
for (final Card ca : allp) {
final ArrayList<StaticAbility> staticAbilities = ca.getStaticAbilities();
for (final StaticAbility stAb : staticAbilities) {
if (stAb.applyAbility("CantBeCast", card, activator)) {
if (stAb.applyAbility("CantBeCast", source, activator)) {
return false;
}
}
}
return true;
} // canPlay()
}
/** {@inheritDoc} */
@Override

View File

@@ -316,10 +316,9 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
//GuiDisplayUtil.updateGUI();
} else {
for (OptionalCost s : sp.getOptionalCosts()) {
sp.getSourceCard().addOptionalCostPaid(s);
}
if (sp.getSourceCard().isCopiedSpell()) {
if (sp.isCopied()) {
si = this.push(sp);
} else {
if (sp.isMultiKicker()) {
@@ -474,7 +473,7 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
game.getPhaseHandler().setPriority(sp.getActivatingPlayer());
}
if (sp.isSpell() && !sp.getSourceCard().isCopiedSpell()) {
if (sp.isSpell() && !sp.isCopied()) {
this.thisTurnCast.add(sp.getSourceCard());
final Game game = sp.getActivatingPlayer().getGame();