From 4e57d64659481ff31ab75be345c8406a29bd7a89 Mon Sep 17 00:00:00 2001 From: swordshine Date: Thu, 4 Apr 2013 10:31:03 +0000 Subject: [PATCH] - Converted Nebuchadnezzar and Brilliant Ultimatum --- res/cardsfolder/b/brilliant_ultimatum.txt | 8 +- res/cardsfolder/n/nebuchadnezzar.txt | 5 +- .../cardfactory/CardFactoryCreatures.java | 79 -------- .../cardfactory/CardFactorySorceries.java | 187 +----------------- 4 files changed, 12 insertions(+), 267 deletions(-) diff --git a/res/cardsfolder/b/brilliant_ultimatum.txt b/res/cardsfolder/b/brilliant_ultimatum.txt index ca4db3d50fa..da052cd2587 100644 --- a/res/cardsfolder/b/brilliant_ultimatum.txt +++ b/res/cardsfolder/b/brilliant_ultimatum.txt @@ -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 \ No newline at end of file diff --git a/res/cardsfolder/n/nebuchadnezzar.txt b/res/cardsfolder/n/nebuchadnezzar.txt index ab711332369..d5a64f06c47 100644 --- a/res/cardsfolder/n/nebuchadnezzar.txt +++ b/res/cardsfolder/n/nebuchadnezzar.txt @@ -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 diff --git a/src/main/java/forge/card/cardfactory/CardFactoryCreatures.java b/src/main/java/forge/card/cardfactory/CardFactoryCreatures.java index 86158d76789..99a31805572 100644 --- a/src/main/java/forge/card/cardfactory/CardFactoryCreatures.java +++ b/src/main/java/forge/card/cardfactory/CardFactoryCreatures.java @@ -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 hand = new ArrayList(this.getTargetPlayer().getCardsIn(ZoneType.Hand)); - int numCards = card.getXManaCostPaid(); - numCards = Math.min(hand.size(), numCards); - - final List revealed = new ArrayList(); - 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); } // *************************************************** diff --git a/src/main/java/forge/card/cardfactory/CardFactorySorceries.java b/src/main/java/forge/card/cardfactory/CardFactorySorceries.java index c7d2539eba0..e50a7545de9 100644 --- a/src/main/java/forge/card/cardfactory/CardFactorySorceries.java +++ b/src/main/java/forge/card/cardfactory/CardFactorySorceries.java @@ -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 lib = card.getController().getCardsIn(ZoneType.Library); - final List cards = new ArrayList(); - final List exiled = new ArrayList(); - 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 pile1 = new ArrayList(); - final List pile2 = new ArrayList(); - 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 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 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 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 cards = getActivatingPlayer().getCardsIn(ZoneType.Library); - return cards.size() >= 8; - } - }; // SpellAbility - - } - private static final void balanceLands(Spell card) { List> lands = new ArrayList>(); @@ -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)); }