Added Venser, Shaper Savant

Added support to ChangeZone AF for targeting spells on stack. Might need some tweaking.
Added counting of cards on the stack
This commit is contained in:
moomarc
2012-04-18 10:47:08 +00:00
parent 9313a97d97
commit e74baa3d64
4 changed files with 94 additions and 0 deletions

1
.gitattributes vendored
View File

@@ -9831,6 +9831,7 @@ res/cardsfolder/v/venomous_dragonfly.txt svneol=native#text/plain
res/cardsfolder/v/venomous_fangs.txt -text
res/cardsfolder/v/venomous_vines.txt svneol=native#text/plain
res/cardsfolder/v/venomspout_brackus.txt svneol=native#text/plain
res/cardsfolder/v/venser_shaper_savant.txt -text
res/cardsfolder/v/venser_the_sojourner.txt svneol=native#text/plain
res/cardsfolder/v/vensers_journal.txt svneol=native#text/plain
res/cardsfolder/v/vensers_sliver.txt svneol=native#text/plain

View File

@@ -0,0 +1,17 @@
Name:Venser, Shaper Savant
ManaCost:2 U U
Types:Legendary Creature Human Wizard
Text:no text
PT:2/2
K:Flash
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | CheckSVar$ X | SVarCompare$ GE1 | Execute$ ChooseTgtMode | TriggerDescription$ When CARDNAME enters the battlefield, return target spell or permanent to its owner's hand.
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | CheckSVar$ X | SVarCompare$ LT1 | Execute$ BouncePermanent | Secondary$ True | TriggerDescription$ When CARDNAME enters the battlefield, return target spell or permanent to its owner's hand.
SVar:ChooseTgtMode:AB$ Charm | Cost$ 0 | Defined$ You | Choices$ BounceSpell,BouncePermanent
SVar:BounceSpell:DB$ChangeZone | TargetType$ Spell | ValidTgts$ Card | TgtZone$ Stack | Origin$ Stack | Destination$ Hand | TargetMin$ 1 | TargetMax$ 1 | SpellDescription$ Return target spell to its owner's hand.
SVar:BouncePermanent:DB$ChangeZone | ValidTgts$ Permanent | TgtPrompt$ Select target permanent | Origin$ Battlefield | Destination$ Hand | TargetMin$ 1 | TargetMax$ 1 | SpellDescription$ Return target permanent to its owner's hand.
SVar:X:Count$SpellsOnStack
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/venser_shaper_savant.jpg
SetInfo:FUT|Rare|http://magiccards.info/scans/en/fut/46.jpg
Oracle:Flash (You may cast this spell any time you could cast an instant.)\nWhen Venser, Shaper Savant enters the battlefield, return target spell or permanent to its owner's hand.
End

View File

@@ -1888,6 +1888,8 @@ public final class AbilityFactoryChangeZone {
*/
private static void changeKnownOriginResolve(final AbilityFactory af, final SpellAbility sa) {
ArrayList<Card> tgtCards;
ArrayList<SpellAbility> sas;
final HashMap<String, String> params = af.getMapParams();
final Target tgt = sa.getTarget();
final Player player = sa.getActivatingPlayer();
@@ -1905,6 +1907,28 @@ public final class AbilityFactoryChangeZone {
}
}
// changing zones for spells on the stack
if (tgt != null) {
sas = tgt.getTargetSAs();
} else {
sas = AbilityFactory.getDefinedSpellAbilities(sa.getSourceCard(), params.get("Defined"), sa);
}
for (final SpellAbility tgtSA : sas) {
final Card tgtSACard = tgtSA.getSourceCard();
if (!tgtSA.isSpell()) { // Catch any abilities or triggers that slip through somehow
continue;
}
final SpellAbilityStackInstance si = AllZone.getStack().getInstanceFromSpellAbility(tgtSA);
if (si == null) {
continue;
}
removeFromStack(tgtSA, sa, si);
} // End of change from stack
final String remember = params.get("RememberChanged");
final String imprint = params.get("Imprint");
@@ -2043,6 +2067,54 @@ public final class AbilityFactoryChangeZone {
return ret;
}
/**
* <p>
* removeFromStack.
* </p>
*
* @param tgtSA
* a {@link forge.card.spellability.SpellAbility} object.
* @param srcSA
* a {@link forge.card.spellability.SpellAbility} object.
* @param si
* a {@link forge.card.spellability.SpellAbilityStackInstance}
* object.
*/
private static void removeFromStack(final SpellAbility tgtSA, final SpellAbility srcSA, final SpellAbilityStackInstance si) {
AllZone.getStack().remove(si);
final AbilityFactory af = srcSA.getAbilityFactory();
final HashMap<String, String> params = af.getMapParams();
if (params.containsKey("Destination")) {
if (tgtSA.isAbility()) {
// Shouldn't be able to target Abilities but leaving this in for now
} else if (tgtSA.isFlashBackAbility()) {
Singletons.getModel().getGameAction().exile(tgtSA.getSourceCard());
} else if (params.get("Destination").equals("Graveyard")) {
Singletons.getModel().getGameAction().moveToGraveyard(tgtSA.getSourceCard());
} else if (params.get("Destination").equals("Exile")) {
Singletons.getModel().getGameAction().exile(tgtSA.getSourceCard());
} else if (params.get("Destination").equals("TopOfLibrary")) {
Singletons.getModel().getGameAction().moveToLibrary(tgtSA.getSourceCard());
} else if (params.get("Destination").equals("Hand")) {
Singletons.getModel().getGameAction().moveToHand(tgtSA.getSourceCard());
} else if (params.get("Destination").equals("BottomOfLibrary")) {
Singletons.getModel().getGameAction().moveToBottomOfLibrary(tgtSA.getSourceCard());
} else if (params.get("Destination").equals("ShuffleIntoLibrary")) {
Singletons.getModel().getGameAction().moveToBottomOfLibrary(tgtSA.getSourceCard());
tgtSA.getSourceCard().getController().shuffle();
} else {
throw new IllegalArgumentException("AbilityFactory_ChangeZone: Invalid Destination argument for card "
+ srcSA.getSourceCard().getName());
}
if (!tgtSA.isAbility()) {
System.out.println("Moving spell to " + params.get("Destination"));
}
}
}
// *************************************************************************************
// ************************** ChangeZoneAll
// ********************************************

View File

@@ -3261,6 +3261,10 @@ public class CardFactoryUtil {
}
}
if (sq[0].contains("SpellsOnStack")) {
someCards.addAll(AllZoneUtil.getCardsIn(ZoneType.Stack));
}
if (sq[0].contains("InAllHands")) {
if (!mh) {
someCards.addAll(cardController.getCardsIn(ZoneType.Hand));