mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +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.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Observable;
|
import java.util.Observable;
|
||||||
import java.util.Observer;
|
import java.util.Observer;
|
||||||
@@ -299,7 +298,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
GuiDisplayUtil.devModeSetLife();
|
GuiDisplayUtil.devModeSetLife();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
//end DevMode AddCounter
|
//end DevMode SetLife
|
||||||
|
|
||||||
Object[] objDev = {
|
Object[] objDev = {
|
||||||
GuiDisplay4.canLoseByDecking,
|
GuiDisplay4.canLoseByDecking,
|
||||||
@@ -1505,15 +1504,38 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
|||||||
if (AllZone.getNameChanger().shouldChangeCardName()) {
|
if (AllZone.getNameChanger().shouldChangeCardName()) {
|
||||||
c = AllZone.getNameChanger().changeCard(c);
|
c = AllZone.getNameChanger().changeCard(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator<Card> iter = YieldUtils.toIterable(c).iterator();
|
|
||||||
|
|
||||||
if (!iter.hasNext()) {
|
Iterable<Card> myIterable = YieldUtils.toIterable(c);
|
||||||
|
ArrayList<Card> choices = YieldUtils.toArrayList(myIterable);
|
||||||
|
System.out.println("immediately after: "+choices);
|
||||||
|
//Iterator<Card> iter = myIterable.iterator();
|
||||||
|
|
||||||
|
ArrayList<Card> choices2 = new ArrayList<Card>();
|
||||||
|
|
||||||
|
if (choices.isEmpty()) {
|
||||||
GuiUtils.getChoiceOptional(title, new String[]{"no cards"});
|
GuiUtils.getChoiceOptional(title, new String[]{"no cards"});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Card choice = GuiUtils.getChoiceOptional(title, iter);
|
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);
|
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());
|
c.addController(af.getHostCard());
|
||||||
|
|
||||||
movedCard = AllZone.getGameAction().moveTo(AllZone.getZone(destination, c.getController()), c);
|
movedCard = AllZone.getGameAction().moveTo(AllZone.getZone(destination, c.getController()), c);
|
||||||
} else
|
} else {
|
||||||
movedCard = AllZone.getGameAction().moveTo(destZone, c);
|
movedCard = AllZone.getGameAction().moveTo(destZone, c);
|
||||||
|
if(params.containsKey("ExileFaceDown")) {
|
||||||
|
movedCard.setIsFaceDown(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (remember != null)
|
if (remember != null)
|
||||||
card.addRemembered(movedCard);
|
card.addRemembered(movedCard);
|
||||||
@@ -771,8 +775,12 @@ public class AbilityFactory_ChangeZone {
|
|||||||
}
|
}
|
||||||
|
|
||||||
newCard = AllZone.getGameAction().moveTo(AllZone.getZone(destination, c.getController()), c);
|
newCard = AllZone.getGameAction().moveTo(AllZone.getZone(destination, c.getController()), c);
|
||||||
} else
|
} else {
|
||||||
newCard = AllZone.getGameAction().moveTo(destZone, c);
|
newCard = AllZone.getGameAction().moveTo(destZone, c);
|
||||||
|
if(params.containsKey("ExileFaceDown")) {
|
||||||
|
newCard.setIsFaceDown(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (remember != null)
|
if (remember != null)
|
||||||
card.addRemembered(newCard);
|
card.addRemembered(newCard);
|
||||||
@@ -1399,6 +1407,9 @@ public class AbilityFactory_ChangeZone {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
movedCard = AllZone.getGameAction().moveTo(AllZone.getZone(destination, pl), tgtC);
|
movedCard = AllZone.getGameAction().moveTo(AllZone.getZone(destination, pl), tgtC);
|
||||||
|
if(params.containsKey("ExileFaceDown")) {
|
||||||
|
movedCard.setIsFaceDown(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (remember != null)
|
if (remember != null)
|
||||||
@@ -1747,8 +1758,12 @@ public class AbilityFactory_ChangeZone {
|
|||||||
if (params.containsKey("GainControl")) {
|
if (params.containsKey("GainControl")) {
|
||||||
c.addController(af.getHostCard());
|
c.addController(af.getHostCard());
|
||||||
AllZone.getGameAction().moveToPlay(c, sa.getActivatingPlayer());
|
AllZone.getGameAction().moveToPlay(c, sa.getActivatingPlayer());
|
||||||
} else
|
} else {
|
||||||
AllZone.getGameAction().moveTo(destination, c, libraryPos);
|
Card movedCard = AllZone.getGameAction().moveTo(destination, c, libraryPos);
|
||||||
|
if(params.containsKey("ExileFaceDown")) {
|
||||||
|
movedCard.setIsFaceDown(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (remember != null)
|
if (remember != null)
|
||||||
sa.getSourceCard().addRemembered(c);
|
sa.getSourceCard().addRemembered(c);
|
||||||
|
|||||||
Reference in New Issue
Block a user