- Converted Firebolt, Tinker, Oust, Path to Exile to AF

- moveTo Tweaks
This commit is contained in:
jendave
2011-08-06 15:48:41 +00:00
parent b5ce2f193f
commit aedf570c59
9 changed files with 26 additions and 576 deletions

View File

@@ -1,7 +1,10 @@
Name:Firebolt Name:Firebolt
ManaCost:R ManaCost:R
Types:Sorcery Types:Sorcery
Text:Firebolt deals 2 damage to target creature or player. Text:no text
A:SP$DealDamage | Cost$ R | Tgt$ TgtCP | NumDmg$ 2 | SpellDescription$ CARDNAME deals 2 damage to target creature or player.
A:SP$DealDamage | Cost$ 4 R | Tgt$ TgtCP | NumDmg$ 2 | Flashback$ True | CostDesc$ Flashback 4 R | SpellDescription$ (You may cast this card from your graveyard for its flashback cost. Then exile it.)
SVar:Rarity:Common SVar:Rarity:Common
SVar:Picture:http://resources.wizards.com/magic/cards/od/en-us/card30570.jpg SVar:Picture:http://resources.wizards.com/magic/cards/od/en-us/card30570.jpg
SetInfo:ODY|Common|http://magiccards.info/scans/en/od/193.jpg SetInfo:ODY|Common|http://magiccards.info/scans/en/od/193.jpg

View File

@@ -1,7 +1,10 @@
Name:Oust Name:Oust
ManaCost:W ManaCost:W
Types:Sorcery Types:Sorcery
Text:Put target creature into its owner's library second from the top. Its controller gains 3 life. Text:no text
A:SP$ChangeZone | Cost$ W | Origin$ Battlefield | Destination$ Library | ValidTgts$ Creature | LibraryPosition$ 1 | SubAbility$ SVar=DBGainLife | SpellDescription$ Put target creature into its owner's library second from the top. Its controller gains 3 life.
# Library Position is zero indexed. So 1 is second from the top
SVar:DBGainLife:DB$GainLife | Defined$ TargetedController | LifeAmount$ 3
SVar:PlayMain1:TRUE SVar:PlayMain1:TRUE
SVar:Rarity:Uncommon SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/oust.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/oust.jpg

View File

@@ -2,6 +2,8 @@ Name:Path to Exile
ManaCost:W ManaCost:W
Types:Instant Types:Instant
Text:Exile target creature. Its controller may search his or her library for a basic land card, put that card onto the battlefield tapped, then shuffle his or her library. Text:Exile target creature. Its controller may search his or her library for a basic land card, put that card onto the battlefield tapped, then shuffle his or her library.
A:SP$ChangeZone | Cost$ W | Origin$ Battlefield | Destination$ Exile | ValidTgts$ Creature | SubAbility$ SVar=DBChange | SpellDescription$ Exile target creature. Its controller may search his or her library for a basic land card, put that card onto the battlefield tapped, then shuffle his or her library.
SVar:DBChange:DB$ChangeZone | Origin$ Library | Destination$ Battlefield | Tapped$ True | ChangeType$ Land.Basic | ChangeNum$ 1 | Defined$ TargetedController
SVar:Rarity:Uncommon SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/path_to_exile.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/path_to_exile.jpg
SetInfo:CFX|Uncommon|http://magiccards.info/scans/en/cfx/15.jpg SetInfo:CFX|Uncommon|http://magiccards.info/scans/en/cfx/15.jpg

View File

@@ -1,7 +1,8 @@
Name:Tinker Name:Tinker
ManaCost:2 U ManaCost:2 U
Types:Sorcery Types:Sorcery
Text:As an additional cost to cast Tinker, sacrifice an artifact.\r\nSearch your library for an artifact card and put that card onto the battlefield. Then shuffle your library. Text:no text
A:SP$ChangeZone | Cost$ 2 U Sac<1/Artifact> | Origin$ Library | Destination$ Battlefield | ChangeType$ Artifact | ChangeNum$ 1 | SpellDescription$ Search your library for an artifact card and put that card onto the battlefield. Then shuffle your library.
SVar:Rarity:Uncommon SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/tinker.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/tinker.jpg
SetInfo:ULG|Uncommon|http://magiccards.info/scans/en/ul/45.jpg SetInfo:ULG|Uncommon|http://magiccards.info/scans/en/ul/45.jpg

