diff --git a/.gitattributes b/.gitattributes index 86fca49a8d4..d0a4e7beea8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8294,6 +8294,7 @@ res/cardsfolder/s/sphinx_of_jwar_isle.txt svneol=native#text/plain res/cardsfolder/s/sphinx_of_lost_truths.txt svneol=native#text/plain res/cardsfolder/s/sphinx_of_magosi.txt svneol=native#text/plain res/cardsfolder/s/sphinx_of_the_steel_wind.txt svneol=native#text/plain +res/cardsfolder/s/sphinx_of_uthuun.txt -text res/cardsfolder/s/sphinx_sovereign.txt svneol=native#text/plain res/cardsfolder/s/sphinx_summoner.txt svneol=native#text/plain res/cardsfolder/s/sphinxs_herald.txt -text diff --git a/res/cardsfolder/f/fact_or_fiction.txt b/res/cardsfolder/f/fact_or_fiction.txt index f38029227d8..0687fc29e31 100644 --- a/res/cardsfolder/f/fact_or_fiction.txt +++ b/res/cardsfolder/f/fact_or_fiction.txt @@ -1,7 +1,11 @@ Name:Fact or Fiction ManaCost:3 U Types:Instant -Text: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. +Text:no text +A:SP$ Dig | Cost$ 3 U | DigNum$ 5 | Reveal$ True | RememberRevealed$ True | NoMove$ True | SubAbility$ DBTwoPiles | SpellDescription$ 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. +SVar:DBTwoPiles:DB$ TwoPiles | Defined$ You | DefinedCards$ Remembered | Separator$ Opponent | ChosenPile$ DBHand | ChosenPile$ DBHand | UnchosenPile$ DBGrave +SVar:DBHand:DB$ ChangeZone | Defined$ Remembered | Origin$ Library | Destination$ Hand +SVar:DBGrave:DB$ ChangeZone | Defined$ Remembered | Origin$ Library | Destination$ Graveyard SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/fact_or_fiction.jpg SetInfo:INV|Uncommon|http://magiccards.info/scans/en/in/57.jpg diff --git a/res/cardsfolder/s/sphinx_of_uthuun.txt b/res/cardsfolder/s/sphinx_of_uthuun.txt new file mode 100644 index 00000000000..de7a4d593d1 --- /dev/null +++ b/res/cardsfolder/s/sphinx_of_uthuun.txt @@ -0,0 +1,17 @@ +Name:Sphinx of Uthuun +ManaCost:5 U U +Types:Creature Sphinx +Text:no text +PT:5/5 +K:Flying +T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigChangeZone | TriggerDescription$ When CARDNAME enters the battlefield, 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. +SVar:TrigChangeZone:AB$Dig | Cost$ 0 | DigNum$ 5 | Reveal$ True | RememberRevealed$ True | NoMove$ True | SubAbility$ DBTwoPiles | SpellDescription$ 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. +SVar:DBTwoPiles:DB$ TwoPiles | Defined$ You | DefinedCards$ Remembered | Separator$ Opponent | ChosenPile$ DBHand | ChosenPile$ DBHand | UnchosenPile$ DBGrave +SVar:DBHand:DB$ ChangeZone | Defined$ Remembered | Origin$ Library | Destination$ Hand +SVar:DBGrave:DB$ ChangeZone | Defined$ Remembered | Origin$ Library | Destination$ Graveyard | SubAbility$ DBCleanup +SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True +SVar:Rarity:Rare +SVar:Picture:http://www.wizards.com/global/images/magic/general/sphinx_of_uthuun.jpg +SetInfo:M12|Rare|http://magiccards.info/scans/en/m12/76.jpg +Oracle:Flying\nWhen Sphinx of Uthuun enters the battlefield, 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. +End \ No newline at end of file diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryChangeZone.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryChangeZone.java index 38d1fd78ad6..338f0525490 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryChangeZone.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryChangeZone.java @@ -816,9 +816,15 @@ public final class AbilityFactoryChangeZone { } } + int changeNum = params.containsKey("ChangeNum") ? AbilityFactory.calculateAmount(card, + params.get("ChangeNum"), sa) : 1; + CardList fetchList; if (defined) { fetchList = new CardList(AbilityFactory.getDefinedCards(card, params.get("Defined"), sa)); + if (!params.containsKey("ChangeNum")) { + changeNum = fetchList.size(); + } } else if (!origin.contains(Zone.Library) && !origin.contains(Zone.Hand)) { fetchList = AllZoneUtil.getCardsIn(origin); } else { @@ -844,9 +850,6 @@ public final class AbilityFactoryChangeZone { final PlayerZone destZone = player.getZone(destination); - final int changeNum = params.containsKey("ChangeNum") ? AbilityFactory.calculateAmount(card, - params.get("ChangeNum"), sa) : 1; - final String remember = params.get("RememberChanged"); final String imprint = params.get("Imprint"); @@ -865,7 +868,7 @@ public final class AbilityFactoryChangeZone { } else if (params.containsKey("Mandatory")) { o = GuiUtils.getChoice("Select a card", fetchList.toArray()); } else if (params.containsKey("Defined")) { - o = fetchList.get(i); + o = fetchList.get(0); } else { o = GuiUtils.getChoiceOptional("Select a card", fetchList.toArray()); } @@ -985,9 +988,15 @@ public final class AbilityFactoryChangeZone { type = "Card"; } + int changeNum = params.containsKey("ChangeNum") ? AbilityFactory.calculateAmount(card, + params.get("ChangeNum"), sa) : 1; + CardList fetchList; if (defined) { fetchList = new CardList(AbilityFactory.getDefinedCards(card, params.get("Defined"), sa)); + if (!params.containsKey("ChangeNum")) { + changeNum = fetchList.size(); + } } else if (!origin.contains(Zone.Library) && !origin.contains(Zone.Hand)) { fetchList = AllZoneUtil.getCardsIn(origin); fetchList = AbilityFactory.filterListByType(fetchList, type, sa); @@ -1002,15 +1011,13 @@ public final class AbilityFactoryChangeZone { final CardList fetched = new CardList(); - final int changeNum = params.containsKey("ChangeNum") ? AbilityFactory.calculateAmount(card, - params.get("ChangeNum"), sa) : 1; - final String remember = params.get("RememberChanged"); final String imprint = params.get("Imprint"); if (params.containsKey("Unimprint")) { card.clearImprinted(); } + System.out.println("change fetchList:" + fetchList); for (int i = 0; i < changeNum; i++) { if ((fetchList.size() == 0) || (destination == null)) { @@ -1053,7 +1060,9 @@ public final class AbilityFactoryChangeZone { } fetched.add(c); - fetchList.remove(c); + if (!defined) { + fetchList.remove(c); + } } if (origin.contains(Zone.Library) && !defined) { diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryClash.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryClash.java index ca253c583d8..bf33bf36253 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryClash.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryClash.java @@ -26,6 +26,8 @@ import javax.swing.JOptionPane; import forge.AllZone; import forge.Card; import forge.CardList; +import forge.CardUtil; +import forge.Constant; import forge.Constant.Zone; import forge.GameActionUtil; import forge.Player; @@ -615,6 +617,12 @@ public final class AbilityFactoryClash { private static void twoPilesResolve(final AbilityFactory af, final SpellAbility sa) { final HashMap params = af.getMapParams(); final Card card = af.getHostCard(); + Constant.Zone zone = null; + boolean pile1WasChosen = true; + + if (params.containsKey("Origin")) { + zone = Constant.Zone.smartValueOf(params.get("Zone")); + } String valid = ""; if (params.containsKey("ValidCards")) { @@ -644,8 +652,14 @@ public final class AbilityFactoryClash { if ((tgt == null) || p.canBeTargetedBy(sa)) { final ArrayList pile1 = new ArrayList(); final ArrayList pile2 = new ArrayList(); - CardList pool = p.getCardsIn(Zone.Battlefield); + CardList pool = new CardList(); + if (params.containsKey("DefinedCards")) { + pool = new CardList(AbilityFactory.getDefinedCards(sa.getSourceCard(), params.get("DefinedCards"), sa)); + } else { + pool = p.getCardsIn(zone); + } pool = pool.getValidCards(valid, card.getController(), card); + int size = pool.size(); // first, separate the cards into piles if (separator.isHuman()) { @@ -657,12 +671,36 @@ public final class AbilityFactoryClash { for (final Card c : pool) { pile2.add(c); } - } else { - // TODO - not implemented + } else if (size > 0) { + //computer separates + Card biggest = null; + Card smallest = null; + biggest = pool.get(0); + smallest = pool.get(0); + + for (Card c : pool) { + if (c.getCMC() >= biggest.getCMC()) { + biggest = c; + } + if (c.getCMC() <= smallest.getCMC()) { + smallest = c; + } + } + pile1.add(biggest); + + if (size > 3) { + pile1.add(smallest); + } + for (Card c : pool) { + if (!pile1.contains(c)) { + pile2.add(c); + } + } } System.out.println("Pile 1:" + pile1); System.out.println("Pile 2:" + pile2); + card.clearRemembered(); // then, the chooser picks a pile if (chooser.isHuman()) { @@ -693,6 +731,7 @@ public final class AbilityFactoryClash { for (final Card z : pile2) { card.addRemembered(z); } + pile1WasChosen = false; } } @@ -715,6 +754,7 @@ public final class AbilityFactoryClash { for (final Card c : pile2) { card.addRemembered(c); } + pile1WasChosen = false; } } @@ -727,6 +767,27 @@ public final class AbilityFactoryClash { AbilityFactory.resolve(action, false); } + + // take action on the chosen pile + if (params.containsKey("UnchosenPile")) { + //switch the remembered cards + card.clearRemembered(); + if (pile1WasChosen) { + for (final Card c : pile2) { + card.addRemembered(c); + } + } else { + for (final Card c : pile1) { + card.addRemembered(c); + } + } + final AbilityFactory afPile = new AbilityFactory(); + final SpellAbility action = afPile.getAbility(card.getSVar(params.get("UnchosenPile")), card); + action.setActivatingPlayer(sa.getActivatingPlayer()); + ((AbilitySub) action).setParent(sa); + + AbilityFactory.resolve(action, false); + } } } } // end twoPiles resolve diff --git a/src/main/java/forge/card/cardfactory/CardFactoryInstants.java b/src/main/java/forge/card/cardfactory/CardFactoryInstants.java index 0792843a5e4..dc32d8d9bd5 100644 --- a/src/main/java/forge/card/cardfactory/CardFactoryInstants.java +++ b/src/main/java/forge/card/cardfactory/CardFactoryInstants.java @@ -65,7 +65,7 @@ public class CardFactoryInstants { public static Card getCard(final Card card, final String cardName) { // *************** START *********** START ************************** - if (cardName.equals("Fact or Fiction")) { + /*if (cardName.equals("Fact or Fiction")) { final SpellAbility spell = new Spell(card) { private static final long serialVersionUID = 1481112451519L; @@ -227,10 +227,10 @@ public class CardFactoryInstants { }; // SpellAbility card.addSpellAbility(spell); - } // *************** END ************ END ************************** + }*/ // *************** END ************ END ************************** //*************** START *********** START ************************** - else if (cardName.equals("Hurkyl's Recall")) { + if (cardName.equals("Hurkyl's Recall")) { /* * Return all artifacts target player owns to his or her hand. */