convert Opt to AF_Dig

This commit is contained in:
jendave
2011-08-06 23:58:22 +00:00
parent 7c8bb5e7f0
commit 48484cb154
2 changed files with 7 additions and 54 deletions

View File

@@ -1,9 +1,11 @@
Name:Opt Name:Opt
ManaCost:U ManaCost:U
Types:Instant Types:Instant
Text:Look at the top card of your library. You may put that card on the bottom of your library. Draw a card. Text:no text
A:SP$ Dig | Cost$ U | DigNum$ 1 | ChangeNum$ 1 | DestinationZone$ Library | LibraryPosition$ -1 | Optional$ True | LibraryPosition2$ 0 | SubAbility$ SVar=DBDraw | SpellDescription$ Look at the top card of your library. You may put that card on the bottom of your library. Draw a card.
SVar:DBDraw:DB$Draw | Defined$ You | NumCards$ 1
SVar:RemAIDeck:True SVar:RemAIDeck:True
SVar:Rarity:Common SVar:Rarity:Common
SVar:Picture:http://resources.wizards.com/magic/cards/in/en-us/card22988.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/opt.jpg
SetInfo:INV|Common|http://magiccards.info/scans/en/in/64.jpg SetInfo:INV|Common|http://magiccards.info/scans/en/in/64.jpg
End End

View File

@@ -16,7 +16,6 @@ import forge.Combat;
import forge.Command; import forge.Command;
import forge.ComputerUtil; import forge.ComputerUtil;
import forge.Constant; import forge.Constant;
import forge.GameActionUtil;
import forge.MyRandom; import forge.MyRandom;
import forge.PhaseUtil; import forge.PhaseUtil;
import forge.Player; import forge.Player;
@@ -156,8 +155,7 @@ public class CardFactory_Instants {
@Override @Override
public boolean canPlayAI() { public boolean canPlayAI() {
CardList small = new CardList(AllZone.Computer_Battlefield.getCards()); CardList small = AllZoneUtil.getCreaturesInPlay(AllZone.ComputerPlayer);
small = small.getType("Creature");
//try to make a good attacker //try to make a good attacker
if(0 < small.size()) { if(0 < small.size()) {
@@ -550,8 +548,7 @@ public class CardFactory_Instants {
@Override @Override
public boolean canPlayAI() { public boolean canPlayAI() {
PlayerZone Library = AllZone.getZone(Constant.Zone.Library, card.getController()); CardList cards = AllZoneUtil.getPlayerCardsInPlay(AllZone.ComputerPlayer);
CardList cards = new CardList(Library.getCards());
return cards.size() >= 10; return cards.size() >= 10;
} }
};//SpellAbility };//SpellAbility
@@ -703,9 +700,7 @@ public class CardFactory_Instants {
|| !CardFactoryUtil.canTarget(card, getTargetCard())) return; || !CardFactoryUtil.canTarget(card, getTargetCard())) return;
//get all permanents //get all permanents
CardList all = new CardList(); CardList all = AllZoneUtil.getCardsInPlay();
all.addAll(AllZone.Human_Battlefield.getCards());
all.addAll(AllZone.Computer_Battlefield.getCards());
CardList sameName = all.getName(getTargetCard().getName()); CardList sameName = all.getName(getTargetCard().getName());
sameName = sameName.filter(new CardListFilter() sameName = sameName.filter(new CardListFilter()
@@ -770,50 +765,6 @@ public class CardFactory_Instants {
card.clearFirstSpellAbility(); card.clearFirstSpellAbility();
card.addSpellAbility(spell); card.addSpellAbility(spell);
}//*************** END ************ END ************************** }//*************** END ************ END **************************
//*************** START *********** START **************************
else if(cardName.equals("Opt")) {
SpellAbility spell = new Spell(card) {
private static final long serialVersionUID = 6002051826637535590L;
@Override
public void resolve() {
Player player = card.getController();
if(player.isHuman()) humanResolve();
else computerResolve();
player.drawCard();
}
public void computerResolve() {
//if top card of library is a land, put it on bottom of library
if(AllZone.Computer_Library.getCards().length != 0) {
Card top = AllZone.Computer_Library.get(0);
if(top.isLand())
AllZone.GameAction.moveToBottomOfLibrary(top);
}
}//computerResolve()
public void humanResolve() {
PlayerZone library = AllZone.getZone(Constant.Zone.Library, card.getController());
//see if any cards are in library
if(library.getCards().length != 0) {
Card top = library.get(0);
StringBuilder sb = new StringBuilder();
sb.append("Put ").append(top.getName()).append(" on the Bottom of your Library?");
if (GameActionUtil.showYesNoDialog(top, sb.toString()))
AllZone.GameAction.moveToBottomOfLibrary(top);
}//if
}//resolve()
};
// Do not remove SpellAbilities created by AbilityFactory or Keywords.
card.clearFirstSpellAbility();
card.addSpellAbility(spell);
}//*************** END ************ END **************************
//*************** START *********** START ************************** //*************** START *********** START **************************