- Added UntapUpTo to AF_Untap

- Converted Urza's "Free" Spells from Drawback to AF SubAbility
This commit is contained in:
jendave
2011-08-06 23:01:20 +00:00
parent 62afef36ca
commit 833d70aa74
6 changed files with 87 additions and 44 deletions

View File

@@ -3,7 +3,8 @@ ManaCost:2 U
Types:Instant
Text:no text
A:SP$ Draw | Cost$ 2 U | NumCards$ 2 | SpellDescription$ Draw two cards, then discard two cards. Untap up to three lands. | SubAbility$ SVar=DBDiscard
SVar:DBDiscard:DB$Discard | NumCards$ 2 | Mode$ TgtChoose | SubAbility$ YouUntapUpTo/3/Land
SVar:DBDiscard:DB$Discard | NumCards$ 2 | Mode$ TgtChoose | SubAbility$ SVar=DBUntap
SVar:DBUntap:DB$ Untap | UntapUpTo$ True | UntapType$ Land | Amount$ 3
# Use old subability for untapping until AF$Untap can handle Urza block style "Free" spells
SVar:RemAIDeck:True
SVar:Rarity:Common

View File

@@ -2,7 +2,8 @@ Name:Rewind
ManaCost:2 U U
Types:Instant
Text:no text
A:SP$ Counter | Cost$ 2 U U | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | SubAbility$ YouUntapUpTo/4/Land | SpellDescription$ Counter target spell. Untap up to four lands.
A:SP$ Counter | Cost$ 2 U U | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | SubAbility$ SVar=DBUntap | SpellDescription$ Counter target spell. Untap up to four lands.
SVar:DBUntap:DB$ Untap | UntapUpTo$ True | UntapType$ Land | Amount$ 4
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/rewind.jpg
SetInfo:8ED|Uncommon|http://magiccards.info/scans/en/8e/96.jpg

View File

@@ -2,7 +2,8 @@ Name:Snap
ManaCost:1 U
Types:Instant
Text:no text
A:SP$ChangeZone | Cost$ 1 U | ValidTgts$ Creature | TgtPrompt$ Select target creature | Origin$ Battlefield | Destination$ Hand | SpellDescription$ Return target creature to its owner's hand. Untap up to two lands. | SubAbility$ YouUntapUpTo/2/Land
A:SP$ChangeZone | Cost$ 1 U | ValidTgts$ Creature | TgtPrompt$ Select target creature | Origin$ Battlefield | Destination$ Hand | SpellDescription$ Return target creature to its owner's hand. Untap up to two lands. | SubAbility$ SVar=DBUntap
SVar:DBUntap:DB$ Untap | UntapUpTo$ True | UntapType$ Land | Amount$ 2
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/snap.jpg
SetInfo:ULG|Common|http://magiccards.info/scans/en/ul/43.jpg

View File

@@ -5,7 +5,8 @@ Text:no text
A:SP$ ChangeZoneAll | Cost$ 4 U U | ChangeType$ Card | Origin$ Hand | Destination$ Library | Shuffle$ True | SubAbility$ SVar=DBChangeAll | SpellDescription$ Each player shuffles his or her graveyard and hand into his or her library
SVar:DBChangeAll:DB$ChangeZoneAll | ChangeType$ Card | Origin$ Graveyard | Destination$ Library | SubAbility$ SVar=DBDraw
SVar:DBDraw:DB$Draw | NumCards$ 7 | Defined$ Each | SubAbility$ SVar=DBChange | SpellDescription$ , then draws seven cards.
SVar:DBChange:DB$ChangeZone | Origin$ Stack | Destination$ Exile | SubAbility$ YouUntapUpTo/6/Land | SpellDescription$ Exile Time Spiral. You untap up to six lands.
SVar:DBChange:DB$ChangeZone | Origin$ Stack | Destination$ Exile | SubAbility$ SVar=DBUntap | SpellDescription$ Exile Time Spiral. You untap up to six lands.
SVar:DBUntap:DB$ Untap | UntapUpTo$ True | UntapType$ Land | Amount$ 6
SVar:RemAIDeck:True
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/time_spiral.jpg

