Build 10/26:

This commit is contained in:
jendave
2011-08-06 02:39:43 +00:00
parent c2b2a7edc2
commit 69322b3ef1
18 changed files with 26100 additions and 24910 deletions

5
.gitattributes vendored
View File

@@ -47,6 +47,11 @@ src/Card.java svneol=native#text/plain
src/CardDetailUtil.java svneol=native#text/plain src/CardDetailUtil.java svneol=native#text/plain
src/CardFactory.java svneol=native#text/plain src/CardFactory.java svneol=native#text/plain
src/CardFactoryUtil.java svneol=native#text/plain src/CardFactoryUtil.java svneol=native#text/plain
src/CardFactory_Auras.java -text svneol=native#text/plain
src/CardFactory_Creatures.java -text svneol=native#text/plain
src/CardFactory_Equipment.java -text svneol=native#text/plain
src/CardFactory_Lands.java -text svneol=native#text/plain
src/CardFactory_Planeswalkers.java -text svneol=native#text/plain
src/CardList.java svneol=native#text/plain src/CardList.java svneol=native#text/plain
src/CardListFilter.java svneol=native#text/plain src/CardListFilter.java svneol=native#text/plain
src/CardListUtil.java svneol=native#text/plain src/CardListUtil.java svneol=native#text/plain

File diff suppressed because it is too large Load Diff

View File

@@ -2350,6 +2350,36 @@ public class CardFactoryUtil
return s; return s;
} }
public static int getCanPlayNumberOfLands(String player)
{
int count = 1;
CardList list = new CardList(AllZone.getZone(Constant.Zone.Play, player).getCards());
list = list.filter(new CardListFilter()
{
public boolean addCard(Card c) {
return c.getName().equals("Exploration") || c.getName().equals("Azusa, Lost but Seeking") || c.getName().equals("Fastbond");
}
});
for (Card var : list)
{
if (var.getName().equals("Exploration"))
count++;
else if (var.getName().equals("Azusa, Lost but Seeking"))
count = count + 2;
else if (var.getName().equals("Fastbond"))
count = 100;
}
return count;
}
public static CardList getFastbonds(String player)
{
CardList list = new CardList(AllZone.getZone(Constant.Zone.Play, player).getCards());
list = list.getName("Fastbond");
return list;
}
//may return null //may return null
static public Card getRandomCard(CardList list) static public Card getRandomCard(CardList list)

5145
src/CardFactory_Auras.java Normal file

File diff suppressed because it is too large Load Diff

15165
src/CardFactory_Creatures.java Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1867
src/CardFactory_Lands.java Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -11,5 +11,7 @@ public interface Computer
public void main2(); public void main2();
public void end_of_turn();//end of Human's turn public void end_of_turn();//end of Human's turn
public void addNumberPlayLands(int n);
public void stack_not_empty(); public void stack_not_empty();
} }

View File

