*Converted Planar deck and Scheme deck to zones.

This commit is contained in:
Hellfish
2013-05-12 13:08:41 +00:00
parent 960ce927b6
commit fd52e98c18
8 changed files with 49 additions and 61 deletions

View File

@@ -211,8 +211,12 @@ public class TriggerHandler {
// This is done to allow the list of triggers to be modified while
// triggers are running.
final ArrayList<Trigger> delayedTriggersWorkingCopy = new ArrayList<Trigger>(this.delayedTriggers);
List<Card> allCards = game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES);
allCards.addAll(game.getCardsIn(ZoneType.Stack));
List<Card> allCards = new ArrayList<Card>();
for(Player p : game.getPlayers())
{
allCards.addAll(p.getAllCards());
}
//allCards.addAll(game.getCardsIn(ZoneType.Stack));
boolean checkStatics = false;
// Static triggers
@@ -233,7 +237,7 @@ public class TriggerHandler {
}
// AP
allCards = playerAP.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES);
allCards = playerAP.getAllCards();
allCards.addAll(CardLists.filterControlledBy(game.getCardsIn(ZoneType.Stack), playerAP));
// add cards that move to hidden zones
if (runParams.containsKey("Destination") && runParams.containsKey("Card")) {
@@ -266,7 +270,7 @@ public class TriggerHandler {
continue;
}
allCards = nap.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES);
allCards = nap.getAllCards();
allCards.addAll(CardLists.filterControlledBy(game.getCardsIn(ZoneType.Stack), nap));
// add cards that move to hidden zones
if (runParams.containsKey("Destination") && runParams.containsKey("Card")) {

View File

@@ -73,12 +73,24 @@ public class GameNew {
// Schemes
List<Card> sd = new ArrayList<Card>();
for(IPaperCard cp : psc.getSchemes(player)) sd.add(cp.toForgeCard(player));
if ( !sd.isEmpty()) player.setSchemeDeck(sd);
if ( !sd.isEmpty()) {
for(Card c : sd) {
player.getZone(ZoneType.SchemeDeck).add(c);
}
player.getZone(ZoneType.SchemeDeck).shuffle();
}
// Planes
List<Card> l = new ArrayList<Card>();
for(IPaperCard cp : psc.getPlanes(player)) l.add(cp.toForgeCard(player));
if ( !l.isEmpty() ) player.setPlanarDeck(l);
if ( !l.isEmpty() ) {
for(Card c : l) {
player.getZone(ZoneType.PlanarDeck).add(c);
}
player.getZone(ZoneType.PlanarDeck).shuffle();
}
}
private static Set<CardPrinted> getRemovedAnteCards(Deck toUse) {

View File

@@ -571,47 +571,6 @@ public class GameState {
public void setActivePlane(Card activePlane0) {
this.activePlane = activePlane0;
}
/**
*
* Currently unused. Base for the Single Planar deck option. (Rule 901.15)
*/
public void setCommunalPlaneDeck(List<Card> deck) {
communalPlanarDeck.clear();
communalPlanarDeck.addAll(deck);
CardLists.shuffle(communalPlanarDeck);
for(Player p : roIngamePlayers)
{
p.setPlanarDeck(communalPlanarDeck);
}
}
/**
*
* Currently unused. Base for the Single Planar deck option. (Rule 901.15)
*/
public void initCommunalPlane()
{
getTriggerHandler().suppressMode(TriggerType.PlaneswalkedTo);
Card firstPlane = null;
while(true)
{
firstPlane = communalPlanarDeck.get(0);
communalPlanarDeck.remove(0);
if(firstPlane.getType().contains("Phenomenon"))
{
communalPlanarDeck.add(firstPlane);
}
else
{
this.getPhaseHandler().getPlayerTurn().getZone(ZoneType.Command).add(firstPlane);
break;
}
}
getTriggerHandler().clearSuppression(TriggerType.PlaneswalkedTo);
}
public void archenemy904_10() {
//904.10. If a non-ongoing scheme card is face up in the

View File

@@ -172,7 +172,7 @@ public class Player extends GameEntity implements Comparable<Player> {
/** The Constant ALL_ZONES. */
public static final List<ZoneType> ALL_ZONES = Collections.unmodifiableList(Arrays.asList(ZoneType.Battlefield,
ZoneType.Library, ZoneType.Graveyard, ZoneType.Hand, ZoneType.Exile, ZoneType.Command, ZoneType.Ante,
ZoneType.Sideboard));
ZoneType.Sideboard, ZoneType.PlanarDeck,ZoneType.SchemeDeck));
protected final GameState game;
@@ -2968,9 +2968,9 @@ public class Player extends GameEntity implements Comparable<Player> {
public void planeswalk()
{
currentPlane = planarDeck.get(0);
currentPlane = getZone(ZoneType.PlanarDeck).get(0);
planarDeck.remove(0);
getZone(ZoneType.PlanarDeck).remove(currentPlane);
getZone(ZoneType.Command).add(currentPlane);
game.setActivePlane(currentPlane);
@@ -2996,17 +2996,11 @@ public class Player extends GameEntity implements Comparable<Player> {
Zone com = game.getZoneOf(currentPlane);
com.remove(currentPlane);
currentPlane.clearControllers();
planarDeck.add(currentPlane);
getZone(ZoneType.PlanarDeck).add(currentPlane);
currentPlane = null;
}
}
public void setPlanarDeck(List<Card> pd)
{
planarDeck = pd;
Collections.shuffle(planarDeck);
}
/**
*
* Sets up the first plane of a round.
@@ -3016,11 +3010,11 @@ public class Player extends GameEntity implements Comparable<Player> {
Card firstPlane = null;
while(true)
{
firstPlane = planarDeck.get(0);
planarDeck.remove(0);
firstPlane = getZone(ZoneType.PlanarDeck).get(0);
getZone(ZoneType.PlanarDeck).remove(firstPlane);
if(firstPlane.getType().contains("Phenomenon"))
{
planarDeck.add(firstPlane);
getZone(ZoneType.PlanarDeck).add(firstPlane);
}
else
{

View File

@@ -372,4 +372,8 @@ public class Zone extends MyObservable implements IZone, Observer, java.io.Seria
public void updateLabelObservers() {
}
public void shuffle()
{
Collections.shuffle(cardList);
}
}

View File

@@ -16,7 +16,9 @@ public enum ZoneType {
Command(false),
Stack(false),
Sideboard(true),
Ante(false);
Ante(false),
SchemeDeck(true),
PlanarDeck(true);
public static final List<ZoneType> STATIC_ABILITIES_SOURCE_ZONES = Arrays.asList(new ZoneType[]{Battlefield, Graveyard, Exile, Command/*, Hand*/});