- Converted Nebuchadnezzar and Brilliant Ultimatum

This commit is contained in:
swordshine
2013-04-04 10:31:03 +00:00
parent 969ab15f53
commit 4e57d64659
4 changed files with 12 additions and 267 deletions

View File

@@ -1,7 +1,13 @@
Name:Brilliant Ultimatum
ManaCost:W W U U U B B
Types:Sorcery
Text:Exile the top five cards of your library. An opponent separates those cards into two piles. You may play any number of cards from one of those piles without paying their mana costs.
A:SP$ Mill | Cost$ W W U U U B B | Defined$ You | NumCards$ 5 | Destination$ Exile | RememberMilled$ True | SubAbility$ DBTwoPiles | SpellDescription$ Exile the top five cards of your library. An opponent separates those cards into two piles. You may play any number of cards from one of those piles without paying their mana costs.
SVar:DBTwoPiles:DB$ TwoPiles | Defined$ You | DefinedCards$ Remembered | Separator$ Opponent | ChosenPile$ DBPlay | SubAbility$ DBCleanup
SVar:DBPlay:DB$ RepeatEach | UseImprinted$ True | RepeatCards$ Card.IsRemembered | ChooseOrder$ True | Zone$ Exile | RepeatSubAbility$ DBPlayCard
SVar:DBPlayCard:DB$ Play | Defined$ Imprinted | Controller$ You | WithoutManaCost$ True | Optional$ True
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:Y:Count$InYourLibrary
SVar:NeedsToPlayVar:Y GE8
SVar:Picture:http://www.wizards.com/global/images/magic/general/brilliant_ultimatum.jpg
Oracle:Exile the top five cards of your library. An opponent separates those cards into two piles. You may play any number of cards from one of those piles without paying their mana costs.
SetInfo:ALA Rare

View File

@@ -2,7 +2,10 @@ Name:Nebuchadnezzar
ManaCost:3 U B
Types:Legendary Creature Human Wizard
PT:3/3
#This is necessary for cost payment, but not used.
A:AB$ NameCard | Cost$ X T | Defined$ You | SubAbility$ DBReveal | PlayerTurn$ True | SpellDescription$ Name a card. Target opponent reveals X cards at random from his or her hand. Then that player discards all cards with that name revealed this way. Activate this ability only during your turn.
SVar:DBReveal:DB$ Reveal | ValidTgts$ Opponent | Random$ True | NumCards$ X | References$ X | RememberRevealed$ True | SubAbility$ DBDiscard
SVar:DBDiscard:DB$ Discard | DefinedCards$ ValidHand Card.IsRemembered+NamedCard | Defined$ Targeted | Mode$ Defined | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:X:Count$xPaid
SVar:RemAIDeck:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/nebuchadnezzar.jpg

View File

