mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
add the ability to Exile cards face down. Added an ExileFaceDown$ True parameter to ChangeZone and ChangeZoneAll. In the GUI code, I had to change the ZoneAction (for viewing Exile, Graveyard, etc.) class to not use the YieldUtils iterator stuff. I pull the Generator into an ArrayList. If someone can do it with Iterator, go for it.
This commit is contained in:
@@ -30,7 +30,6 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Observable;
|
||||
import java.util.Observer;
|
||||
@@ -299,7 +298,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
||||
GuiDisplayUtil.devModeSetLife();
|
||||
}
|
||||
};
|
||||
//end DevMode AddCounter
|
||||
//end DevMode SetLife
|
||||
|
||||
Object[] objDev = {
|
||||
GuiDisplay4.canLoseByDecking,
|
||||
@@ -1506,14 +1505,37 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
||||
c = AllZone.getNameChanger().changeCard(c);
|
||||
}
|
||||
|
||||
Iterator<Card> iter = YieldUtils.toIterable(c).iterator();
|
||||
Iterable<Card> myIterable = YieldUtils.toIterable(c);
|
||||
ArrayList<Card> choices = YieldUtils.toArrayList(myIterable);
|
||||
System.out.println("immediately after: "+choices);
|
||||
//Iterator<Card> iter = myIterable.iterator();
|
||||
|
||||
if (!iter.hasNext()) {
|
||||
ArrayList<Card> choices2 = new ArrayList<Card>();
|
||||
|
||||
if (choices.isEmpty()) {
|
||||
GuiUtils.getChoiceOptional(title, new String[]{"no cards"});
|
||||
}
|
||||
else {
|
||||
for(int i = 0; i < choices.size(); i++) {
|
||||
Card crd = choices.get(i);
|
||||
System.out.println(crd+": "+crd.isFaceDown());
|
||||
if(crd.isFaceDown()) {
|
||||
Card faceDown = new Card();
|
||||
faceDown.setName("Face Down");
|
||||
choices2.add(faceDown);
|
||||
System.out.println("Added: "+faceDown);
|
||||
}
|
||||
else {
|
||||
choices2.add(crd);
|
||||
}
|
||||
}
|
||||
System.out.println("Face down cards replaced: "+choices2);
|
||||
Card choice = (Card) GuiUtils.getChoiceOptional(title, choices2.toArray());
|
||||
if (choice != null) doAction(choice);
|
||||
/*
|
||||
Card choice = GuiUtils.getChoiceOptional(title, iter);
|
||||
if (choice != null) doAction(choice);
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -650,8 +650,12 @@ public class AbilityFactory_ChangeZone {
|
||||
c.addController(af.getHostCard());
|
||||
|
||||
movedCard = AllZone.getGameAction().moveTo(AllZone.getZone(destination, c.getController()), c);
|
||||
} else
|
||||
} else {
|
||||
movedCard = AllZone.getGameAction().moveTo(destZone, c);
|
||||
if(params.containsKey("ExileFaceDown")) {
|
||||
movedCard.setIsFaceDown(true);
|
||||
}
|
||||
}
|
||||
|
||||
if (remember != null)
|
||||
card.addRemembered(movedCard);
|
||||
@@ -771,8 +775,12 @@ public class AbilityFactory_ChangeZone {
|
||||
}
|
||||
|
||||
newCard = AllZone.getGameAction().moveTo(AllZone.getZone(destination, c.getController()), c);
|
||||
} else
|
||||
} else {
|
||||
newCard = AllZone.getGameAction().moveTo(destZone, c);
|
||||
if(params.containsKey("ExileFaceDown")) {
|
||||
newCard.setIsFaceDown(true);
|
||||
}
|
||||
}
|
||||
|
||||
if (remember != null)
|
||||
card.addRemembered(newCard);
|
||||
@@ -1399,6 +1407,9 @@ public class AbilityFactory_ChangeZone {
|
||||
}
|
||||
} else {
|
||||
movedCard = AllZone.getGameAction().moveTo(AllZone.getZone(destination, pl), tgtC);
|
||||
if(params.containsKey("ExileFaceDown")) {
|
||||
movedCard.setIsFaceDown(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (remember != null)
|
||||
@@ -1747,8 +1758,12 @@ public class AbilityFactory_ChangeZone {
|
||||
if (params.containsKey("GainControl")) {
|
||||
c.addController(af.getHostCard());
|
||||
AllZone.getGameAction().moveToPlay(c, sa.getActivatingPlayer());
|
||||
} else
|
||||
AllZone.getGameAction().moveTo(destination, c, libraryPos);
|
||||
} else {
|
||||
Card movedCard = AllZone.getGameAction().moveTo(destination, c, libraryPos);
|
||||
if(params.containsKey("ExileFaceDown")) {
|
||||
movedCard.setIsFaceDown(true);
|
||||
}
|
||||
}
|
||||
|
||||
if (remember != null)
|
||||
sa.getSourceCard().addRemembered(c);
|
||||
|
||||
Reference in New Issue
Block a user