- Converted Fact or Fiction to script.

- Added Sphinx of Uthuun.
This commit is contained in:
Sloth
2012-02-16 15:05:21 +00:00
parent 7838e58e61
commit f0504c8934
6 changed files with 107 additions and 15 deletions

1
.gitattributes vendored
View File

@@ -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_lost_truths.txt svneol=native#text/plain
res/cardsfolder/s/sphinx_of_magosi.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_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_sovereign.txt svneol=native#text/plain
res/cardsfolder/s/sphinx_summoner.txt svneol=native#text/plain res/cardsfolder/s/sphinx_summoner.txt svneol=native#text/plain
res/cardsfolder/s/sphinxs_herald.txt -text res/cardsfolder/s/sphinxs_herald.txt -text

View File

@@ -1,7 +1,11 @@
Name:Fact or Fiction Name:Fact or Fiction
ManaCost:3 U ManaCost:3 U
Types:Instant 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:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/fact_or_fiction.jpg 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 SetInfo:INV|Uncommon|http://magiccards.info/scans/en/in/57.jpg

View File

@@ -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

View File

@@ -816,9 +816,15 @@ public final class AbilityFactoryChangeZone {
} }
} }
int changeNum = params.containsKey("ChangeNum") ? AbilityFactory.calculateAmount(card,
params.get("ChangeNum"), sa) : 1;
CardList fetchList; CardList fetchList;
if (defined) { if (defined) {
fetchList = new CardList(AbilityFactory.getDefinedCards(card, params.get("Defined"), sa)); 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)) { } else if (!origin.contains(Zone.Library) && !origin.contains(Zone.Hand)) {
fetchList = AllZoneUtil.getCardsIn(origin); fetchList = AllZoneUtil.getCardsIn(origin);
} else { } else {
@@ -844,9 +850,6 @@ public final class AbilityFactoryChangeZone {
final PlayerZone destZone = player.getZone(destination); 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 remember = params.get("RememberChanged");
final String imprint = params.get("Imprint"); final String imprint = params.get("Imprint");
@@ -865,7 +868,7 @@ public final class AbilityFactoryChangeZone {
} else if (params.containsKey("Mandatory")) { } else if (params.containsKey("Mandatory")) {
o = GuiUtils.getChoice("Select a card", fetchList.toArray()); o = GuiUtils.getChoice("Select a card", fetchList.toArray());
} else if (params.containsKey("Defined")) { } else if (params.containsKey("Defined")) {
o = fetchList.get(i); o = fetchList.get(0);
} else { } else {
o = GuiUtils.getChoiceOptional("Select a card", fetchList.toArray()); o = GuiUtils.getChoiceOptional("Select a card", fetchList.toArray());
} }
@@ -985,9 +988,15 @@ public final class AbilityFactoryChangeZone {
type = "Card"; type = "Card";
} }
int changeNum = params.containsKey("ChangeNum") ? AbilityFactory.calculateAmount(card,
params.get("ChangeNum"), sa) : 1;
CardList fetchList; CardList fetchList;
if (defined) { if (defined) {
fetchList = new CardList(AbilityFactory.getDefinedCards(card, params.get("Defined"), sa)); 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)) { } else if (!origin.contains(Zone.Library) && !origin.contains(Zone.Hand)) {
fetchList = AllZoneUtil.getCardsIn(origin); fetchList = AllZoneUtil.getCardsIn(origin);
fetchList = AbilityFactory.filterListByType(fetchList, type, sa); fetchList = AbilityFactory.filterListByType(fetchList, type, sa);
@@ -1002,15 +1011,13 @@ public final class AbilityFactoryChangeZone {
final CardList fetched = new CardList(); 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 remember = params.get("RememberChanged");
final String imprint = params.get("Imprint"); final String imprint = params.get("Imprint");
if (params.containsKey("Unimprint")) { if (params.containsKey("Unimprint")) {
card.clearImprinted(); card.clearImprinted();
} }
System.out.println("change fetchList:" + fetchList);
for (int i = 0; i < changeNum; i++) { for (int i = 0; i < changeNum; i++) {
if ((fetchList.size() == 0) || (destination == null)) { if ((fetchList.size() == 0) || (destination == null)) {
@@ -1053,7 +1060,9 @@ public final class AbilityFactoryChangeZone {
} }
fetched.add(c); fetched.add(c);
fetchList.remove(c); if (!defined) {
fetchList.remove(c);
}
} }
if (origin.contains(Zone.Library) && !defined) { if (origin.contains(Zone.Library) && !defined) {

View File

@@ -26,6 +26,8 @@ import javax.swing.JOptionPane;
import forge.AllZone; import forge.AllZone;
import forge.Card; import forge.Card;
import forge.CardList; import forge.CardList;
import forge.CardUtil;
import forge.Constant;
import forge.Constant.Zone; import forge.Constant.Zone;
import forge.GameActionUtil; import forge.GameActionUtil;
import forge.Player; import forge.Player;
@@ -615,6 +617,12 @@ public final class AbilityFactoryClash {
private static void twoPilesResolve(final AbilityFactory af, final SpellAbility sa) { private static void twoPilesResolve(final AbilityFactory af, final SpellAbility sa) {
final HashMap<String, String> params = af.getMapParams(); final HashMap<String, String> params = af.getMapParams();
final Card card = af.getHostCard(); 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 = ""; String valid = "";
if (params.containsKey("ValidCards")) { if (params.containsKey("ValidCards")) {
@@ -644,8 +652,14 @@ public final class AbilityFactoryClash {
if ((tgt == null) || p.canBeTargetedBy(sa)) { if ((tgt == null) || p.canBeTargetedBy(sa)) {
final ArrayList<Card> pile1 = new ArrayList<Card>(); final ArrayList<Card> pile1 = new ArrayList<Card>();
final ArrayList<Card> pile2 = new ArrayList<Card>(); final ArrayList<Card> pile2 = new ArrayList<Card>();
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); pool = pool.getValidCards(valid, card.getController(), card);
int size = pool.size();
// first, separate the cards into piles // first, separate the cards into piles
if (separator.isHuman()) { if (separator.isHuman()) {
@@ -657,12 +671,36 @@ public final class AbilityFactoryClash {
for (final Card c : pool) { for (final Card c : pool) {
pile2.add(c); pile2.add(c);
} }
} else { } else if (size > 0) {
// TODO - not implemented //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 1:" + pile1);
System.out.println("Pile 2:" + pile2); System.out.println("Pile 2:" + pile2);
card.clearRemembered();
// then, the chooser picks a pile // then, the chooser picks a pile
if (chooser.isHuman()) { if (chooser.isHuman()) {
@@ -693,6 +731,7 @@ public final class AbilityFactoryClash {
for (final Card z : pile2) { for (final Card z : pile2) {
card.addRemembered(z); card.addRemembered(z);
} }
pile1WasChosen = false;
} }
} }
@@ -715,6 +754,7 @@ public final class AbilityFactoryClash {
for (final Card c : pile2) { for (final Card c : pile2) {
card.addRemembered(c); card.addRemembered(c);
} }
pile1WasChosen = false;
} }
} }
@@ -727,6 +767,27 @@ public final class AbilityFactoryClash {
AbilityFactory.resolve(action, false); 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 } // end twoPiles resolve

View File

@@ -65,7 +65,7 @@ public class CardFactoryInstants {
public static Card getCard(final Card card, final String cardName) { public static Card getCard(final Card card, final String cardName) {
// *************** START *********** START ************************** // *************** START *********** START **************************
if (cardName.equals("Fact or Fiction")) { /*if (cardName.equals("Fact or Fiction")) {
final SpellAbility spell = new Spell(card) { final SpellAbility spell = new Spell(card) {
private static final long serialVersionUID = 1481112451519L; private static final long serialVersionUID = 1481112451519L;
@@ -227,10 +227,10 @@ public class CardFactoryInstants {
}; // SpellAbility }; // SpellAbility
card.addSpellAbility(spell); card.addSpellAbility(spell);
} // *************** END ************ END ************************** }*/ // *************** END ************ END **************************
//*************** START *********** START ************************** //*************** 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. * Return all artifacts target player owns to his or her hand.
*/ */