@@ -528,83 +528,6 @@ public class CardFactoryCreatures {
card.addTrigger(myTrigger);
}
private static void getCard_Nebuchadnezzar(final Card card, final String cardName) {
/*
* X, T: Name a card. Target opponent reveals X cards at random from
* his or her hand. Then that player discards all cards with that
* name revealed this way. Activate this ability only during your
* turn.
*/
final Cost abCost = new Cost(card, "X T", true);
final Target target = new Target(card, "Select target opponent", "Opponent".split(","));
class NebuchadnezzarAbility extends AbilityActivated {
public NebuchadnezzarAbility(final Card ca, final Cost co, final Target t) {
super(ca, co, t);
}
@Override
public AbilityActivated getCopy() {
AbilityActivated discard = new NebuchadnezzarAbility(getSourceCard(),
getPayCosts(), new Target(getTarget()));
discard.getRestrictions().setPlayerTurn(true);
return discard;
}
private static final long serialVersionUID = 4839778470534392198L;
@Override
public void resolve() {
// name a card
final String choice = JOptionPane.showInputDialog(null, "Name a card", cardName,
JOptionPane.QUESTION_MESSAGE);
final List<Card> hand = new ArrayList<Card>(this.getTargetPlayer().getCardsIn(ZoneType.Hand));
int numCards = card.getXManaCostPaid();
numCards = Math.min(hand.size(), numCards);
final List<Card> revealed = new ArrayList<Card>();
for (int i = 0; i < numCards; i++) {
final Card random = Aggregates.random(hand);
revealed.add(random);
hand.remove(random);
}
if (!revealed.isEmpty()) {
GuiChoose.one("Revealed at random", revealed);
} else {
GuiChoose.one("Revealed at random", new String[] { "Nothing to reveal" });
}
for (final Card c : revealed) {
if (c.getName().equals(choice)) {
c.getController().discard(c, this);
}
}
}
@Override
public boolean canPlayAI() {
return false;
}
@Override
public String getDescription() {
final StringBuilder sbDesc = new StringBuilder();
sbDesc.append(abCost).append("Name a card. ");
sbDesc.append("Target opponent reveals X cards at random from his or her hand. ");
sbDesc.append("Then that player discards all cards with that name revealed this way. ");
sbDesc.append("Activate this ability only during your turn.");
return sbDesc.toString();
}
}
final AbilityActivated discard = new NebuchadnezzarAbility(card, abCost, target);
discard.getRestrictions().setPlayerTurn(true);
final StringBuilder sbStack = new StringBuilder();
sbStack.append(cardName).append(" - name a card.");
discard.setStackDescription(sbStack.toString());
card.addSpellAbility(discard);
}
// // This is a hardcoded card template
@@ -628,8 +551,6 @@ public class CardFactoryCreatures {
getCard_SurturedGhoul(card);
} else if (cardName.equals("Phyrexian Dreadnought")) {
getCard_PhyrexianDreadnought(card, cardName);
} else if (cardName.equals("Nebuchadnezzar")) {
getCard_Nebuchadnezzar(card, cardName);
}
// ***************************************************

View File