View File

@@ -11,7 +11,10 @@ import forge.Card;
import forge.CardList;
import forge.CardListFilter;
import forge.ComputerUtil;
import forge.GameAction;
import forge.MyRandom;
import forge.Player;
import forge.card.cardFactory.CardFactory;
import forge.card.cardFactory.CardFactoryUtil;
import forge.card.spellability.Ability_Activated;
import forge.card.spellability.Ability_Sub;
@@ -112,7 +115,7 @@ public class AbilityFactory_PermanentState {
public static String untapStackDescription(AbilityFactory af, SpellAbility sa){
// when getStackDesc is called, just build exactly what is happening
StringBuilder sb = new StringBuilder();
final HashMap<String,String> params = af.getMapParams();
final HashMap<String, String> params = af.getMapParams();
Card hostCard = sa.getSourceCard();
if (sa instanceof Ability_Sub)
@@ -122,20 +125,26 @@ public class AbilityFactory_PermanentState {
sb.append("Untap ");
if (params.containsKey("UntapUpTo")) {
sb.append("up to ").append(params.get("Amount")).append(" ");
sb.append(params.get("UntapType")).append("s");
}
else {
ArrayList<Card> tgtCards;
Target tgt = af.getAbTgt();
if (tgt != null)
tgtCards = tgt.getTargetCards();
else{
else {
tgtCards = AbilityFactory.getDefinedCards(hostCard, params.get("Defined"), sa);
}
Iterator<Card> it = tgtCards.iterator();
while(it.hasNext()) {
while (it.hasNext()) {
sb.append(it.next());
if(it.hasNext()) sb.append(", ");
if (it.hasNext())
sb.append(", ");
}
}
sb.append(".");
Ability_Sub subAb = sa.getSubAbility();
@@ -351,9 +360,12 @@ public class AbilityFactory_PermanentState {
public static void untapResolve(final AbilityFactory af, final SpellAbility sa){
HashMap<String,String> params = af.getMapParams();
Card card = sa.getSourceCard();
ArrayList<Card> tgtCards;
Target tgt = af.getAbTgt();
ArrayList<Card> tgtCards = null;
if (params.containsKey("UntapUpTo"))
chooseUntapUpTo(af, sa, params);
else{
if (tgt != null)
tgtCards = tgt.getTargetCards();
else{
@@ -364,6 +376,7 @@ public class AbilityFactory_PermanentState {
if (AllZone.GameAction.isCardInPlay(tgtC) && (tgt == null || CardFactoryUtil.canTarget(af.getHostCard(), tgtC)))
tgtC.untap();
}
}
if (af.hasSubAbility()){
Ability_Sub abSub = sa.getSubAbility();
@@ -379,6 +392,32 @@ public class AbilityFactory_PermanentState {
}
}
public static void chooseUntapUpTo(AbilityFactory af, SpellAbility sa, HashMap<String,String> params){
int num = Integer.parseInt(params.get("Amount"));
String valid = params.get("UntapType");
Player activatingPlayer = sa.getActivatingPlayer();
// Reuse existing UntapUpTo Input
if (activatingPlayer.isHuman())
AllZone.InputControl.setInput(CardFactoryUtil.input_UntapUpToNType(num, valid));
else{
CardList list = new CardList(AllZone.Computer_Battlefield.getCards());
list = list.getType(valid);
list = list.getTapState("Tapped");
int count = 0;
while(list.size() != 0 )
for(int i = 0; i < num && i < list.size(); i++){
Card c = CardFactoryUtil.AI_getBestLand(list);
c.untap();
list.remove(c);
count++;
}
}
}
// ****************************************
// ************** Tap *********************
// ****************************************

View File

@@ -3973,7 +3973,7 @@ public class CardFactoryUtil {
@Override
public void selectCard(Card card, PlayerZone zone) {
if(card.isLand() && zone.is(Constant.Zone.Battlefield)) {
if(card.isType(type) && zone.is(Constant.Zone.Battlefield)) {
card.untap();
count++;
if(count == stop) stop();