@@ -1,3 +1,5 @@
//import java.util.*; //import java.util.*;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
@@ -5,11 +7,11 @@ import forge.error.ErrorViewer;
public class ComputerAI_Burn implements Computer { public class ComputerAI_Burn implements Computer {
private volatile boolean playLand = true; private volatile int numberPlayLand = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer);
public void main1() { public void main1() {
if(playLand) { if(numberPlayLand > 0) {
playLand = false; numberPlayLand--;
ComputerUtil.playLand(); ComputerUtil.playLand();
} }
Runnable run = new Runnable() { Runnable run = new Runnable() {
@@ -53,17 +55,16 @@ public class ComputerAI_Burn implements Computer {
}//main1() }//main1()
public void main2() { public void main2() {
playLand = true; numberPlayLand = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer);
//AllZone.Phase.nextPhase(); //AllZone.Phase.nextPhase();
//for debugging: System.out.println("need to nextPhase(ComputerAI_Burn.main2) = true; Note, this is untested, did it work?"); //for debugging: System.out.println("need to nextPhase(ComputerAI_Burn.main2) = true; Note, this is untested, did it work?");
AllZone.Phase.setNeedToNextPhase(true); AllZone.Phase.setNeedToNextPhase(true);
} }
public void declare_attackers_before()
public void declare_attackers_before() { {
AllZone.Phase.setNeedToNextPhase(true); AllZone.Phase.setNeedToNextPhase(true);
} }
public void declare_attackers() { public void declare_attackers() {
//AllZone.Phase.nextPhase(); //AllZone.Phase.nextPhase();
@@ -119,12 +120,17 @@ public class ComputerAI_Burn implements Computer {
for(int i = 0; i < 14; i++) for(int i = 0; i < 14; i++)
library.add(cf.getCard("Mountain", Constant.Player.Computer)); library.add(cf.getCard("Mountain", Constant.Player.Computer));
if(library.size() != 40) throw new RuntimeException( if(library.size() != 40)
"ComputerAI_Burn : getLibrary() error, library size is " + library.size()); throw new RuntimeException("ComputerAI_Burn : getLibrary() error, library size is " + library.size());
return library.toArray(); return library.toArray();
} }
public void addNumberPlayLands(int n)
{
numberPlayLand += n;
}
public void stack_not_empty() { public void stack_not_empty() {
//same as Input.stop() method //same as Input.stop() method
//ends the method //ends the method

View File

@@ -5,11 +5,11 @@ import forge.error.ErrorViewer;
public class ComputerAI_Burn2 implements Computer { public class ComputerAI_Burn2 implements Computer {
private volatile boolean playLand = true; private volatile int numberPlayLand = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer);
public void main1() { public void main1() {
if(playLand) { if(numberPlayLand > 0 ) {
playLand = false; numberPlayLand--;
ComputerUtil.playLand(); ComputerUtil.playLand();
Card c[] = AllZone.Computer_Hand.getCards(); Card c[] = AllZone.Computer_Hand.getCards();
@@ -73,15 +73,16 @@ public class ComputerAI_Burn2 implements Computer {
}//main1() }//main1()
public void main2() { public void main2() {
playLand = true; numberPlayLand = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer);
//AllZone.Phase.nextPhase(); //AllZone.Phase.nextPhase();
//for debugging: System.out.println("need to nextPhase(ComputerAI_Burn2.main2) = true; Note, this is not tested, did it work?"); //for debugging: System.out.println("need to nextPhase(ComputerAI_Burn2.main2) = true; Note, this is not tested, did it work?");
AllZone.Phase.setNeedToNextPhase(true); AllZone.Phase.setNeedToNextPhase(true);
} }
public void declare_attackers_before() { public void declare_attackers_before()
AllZone.Phase.setNeedToNextPhase(true); {
AllZone.Phase.setNeedToNextPhase(true);
} }
public void declare_attackers() { public void declare_attackers() {
@@ -161,12 +162,17 @@ public class ComputerAI_Burn2 implements Computer {
for(int i = 0; i < 17; i++) for(int i = 0; i < 17; i++)
library.add(cf.getCard("Mountain", Constant.Player.Computer)); library.add(cf.getCard("Mountain", Constant.Player.Computer));
if(library.size() != 40) throw new RuntimeException( if(library.size() != 40)
"ComputerAI_Burn : getLibrary() error, library size is " + library.size()); throw new RuntimeException("ComputerAI_Burn : getLibrary() error, library size is " + library.size());
return library.toArray(); return library.toArray();
} }
public void addNumberPlayLands(int n)
{
numberPlayLand += n;
}
public void stack_not_empty() { public void stack_not_empty() {
//same as Input.stop() method //same as Input.stop() method
//ends the method //ends the method

View File

@@ -6,7 +6,8 @@ import java.util.TreeSet;
public class ComputerAI_General implements Computer { public class ComputerAI_General implements Computer {
private boolean playLand = true; //private boolean playLand = true;
private int numberPlayLand = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer);
private Collection<Card> playMain1Cards; private Collection<Card> playMain1Cards;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@@ -17,8 +18,8 @@ public class ComputerAI_General implements Computer {
} }
public void main1() { public void main1() {
if(playLand) { if(numberPlayLand > 0) {
playLand = false; numberPlayLand--;
ComputerUtil.playLand(); ComputerUtil.playLand();
for(String effect:AllZone.StateBasedEffects.getStateBasedMap().keySet()) { for(String effect:AllZone.StateBasedEffects.getStateBasedMap().keySet()) {
Command com = GameActionUtil.commands.get(effect); Command com = GameActionUtil.commands.get(effect);
@@ -27,13 +28,26 @@ public class ComputerAI_General implements Computer {
GameActionUtil.executeCardStateEffects(); GameActionUtil.executeCardStateEffects();
} }
// AllZone.Phase.nextPhase(); // AllZone.Phase.nextPhase();
playCards(Constant.Phase.Main1); playCards(Constant.Phase.Main1);
//for cards like Exploration, Fastbond, Azusa, ...
while(numberPlayLand > 0)
{
numberPlayLand--;
ComputerUtil.playLand();
for(String effect:AllZone.StateBasedEffects.getStateBasedMap().keySet()) {
Command com = GameActionUtil.commands.get(effect);
com.execute();
}
GameActionUtil.executeCardStateEffects();
}
}//main1() }//main1()
public void main2() { public void main2() {
playLand = true; numberPlayLand = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer);
playCards(Constant.Phase.Main2); playCards(Constant.Phase.Main2);
} }
@@ -292,6 +306,11 @@ public class ComputerAI_General implements Computer {
return library.toArray(); return library.toArray();
} }
public void addNumberPlayLands(int n)
{
numberPlayLand += n;
}
public void stack_not_empty() { public void stack_not_empty() {
//same as Input.stop() method //same as Input.stop() method
//ends the method //ends the method

View File

@@ -21,6 +21,12 @@ public class ComputerAI_Input extends Input
think(); think();
}//getMessage(); }//getMessage();
public Computer getComputer()
{
return computer;
}
private void think() private void think()
{ {
final String phase = AllZone.Phase.getPhase(); final String phase = AllZone.Phase.getPhase();

View File

@@ -2,15 +2,15 @@ import java.util.*;
public class ComputerAI_Rats2 implements Computer public class ComputerAI_Rats2 implements Computer
{ {
private boolean playLand = true; private int numberPlayLand = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer);
private static Random random = new Random(); private static Random random = new Random();
public void main1() public void main1()
{ {
if(playLand) if(numberPlayLand > 0)
{ {
playLand = false; numberPlayLand--;
ComputerUtil.playLand(); ComputerUtil.playLand();
} }
@@ -25,7 +25,7 @@ public class ComputerAI_Rats2 implements Computer
} }
public void main2() public void main2()
{ {
playLand = true; numberPlayLand = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer);
//AllZone.Phase.nextPhase(); //AllZone.Phase.nextPhase();
//for debugging: System.out.println("need to nextPhase(ComputerAI_Rats2.main2) = true"); //for debugging: System.out.println("need to nextPhase(ComputerAI_Rats2.main2) = true");
@@ -132,6 +132,12 @@ public class ComputerAI_Rats2 implements Computer
//for debugging: System.out.println("need to nextPhase(ComputerAI_Rats2.playInstantAndAbilities) = true"); //for debugging: System.out.println("need to nextPhase(ComputerAI_Rats2.playInstantAndAbilities) = true");
AllZone.Phase.setNeedToNextPhase(true); AllZone.Phase.setNeedToNextPhase(true);
} }
public void addNumberPlayLands(int n)
{
numberPlayLand += n;
}
public void stack_not_empty() public void stack_not_empty()
{ {
AllZone.InputControl.resetInput(); AllZone.InputControl.resetInput();

View File

@@ -1,6 +1,8 @@
public class ComputerAI_Testing implements Computer public class ComputerAI_Testing implements Computer
{ {
private int numberPlayLand = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer);
//must shuffle this //must shuffle this
public Card[] getLibrary() {return new Card[] {};} public Card[] getLibrary() {return new Card[] {};}
@@ -56,4 +58,9 @@ public class ComputerAI_Testing implements Computer
//for debugging: System.out.println("need to nextPhase(ComputerAI_Testing.end_of_turn) = true"); //for debugging: System.out.println("need to nextPhase(ComputerAI_Testing.end_of_turn) = true");
AllZone.Phase.setNeedToNextPhase(true); AllZone.Phase.setNeedToNextPhase(true);
} }
public void addNumberPlayLands(int n)
{
numberPlayLand += n;
}
} }

View File

@@ -22,7 +22,9 @@
boolean humanSkipsDrawPhase = humanCards.containsName("Necropotence") || humanCards.containsName("Yawgmoth's Bargain"); boolean humanSkipsDrawPhase = humanCards.containsName("Necropotence") || humanCards.containsName("Yawgmoth's Bargain");
if(AllZone.Phase.getPhase().equals(Constant.Phase.Draw) && humanSkipsDrawPhase){ if(AllZone.Phase.getPhase().equals(Constant.Phase.Draw) && humanSkipsDrawPhase){
Input_Main.canPlayLand = true; //Input_Main.canPlayLand = true;
Input_Main.canPlayNumberOfLands = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Human);
Input_Main.firstLandHasBeenPlayed = false;
AllZone.Phase.setNeedToNextPhase(true); AllZone.Phase.setNeedToNextPhase(true);
} }
@@ -56,7 +58,9 @@
if(AllZone.Phase.getPhase().equals(Constant.Phase.Draw)) if(AllZone.Phase.getPhase().equals(Constant.Phase.Draw))
{ {
Input_Main.canPlayLand = true; //Input_Main.canPlayLand = true;
Input_Main.canPlayNumberOfLands = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Human);
Input_Main.firstLandHasBeenPlayed = false;
//AllZone.Phase.nextPhase(); //AllZone.Phase.nextPhase();
//for debugging: System.out.println("need to nextPhase(from Input_Draw on human's draw) = true"); //for debugging: System.out.println("need to nextPhase(from Input_Draw on human's draw) = true");

View File

@@ -5,7 +5,9 @@ public class Input_Main extends Input
{ {
private static final long serialVersionUID = -2162856359060870957L; private static final long serialVersionUID = -2162856359060870957L;
//Input_Draw changes this //Input_Draw changes this
public static boolean canPlayLand; //public static boolean canPlayLand;
public static boolean firstLandHasBeenPlayed;
public static int canPlayNumberOfLands;
public void showMessage() public void showMessage()
{ {
@@ -18,7 +20,6 @@ public class Input_Main extends Input
} }
public void selectButtonOK() public void selectButtonOK()
{ {
//AllZone.Phase.nextPhase(); //AllZone.Phase.nextPhase();
//for debugging: System.out.println("need to nextPhase(Input_Main.selectButtonOK) = true"); //for debugging: System.out.println("need to nextPhase(Input_Main.selectButtonOK) = true");
AllZone.Phase.setNeedToNextPhase(true); AllZone.Phase.setNeedToNextPhase(true);
@@ -28,14 +29,26 @@ public class Input_Main extends Input
//these if statements cannot be combined //these if statements cannot be combined
if(card.isLand() && zone.is(Constant.Zone.Hand, Constant.Player.Human)) if(card.isLand() && zone.is(Constant.Zone.Hand, Constant.Player.Human))
{ {
if(canPlayLand) if(canPlayNumberOfLands > 0 )
{ {
InputUtil.playAnyCard(card, zone); CardList fastbonds = CardFactoryUtil.getFastbonds(Constant.Player.Human);
canPlayLand = false; if (fastbonds.size() > 0){
AllZone.GameAction.checkStateEffects(); if (firstLandHasBeenPlayed)
{
for ( Card vard : fastbonds)
{
AllZone.GameAction.getPlayerLife(Constant.Player.Human).subtractLife(1);
}
}
}
InputUtil.playAnyCard(card, zone);
canPlayNumberOfLands--;
firstLandHasBeenPlayed = true;
AllZone.GameAction.checkStateEffects();
} }
//TODO: add code for exploration / fastbond here //TODO: add code for exploration / fastbond here
} }
else else
{ {

View File

@@ -21,6 +21,21 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone
super.add(o); super.add(o);
Card c = (Card) o; Card c = (Card) o;
//cannot use addComesIntoPlayCommand - trigger might be set to false;
if (c.getName().equals("Exploration")) {
Input_Main.canPlayNumberOfLands++;
AllZone.Computer.getComputer().addNumberPlayLands(1);
}
else if (c.getName().equals("Azusa, Lost but Seeking")) {
Input_Main.canPlayNumberOfLands+=2;
AllZone.Computer.getComputer().addNumberPlayLands(2);
}
else if( c.getName().equals("Fastbond")) {
Input_Main.canPlayNumberOfLands+=100;
AllZone.Computer.getComputer().addNumberPlayLands(100);
}
if (trigger) if (trigger)
{ {
c.setSickness(true);// summoning sickness c.setSickness(true);// summoning sickness
@@ -109,6 +124,22 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone
super.remove(o); super.remove(o);
Card c = (Card) o; Card c = (Card) o;
//cannot use addLeavesPlayCommand - trigger might be set to false
if (c.getName().equals("Exploration")) {
Input_Main.canPlayNumberOfLands--;
AllZone.Computer.getComputer().addNumberPlayLands(-1);
}
else if (c.getName().equals("Azusa, Lost but Seeking")) {
Input_Main.canPlayNumberOfLands-=2;
AllZone.Computer.getComputer().addNumberPlayLands(-2);
}
else if( c.getName().equals("Fastbond")) {
Input_Main.canPlayNumberOfLands-=100;
AllZone.Computer.getComputer().addNumberPlayLands(-100);
}
if (leavesTrigger) if (leavesTrigger)
c.leavesPlay(); c.leavesPlay();