- 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. 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: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: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: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:DBPossibilityCleanup:DB$ Cleanup | ClearRemembered$ True | ClearImprinted$ True
SVar:Picture:http://www.wizards.com/global/images/magic/general/possibility_storm.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/possibility_storm.jpg

View File

@@ -524,10 +524,12 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
for (SpellAbility spell : spells) { for (SpellAbility spell : spells) {
if (tgtC.isInZone(ZoneType.Exile)) { if (tgtC.isInZone(ZoneType.Exile)) {
final SpellAbilityStackInstance si = game.getStack().getInstanceFromSpellAbility(spell); final SpellAbilityStackInstance si = game.getStack().getInstanceFromSpellAbility(spell);
if (si != null) {
game.getStack().remove(si); game.getStack().remove(si);
} }
} }
} }
}
if (sa.hasParam("ExileFaceDown")) { if (sa.hasParam("ExileFaceDown")) {
movedCard.setState(CardCharacteristicName.FaceDown); movedCard.setState(CardCharacteristicName.FaceDown);
} }

View File

@@ -206,7 +206,7 @@ public class PlayEffect extends SpellAbilityEffect {
// get basic spells (no flashback, etc.) // get basic spells (no flashback, etc.)
ArrayList<SpellAbility> sas = new ArrayList<SpellAbility>(); ArrayList<SpellAbility> sas = new ArrayList<SpellAbility>();
for (SpellAbility s : tgtCard.getBasicSpells()) { for (SpellAbility s : tgtCard.getBasicSpells()) {
final SpellAbility newSA = s.copy(); final Spell newSA = (Spell) s.copy();
newSA.setActivatingPlayer(controller); newSA.setActivatingPlayer(controller);
SpellAbilityRestriction res = new SpellAbilityRestriction(); SpellAbilityRestriction res = new SpellAbilityRestriction();
// timing restrictions still apply // timing restrictions still apply
@@ -216,7 +216,7 @@ public class PlayEffect extends SpellAbilityEffect {
res.setZone(null); res.setZone(null);
newSA.setRestrictions(res); newSA.setRestrictions(res);
// timing restrictions still apply // timing restrictions still apply
if (res.checkTimingRestrictions(tgtCard, newSA)) { if (res.checkTimingRestrictions(tgtCard, newSA) && newSA.checkOtherRestrictions()) {
sas.add(newSA); 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 // CantBeCast static abilities
final List<Card> allp = new ArrayList<Card>(game.getCardsIn(ZoneType.listValueOf("Battlefield,Command"))); final List<Card> allp = new ArrayList<Card>(game.getCardsIn(ZoneType.listValueOf("Battlefield,Command")));
allp.add(card); allp.add(source);
for (final Card ca : allp) { for (final Card ca : allp) {
final ArrayList<StaticAbility> staticAbilities = ca.getStaticAbilities(); final ArrayList<StaticAbility> staticAbilities = ca.getStaticAbilities();
for (final StaticAbility stAb : staticAbilities) { for (final StaticAbility stAb : staticAbilities) {
if (stAb.applyAbility("CantBeCast", card, activator)) { if (stAb.applyAbility("CantBeCast", source, activator)) {
return false; return false;
} }
} }
} }
return true; return true;
} // canPlay() }
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override

View File

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