From d5c9a9c34a1796cddba25d33d465a9a5bcd4776b Mon Sep 17 00:00:00 2001 From: Agetian Date: Sun, 21 Jul 2013 11:55:25 +0000 Subject: [PATCH] - Implemented a part of the rule 119.7: a source can be a face-up card in the command zone. --- .../ability/effects/ChooseSourceEffect.java | 36 +++++++++++++------ 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/src/main/java/forge/card/ability/effects/ChooseSourceEffect.java b/src/main/java/forge/card/ability/effects/ChooseSourceEffect.java index 3c0d1432658..a1cb337c8e6 100644 --- a/src/main/java/forge/card/ability/effects/ChooseSourceEffect.java +++ b/src/main/java/forge/card/ability/effects/ChooseSourceEffect.java @@ -48,11 +48,19 @@ public class ChooseSourceEffect extends SpellAbilityEffect { List permanentSources = new ArrayList(); List stackSources = new ArrayList(); List referencedSources = new ArrayList(); + List commandZoneSources = new ArrayList(); List sourcesToChooseFrom = new ArrayList(); // Get the list of permanent cards permanentSources = game.getCardsIn(ZoneType.Battlefield); + // A source can be a face-up card in the command zone + commandZoneSources = new ArrayList(); + for (Card c : game.getCardsIn(ZoneType.Command)) { + if (!c.isFaceDown()) { + commandZoneSources.add(c); + } + } // Get the list of cards that produce effects on the stack @@ -91,32 +99,40 @@ public class ChooseSourceEffect extends SpellAbilityEffect { stackSources = CardLists.getValidCards(stackSources, sa.getParam("Choices"), host.getController(), host); referencedSources = CardLists.getValidCards(referencedSources, sa.getParam("Choices"), host.getController(), host); + commandZoneSources = CardLists.getValidCards(commandZoneSources, sa.getParam("Choices"), host.getController(), host); } if (sa.hasParam("TargetControls")) { permanentSources = CardLists.filterControlledBy(permanentSources, tgtPlayers.get(0)); stackSources = CardLists.filterControlledBy(stackSources, tgtPlayers.get(0)); referencedSources = CardLists.filterControlledBy(referencedSources, tgtPlayers.get(0)); + commandZoneSources = CardLists.filterControlledBy(commandZoneSources, tgtPlayers.get(0)); } - Card divPermanentCards = new Card(); - divPermanentCards.setName("--PERMANENT SOURCES:--"); - Card divStackCards = new Card(); - divStackCards.setName("--SOURCES ON STACK:--"); - Card divReferencedCards = new Card(); - divReferencedCards.setName("--SOURCES REFERENCED ON STACK:--"); + Card divPermanentSources = new Card(); + divPermanentSources.setName("--PERMANENT SOURCES:--"); + Card divStackSources = new Card(); + divStackSources.setName("--SOURCES ON STACK:--"); + Card divReferencedSources = new Card(); + divReferencedSources.setName("--SOURCES REFERENCED ON STACK:--"); + Card divCommandZoneSources = new Card(); + divCommandZoneSources.setName("--SOURCES IN COMMAND ZONE:--"); if (permanentSources.size() > 0) { - sourcesToChooseFrom.add(divPermanentCards); + sourcesToChooseFrom.add(divPermanentSources); sourcesToChooseFrom.addAll(permanentSources); } if (stackSources.size() > 0) { - sourcesToChooseFrom.add(divStackCards); + sourcesToChooseFrom.add(divStackSources); sourcesToChooseFrom.addAll(stackSources); } if (referencedSources.size() > 0) { - sourcesToChooseFrom.add(divReferencedCards); + sourcesToChooseFrom.add(divReferencedSources); sourcesToChooseFrom.addAll(referencedSources); } + if (commandZoneSources.size() > 0) { + sourcesToChooseFrom.add(divCommandZoneSources); + sourcesToChooseFrom.addAll(commandZoneSources); + } if (sourcesToChooseFrom.size() == 0) { return; @@ -134,7 +150,7 @@ public class ChooseSourceEffect extends SpellAbilityEffect { Card o = null; do { o = GuiChoose.one(choiceTitle, sourcesToChooseFrom); - } while (o.equals(divPermanentCards) || o.equals(divStackCards) || o.equals(divReferencedCards)); + } while (o.equals(divPermanentSources) || o.equals(divStackSources) || o.equals(divReferencedSources) || o.equals(divCommandZoneSources)); chosen.add(o); sourcesToChooseFrom.remove(o);