mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
- Add changes to allow for a one of the two piles to be facedown
- Add Fortune's Favor
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -6363,6 +6363,7 @@ forge-gui/res/cardsfolder/f/fortitude.txt svneol=native#text/plain
|
|||||||
forge-gui/res/cardsfolder/f/fortress_crab.txt -text
|
forge-gui/res/cardsfolder/f/fortress_crab.txt -text
|
||||||
forge-gui/res/cardsfolder/f/fortress_cyclops.txt -text
|
forge-gui/res/cardsfolder/f/fortress_cyclops.txt -text
|
||||||
forge-gui/res/cardsfolder/f/fortune_thief.txt svneol=native#text/plain
|
forge-gui/res/cardsfolder/f/fortune_thief.txt svneol=native#text/plain
|
||||||
|
forge-gui/res/cardsfolder/f/fortunes_favor.txt -text
|
||||||
forge-gui/res/cardsfolder/f/fossil_find.txt -text
|
forge-gui/res/cardsfolder/f/fossil_find.txt -text
|
||||||
forge-gui/res/cardsfolder/f/foster.txt -text
|
forge-gui/res/cardsfolder/f/foster.txt -text
|
||||||
forge-gui/res/cardsfolder/f/foul_emissary.txt -text svneol=unset#text/plain
|
forge-gui/res/cardsfolder/f/foul_emissary.txt -text svneol=unset#text/plain
|
||||||
|
|||||||
@@ -741,11 +741,14 @@ public class PlayerControllerAi extends PlayerController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean chooseCardsPile(SpellAbility sa, CardCollectionView pile1, CardCollectionView pile2, boolean faceUp) {
|
public boolean chooseCardsPile(SpellAbility sa, CardCollectionView pile1, CardCollectionView pile2, String faceUp) {
|
||||||
if (!faceUp) {
|
if (faceUp.equals("True")) {
|
||||||
// AI will choose the first pile if it is larger or the same
|
// AI will choose the first pile if it is larger or the same
|
||||||
// TODO Improve this to be slightly more random to not be so predictable
|
// TODO Improve this to be slightly more random to not be so predictable
|
||||||
return pile1.size() >= pile2.size();
|
return pile1.size() >= pile2.size();
|
||||||
|
} else if (faceUp.equals("One")) {
|
||||||
|
// Probably want to see if the face up pile has anything "worth it", then potentially take face down pile
|
||||||
|
return pile1.size() >= pile2.size();
|
||||||
} else {
|
} else {
|
||||||
boolean allCreatures = Iterables.all(Iterables.concat(pile1, pile2), CardPredicates.Presets.CREATURES);
|
boolean allCreatures = Iterables.all(Iterables.concat(pile1, pile2), CardPredicates.Presets.CREATURES);
|
||||||
int cmc1 = allCreatures ? ComputerUtilCard.evaluateCreatureList(pile1) : ComputerUtilCard.evaluatePermanentList(pile1);
|
int cmc1 = allCreatures ? ComputerUtilCard.evaluateCreatureList(pile1) : ComputerUtilCard.evaluatePermanentList(pile1);
|
||||||
|
|||||||
@@ -54,9 +54,4 @@ public class TwoPilesAi extends SpellAbilityAi {
|
|||||||
int size = pool.size();
|
int size = pool.size();
|
||||||
return size > 2;
|
return size > 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean doTriggerAINoCost(Player aiPlayer, SpellAbility sa, boolean mandatory) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -268,11 +268,7 @@ public class PumpEffect extends SpellAbilityEffect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sa.hasParam("RememberObjects")) {
|
if (sa.hasParam("RememberObjects")) {
|
||||||
pumpRemembered = sa.getParam("RememberObjects");
|
for (final Object o : AbilityUtils.getDefinedObjects(host, sa.getParam("RememberObjects"), sa)) {
|
||||||
}
|
|
||||||
|
|
||||||
if (pumpRemembered != null) {
|
|
||||||
for (final Object o : AbilityUtils.getDefinedObjects(host, pumpRemembered, sa)) {
|
|
||||||
host.addRemembered(o);
|
host.addRemembered(o);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,16 +89,21 @@ public class TwoPilesEffect extends SpellAbilityEffect {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String title = "One".equals(sa.getParamOrDefault("FaceDown", "False")) ? "Select cards for a face down pile" :
|
||||||
|
"Divide cards into two piles";
|
||||||
|
|
||||||
|
card.clearRemembered();
|
||||||
|
|
||||||
// first, separate the cards into piles
|
// first, separate the cards into piles
|
||||||
final CardCollectionView pile1 = separator.getController().chooseCardsForEffect(pool, sa, "Divide cards into two piles", 0, size, false);
|
final CardCollectionView pile1 = separator.getController().chooseCardsForEffect(pool, sa, title, 0, size, false);
|
||||||
final CardCollection pile2 = new CardCollection(pool);
|
final CardCollection pile2 = new CardCollection(pool);
|
||||||
pile2.removeAll(pile1);
|
pile2.removeAll(pile1);
|
||||||
|
|
||||||
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();
|
|
||||||
|
|
||||||
pile1WasChosen = chooser.getController().chooseCardsPile(sa, pile1, pile2, !sa.hasParam("FaceDown"));
|
|
||||||
|
pile1WasChosen = chooser.getController().chooseCardsPile(sa, pile1, pile2, sa.getParamOrDefault("FaceDown", "False"));
|
||||||
CardCollectionView chosenPile = pile1WasChosen ? pile1 : pile2;
|
CardCollectionView chosenPile = pile1WasChosen ? pile1 : pile2;
|
||||||
CardCollectionView unchosenPile = !pile1WasChosen ? pile1 : pile2;
|
CardCollectionView unchosenPile = !pile1WasChosen ? pile1 : pile2;
|
||||||
|
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ public abstract class PlayerController {
|
|||||||
|
|
||||||
public abstract boolean playSaFromPlayEffect(SpellAbility tgtSA);
|
public abstract boolean playSaFromPlayEffect(SpellAbility tgtSA);
|
||||||
public abstract Map<GameEntity, CounterType> chooseProliferation();
|
public abstract Map<GameEntity, CounterType> chooseProliferation();
|
||||||
public abstract boolean chooseCardsPile(SpellAbility sa, CardCollectionView pile1, CardCollectionView pile2, boolean faceUp);
|
public abstract boolean chooseCardsPile(SpellAbility sa, CardCollectionView pile1, CardCollectionView pile2, String faceUp);
|
||||||
|
|
||||||
public abstract void revealAnte(String message, Multimap<Player, PaperCard> removedAnteCards);
|
public abstract void revealAnte(String message, Multimap<Player, PaperCard> removedAnteCards);
|
||||||
|
|
||||||
|
|||||||
@@ -585,7 +585,7 @@ public class PlayerControllerForTests extends PlayerController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean chooseCardsPile(SpellAbility sa, CardCollectionView pile1, CardCollectionView pile2, boolean faceUp) {
|
public boolean chooseCardsPile(SpellAbility sa, CardCollectionView pile1, CardCollectionView pile2, String faceUp) {
|
||||||
return MyRandom.getRandom().nextBoolean();
|
return MyRandom.getRandom().nextBoolean();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
10
forge-gui/res/cardsfolder/f/fortunes_favor.txt
Normal file
10
forge-gui/res/cardsfolder/f/fortunes_favor.txt
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
Name:Fortune's Favor
|
||||||
|
ManaCost:3 U
|
||||||
|
Types:Instant
|
||||||
|
A:SP$ PeekAndReveal | Cost$ 3 U | Defined$ You | PeekAmount$ 4 | NoPeek$ True | NoReveal$ True | RememberPeeked$ True | SubAbility$ Separate | SpellDescription$ Target opponent looks at the top four cards of your library and separates them into a face-down pile and a face-up pile. Put one pile into your hand and the other into your graveyard.
|
||||||
|
SVar:Separate:DB$ TwoPiles | Defined$ You | Separator$ TargetedPlayer | Chooser$ You | ValidTgts$ Opponent | DefinedCards$ Remembered | ChosenPile$ DBHand | UnchosenPile$ DBGrave | Zone$ Library | FaceDown$ One | StackDescription$ None
|
||||||
|
SVar:DBHand:DB$ ChangeZone | Defined$ Remembered | Origin$ Library | Destination$ Hand | SubAbility$ DBCleanup
|
||||||
|
SVar:DBGrave:DB$ ChangeZone | Defined$ Remembered | Origin$ Library | Destination$ Graveyard | SubAbility$ DBCleanup
|
||||||
|
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
|
||||||
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/fortunes_favor.jpg
|
||||||
|
Oracle:Target opponent looks at the top four cards of your library and separates them into a face-down pile and a face-up pile. Put one pile into your hand and the other into your graveyard.
|
||||||
@@ -1289,25 +1289,33 @@ public class PlayerControllerHuman
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean chooseCardsPile(final SpellAbility sa, final CardCollectionView pile1, final CardCollectionView pile2, final boolean faceUp) {
|
public boolean chooseCardsPile(final SpellAbility sa, final CardCollectionView pile1, final CardCollectionView pile2, final String faceUp) {
|
||||||
if (!faceUp) {
|
final String p1Str = String.format("-- Pile 1 (%s cards) --", pile1.size());
|
||||||
final String p1Str = String.format("Pile 1 (%s cards)", pile1.size());
|
final String p2Str = String.format("-- Pile 2 (%s cards) --", pile2.size());
|
||||||
final String p2Str = String.format("Pile 2 (%s cards)", pile2.size());
|
|
||||||
|
/*
|
||||||
|
if (faceUp.equals("True")) {
|
||||||
final List<String> possibleValues = ImmutableList.of(p1Str , p2Str);
|
final List<String> possibleValues = ImmutableList.of(p1Str , p2Str);
|
||||||
return getGui().confirm(CardView.get(sa.getHostCard()), "Choose a Pile", possibleValues);
|
return getGui().confirm(CardView.get(sa.getHostCard()), "Choose a Pile", possibleValues);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
tempShowCards(pile1);
|
|
||||||
tempShowCards(pile2);
|
|
||||||
|
|
||||||
final List<CardView> cards = Lists.newArrayListWithCapacity(pile1.size() + pile2.size() + 2);
|
final List<CardView> cards = Lists.newArrayListWithCapacity(pile1.size() + pile2.size() + 2);
|
||||||
final CardView pileView1 = new CardView(Integer.MIN_VALUE, null, "--- Pile 1 ---");
|
final CardView pileView1 = new CardView(Integer.MIN_VALUE, null, p1Str);
|
||||||
cards.add(pileView1);
|
|
||||||
cards.addAll(CardView.getCollection(pile1));
|
|
||||||
|
|
||||||
final CardView pileView2 = new CardView(Integer.MIN_VALUE + 1, null, "--- Pile 2 ---");
|
cards.add(pileView1);
|
||||||
|
if (faceUp.equals("False")) {
|
||||||
|
tempShowCards(pile1);
|
||||||
|
cards.addAll(CardView.getCollection(pile1));
|
||||||
|
}
|
||||||
|
|
||||||
|
final CardView pileView2 = new CardView(Integer.MIN_VALUE + 1, null, p2Str);
|
||||||
cards.add(pileView2);
|
cards.add(pileView2);
|
||||||
cards.addAll(CardView.getCollection(pile2));
|
if (!faceUp.equals("True")) {
|
||||||
|
tempShowCards(pile2);
|
||||||
|
cards.addAll(CardView.getCollection(pile2));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// make sure Pile 1 or Pile 2 is clicked on
|
// make sure Pile 1 or Pile 2 is clicked on
|
||||||
boolean result;
|
boolean result;
|
||||||
|
|||||||
Reference in New Issue
Block a user