diff --git a/res/card-pictures.txt b/res/card-pictures.txt index 1f94b551cb7..0c5da282ec1 100644 --- a/res/card-pictures.txt +++ b/res/card-pictures.txt @@ -38,6 +38,7 @@ snow_covered_mountain.jpg http://www.wizards.com/global/images/magic/gene snow_covered_mountain1.jpg http://www.wizards.com/global/images/magic/general/snow_covered_mountain.jpg snow_covered_mountain2.jpg http://www.magickartenmarkt.de/img/cards/Ice_Age/snow_covered_mountain.jpg snow_covered_mountain3.jpg http://www.magickartenmarkt.de/img/cards/Ice_Age/snow_covered_mountain.jpg +fact_or_fiction.jpg http://www.wizards.com/global/images/magic/general/fact_or_fiction.jpg pestilence_demon.jpg http://www.wizards.com/global/images/magic/general/pestilence_demon.jpg bloodthrone_vampire.jpg http://www.wizards.com/global/images/magic/general/bloodthrone_vampire.jpg vampire_aristocrat.jpg http://www.wizards.com/global/images/magic/general/vampire_aristocrat.jpg diff --git a/res/cards.txt b/res/cards.txt index c8567d9ae8e..ac37303a56f 100644 --- a/res/cards.txt +++ b/res/cards.txt @@ -1,3 +1,8 @@ +Fact or Fiction +3 U +Instant +Reveal the top five cards of your library. An opponent separates those cards into two piles. Put one pile into your hand and the other into your graveyard. + Pestilence Demon 5 B B B Creature Demon diff --git a/src/forge/CardFactory.java b/src/forge/CardFactory.java index 00ddf27275a..37aefa90c9b 100644 --- a/src/forge/CardFactory.java +++ b/src/forge/CardFactory.java @@ -8188,6 +8188,123 @@ public class CardFactory implements NewConstants { card.addSpellAbility(spell); }//*************** END ************ END ************************** + //*************** START *********** START ************************** + else if(cardName.equals("Fact or Fiction")) { + final SpellAbility spell = new Spell(card) { + private static final long serialVersionUID = 1481112451519L; + + @Override + public void resolve() { + + Card choice = null; + + //check for no cards in hand on resolve + PlayerZone Library = AllZone.getZone(Constant.Zone.Library, card.getController()); + PlayerZone Hand = AllZone.getZone(Constant.Zone.Hand, card.getController()); + PlayerZone Grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController()); + CardList cards = new CardList(); + + if(Library.size() == 0) { + JOptionPane.showMessageDialog(null, "No more cards in library.", "", JOptionPane.INFORMATION_MESSAGE); + return; + } + int Count = 5; + if(Library.size() < 5) Count = Library.size(); + for(int i = 0; i < Count; i++) cards.add(Library.get(i)); + CardList Pile1 = new CardList(); + CardList Pile2 = new CardList(); + boolean stop = false; + int Pile1CMC = 0; + int Pile2CMC = 0; + + + AllZone.Display.getChoice("Revealing top " + Count + " cards of library: ", cards.toArray()); + //Human chooses + if(card.getController().equals(Constant.Player.Computer)) { + for(int i = 0; i < Count; i++) { + if(stop == false) { + choice = AllZone.Display.getChoiceOptional("Choose cards to put into the first pile: ", cards.toArray()); + if(choice != null) { + Pile1.add(choice); + cards.remove(choice); + Pile1CMC = Pile1CMC + CardUtil.getConvertedManaCost(choice); + } + else stop = true; + } + } + for(int i = 0; i < Count; i++) { + if(!Pile1.contains(Library.get(i))) { + Pile2.add(Library.get(i)); + Pile2CMC = Pile2CMC + CardUtil.getConvertedManaCost(Library.get(i)); + } + } + StringBuilder sb = new StringBuilder(); + sb.append("You have spilt the cards into the following piles" + "\r\n" + "\r\n"); + sb.append("Pile 1: " + "\r\n"); + for(int i = 0; i < Pile1.size(); i++) sb.append(Pile1.get(i).getName() + "\r\n"); + sb.append("\r\n" + "Pile 2: " + "\r\n"); + for(int i = 0; i < Pile2.size(); i++) sb.append(Pile2.get(i).getName() + "\r\n"); + JOptionPane.showMessageDialog(null, sb, "", JOptionPane.INFORMATION_MESSAGE); + if(Pile1CMC >= Pile2CMC) { + JOptionPane.showMessageDialog(null, "Computer adds the first pile to its hand and puts the second pile into the graveyard", "", JOptionPane.INFORMATION_MESSAGE); + for(int i = 0; i < Pile1.size(); i++) AllZone.GameAction.moveTo(Hand, Pile1.get(i)); + for(int i = 0; i < Pile2.size(); i++) AllZone.GameAction.moveTo(Grave, Pile2.get(i)); + } else { + JOptionPane.showMessageDialog(null, "Computer adds the second pile to its hand and puts the first pile into the graveyard", "", JOptionPane.INFORMATION_MESSAGE); + for(int i = 0; i < Pile2.size(); i++) AllZone.GameAction.moveTo(Hand, Pile2.get(i)); + for(int i = 0; i < Pile1.size(); i++) AllZone.GameAction.moveTo(Grave, Pile1.get(i)); + } + + } else//Computer chooses (It picks the highest converted mana cost card and 1 random card.) + { + Card biggest = null; + biggest = Library.get(0); + + for(int i = 0; i < Count; i++) { + if(CardUtil.getConvertedManaCost(biggest.getManaCost()) >= CardUtil.getConvertedManaCost(biggest.getManaCost())) { + biggest = cards.get(i); + } + } + Pile1.add(biggest); + cards.remove(biggest); + if(cards.size() > 0) { + Card Random = CardUtil.getRandom(cards.toArray()); + Pile1.add(Random); + } + for(int i = 0; i < Count; i++) if(!Pile1.contains(Library.get(i))) Pile2.add(Library.get(i)); + StringBuilder sb = new StringBuilder(); + sb.append("Choose a pile to add to your hand: " + "\r\n" + "\r\n"); + sb.append("Pile 1: " + "\r\n"); + for(int i = 0; i < Pile1.size(); i++) sb.append(Pile1.get(i).getName() + "\r\n"); + sb.append("\r\n" + "Pile 2: " + "\r\n"); + for(int i = 0; i < Pile2.size(); i++) sb.append(Pile2.get(i).getName() + "\r\n"); + Object[] possibleValues = {"Pile 1", "Pile 2"}; + Object q = JOptionPane.showOptionDialog(null, sb, "Fact or Fiction", + JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, + null, possibleValues, possibleValues[0]); + if(q.equals(0)) { + for(int i = 0; i < Pile1.size(); i++) AllZone.GameAction.moveTo(Hand, Pile1.get(i)); + for(int i = 0; i < Pile2.size(); i++) AllZone.GameAction.moveTo(Grave, Pile2.get(i)); + } else { + for(int i = 0; i < Pile2.size(); i++) AllZone.GameAction.moveTo(Hand, Pile2.get(i)); + for(int i = 0; i < Pile1.size(); i++) AllZone.GameAction.moveTo(Grave, Pile1.get(i)); + } + } + Pile1.clear(); + Pile2.clear(); + }//resolve() + + @Override + public boolean canPlayAI() { + PlayerZone Library = AllZone.getZone(Constant.Zone.Library, card.getController()); + CardList cards = new CardList(Library.getCards()); + return cards.size() >= 10; + } + };//SpellAbility + card.clearSpellAbility(); + card.addSpellAbility(spell); + }//*************** END ************ END ************************** + //*************** START *********** START ************************** else if(cardName.equals("Temporal Fissure")) { final SpellAbility spell = new Spell(card) {