View File

@@ -695,6 +695,15 @@ public class AbilityFactory {
players.addAll(tgt.getTargetPlayers()); players.addAll(tgt.getTargetPlayers());
} }
else if (defined.equals("TargetedController")){
ArrayList<Card> list = getDefinedCards(card, "Targeted", sa);
for(Card c : list){
Player p = c.getController();
if (!players.contains(p))
players.add(p);
}
}
else{ else{
if (defined.equals("You") || defined.equals("Each")) if (defined.equals("You") || defined.equals("Each"))
players.add(sa.getActivatingPlayer()); players.add(sa.getActivatingPlayer());

View File

@@ -782,7 +782,7 @@ public class AbilityFactory_ChangeZone {
else if (libraryPosition == 0) else if (libraryPosition == 0)
sb.append(" on top of").append(pronoun).append("owner's library."); sb.append(" on top of").append(pronoun).append("owner's library.");
else else
sb.append(libraryPosition-1).append(" from the top of").append(pronoun).append("owner's library."); sb.append(" ").append(libraryPosition+1).append(" from the top of").append(pronoun).append("owner's library.");
} }
} }
@@ -890,4 +890,5 @@ public class AbilityFactory_ChangeZone {
return AbilityFactory.getDefinedCards(sa.getSourceCard(), defined, sa).get(0); return AbilityFactory.getDefinedCards(sa.getSourceCard(), defined, sa).get(0);
} }
} }

View File

