mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
convert Incendiary Command to script
This commit is contained in:
@@ -1,7 +1,19 @@
|
|||||||
Name:Incendiary Command
|
Name:Incendiary Command
|
||||||
ManaCost:3 R R
|
ManaCost:3 R R
|
||||||
Types:Sorcery
|
Types:Sorcery
|
||||||
Text:Choose two - Incendiary Command deals 4 damage to target player; or Incendiary Command deals 2 damage to each creature; or destroy target nonbasic land; or each player discards all cards in his or her hand, then draws that many cards.
|
Text:no text
|
||||||
|
A:SP$ Charm | Cost$ 3 R R | Choices$ DBDamageP,DBDamageC,DBDestroy,DBDiscard | CharmNum$ 2 | SpellDescription$ Choose two - CARDNAME deals 4 damage to target player; or CARDNAME deals 2 damage to each creature; or destroy target nonbasic land; or each player discards all the cards in his or her hand, then draws that many cards.
|
||||||
|
SVar:DBDamageP:DB$ DealDamage | Tgt$ TgtP | NumDmg$ 4 | SpellDescription$ CARDNAME deals 4 damage to target player.
|
||||||
|
SVar:DBDamageC:DB$ DamageAll | ValidCards$ Creature | NumDmg$ 2 | SpellDescription$ CARDNAME deals 2 damage to each creature.
|
||||||
|
SVar:DBDestroy:DB$ Destroy | ValidTgts$ Land.nonBasic | TgtPrompt$ Select target nonbasic land | SpellDescription$ Destroy target nonbasic land.
|
||||||
|
SVar:DBDiscard:DB$ Discard | Defined$ You | RememberDiscarded$ True | Mode$ Hand | SubAbility$ YouDraw | SpellDescription$ Each player discards all the cards in his or her hand, then draws that many cards.
|
||||||
|
SVar:YouDraw:DB$ Draw | Defined$ You | NumCards$ X | SubAbility$ YourCleanup
|
||||||
|
SVar:YourCleanup:DB$ Cleanup | ClearRemembered$ True | SubAbility$ OppDiscard
|
||||||
|
SVar:OppDiscard:DB$ Discard | Defined$ Opponent | RememberDiscarded$ True | Mode$ Hand | SubAbility$ OppDraw
|
||||||
|
SVar:OppDraw:DB$ Draw | Defined$ Opponent | NumCards$ Y | SubAbility$ OppCleanup
|
||||||
|
SVar:OppCleanup:DB$ Cleanup | ClearRemembered$ True
|
||||||
|
SVar:X:Remembered$Amount
|
||||||
|
SVar:Y:Remembered$Amount
|
||||||
SVar:RemAIDeck:True
|
SVar:RemAIDeck:True
|
||||||
SVar:Rarity:Rare
|
SVar:Rarity:Rare
|
||||||
SVar:Picture:http://resources.wizards.com/magic/cards/lrw/en/card141830.jpg
|
SVar:Picture:http://resources.wizards.com/magic/cards/lrw/en/card141830.jpg
|
||||||
|
|||||||
@@ -809,247 +809,6 @@ public class CardFactory_Sorceries {
|
|||||||
}// *************** END ************ END **************************
|
}// *************** END ************ END **************************
|
||||||
|
|
||||||
|
|
||||||
//*************** START *********** START **************************
|
|
||||||
else if (cardName.equals("Incendiary Command")) {
|
|
||||||
//not sure what to call variables, so I just made up something
|
|
||||||
final Player[] m_player = new Player[1];
|
|
||||||
final Card[] m_land = new Card[1];
|
|
||||||
|
|
||||||
final ArrayList<String> userChoice = new ArrayList<String>();
|
|
||||||
|
|
||||||
final String[] cardChoice = {
|
|
||||||
"Incendiary Command deals 4 damage to target player",
|
|
||||||
"Incendiary Command deals 2 damage to each creature", "Destroy target nonbasic land",
|
|
||||||
"Each player discards all cards in his or her hand, then draws that many cards"};
|
|
||||||
|
|
||||||
final SpellAbility spell = new Spell(card) {
|
|
||||||
private static final long serialVersionUID = 9178547049760990376L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void resolve() {
|
|
||||||
//System.out.println(userChoice);
|
|
||||||
//System.out.println(m_land[0]);
|
|
||||||
//System.out.println(m_player[0]);
|
|
||||||
|
|
||||||
//"Incendiary Command deals 4 damage to target player",
|
|
||||||
for (int i = 0; i < card.getChoices().size(); i++) {
|
|
||||||
if (card.getChoice(i).equals(cardChoice[0])) {
|
|
||||||
if (card.getChoiceTarget(0).equals(AllZone.getHumanPlayer().getName())) {
|
|
||||||
setTargetPlayer(AllZone.getHumanPlayer());
|
|
||||||
} else {
|
|
||||||
setTargetPlayer(AllZone.getComputerPlayer());
|
|
||||||
}
|
|
||||||
getTargetPlayer().addDamage(4, card);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//"Incendiary Command deals 2 damage to each creature",
|
|
||||||
if (userChoice.contains(cardChoice[1]) || card.getChoices().contains(cardChoice[1])) {
|
|
||||||
CardList list = AllZoneUtil.getCreaturesInPlay();
|
|
||||||
|
|
||||||
for (int i = 0; i < list.size(); i++) {
|
|
||||||
list.get(i).addDamage(2, card);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//"Destroy target nonbasic land",
|
|
||||||
for (int i = 0; i < card.getChoices().size(); i++) {
|
|
||||||
if (card.getChoice(i).equals(cardChoice[2])) {
|
|
||||||
CardList all = AllZoneUtil.getCardsIn(Zone.Battlefield);
|
|
||||||
for (int i2 = 0; i2 < all.size(); i2++) {
|
|
||||||
if (String.valueOf(all.get(i2).getUniqueNumber()).equals(card.getChoiceTarget(card.getChoices().size() - 1))) {
|
|
||||||
setTargetCard(all.get(i2));
|
|
||||||
AllZone.getGameAction().destroy(getTargetCard());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//"Each player discards all cards in his or her hand, then draws that many cards"
|
|
||||||
if (userChoice.contains(cardChoice[3]) || card.getChoices().contains(cardChoice[3])) {
|
|
||||||
discardDraw(AllZone.getComputerPlayer());
|
|
||||||
discardDraw(AllZone.getHumanPlayer());
|
|
||||||
}
|
|
||||||
}//resolve()
|
|
||||||
|
|
||||||
void discardDraw(Player player) {
|
|
||||||
CardList hand = player.getCardsIn(Zone.Hand);
|
|
||||||
int n = hand.size();
|
|
||||||
|
|
||||||
//technically should let the user discard one card at a time
|
|
||||||
//in case graveyard order matters
|
|
||||||
player.discard(n, this, true);
|
|
||||||
|
|
||||||
player.drawCards(n);
|
|
||||||
}
|
|
||||||
|
|
||||||
@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("deals 4 damage to " + m_player[0]);
|
|
||||||
|
|
||||||
if (userChoice.contains(cardChoice[1]) || card.getChoices().contains(cardChoice[1]))
|
|
||||||
a.add("deals 2 damage to each creature");
|
|
||||||
|
|
||||||
if (userChoice.contains(cardChoice[2]) || card.getChoices().contains(cardChoice[2]))
|
|
||||||
a.add("destroy " + m_land[0]);
|
|
||||||
|
|
||||||
if (userChoice.contains(cardChoice[3]) || card.getChoices().contains(cardChoice[3]))
|
|
||||||
a.add("each player discards all cards in his or her hand, then draws that many cards");
|
|
||||||
|
|
||||||
String s = a.get(0) + ", " + a.get(1);
|
|
||||||
spell.setStackDescription(card.getName() + " - " + s);
|
|
||||||
}
|
|
||||||
};//Command
|
|
||||||
|
|
||||||
|
|
||||||
final Input targetLand = new Input() {
|
|
||||||
private static final long serialVersionUID = 1485276539154359495L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void showMessage() {
|
|
||||||
AllZone.getDisplay().showMessage("Select target nonbasic land");
|
|
||||||
ButtonUtil.enableOnlyCancel();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void selectButtonCancel() {
|
|
||||||
stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void selectCard(Card c, PlayerZone zone) {
|
|
||||||
if (c.isLand()
|
|
||||||
&& zone.is(Constant.Zone.Battlefield)
|
|
||||||
&& !c.isBasicLand()) {
|
|
||||||
if (card.isCopiedSpell()) card.getChoiceTargets().remove(0);
|
|
||||||
m_land[0] = c;
|
|
||||||
spell.setTargetCard(c);
|
|
||||||
card.setSpellChoiceTarget(String.valueOf(c.getUniqueNumber()));
|
|
||||||
setStackDescription.execute();
|
|
||||||
stopSetNext(new Input_PayManaCost(spell));
|
|
||||||
}//if
|
|
||||||
}//selectCard()
|
|
||||||
};//Input targetLand
|
|
||||||
|
|
||||||
final Input targetPlayer = new Input() {
|
|
||||||
private static final long serialVersionUID = -2636869617248434242L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void showMessage() {
|
|
||||||
AllZone.getDisplay().showMessage("Select target player");
|
|
||||||
ButtonUtil.enableOnlyCancel();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void selectButtonCancel() {
|
|
||||||
stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void selectPlayer(Player player) {
|
|
||||||
if (card.isCopiedSpell()) card.getChoiceTargets().remove(0);
|
|
||||||
m_player[0] = player;
|
|
||||||
spell.setTargetPlayer(player);
|
|
||||||
card.setSpellChoiceTarget(player.toString());
|
|
||||||
setStackDescription.execute();
|
|
||||||
//if user needs to target nonbasic land
|
|
||||||
if (userChoice.contains(cardChoice[2]) || card.getChoices().contains(cardChoice[2]))
|
|
||||||
stopSetNext(targetLand);
|
|
||||||
else {
|
|
||||||
stopSetNext(new Input_PayManaCost(spell));
|
|
||||||
}
|
|
||||||
}//selectPlayer()
|
|
||||||
};//Input targetPlayer
|
|
||||||
|
|
||||||
|
|
||||||
Input chooseTwoInput = new Input() {
|
|
||||||
private static final long serialVersionUID = 5625588008756700226L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void showMessage() {
|
|
||||||
if (card.isCopiedSpell()) {
|
|
||||||
if (card.getChoices().contains(cardChoice[0])) stopSetNext(targetPlayer);
|
|
||||||
else if (card.getChoices().contains(cardChoice[2])) stopSetNext(targetLand);
|
|
||||||
else {
|
|
||||||
setStackDescription.execute();
|
|
||||||
|
|
||||||
stopSetNext(new Input_PayManaCost(spell));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//reset variables
|
|
||||||
m_player[0] = null;
|
|
||||||
m_land[0] = null;
|
|
||||||
card.getChoices().clear();
|
|
||||||
card.getChoiceTargets().clear();
|
|
||||||
userChoice.clear();
|
|
||||||
|
|
||||||
ArrayList<String> display = new ArrayList<String>();
|
|
||||||
|
|
||||||
//get all
|
|
||||||
CardList list = AllZoneUtil.getCardsIn(Zone.Battlefield);
|
|
||||||
|
|
||||||
CardList land = list.getType("Land");
|
|
||||||
CardList basicLand = list.getType("Basic");
|
|
||||||
|
|
||||||
display.add("Incendiary Command deals 4 damage to target player");
|
|
||||||
display.add("Incendiary Command deals 2 damage to each creature");
|
|
||||||
if (land.size() != basicLand.size()) display.add("Destroy target nonbasic land");
|
|
||||||
display.add("Each player discards all cards in his or her hand, then draws that many cards");
|
|
||||||
|
|
||||||
ArrayList<String> a = chooseTwo(display);
|
|
||||||
//everything stops here if user cancelled
|
|
||||||
if (a == null) {
|
|
||||||
stop();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
userChoice.addAll(a);
|
|
||||||
|
|
||||||
if (userChoice.contains(cardChoice[0])) stopSetNext(targetPlayer);
|
|
||||||
else if (userChoice.contains(cardChoice[2])) stopSetNext(targetLand);
|
|
||||||
else {
|
|
||||||
setStackDescription.execute();
|
|
||||||
|
|
||||||
stopSetNext(new Input_PayManaCost(spell));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}//showMessage()
|
|
||||||
|
|
||||||
ArrayList<String> chooseTwo(ArrayList<String> choices) {
|
|
||||||
ArrayList<String> out = new ArrayList<String>();
|
|
||||||
Object o = GuiUtils.getChoiceOptional("Choose Two", choices.toArray());
|
|
||||||
if (o == null) return null;
|
|
||||||
|
|
||||||
out.add((String) o);
|
|
||||||
card.addSpellChoice((String) o);
|
|
||||||
choices.remove(out.get(0));
|
|
||||||
o = GuiUtils.getChoiceOptional("Choose Two", choices.toArray());
|
|
||||||
if (o == null) return null;
|
|
||||||
|
|
||||||
out.add((String) o);
|
|
||||||
card.addSpellChoice((String) o);
|
|
||||||
return out;
|
|
||||||
}//chooseTwo()
|
|
||||||
};//Input chooseTwoInput
|
|
||||||
card.addSpellAbility(spell);
|
|
||||||
|
|
||||||
card.setSpellWithChoices(true);
|
|
||||||
spell.setBeforePayMana(chooseTwoInput);
|
|
||||||
}//*************** END ************ END **************************
|
|
||||||
|
|
||||||
|
|
||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
else if (cardName.equals("Parallel Evolution")) {
|
else if (cardName.equals("Parallel Evolution")) {
|
||||||
SpellAbility spell = new Spell(card) {
|
SpellAbility spell = new Spell(card) {
|
||||||
|
|||||||
Reference in New Issue
Block a user