mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
- Converted Fact or Fiction to script.
- Added Sphinx of Uthuun.
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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<String, String> 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<Card> pile1 = 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);
|
||||
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
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user