@@ -2282,82 +2282,6 @@ public class CardFactory_Instants {
card.addSpellAbility(spell); card.addSpellAbility(spell);
}//*************** END ************ END ************************** }//*************** END ************ END **************************
//*************** START *********** START **************************
else if (cardName.equals("Path to Exile")) {
SpellAbility spell = new Spell(card) {
private static final long serialVersionUID = 4752934806606319269L;
@Override
public void resolve() {
if (AllZone.GameAction.isCardInPlay(getTargetCard())
&& CardFactoryUtil.canTarget(card, getTargetCard())) {
Player player = getTargetCard().getController();
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player);
//remove card from play
AllZone.GameAction.exile(getTargetCard());
//Retrieve basic land
CardList lands = new CardList(lib.getCards());
lands = lands.getType("Basic");
if (player.equals(AllZone.HumanPlayer) && lands.size() > 0) {
String question = "Pick a basic land card to put onto the battlefield tapped?";
if (GameActionUtil.showYesNoDialog(card, question)) {
Object o = GuiUtils.getChoiceOptional("Choose a Basic Land", lands.toArray());
if (o != null) {
Card card = (Card) o;
lib.remove(card);
AllZone.Human_Battlefield.add(card);
card.tap();
lands.remove(card);
player.shuffle();
}
}// if choice yes
} // player equals human
// // player equals computer
else if (player.equals(AllZone.ComputerPlayer) && lands.size() > 0) {
Card card = lands.get(0);
lib.remove(card);
// hand.add(card);
AllZone.Computer_Battlefield.add(card);
card.tap();
lands.remove(card);
player.shuffle();
}
}
}//resolve()
@Override
public boolean canPlayAI() {
CardList creature = new CardList(AllZone.Human_Battlefield.getCards());
creature = creature.getType("Creature");
creature = creature.filter(new CardListFilter() {
public boolean addCard(Card c) {
return CardFactoryUtil.canTarget(card, c);
}
});
return creature.size() != 0 && (AllZone.Phase.getTurn() > 4);
}
@Override
public void chooseTargetAI() {
CardList play = new CardList(AllZone.Human_Battlefield.getCards());
Card target = CardFactoryUtil.AI_getBestCreature(play, card);
setTargetCard(target);
}
};
spell.setBeforePayMana(CardFactoryUtil.input_targetCreature(spell));
card.clearSpellAbility();
card.addSpellAbility(spell);
}//*************** END ************ END **************************
//*************** START *********** START ************************** //*************** START *********** START **************************
else if(cardName.equals("Force of Will")) { else if(cardName.equals("Force of Will")) {
final SpellAbility spell = new Spell(card) { final SpellAbility spell = new Spell(card) {

View File

@@ -1573,312 +1573,6 @@ public class CardFactory_Sorceries {
}//*************** END ************ END *************************** }//*************** END ************ END ***************************
//*************** START *********** START **************************
else if(cardName.equals("Firebolt")) {
final SpellAbility spell = new Spell(card) {
private static final long serialVersionUID = -4100322462753117988L;
int damage = 2;
Card check;
@Override
public boolean canPlayAI() {
PlayerZone compHand = AllZone.getZone(Constant.Zone.Hand, AllZone.ComputerPlayer);
CardList hand = new CardList(compHand.getCards());
if(AllZone.HumanPlayer.getLife() <= damage) return AllZone.GameAction.isCardInZone(card,
compHand);
if(hand.size() >= 8) return true && AllZone.GameAction.isCardInZone(card, compHand);
check = getFlying();
return check != null && AllZone.GameAction.isCardInZone(card, compHand);
}
@Override
public void chooseTargetAI() {
if(AllZone.HumanPlayer.getLife() <= damage) {
setTargetPlayer(AllZone.HumanPlayer);
return;
}
Card c = getFlying();
if((c == null) || (!check.equals(c))) {
c = getAnyCreature();
if (c == null) {
setTargetPlayer(AllZone.HumanPlayer);
return;
}
}
setTargetCard(c);
}//chooseTargetAI()
//uses "damage" variable
Card getFlying() {
CardList flying = CardFactoryUtil.AI_getHumanCreature("Flying", card, true);
for(int i = 0; i < flying.size(); i++)
if(flying.get(i).getNetDefense() <= damage) return flying.get(i);
return null;
}
Card getAnyCreature() {
CardList creatures = CardFactoryUtil.AI_getHumanCreature(card, true);
for(int i = 0; i < creatures.size(); i++)
if(creatures.get(i).getNetDefense() <= damage) return creatures.get(i);
return null;
}
@Override
public void resolve() {
if(getTargetCard() != null) {
if(AllZone.GameAction.isCardInPlay(getTargetCard())
&& CardFactoryUtil.canTarget(card, getTargetCard())) {
Card c = getTargetCard();
c.addDamage(damage, card);
}
} else getTargetPlayer().addDamage(damage, card);
}
};//SpellAbility
final SpellAbility flashback = new Spell(card) {
private static final long serialVersionUID = -4811352682106571233L;
int damage = 2;
Card check;
@Override
public boolean canPlay() {
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController());
return AllZone.GameAction.isCardInZone(card, grave)
&& Phase.canCastSorcery(card.getController());
}
@Override
public boolean canPlayAI() {
if(AllZone.HumanPlayer.getLife() <= damage) return true;
check = getFlying();
return check != null;
}
@Override
public void chooseTargetAI() {
if(AllZone.HumanPlayer.getLife() <= damage) {
setTargetPlayer(AllZone.HumanPlayer);
return;
}
Card c = getFlying();
if((c == null) || (!check.equals(c))) throw new RuntimeException(card
+ " error in chooseTargetAI() - Card c is " + c + ", Card check is " + check);
setTargetCard(c);
}//chooseTargetAI()
//uses "damage" variable
Card getFlying() {
CardList flying = CardFactoryUtil.AI_getHumanCreature("Flying", card, true);
for(int i = 0; i < flying.size(); i++)
if(flying.get(i).getNetDefense() <= damage) return flying.get(i);
return null;
}
@Override
public void resolve() {
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController());
PlayerZone removed = AllZone.getZone(Constant.Zone.Exile, card.getController());
if(getTargetCard() != null) {
if(AllZone.GameAction.isCardInPlay(getTargetCard())
&& CardFactoryUtil.canTarget(card, getTargetCard())) {
Card c = getTargetCard();
c.addDamage(damage, card);
}
} else getTargetPlayer().addDamage(damage, card);
grave.remove(card);
removed.add(card);
}
};//flashback
flashback.setFlashBackAbility(true);
flashback.setManaCost("4 R");
flashback.setBeforePayMana(CardFactoryUtil.input_targetCreaturePlayer(flashback, true, false));
flashback.setDescription("Flashback: 4 R");
card.clearSpellAbility();
card.addSpellAbility(spell);
card.addSpellAbility(flashback);
spell.setBeforePayMana(CardFactoryUtil.input_targetCreaturePlayer(spell, true, false));
card.setFlashback(true);
card.setSVar("PlayMain1", "TRUE");
}//*************** END ************ END **************************
/*
//*************** START *********** START **************************
else if (cardName.equals("Morbid Hunger")) {
final SpellAbility spell = new Spell(card) {
private static final long serialVersionUID = -5460524956297956293L;
int damage = 3;
Card check;
@Override
public boolean canPlayAI() {
PlayerZone compHand = AllZone.getZone(Constant.Zone.Hand, AllZone.ComputerPlayer);
CardList hand = new CardList(compHand.getCards());
if (AllZone.HumanPlayer.getLife() <= damage) return AllZone.GameAction.isCardInZone(card, compHand);
if (hand.size() >= 8) return true && AllZone.GameAction.isCardInZone(card, compHand);
check = getFlying();
return check != null && AllZone.GameAction.isCardInZone(card, compHand);
}
@Override
public void chooseTargetAI() {
if (AllZone.HumanPlayer.getLife() <= damage) {
setTargetPlayer(AllZone.HumanPlayer);
return;
}
Card c = getFlying();
if ((c == null) || (!check.equals(c))) {
c = getAnyCreature();
if (c == null) {
setTargetPlayer(AllZone.HumanPlayer);
return;
}
}
setTargetCard(c);
}//chooseTargetAI()
//uses "damage" variable
Card getFlying() {
CardList flying = CardFactoryUtil.AI_getHumanCreature("Flying", card, true);
for (int i = 0; i < flying.size(); i++)
if (flying.get(i).getNetDefense() <= damage) return flying.get(i);
return null;
}
Card getAnyCreature() {
CardList creatures = CardFactoryUtil.AI_getHumanCreature(card, true);
for (int i = 0; i < creatures.size(); i++)
if (creatures.get(i).getNetDefense() <= damage) return creatures.get(i);
return null;
}
@Override
public void resolve() {
if (getTargetCard() != null) {
if (AllZone.GameAction.isCardInPlay(getTargetCard())
&& CardFactoryUtil.canTarget(card, getTargetCard())) {
Card c = getTargetCard();
c.addDamage(damage, card);
card.getController().gainLife(3, card);
}
} else {
getTargetPlayer().addDamage(damage, card);
card.getController().gainLife(3, card);
}
}
};//SpellAbility
final SpellAbility flashback = new Spell(card) {
private static final long serialVersionUID = 4193073989624300707L;
int damage = 3;
Card check;
@Override
public boolean canPlay() {
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController());
return AllZone.GameAction.isCardInZone(card, grave)
&& Phase.canCastSorcery(card.getController());
}
@Override
public boolean canPlayAI() {
if (AllZone.HumanPlayer.getLife() <= damage) return true;
check = getFlying();
return check != null;
}
@Override
public void chooseTargetAI() {
if (AllZone.HumanPlayer.getLife() <= damage) {
setTargetPlayer(AllZone.HumanPlayer);
return;
}
Card c = getFlying();
if ((c == null) || (!check.equals(c))) throw new RuntimeException(card
+ " error in chooseTargetAI() - Card c is " + c + ", Card check is " + check);
setTargetCard(c);
}//chooseTargetAI()
//uses "damage" variable
Card getFlying() {
CardList flying = CardFactoryUtil.AI_getHumanCreature("Flying", card, true);
for (int i = 0; i < flying.size(); i++)
if (flying.get(i).getNetDefense() <= damage) return flying.get(i);
return null;
}
@Override
public void resolve() {
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController());
PlayerZone removed = AllZone.getZone(Constant.Zone.Exile, card.getController());
if (getTargetCard() != null) {
if (AllZone.GameAction.isCardInPlay(getTargetCard())
&& CardFactoryUtil.canTarget(card, getTargetCard())) {
Card c = getTargetCard();
c.addDamage(damage, card);
card.getController().gainLife(3, card);
}
} else {
getTargetPlayer().addDamage(damage, card);
card.getController().gainLife(3, card);
}
grave.remove(card);
removed.add(card);
}
};//flashback
flashback.setFlashBackAbility(true);
flashback.setManaCost("7 B B");
flashback.setBeforePayMana(CardFactoryUtil.input_targetCreaturePlayer(flashback, true, false));
flashback.setDescription("Flashback: 7 B B");
card.clearSpellAbility();
card.addSpellAbility(spell);
card.addSpellAbility(flashback);
spell.setBeforePayMana(CardFactoryUtil.input_targetCreaturePlayer(spell, true, false));
card.setFlashback(true);
card.setSVar("PlayMain1", "TRUE");
}//*************** END ************ END **************************
*/
//*************** START *********** START ************************** //*************** START *********** START **************************
else if(cardName.equals("Erratic Explosion")) { else if(cardName.equals("Erratic Explosion")) {
final SpellAbility spell = new Spell(card) { final SpellAbility spell = new Spell(card) {
@@ -3439,122 +3133,6 @@ public class CardFactory_Sorceries {
}//*************** END ************ END ************************** }//*************** END ************ END **************************
//*************** START *********** START **************************
else if(cardName.equals("Tinker")) {
final SpellAbility spell = new Spell(card) {
private static final long serialVersionUID = -5878957726445248334L;
@Override
public boolean canPlay() {
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController());
CardList list = new CardList(play.getCards());
list = list.getType("Artifact");
return list.size() > 0;
}
@Override
public boolean canPlayAI() {
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, AllZone.ComputerPlayer);
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, AllZone.ComputerPlayer);
CardList playList = new CardList(play.getCards());
playList = playList.filter(new CardListFilter() {
public boolean addCard(Card c) {
return c.isArtifact() && CardUtil.getConvertedManaCost(c.getManaCost()) <= 2;
}
});
CardList libList = new CardList(lib.getCards());
libList = libList.filter(new CardListFilter() {
public boolean addCard(Card c) {
return c.isArtifact() && CardUtil.getConvertedManaCost(c.getManaCost()) > 5;
}
});
if(libList.size() > 0 && playList.size() > 0) {
playList.shuffle();
setTargetCard(playList.get(0));
return true;
}
return false;
}
@Override
public void resolve() {
Card c = getTargetCard();
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController());
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, card.getController());
if(AllZone.GameAction.isCardInPlay(c)) {
AllZone.GameAction.sacrifice(c);
if(card.getController().equals(AllZone.ComputerPlayer)) {
CardList list = new CardList(lib.getCards());
list = list.filter(new CardListFilter() {
public boolean addCard(Card c) {
return c.isArtifact() && CardUtil.getConvertedManaCost(c.getManaCost()) > 5;
}
});
if(list.size() > 0) {
Card crd = CardFactoryUtil.AI_getBestArtifact(list);
lib.remove(crd);
play.add(crd);
AllZone.ComputerPlayer.shuffle();
}
} else //human
{
CardList list = new CardList(lib.getCards());
list = list.filter(new CardListFilter() {
public boolean addCard(Card c) {
return c.isArtifact();
}
});
if(list.size() > 0) {
Object o = GuiUtils.getChoiceOptional("Select artifact", list.toArray());
if(o != null) {
Card crd = (Card) o;
lib.remove(crd);
play.add(crd);
}
AllZone.HumanPlayer.shuffle();
}
}
}//if isCardInPlay
}
};
Input runtime = new Input() {
private static final long serialVersionUID = -4653972223582155502L;
@Override
public void showMessage() {
CardList choice = new CardList();
choice.addAll(AllZone.Human_Battlefield.getCards());
choice = choice.getType("Artifact");
boolean free = false;
if(this.isFree()) free = true;
stopSetNext(CardFactoryUtil.input_targetSpecific(spell, choice,
"Select artifact to sacrifice.", false, free));
}
};
spell.setBeforePayMana(runtime);
card.clearSpellAbility();
card.addSpellAbility(spell);
}//*************** END ************ END **************************
//*************** START *********** START ************************** //*************** START *********** START **************************
else if(cardName.equals("Stitch in Time")) { else if(cardName.equals("Stitch in Time")) {
final SpellAbility spell = new Spell(card) { final SpellAbility spell = new Spell(card) {
@@ -3588,17 +3166,9 @@ public class CardFactory_Sorceries {
public void resolve() { public void resolve() {
Player player = getTargetPlayer(); Player player = getTargetPlayer();
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player); int max = AllZoneUtil.getPlayerCardsInLibrary(player).size() / 2;
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, player);
CardList libList = new CardList(lib.getCards());
int max = libList.size() / 2; player.mill(max);
for(int i = 0; i < max; i++) {
Card c = libList.get(i);
lib.remove(c);
grave.add(c);
}
} }
};//SpellAbility };//SpellAbility
@@ -5239,69 +4809,6 @@ public class CardFactory_Sorceries {
}//*************** END ************ END ************************** }//*************** END ************ END **************************
//*************** START *********** START **************************
else if (cardName.equals("Oust")) {
/*
* Put target creature into its owner's library second from the
* top. Its controller gains 3 life.
*/
final SpellAbility spell = new Spell(card){
private static final long serialVersionUID = 4305992990847699048L;
@Override
public void resolve() {
if (AllZone.GameAction.isCardInPlay(getTargetCard())
&& CardFactoryUtil.canTarget(card, getTargetCard())) {
Card tgt = getTargetCard();
if (null != tgt) {
if (tgt.isToken()) {
AllZone.GameAction.exile(tgt);
} else {
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, tgt.getOwner());
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, tgt.getController());
play.remove(tgt);
if (lib.size() > 0) {
lib.add(tgt, 1); //add second from top if lib not empty
} else {
lib.add(tgt); //add to top if lib is empty
}
}//else
tgt.getController().gainLife(3, card);
}
}//if isCardInPlay() && canTarget()
}//resolve()
@Override
public boolean canPlayAI() {
return getHumanCreatures().size() != 0;
}//canPlayAI()
@Override
public void chooseTargetAI() {
Card best = CardFactoryUtil.AI_getBestCreature(getHumanCreatures());
setTargetCard(best);
}//chooseTargetAI()
CardList getHumanCreatures() {
CardList list = new CardList(AllZone.Human_Battlefield.getCards());
list = list.filter(new CardListFilter() {
public boolean addCard(Card c) {
return c.isCreature()
&& c.getNetAttack() > 2
&& CardFactoryUtil.canTarget(card, c);
}
});
return list;
}//getHumanCreature()
};//SpellAbility
spell.setBeforePayMana(CardFactoryUtil.input_targetCreature(spell));
card.clearSpellAbility();
card.addSpellAbility(spell);
}//*************** END ************ END **************************
//*************** START *********** START ************************** //*************** START *********** START **************************
else if(cardName.equals("Fireball")) { else if(cardName.equals("Fireball")) {
/* /*

View File

@@ -248,7 +248,7 @@ public class GameAction {
// todo is this copy necessary? // todo is this copy necessary?
c = AllZone.CardFactory.copyCard(c); c = AllZone.CardFactory.copyCard(c);
if (libPosition == -1) if (libPosition == -1 || libPosition > library.getCards().length)
libPosition = library.getCards().length; libPosition = library.getCards().length;
library.add(c, libPosition); library.add(c, libPosition);