- Updated the Setup Battlefield functionality: made the dev_battle.txt format more intuitive, added an ability to add cards into the human and computer graveyards.

This commit is contained in:
jendave
2011-08-07 00:44:08 +00:00
parent 6faa132288
commit d7612cd3aa
3 changed files with 111 additions and 27 deletions

View File

@@ -1,7 +1,9 @@
5
6
Forest; Forest; Forest; Llanowar Elves
Mountain; Mountain; Mountain
Island; Raging Goblin
Swamp; Swamp; Forest
HumanLife=5
AILife=6
HumanCardsInPlay=Forest; Forest; Forest; Llanowar Elves
AICardsInPlay=Mountain; Mountain; Mountain
HumanCardsInHand=Island; Raging Goblin
AICardsInHand=Swamp; Swamp; Forest
HumanCardsInGraveyard=NONE
AICardsInGraveyard=NONE
END

View File

@@ -1099,6 +1099,8 @@ public class GuiDisplay3 extends JFrame implements CardContainer, Display, NewCo
String t_computerSetupCardsInPlay = "";
String t_humanSetupCardsInHand = "";
String t_computerSetupCardsInHand = "";
String t_humanSetupGraveyard = "";
String t_computerSetupGraveyard = "";
String t_end = "";
try {
@@ -1106,12 +1108,14 @@ public class GuiDisplay3 extends JFrame implements CardContainer, Display, NewCo
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
t_humanLife = br.readLine();
t_computerLife = br.readLine();
t_humanSetupCardsInPlay = br.readLine();
t_computerSetupCardsInPlay = br.readLine();
t_humanSetupCardsInHand = br.readLine();
t_computerSetupCardsInHand = br.readLine();
t_humanLife = br.readLine().split("=")[1];
t_computerLife = br.readLine().split("=")[1];
t_humanSetupCardsInPlay = br.readLine().split("=")[1];
t_computerSetupCardsInPlay = br.readLine().split("=")[1];
t_humanSetupCardsInHand = br.readLine().split("=")[1];
t_computerSetupCardsInHand = br.readLine().split("=")[1];
t_humanSetupGraveyard = br.readLine().split("=")[1];
t_computerSetupGraveyard = br.readLine().split("=")[1];
t_end = br.readLine();
in.close();
@@ -1132,13 +1136,17 @@ public class GuiDisplay3 extends JFrame implements CardContainer, Display, NewCo
String computerSetupCardsInPlay[] = t_computerSetupCardsInPlay.split(";");
String humanSetupCardsInHand[] = t_humanSetupCardsInHand.split(";");
String computerSetupCardsInHand[] = t_computerSetupCardsInHand.split(";");
String humanSetupGraveyard[] = t_humanSetupGraveyard.split(";");
String computerSetupGraveyard[] = t_computerSetupGraveyard.split(";");
CardList humanDevSetup = new CardList();
CardList computerDevSetup = new CardList();
CardList humanDevHandSetup = new CardList();
CardList computerDevHandSetup = new CardList();
CardList humanDevGraveyardSetup = new CardList();
CardList computerDevGraveyardSetup = new CardList();
if (!t_humanSetupCardsInPlay.trim().equals("")) {
if (!t_humanSetupCardsInPlay.trim().toLowerCase().equals("none")) {
for (int i = 0; i < humanSetupCardsInPlay.length; i ++) {
Card c = AllZone.CardFactory.getCard(humanSetupCardsInPlay[i].trim(), AllZone.HumanPlayer);
for(Trigger trig : c.getTriggers()) {
@@ -1152,7 +1160,7 @@ public class GuiDisplay3 extends JFrame implements CardContainer, Display, NewCo
}
}
if (!t_humanSetupCardsInHand.trim().equals("")) {
if (!t_humanSetupCardsInHand.trim().toLowerCase().equals("none")) {
for (int i = 0; i < humanSetupCardsInHand.length; i ++) {
Card c = AllZone.CardFactory.getCard(humanSetupCardsInHand[i].trim(), AllZone.HumanPlayer);
for(Trigger trig : c.getTriggers()) {
@@ -1166,7 +1174,7 @@ public class GuiDisplay3 extends JFrame implements CardContainer, Display, NewCo
}
}
if (!t_computerSetupCardsInPlay.trim().equals("")) {
if (!t_computerSetupCardsInPlay.trim().toLowerCase().equals("none")) {
for (int i = 0; i < computerSetupCardsInPlay.length; i ++) {
Card c = AllZone.CardFactory.getCard(computerSetupCardsInPlay[i].trim(), AllZone.ComputerPlayer);
@@ -1180,7 +1188,7 @@ public class GuiDisplay3 extends JFrame implements CardContainer, Display, NewCo
}
}
if (!t_computerSetupCardsInHand.trim().equals("")) {
if (!t_computerSetupCardsInHand.trim().toLowerCase().equals("none")) {
for (int i = 0; i < computerSetupCardsInHand.length; i ++) {
Card c = AllZone.CardFactory.getCard(computerSetupCardsInHand[i].trim(), AllZone.ComputerPlayer);
@@ -1194,6 +1202,34 @@ public class GuiDisplay3 extends JFrame implements CardContainer, Display, NewCo
}
}
if (!t_computerSetupGraveyard.trim().toLowerCase().equals("none")) {
for (int i = 0; i < computerSetupGraveyard.length; i ++) {
Card c = AllZone.CardFactory.getCard(computerSetupGraveyard[i].trim(), AllZone.ComputerPlayer);
c.setCurSetCode(c.getMostRecentSet());
c.setImageFilename(CardUtil.buildFilename(c));
for(Trigger trig : c.getTriggers()) {
AllZone.TriggerHandler.registerTrigger(trig);
}
computerDevGraveyardSetup.add(c);
}
}
if (!t_humanSetupGraveyard.trim().toLowerCase().equals("none")) {
for (int i = 0; i < humanSetupGraveyard.length; i ++) {
Card c = AllZone.CardFactory.getCard(humanSetupGraveyard[i].trim(), AllZone.ComputerPlayer);
c.setCurSetCode(c.getMostRecentSet());
c.setImageFilename(CardUtil.buildFilename(c));
for(Trigger trig : c.getTriggers()) {
AllZone.TriggerHandler.registerTrigger(trig);
}
humanDevGraveyardSetup.add(c);
}
}
for (Card c : humanDevSetup)
{
AllZone.Human_Hand.add(c);
@@ -1208,6 +1244,11 @@ public class GuiDisplay3 extends JFrame implements CardContainer, Display, NewCo
c.setSickness(false);
}
for (Card c: humanDevGraveyardSetup)
AllZone.Human_Graveyard.add(c);
for (Card c: computerDevGraveyardSetup)
AllZone.Computer_Graveyard.add(c);
if (computerDevHandSetup.size() > 0)
AllZone.Computer_Hand.setCards(computerDevHandSetup.toArray());
if (humanDevHandSetup.size() > 0)
@@ -1220,7 +1261,7 @@ public class GuiDisplay3 extends JFrame implements CardContainer, Display, NewCo
AllZone.GameAction.checkStateEffects();
}
// *****************************
JXMultiSplitPane pane = new JXMultiSplitPane();

View File

@@ -1086,6 +1086,8 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
String t_computerSetupCardsInPlay = "";
String t_humanSetupCardsInHand = "";
String t_computerSetupCardsInHand = "";
String t_humanSetupGraveyard = "";
String t_computerSetupGraveyard = "";
String t_end = "";
try {
@@ -1093,12 +1095,14 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
t_humanLife = br.readLine();
t_computerLife = br.readLine();
t_humanSetupCardsInPlay = br.readLine();
t_computerSetupCardsInPlay = br.readLine();
t_humanSetupCardsInHand = br.readLine();
t_computerSetupCardsInHand = br.readLine();
t_humanLife = br.readLine().split("=")[1];
t_computerLife = br.readLine().split("=")[1];
t_humanSetupCardsInPlay = br.readLine().split("=")[1];
t_computerSetupCardsInPlay = br.readLine().split("=")[1];
t_humanSetupCardsInHand = br.readLine().split("=")[1];
t_computerSetupCardsInHand = br.readLine().split("=")[1];
t_humanSetupGraveyard = br.readLine().split("=")[1];
t_computerSetupGraveyard = br.readLine().split("=")[1];
t_end = br.readLine();
in.close();
@@ -1119,13 +1123,17 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
String computerSetupCardsInPlay[] = t_computerSetupCardsInPlay.split(";");
String humanSetupCardsInHand[] = t_humanSetupCardsInHand.split(";");
String computerSetupCardsInHand[] = t_computerSetupCardsInHand.split(";");
String humanSetupGraveyard[] = t_humanSetupGraveyard.split(";");
String computerSetupGraveyard[] = t_computerSetupGraveyard.split(";");
CardList humanDevSetup = new CardList();
CardList computerDevSetup = new CardList();
CardList humanDevHandSetup = new CardList();
CardList computerDevHandSetup = new CardList();
CardList humanDevGraveyardSetup = new CardList();
CardList computerDevGraveyardSetup = new CardList();
if (!t_humanSetupCardsInPlay.trim().equals("")) {
if (!t_humanSetupCardsInPlay.trim().toLowerCase().equals("none")) {
for (int i = 0; i < humanSetupCardsInPlay.length; i ++) {
Card c = AllZone.CardFactory.getCard(humanSetupCardsInPlay[i].trim(), AllZone.HumanPlayer);
for(Trigger trig : c.getTriggers()) {
@@ -1139,7 +1147,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
}
}
if (!t_humanSetupCardsInHand.trim().equals("")) {
if (!t_humanSetupCardsInHand.trim().toLowerCase().equals("none")) {
for (int i = 0; i < humanSetupCardsInHand.length; i ++) {
Card c = AllZone.CardFactory.getCard(humanSetupCardsInHand[i].trim(), AllZone.HumanPlayer);
for(Trigger trig : c.getTriggers()) {
@@ -1153,7 +1161,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
}
}
if (!t_computerSetupCardsInPlay.trim().equals("")) {
if (!t_computerSetupCardsInPlay.trim().toLowerCase().equals("none")) {
for (int i = 0; i < computerSetupCardsInPlay.length; i ++) {
Card c = AllZone.CardFactory.getCard(computerSetupCardsInPlay[i].trim(), AllZone.ComputerPlayer);
@@ -1167,7 +1175,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
}
}
if (!t_computerSetupCardsInHand.trim().equals("")) {
if (!t_computerSetupCardsInHand.trim().toLowerCase().equals("none")) {
for (int i = 0; i < computerSetupCardsInHand.length; i ++) {
Card c = AllZone.CardFactory.getCard(computerSetupCardsInHand[i].trim(), AllZone.ComputerPlayer);
@@ -1181,6 +1189,34 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
}
}
if (!t_computerSetupGraveyard.trim().toLowerCase().equals("none")) {
for (int i = 0; i < computerSetupGraveyard.length; i ++) {
Card c = AllZone.CardFactory.getCard(computerSetupGraveyard[i].trim(), AllZone.ComputerPlayer);
c.setCurSetCode(c.getMostRecentSet());
c.setImageFilename(CardUtil.buildFilename(c));
for(Trigger trig : c.getTriggers()) {
AllZone.TriggerHandler.registerTrigger(trig);
}
computerDevGraveyardSetup.add(c);
}
}
if (!t_humanSetupGraveyard.trim().toLowerCase().equals("none")) {
for (int i = 0; i < humanSetupGraveyard.length; i ++) {
Card c = AllZone.CardFactory.getCard(humanSetupGraveyard[i].trim(), AllZone.ComputerPlayer);
c.setCurSetCode(c.getMostRecentSet());
c.setImageFilename(CardUtil.buildFilename(c));
for(Trigger trig : c.getTriggers()) {
AllZone.TriggerHandler.registerTrigger(trig);
}
humanDevGraveyardSetup.add(c);
}
}
for (Card c : humanDevSetup)
{
AllZone.Human_Hand.add(c);
@@ -1195,6 +1231,11 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
c.setSickness(false);
}
for (Card c: humanDevGraveyardSetup)
AllZone.Human_Graveyard.add(c);
for (Card c: computerDevGraveyardSetup)
AllZone.Computer_Graveyard.add(c);
if (computerDevHandSetup.size() > 0)
AllZone.Computer_Hand.setCards(computerDevHandSetup.toArray());
if (humanDevHandSetup.size() > 0)