- Converted Explosive Revelation to script.

This commit is contained in:
jeffwadsworth
2012-01-18 17:43:33 +00:00
parent b92445adda
commit acf6d32f47
2 changed files with 6 additions and 125 deletions

View File

@@ -1,7 +1,11 @@
Name:Explosive Revelation
ManaCost:3 R R
Types:Sorcery
Text:Choose target creature or player. Reveal cards from the top of your library until you reveal a nonland card. Explosive Revelation deals damage equal to that card's converted mana cost to that creature or player. Put the nonland card into your hand and the rest on the bottom of your library in any order.
Text:no text
A:SP$ DigUntil | Cost$ 3 R R | Valid$ Card.nonLand | ValidDescription$ nonland | FoundDestination$ Hand | RevealedDestination$ Library | RevealedLibraryPosition$ -1 | RememberFound$ True | SubAbility$ Damage | SpellDescription$ Choose target creature or player. Reveal cards from the top of your library until you reveal a nonland card. CARDNAME deals damage equal to that card's converted mana cost to that creature or player. Put the nonland card into your hand and the rest on the bottom of your library in any order.
SVar:Damage:DB$ DealDamage | ValidTgts$ Creature,Player | TgtPrompt$ Select target creature or player | NumDmg$ X | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:X:Remembered$CardManaCost
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/explosive_revelation.jpg
SetInfo:ROE|Uncommon|http://magiccards.info/scans/en/roe/143.jpg

View File

@@ -1473,129 +1473,6 @@ public class CardFactorySorceries {
card.setSVar("PlayMain1", "TRUE");
} // *************** END ************ END **************************
// *************** START *********** START **************************
else if (cardName.equals("Explosive Revelation")) {
/*
* Choose target creature or player. Reveal cards from the top of
* your library until you reveal a nonland card. Explosive
* Revelation deals damage equal to that card's converted mana cost
* to that creature or player. Put the nonland card into your hand
* and the rest on the bottom of your library in any order.
*/
final Cost cost = new Cost(card.getManaCost(), cardName, false);
final Target tgt = new Target(card, "CP");
final SpellAbility spell = new Spell(card, cost, tgt) {
private static final long serialVersionUID = -3234630801871872940L;
private final int damage = 3;
private Card check;
@Override
public boolean canPlayAI() {
if (AllZone.getHumanPlayer().getLife() <= this.damage) {
return true;
}
this.check = this.getFlying();
return this.check != null;
}
@Override
public void chooseTargetAI() {
if (AllZone.getHumanPlayer().getLife() <= this.damage) {
this.setTargetPlayer(AllZone.getHumanPlayer());
return;
}
final Card c = this.getFlying();
if ((c == null) || (!this.check.equals(c))) {
final StringBuilder sb = new StringBuilder();
sb.append(card).append(" error in chooseTargetAI() - Card c is ");
sb.append(c).append(", Card check is ").append(this.check);
throw new RuntimeException(sb.toString());
}
this.setTargetCard(c);
} // chooseTargetAI()
// uses "damage" variable
Card getFlying() {
final CardList flying = CardFactoryUtil.getHumanCreatureAI("Flying", this, true);
for (int i = 0; i < flying.size(); i++) {
if (flying.get(i).getNetDefense() <= this.damage) {
return flying.get(i);
}
}
return null;
}
@Override
public void resolve() {
final int damage = this.getDamage();
if (this.getTargetCard() != null) {
if (AllZoneUtil.isCardInPlay(this.getTargetCard())
&& this.getTargetCard().canBeTargetedBy(this)) {
final StringBuilder sb = new StringBuilder();
sb.append(cardName).append(" causes ").append(damage);
sb.append(" to ").append(this.getTargetCard());
javax.swing.JOptionPane.showMessageDialog(null, sb.toString());
final Card c = this.getTargetCard();
c.addDamage(damage, card);
}
} else {
final StringBuilder sb = new StringBuilder();
sb.append(cardName).append(" causes ").append(damage);
sb.append(" to ").append(this.getTargetPlayer());
javax.swing.JOptionPane.showMessageDialog(null, sb.toString());
this.getTargetPlayer().addDamage(damage, card);
}
// System.out.println("Library after: "+card.getController()).getCardsIn(Zone.Library);
}
int getDamage() {
/*
* Reveal cards from the top of your library until you
* reveal a nonland card.
*/
final CardList lib = card.getController().getCardsIn(Zone.Library);
final StringBuilder sb = new StringBuilder();
sb.append("Library before: ").append(lib);
Log.debug("Explosive Revelation", sb.toString());
final CardList revealed = new CardList();
if (lib.size() > 0) {
int index = 0;
Card top;
do {
top = lib.get(index);
// System.out.println("Got from top of library:"+top);
index += 1;
revealed.add(top);
} while ((index < lib.size()) && top.isLand());
// Display the revealed cards
GuiUtils.getChoice("Revealed cards:", revealed.toArray());
// non-land card into hand
AllZone.getGameAction().moveToHand(revealed.get(revealed.size() - 1));
// put the rest of the cards on the bottom of library
for (int j = 0; j < (revealed.size() - 1); j++) {
AllZone.getGameAction().moveToBottomOfLibrary(revealed.get(j));
}
// return the damage
// System.out.println("Explosive Revelation does "
// +CardUtil.getConvertedManaCost(top)+" from: "+top);
return CardUtil.getConvertedManaCost(top);
}
return 0;
}
}; // SpellAbility
card.addSpellAbility(spell);
} // *************** END ************ END **************************
// *************** START *********** START **************************
else if (cardName.equals("Fireball")) {