@@ -61,190 +61,6 @@ import forge.util.Aggregates;
*/
public class CardFactorySorceries {
private static final SpellAbility getBrilliantUltimatum(final Card card) {
return new Spell(card) {
private static final long serialVersionUID = 1481112451519L;
@Override
public void resolve() {
Card choice = null;
// check for no cards in hand on resolve
final List<Card> lib = card.getController().getCardsIn(ZoneType.Library);
final List<Card> cards = new ArrayList<Card>();
final List<Card> exiled = new ArrayList<Card>();
if (lib.size() == 0) {
JOptionPane.showMessageDialog(null, "No more cards in library.", "",
JOptionPane.INFORMATION_MESSAGE);
return;
}
int count = 5;
if (lib.size() < 5) {
count = lib.size();
}
for (int i = 0; i < count; i++) {
cards.add(lib.get(i));
}
for (int i = 0; i < count; i++) {
exiled.add(lib.get(i));
Singletons.getModel().getGame().getAction().exile(lib.get(i));
}
final List<Card> pile1 = new ArrayList<Card>();
final List<Card> pile2 = new ArrayList<Card>();
boolean stop = false;
int pile1CMC = 0;
int pile2CMC = 0;
final StringBuilder msg = new StringBuilder();
msg.append("Revealing top ").append(count).append(" cards of library: ");
GuiChoose.one(msg.toString(), cards);
// Human chooses
if (card.getController().isComputer()) {
for (int i = 0; i < count; i++) {
if (!stop) {
choice = GuiChoose.oneOrNone("Choose cards to put into the first pile: ",
cards);
if (choice != null) {
pile1.add(choice);
cards.remove(choice);
pile1CMC = pile1CMC + choice.getCMC();
} else {
stop = true;
}
}
}
for (int i = 0; i < count; i++) {
if (!pile1.contains(exiled.get(i))) {
pile2.add(exiled.get(i));
pile2CMC = pile2CMC + exiled.get(i).getCMC();
}
}
final StringBuilder sb = new StringBuilder();
sb.append("You have spilt the cards into the following piles");
sb.append("\r\n").append("\r\n");
sb.append("Pile 1: ").append("\r\n");
for (int i = 0; i < pile1.size(); i++) {
sb.append(pile1.get(i).getName()).append("\r\n");
}
sb.append("\r\n").append("Pile 2: ").append("\r\n");
for (int i = 0; i < pile2.size(); i++) {
sb.append(pile2.get(i).getName()).append("\r\n");
}
JOptionPane.showMessageDialog(null, sb, "", JOptionPane.INFORMATION_MESSAGE);
if (pile1CMC >= pile2CMC) {
JOptionPane.showMessageDialog(null, "Computer chooses the Pile 1", "",
JOptionPane.INFORMATION_MESSAGE);
for (int i = 0; i < pile1.size(); i++) {
final List<SpellAbility> choices = pile1.get(i).getBasicSpells();
for (final SpellAbility sa : choices) {
if (sa.canPlayAI()) {
ComputerUtil.playStackFree(sa.getActivatingPlayer(), sa);
if (pile1.get(i).isPermanent()) {
exiled.remove(pile1.get(i));
}
break;
}
}
}
} else {
JOptionPane.showMessageDialog(null, "Computer chooses the Pile 2", "",
JOptionPane.INFORMATION_MESSAGE);
for (int i = 0; i < pile2.size(); i++) {
final List<SpellAbility> choices = pile2.get(i).getBasicSpells();
for (final SpellAbility sa : choices) {
if (sa.canPlayAI()) {
ComputerUtil.playStackFree(sa.getActivatingPlayer(), sa);
if (pile2.get(i).isPermanent()) {
exiled.remove(pile2.get(i));
}
break;
}
}
}
}
} else { // Computer chooses (It picks the highest converted
// mana cost card and 1 random card.)
Card biggest = exiled.get(0);
for (final Card c : exiled) {
if (biggest.getManaCost().getCMC() < c.getManaCost().getCMC()) {
biggest = c;
}
}
pile1.add(biggest);
cards.remove(biggest);
if (cards.size() > 2) {
final Card random = Aggregates.random(cards);
pile1.add(random);
}
for (int i = 0; i < count; i++) {
if (!pile1.contains(exiled.get(i))) {
pile2.add(exiled.get(i));
}
}
final StringBuilder sb = new StringBuilder();
sb.append("Choose a pile to add to your hand: ");
sb.append("\r\n").append("\r\n");
sb.append("Pile 1: ").append("\r\n");
for (int i = 0; i < pile1.size(); i++) {
sb.append(pile1.get(i).getName()).append("\r\n");
}
sb.append("\r\n").append("Pile 2: ").append("\r\n");
for (int i = 0; i < pile2.size(); i++) {
sb.append(pile2.get(i).getName()).append("\r\n");
}
final Object[] possibleValues = { "Pile 1", "Pile 2" };
final Object q = JOptionPane.showOptionDialog(null, sb, "Brilliant Ultimatum",
JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, possibleValues,
possibleValues[0]);
List<Card> chosen;
if (q.equals(0)) {
chosen = pile1;
} else {
chosen = pile2;
}
final int numChosen = chosen.size();
for (int i = 0; i < numChosen; i++) {
final Card check = GuiChoose.oneOrNone("Select spells to play in reverse order: ", chosen);
if (check == null) {
break;
}
final Card playing = check;
if (playing.isLand()) {
if (card.getController().canPlayLand(playing)) {
card.getController().playLand(playing);
} else {
JOptionPane.showMessageDialog(null, "You can't play any more lands this turn.", "",
JOptionPane.INFORMATION_MESSAGE);
}
} else {
((HumanPlayer)card.getController()).playCardWithoutManaCost(playing);
}
chosen.remove(playing);
}
}
pile1.clear();
pile2.clear();
} // resolve()
@Override
public boolean canPlayAI() {
final List<Card> cards = getActivatingPlayer().getCardsIn(ZoneType.Library);
return cards.size() >= 8;
}
}; // SpellAbility
}
private static final void balanceLands(Spell card) {
List<List<Card>> lands = new ArrayList<List<Card>>();
@@ -506,8 +322,7 @@ public class CardFactorySorceries {
public static void buildCard(final Card card, final String cardName) {
if (cardName.equals("Brilliant Ultimatum")) { card.addSpellAbility(getBrilliantUltimatum(card));
} else if (cardName.equals("Balance")) { card.addSpellAbility(getBalance(card));
if (cardName.equals("Balance")) { card.addSpellAbility(getBalance(card));
} else if (cardName.equals("Patriarch's Bidding")) { card.addSpellAbility(getPatriarchsBidding(card));
} else if (cardName.equals("Transmute Artifact")) { card.addSpellAbility(getTransmuteArtifact(card));
}