add Austere Command (from Lorwyn)

This commit is contained in:
jendave
2011-08-06 15:18:06 +00:00
parent 23e8891839
commit c8d333381f
3 changed files with 134 additions and 0 deletions

1
.gitattributes vendored
View File

@@ -337,6 +337,7 @@ res/cardsfolder/auriok_salvagers.txt -text svneol=native#text/plain
res/cardsfolder/auriok_sunchaser.txt -text svneol=native#text/plain res/cardsfolder/auriok_sunchaser.txt -text svneol=native#text/plain
res/cardsfolder/auriok_transfixer.txt -text svneol=native#text/plain res/cardsfolder/auriok_transfixer.txt -text svneol=native#text/plain
res/cardsfolder/aurochs.txt -text svneol=native#text/plain res/cardsfolder/aurochs.txt -text svneol=native#text/plain
res/cardsfolder/austere_command.txt svneol=native#text/plain
res/cardsfolder/avalanche_riders.txt -text svneol=native#text/plain res/cardsfolder/avalanche_riders.txt -text svneol=native#text/plain
res/cardsfolder/avatar_of_fury.txt -text svneol=native#text/plain res/cardsfolder/avatar_of_fury.txt -text svneol=native#text/plain
res/cardsfolder/avatar_of_might.txt -text svneol=native#text/plain res/cardsfolder/avatar_of_might.txt -text svneol=native#text/plain

View File

@@ -0,0 +1,8 @@
Name:Austere Command
ManaCost:4 W W
Types:Sorcery
Text:Choose two - Destroy all artifacts; or destroy all enchantments; or destroy all creatures with converted mana cost 3 or less; or destroy all creatures with converted mana cost 4 or greater.
SVar:RemAIDeck:True
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/austere_command.jpg
End

View File

@@ -1,6 +1,7 @@
package forge; package forge;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Vector; import java.util.Vector;
@@ -6925,6 +6926,130 @@ public class CardFactory_Sorceries {
card.addSpellAbility(spell); card.addSpellAbility(spell);
}//*************** END ************ END ************************** }//*************** END ************ END **************************
//*************** START *********** START **************************
else if(cardName.equals("Austere Command")) {
final ArrayList<String> userChoice = new ArrayList<String>();
final String[] cardChoices = {
"Destroy all artifacts",
"Destroy all enchantments",
"Destroy all creatures with converted mana cost 3 or less",
"Destroy all creatures with converted mana cost 4 or more"
};
final SpellAbility spell = new Spell(card) {
private static final long serialVersionUID = -8501457363981482513L;
@Override
public void resolve() {
//"Destroy all artifacts",
if(userChoice.contains(cardChoices[0])) {
CardList cards = AllZoneUtil.getCardsInPlay().filter(AllZoneUtil.artifacts);
for(Card c:cards) AllZone.GameAction.destroy(c);
}
//"Destroy all enchantments",
if(userChoice.contains(cardChoices[1])) {
CardList cards = AllZoneUtil.getCardsInPlay().filter(AllZoneUtil.enchantments);
for(Card c:cards) AllZone.GameAction.destroy(c);
}
//"Destroy all creatures with converted mana cost 3 or less",
if(userChoice.contains(cardChoices[2])) {
CardList cards = AllZoneUtil.getCreaturesInPlay();
cards = cards.filter(new CardListFilter() {
public boolean addCard(Card c) {
return CardUtil.getConvertedManaCost(c) <= 3;
}
});
for(Card c:cards) AllZone.GameAction.destroy(c);
}
//"Destroy all creatures with converted mana cost 4 or more"};
if(userChoice.contains(cardChoices[3])) {
CardList cards = AllZoneUtil.getCreaturesInPlay();
cards = cards.filter(new CardListFilter() {
public boolean addCard(Card c) {
return CardUtil.getConvertedManaCost(c) >= 4;
}
});
for(Card c:cards) AllZone.GameAction.destroy(c);
}
}//resolve()
@Override
public boolean canPlayAI() {
return false;
}
};//SpellAbility
final Command setStackDescription = new Command() {
private static final long serialVersionUID = -635710110379729475L;
public void execute() {
ArrayList<String> a = new ArrayList<String>();
if(userChoice.contains(cardChoices[0])) a.add("destroy all artifacts");
if(userChoice.contains(cardChoices[1])) a.add("destroy all enchantments");
if(userChoice.contains(cardChoices[2])) a.add("destroy all creatures with CMC <= 3");
if(userChoice.contains(cardChoices[3])) a.add("destroy all creatures with CMC >= 4");
String s = a.get(0) + ", " + a.get(1);
spell.setStackDescription(card.getName() + " - " + s);
}
};//Command
Input chooseTwoInput = new Input() {
private static final long serialVersionUID = 2352497236500922820L;
@Override
public void showMessage() {
if(card.isCopiedSpell()) {
setStackDescription.execute();
stopSetNext(new Input_PayManaCost(spell));
}
else {
//reset variables
userChoice.clear();
ArrayList<String> display = new ArrayList<String>(Arrays.asList(cardChoices));
ArrayList<String> a = chooseTwo(display);
//everything stops here if user cancelled
if(a == null) {
stop();
return;
}
userChoice.addAll(a);
setStackDescription.execute();
stopSetNext(new Input_PayManaCost(spell));
}
}//showMessage()
ArrayList<String> chooseTwo(ArrayList<String> choices) {
ArrayList<String> out = new ArrayList<String>();
Object o = AllZone.Display.getChoiceOptional("Choose Two", choices.toArray());
if(o == null) return null;
out.add((String) o);
choices.remove(out.get(0));
o = AllZone.Display.getChoiceOptional("Choose Two", choices.toArray());
if(o == null) return null;
out.add((String) o);
return out;
}//chooseTwo()
};//Input chooseTwoInput
card.clearSpellAbility();
card.addSpellAbility(spell);
spell.setBeforePayMana(chooseTwoInput);
}//*************** END ************ END **************************
return card; return card;
}//getCard }//getCard