mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
- A somewhat more fine-grained and less spoiler-y option to order graveyards, now with three states (Never / With Relevant Cards / Always).
This commit is contained in:
@@ -101,8 +101,6 @@ public class Game {
|
||||
private final GameView view;
|
||||
private final Tracker tracker = new Tracker();
|
||||
|
||||
private Map<Player, Boolean> orderedGraveyardMap = new HashMap<>();
|
||||
|
||||
public Player getMonarch() {
|
||||
return monarch;
|
||||
}
|
||||
@@ -873,31 +871,17 @@ public class Game {
|
||||
//playerCache.clear();
|
||||
}
|
||||
|
||||
public boolean isGraveyardOrdered() {
|
||||
boolean ordered = false;
|
||||
for (Player p : getPlayers()) {
|
||||
ordered |= isGraveyardOrdered(p);
|
||||
}
|
||||
return ordered;
|
||||
}
|
||||
|
||||
// Does the player control any cards that care about the order of cards in the graveyard?
|
||||
public boolean isGraveyardOrdered(final Player p) {
|
||||
if (orderedGraveyardMap.containsKey(p)) {
|
||||
return orderedGraveyardMap.get(p);
|
||||
}
|
||||
for (Card c : p.getAllCards()) {
|
||||
if (c.hasSVar("NeedsOrderedGraveyard")) {
|
||||
orderedGraveyardMap.put(p, true);
|
||||
return true;
|
||||
}
|
||||
if (c.getStates().contains(CardStateName.OriginalText)) {
|
||||
} else if (c.getStates().contains(CardStateName.OriginalText)) {
|
||||
if (c.getState(CardStateName.OriginalText).hasSVar("NeedsOrderedGraveyard")) {
|
||||
orderedGraveyardMap.put(p, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
orderedGraveyardMap.put(p, false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -935,7 +935,7 @@ public class GameAction {
|
||||
setHoldCheckingStaticAbilities(true);
|
||||
|
||||
if (noRegCreats != null) {
|
||||
if (noRegCreats.size() > 1 && game.isGraveyardOrdered() && !orderedNoRegCreats) {
|
||||
if (noRegCreats.size() > 1 && !orderedNoRegCreats) {
|
||||
noRegCreats = (CardCollection) GameActionUtil.orderCardsByTheirOwners(game, noRegCreats, ZoneType.Graveyard);
|
||||
orderedNoRegCreats = true;
|
||||
}
|
||||
@@ -944,7 +944,7 @@ public class GameAction {
|
||||
}
|
||||
}
|
||||
if (desCreats != null) {
|
||||
if (desCreats.size() > 1 && game.isGraveyardOrdered() && !orderedDesCreats) {
|
||||
if (desCreats.size() > 1 && !orderedDesCreats) {
|
||||
desCreats = CardLists.filter(desCreats, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(Card card) {
|
||||
|
||||
@@ -132,7 +132,7 @@ public class ChangeZoneAllEffect extends SpellAbilityEffect {
|
||||
cards = (CardCollection) p.getController().orderMoveToZoneList(cards, destination);
|
||||
}
|
||||
|
||||
if (destination == ZoneType.Graveyard && game.isGraveyardOrdered()) {
|
||||
if (destination == ZoneType.Graveyard) {
|
||||
cards = (CardCollection) GameActionUtil.orderCardsByTheirOwners(game, cards, ZoneType.Graveyard);
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ public class DestroyAllEffect extends SpellAbilityEffect {
|
||||
}
|
||||
});
|
||||
|
||||
if (list.size() > 1 && game.isGraveyardOrdered()) {
|
||||
if (list.size() > 1) {
|
||||
list = GameActionUtil.orderCardsByTheirOwners(game, list, ZoneType.Graveyard);
|
||||
}
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ public class DestroyEffect extends SpellAbilityEffect {
|
||||
}
|
||||
}
|
||||
|
||||
if (tgtCards.size() > 1 && game.isGraveyardOrdered()) {
|
||||
if (tgtCards.size() > 1) {
|
||||
tgtCards = (CardCollection) GameActionUtil.orderCardsByTheirOwners(game, tgtCards, ZoneType.Graveyard);
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ public class DestroyEffect extends SpellAbilityEffect {
|
||||
}
|
||||
}
|
||||
|
||||
if (untargetedCards.size() > 1 && game.isGraveyardOrdered()) {
|
||||
if (untargetedCards.size() > 1) {
|
||||
untargetedCards = (CardCollection) GameActionUtil.orderCardsByTheirOwners(game, untargetedCards, ZoneType.Graveyard);
|
||||
}
|
||||
|
||||
|
||||
@@ -339,7 +339,7 @@ public class DigEffect extends SpellAbilityEffect {
|
||||
|
||||
// now, move the rest to destZone2
|
||||
if (destZone2 == ZoneType.Library || destZone2 == ZoneType.PlanarDeck || destZone2 == ZoneType.SchemeDeck
|
||||
|| (destZone2 == ZoneType.Graveyard && game.isGraveyardOrdered())) {
|
||||
|| destZone2 == ZoneType.Graveyard) {
|
||||
CardCollection afterOrder = rest;
|
||||
if (sa.hasParam("RestRandomOrder")) {
|
||||
CardLists.shuffle(afterOrder);
|
||||
|
||||
@@ -135,7 +135,7 @@ public class DiscardEffect extends SpellAbilityEffect {
|
||||
if (runDiscard) {
|
||||
CardCollectionView toDiscard = AbilityUtils.getDefinedCards(source, sa.getParam("DefinedCards"), sa);
|
||||
|
||||
if (toDiscard.size() > 1 && p.getGame().isGraveyardOrdered()) {
|
||||
if (toDiscard.size() > 1) {
|
||||
toDiscard = GameActionUtil.orderCardsByTheirOwners(p.getGame(), toDiscard, ZoneType.Graveyard);
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ public class DiscardEffect extends SpellAbilityEffect {
|
||||
boolean shouldRemember = sa.hasParam("RememberDiscarded");
|
||||
CardCollectionView toDiscard = new CardCollection(Lists.newArrayList(p.getCardsIn(ZoneType.Hand)));
|
||||
|
||||
if (toDiscard.size() > 1 && p.getGame().isGraveyardOrdered()) {
|
||||
if (toDiscard.size() > 1) {
|
||||
toDiscard = GameActionUtil.orderCardsByTheirOwners(p.getGame(), toDiscard, ZoneType.Graveyard);
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ public class DiscardEffect extends SpellAbilityEffect {
|
||||
|
||||
if (mode.equals("NotRemembered")) {
|
||||
CardCollectionView dPHand = CardLists.getValidCards(p.getCardsIn(ZoneType.Hand), "Card.IsNotRemembered", p, source);
|
||||
if (dPHand.size() > 1 && p.getGame().isGraveyardOrdered()) {
|
||||
if (dPHand.size() > 1) {
|
||||
dPHand = GameActionUtil.orderCardsByTheirOwners(p.getGame(), dPHand, ZoneType.Graveyard);
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ public class DiscardEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
CardCollectionView toDiscardView = toDiscard;
|
||||
if (toDiscard.size() > 1 && p.getGame().isGraveyardOrdered()) {
|
||||
if (toDiscard.size() > 1) {
|
||||
toDiscardView = GameActionUtil.orderCardsByTheirOwners(p.getGame(), toDiscard, ZoneType.Graveyard);
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ public class DiscardEffect extends SpellAbilityEffect {
|
||||
hand = CardLists.filter(hand, Presets.NON_TOKEN);
|
||||
CardCollectionView toDiscard = p.getController().chooseCardsToDiscardUnlessType(Math.min(numCards, numCardsInHand), hand, sa.getParam("UnlessType"), sa);
|
||||
|
||||
if (toDiscard.size() > 1 && p.getGame().isGraveyardOrdered()) {
|
||||
if (toDiscard.size() > 1) {
|
||||
toDiscard = GameActionUtil.orderCardsByTheirOwners(p.getGame(), toDiscard, ZoneType.Graveyard);
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ public class DiscardEffect extends SpellAbilityEffect {
|
||||
|
||||
CardCollectionView dPChHand = CardLists.getValidCards(dPHand, valid.split(","), source.getController(), source, sa);
|
||||
dPChHand = CardLists.filter(dPChHand, Presets.NON_TOKEN);
|
||||
if (dPChHand.size() > 1 && p.getGame().isGraveyardOrdered()) {
|
||||
if (dPChHand.size() > 1) {
|
||||
dPChHand = GameActionUtil.orderCardsByTheirOwners(p.getGame(), dPChHand, ZoneType.Graveyard);
|
||||
}
|
||||
|
||||
@@ -293,7 +293,7 @@ public class DiscardEffect extends SpellAbilityEffect {
|
||||
|
||||
CardCollectionView toBeDiscarded = validCards.isEmpty() ? null : chooser.getController().chooseCardsToDiscardFrom(p, sa, validCards, min, max);
|
||||
|
||||
if (toBeDiscarded.size() > 1 && p.getGame().isGraveyardOrdered()) {
|
||||
if (toBeDiscarded.size() > 1) {
|
||||
toBeDiscarded = GameActionUtil.orderCardsByTheirOwners(p.getGame(), toBeDiscarded, ZoneType.Graveyard);
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ public class SacrificeAllEffect extends SpellAbilityEffect {
|
||||
card.clearRemembered();
|
||||
}
|
||||
|
||||
if (list.size() > 1 && game.isGraveyardOrdered()) {
|
||||
if (list.size() > 1) {
|
||||
list = GameActionUtil.orderCardsByTheirOwners(game, list, ZoneType.Graveyard);
|
||||
}
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ public class SacrificeEffect extends SpellAbilityEffect {
|
||||
}
|
||||
}
|
||||
|
||||
if (choosenToSacrifice.size() > 1 && game.isGraveyardOrdered()) {
|
||||
if (choosenToSacrifice.size() > 1) {
|
||||
choosenToSacrifice = GameActionUtil.orderCardsByTheirOwners(game, choosenToSacrifice, ZoneType.Graveyard);
|
||||
}
|
||||
|
||||
|
||||
@@ -1564,7 +1564,7 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
}
|
||||
|
||||
CardCollectionView milledView = milled;
|
||||
if (destination == ZoneType.Graveyard && milled.size() > 1 && game.isGraveyardOrdered()) {
|
||||
if (destination == ZoneType.Graveyard && milled.size() > 1) {
|
||||
milledView = GameActionUtil.orderCardsByTheirOwners(game, milled, ZoneType.Graveyard);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user