- 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

@@ -4,7 +4,7 @@ Types:Enchantment
T:Mode$ SpellCast | ValidCard$ Card.wasCastFromHand | Execute$ TrigExileSpell | TriggerZones$ Battlefield | TriggerDescription$ Whenever a player casts a spell from his or her hand, that player exiles it, then exiles cards from the top of his or her library until he or she exiles a card that shares a card type with it. That player may cast that card without paying its mana cost. Then he or she puts all cards exiled with CARDNAME on the bottom of his or her library in a random order.
SVar:TrigExileSpell:AB$ ChangeZone | Cost$ 0 | Defined$ TriggeredCard | Origin$ Stack | Destination$ Exile | Fizzle$ True | SubAbility$ DBDig | Imprint$ True
SVar:DBDig:DB$ DigUntil | Defined$ TriggeredCardController | Valid$ Card.sharesTypeWith FirstImprinted | ValidDescription$ shares a card type with exiled card | FoundDestination$ Exile | RevealedDestination$ Exile | RememberFound$ True | ImprintRevealed$ True | SubAbility$ DBPlay
SVar:DBPlay:DB$ Play | Defined$ Remembered | Controller$ RememberedController | WithoutManaCost$ True | Optional$ True | SubAbility$ DBChangeZone
SVar:DBPlay:DB$ Play | Defined$ Remembered | Controller$ TriggeredCardController | WithoutManaCost$ True | Optional$ True | SubAbility$ DBChangeZone
SVar:DBChangeZone:DB$ ChangeZoneAll | Origin$ Exile | ChangeType$ Card.IsRemembered,Card.IsImprinted | Destination$ Library | LibraryPosition$ -1 | RandomOrder$ True | SubAbility$ DBPossibilityCleanup
SVar:DBPossibilityCleanup:DB$ Cleanup | ClearRemembered$ True | ClearImprinted$ True
SVar:Picture:http://www.wizards.com/global/images/magic/general/possibility_storm.jpg

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