mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
add Cryptic Command (from Lorwyn)
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -1063,6 +1063,7 @@ res/cardsfolder/crypt_cobra.txt -text svneol=native#text/plain
|
|||||||
res/cardsfolder/crypt_creeper.txt -text svneol=native#text/plain
|
res/cardsfolder/crypt_creeper.txt -text svneol=native#text/plain
|
||||||
res/cardsfolder/crypt_of_agadeem.txt -text svneol=native#text/plain
|
res/cardsfolder/crypt_of_agadeem.txt -text svneol=native#text/plain
|
||||||
res/cardsfolder/crypt_ripper.txt -text svneol=native#text/plain
|
res/cardsfolder/crypt_ripper.txt -text svneol=native#text/plain
|
||||||
|
res/cardsfolder/cryptic_command.txt -text svneol=native#text/plain
|
||||||
res/cardsfolder/crystal_ball.txt -text svneol=native#text/plain
|
res/cardsfolder/crystal_ball.txt -text svneol=native#text/plain
|
||||||
res/cardsfolder/crystal_quarry.txt -text svneol=native#text/plain
|
res/cardsfolder/crystal_quarry.txt -text svneol=native#text/plain
|
||||||
res/cardsfolder/crystal_rod.txt -text svneol=native#text/plain
|
res/cardsfolder/crystal_rod.txt -text svneol=native#text/plain
|
||||||
|
|||||||
8
res/cardsfolder/cryptic_command.txt
Normal file
8
res/cardsfolder/cryptic_command.txt
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
Name:Cryptic Command
|
||||||
|
ManaCost:1 U U U
|
||||||
|
Types:Instant
|
||||||
|
Text:Choose two - Counter target spell; or return target permanent to its owner's hand; or tap all creatures your opponents control; or draw a card.
|
||||||
|
SVar:RemAIDeck:True
|
||||||
|
SVar:Rarity:Rare
|
||||||
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/cryptic_command.jpg
|
||||||
|
End
|
||||||
@@ -4155,6 +4155,181 @@ public class CardFactory_Instants {
|
|||||||
card.addSpellAbility(spell);
|
card.addSpellAbility(spell);
|
||||||
}//*************** END ************ END **************************
|
}//*************** END ************ END **************************
|
||||||
|
|
||||||
|
|
||||||
|
//*************** START *********** START **************************
|
||||||
|
else if(cardName.equals("Cryptic Command")) {
|
||||||
|
final SpellAbility[] m_spell = new SpellAbility[1];
|
||||||
|
final Card[] m_perm = new Card[1];
|
||||||
|
|
||||||
|
final ArrayList<String> userChoice = new ArrayList<String>();
|
||||||
|
|
||||||
|
final String[] cardChoice = {
|
||||||
|
"Counter target spell",
|
||||||
|
"Return target permanent to its owner's hand",
|
||||||
|
"Tap all creatures your opponents control",
|
||||||
|
"Draw a card"};
|
||||||
|
|
||||||
|
final SpellAbility spell = new Spell(card) {
|
||||||
|
private static final long serialVersionUID = 9178547049760990376L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resolve() {
|
||||||
|
|
||||||
|
//"Counter target spell",
|
||||||
|
for(int i = 0; i <card.getChoices().size(); i++) {
|
||||||
|
if(card.getChoice(i).equals(cardChoice[0])) {
|
||||||
|
if(AllZone.Stack.size() > 0) {
|
||||||
|
SpellAbility sa = AllZone.Stack.peek();
|
||||||
|
if(sa.isSpell()) {
|
||||||
|
AllZone.Stack.pop();
|
||||||
|
AllZone.GameAction.moveToGraveyard(sa.getSourceCard());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//"Return target Permanent to its owner's hand",
|
||||||
|
if(userChoice.contains(cardChoice[1]) || card.getChoices().contains(cardChoice[1])) {
|
||||||
|
if(AllZone.GameAction.isCardInPlay(getTargetCard()) && CardFactoryUtil.canTarget(card, getTargetCard())) {
|
||||||
|
AllZone.GameAction.moveToHand(getTargetCard());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//"Tap all creatures your opponents control",
|
||||||
|
for(int i = 0; i <card.getChoices().size(); i++) {
|
||||||
|
if(card.getChoice(i).equals(cardChoice[2])) {
|
||||||
|
CardList creatures = AllZoneUtil.getCreaturesInPlay(card.getController().getOpponent());
|
||||||
|
for(Card c:creatures) c.tap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//"Draw a card"
|
||||||
|
if(userChoice.contains(cardChoice[3]) || card.getChoices().contains(cardChoice[3])) {
|
||||||
|
card.getController().drawCard();
|
||||||
|
}
|
||||||
|
}//resolve()
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canPlayAI() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};//SpellAbility
|
||||||
|
|
||||||
|
final Command setStackDescription = new Command() {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -4833850318955216009L;
|
||||||
|
|
||||||
|
public void execute() {
|
||||||
|
ArrayList<String> a = new ArrayList<String>();
|
||||||
|
if(userChoice.contains(cardChoice[0]) || card.getChoices().contains(cardChoice[0])) a.add("counter target spell");
|
||||||
|
if(userChoice.contains(cardChoice[1]) || card.getChoices().contains(cardChoice[1])) a.add("return target permanent to its owner's hand");
|
||||||
|
if(userChoice.contains(cardChoice[2]) || card.getChoices().contains(cardChoice[2])) a.add("tap all creatures your opponents control");
|
||||||
|
if(userChoice.contains(cardChoice[3]) || card.getChoices().contains(cardChoice[3])) a.add(" Draw a card.");
|
||||||
|
|
||||||
|
String s = a.get(0) + ", " + a.get(1);
|
||||||
|
spell.setStackDescription(card.getName() + " - " + s);
|
||||||
|
}
|
||||||
|
};//Command
|
||||||
|
|
||||||
|
|
||||||
|
final Input returnTarget = new Input() {
|
||||||
|
private static final long serialVersionUID = 2736368243448655071L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showMessage() {
|
||||||
|
AllZone.Display.showMessage("Select target permanent");
|
||||||
|
ButtonUtil.enableOnlyCancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void selectButtonCancel() {
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void selectCard(Card c, PlayerZone zone) {
|
||||||
|
if(c.isPermanent() && zone.is(Constant.Zone.Battlefield) && CardFactoryUtil.canTarget(card, c)) {
|
||||||
|
if(card.isCopiedSpell()) card.getChoiceTargets().remove(0);
|
||||||
|
m_perm[0] = c;
|
||||||
|
spell.setTargetCard(c);
|
||||||
|
card.setSpellChoiceTarget(String.valueOf(c.getUniqueNumber()));
|
||||||
|
setStackDescription.execute();
|
||||||
|
stopSetNext(new Input_PayManaCost(spell));
|
||||||
|
}//if
|
||||||
|
}//selectCard()
|
||||||
|
};//Input targetLand
|
||||||
|
|
||||||
|
Input chooseTwoInput = new Input() {
|
||||||
|
private static final long serialVersionUID = -4200213000203960667L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showMessage() {
|
||||||
|
if(card.isCopiedSpell()) {
|
||||||
|
if(card.getChoices().contains(cardChoice[1])) stopSetNext(returnTarget);
|
||||||
|
else {
|
||||||
|
setStackDescription.execute();
|
||||||
|
|
||||||
|
stopSetNext(new Input_PayManaCost(spell));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//reset variables
|
||||||
|
m_spell[0] = null;
|
||||||
|
m_perm[0] = null;
|
||||||
|
card.getChoices().clear();
|
||||||
|
card.getChoiceTargets().clear();
|
||||||
|
userChoice.clear();
|
||||||
|
|
||||||
|
ArrayList<String> display = new ArrayList<String>();
|
||||||
|
|
||||||
|
//get all
|
||||||
|
CardList list = AllZoneUtil.getCardsInPlay();
|
||||||
|
|
||||||
|
if(AllZone.Stack.size() > 0) display.add("Counter target spell");
|
||||||
|
if(list.size() > 0) display.add("Return target permanent to its owner's hand");
|
||||||
|
display.add("Tap all creatures your opponents control");
|
||||||
|
display.add("Draw a card");
|
||||||
|
|
||||||
|
ArrayList<String> a = chooseTwo(display);
|
||||||
|
//everything stops here if user cancelled
|
||||||
|
if(a == null) {
|
||||||
|
stop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
userChoice.addAll(a);
|
||||||
|
|
||||||
|
if(userChoice.contains(cardChoice[1])) stopSetNext(returnTarget);
|
||||||
|
else {
|
||||||
|
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);
|
||||||
|
card.addSpellChoice((String) o);
|
||||||
|
choices.remove(out.get(0));
|
||||||
|
o = AllZone.Display.getChoiceOptional("Choose Two", choices.toArray());
|
||||||
|
if(o == null) return null;
|
||||||
|
|
||||||
|
out.add((String) o);
|
||||||
|
card.addSpellChoice((String) o);
|
||||||
|
return out;
|
||||||
|
}//chooseTwo()
|
||||||
|
};//Input chooseTwoInput
|
||||||
|
|
||||||
|
card.clearSpellAbility();
|
||||||
|
card.addSpellAbility(spell);
|
||||||
|
card.setSpellWithChoices(true);
|
||||||
|
spell.setBeforePayMana(chooseTwoInput);
|
||||||
|
}//*************** END ************ END **************************
|
||||||
|
|
||||||
return card;
|
return card;
|
||||||
}//getCard
|
}//getCard
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user