mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Build 10/26:
This commit is contained in:
5
.gitattributes
vendored
5
.gitattributes
vendored
@@ -47,6 +47,11 @@ src/Card.java svneol=native#text/plain
|
||||
src/CardDetailUtil.java svneol=native#text/plain
|
||||
src/CardFactory.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/CardListFilter.java svneol=native#text/plain
|
||||
src/CardListUtil.java svneol=native#text/plain
|
||||
|
||||
25142
src/CardFactory.java
25142
src/CardFactory.java
File diff suppressed because it is too large
Load Diff
@@ -2349,8 +2349,38 @@ public class CardFactoryUtil
|
||||
}
|
||||
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
|
||||
static public Card getRandomCard(CardList list)
|
||||
{
|
||||
|
||||
5145
src/CardFactory_Auras.java
Normal file
5145
src/CardFactory_Auras.java
Normal file
File diff suppressed because it is too large
Load Diff
15165
src/CardFactory_Creatures.java
Normal file
15165
src/CardFactory_Creatures.java
Normal file
File diff suppressed because it is too large
Load Diff
1630
src/CardFactory_Equipment.java
Normal file
1630
src/CardFactory_Equipment.java
Normal file
File diff suppressed because it is too large
Load Diff
1867
src/CardFactory_Lands.java
Normal file
1867
src/CardFactory_Lands.java
Normal file
File diff suppressed because it is too large
Load Diff
1848
src/CardFactory_Planeswalkers.java
Normal file
1848
src/CardFactory_Planeswalkers.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -11,5 +11,7 @@ public interface Computer
|
||||
public void main2();
|
||||
public void end_of_turn();//end of Human's turn
|
||||
|
||||
public void addNumberPlayLands(int n);
|
||||
|
||||
public void stack_not_empty();
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
|
||||
|
||||
//import java.util.*;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
@@ -5,11 +7,11 @@ import forge.error.ErrorViewer;
|
||||
|
||||
|
||||
public class ComputerAI_Burn implements Computer {
|
||||
private volatile boolean playLand = true;
|
||||
private volatile int numberPlayLand = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer);
|
||||
|
||||
public void main1() {
|
||||
if(playLand) {
|
||||
playLand = false;
|
||||
if(numberPlayLand > 0) {
|
||||
numberPlayLand--;
|
||||
ComputerUtil.playLand();
|
||||
}
|
||||
Runnable run = new Runnable() {
|
||||
@@ -53,17 +55,16 @@ public class ComputerAI_Burn implements Computer {
|
||||
}//main1()
|
||||
|
||||
public void main2() {
|
||||
playLand = true;
|
||||
numberPlayLand = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer);
|
||||
|
||||
//AllZone.Phase.nextPhase();
|
||||
//for debugging: System.out.println("need to nextPhase(ComputerAI_Burn.main2) = true; Note, this is untested, did it work?");
|
||||
AllZone.Phase.setNeedToNextPhase(true);
|
||||
}
|
||||
|
||||
public void declare_attackers_before() {
|
||||
AllZone.Phase.setNeedToNextPhase(true);
|
||||
public void declare_attackers_before()
|
||||
{
|
||||
AllZone.Phase.setNeedToNextPhase(true);
|
||||
}
|
||||
|
||||
public void declare_attackers() {
|
||||
|
||||
//AllZone.Phase.nextPhase();
|
||||
@@ -119,12 +120,17 @@ public class ComputerAI_Burn implements Computer {
|
||||
for(int i = 0; i < 14; i++)
|
||||
library.add(cf.getCard("Mountain", Constant.Player.Computer));
|
||||
|
||||
if(library.size() != 40) throw new RuntimeException(
|
||||
"ComputerAI_Burn : getLibrary() error, library size is " + library.size());
|
||||
if(library.size() != 40)
|
||||
throw new RuntimeException("ComputerAI_Burn : getLibrary() error, library size is " + library.size());
|
||||
|
||||
return library.toArray();
|
||||
}
|
||||
|
||||
public void addNumberPlayLands(int n)
|
||||
{
|
||||
numberPlayLand += n;
|
||||
}
|
||||
|
||||
public void stack_not_empty() {
|
||||
//same as Input.stop() method
|
||||
//ends the method
|
||||
|
||||
@@ -5,11 +5,11 @@ import forge.error.ErrorViewer;
|
||||
|
||||
|
||||
public class ComputerAI_Burn2 implements Computer {
|
||||
private volatile boolean playLand = true;
|
||||
private volatile int numberPlayLand = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer);
|
||||
|
||||
public void main1() {
|
||||
if(playLand) {
|
||||
playLand = false;
|
||||
if(numberPlayLand > 0 ) {
|
||||
numberPlayLand--;
|
||||
ComputerUtil.playLand();
|
||||
|
||||
Card c[] = AllZone.Computer_Hand.getCards();
|
||||
@@ -73,15 +73,16 @@ public class ComputerAI_Burn2 implements Computer {
|
||||
}//main1()
|
||||
|
||||
public void main2() {
|
||||
playLand = true;
|
||||
numberPlayLand = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer);
|
||||
|
||||
//AllZone.Phase.nextPhase();
|
||||
//for debugging: System.out.println("need to nextPhase(ComputerAI_Burn2.main2) = true; Note, this is not tested, did it work?");
|
||||
AllZone.Phase.setNeedToNextPhase(true);
|
||||
}
|
||||
|
||||
public void declare_attackers_before() {
|
||||
AllZone.Phase.setNeedToNextPhase(true);
|
||||
public void declare_attackers_before()
|
||||
{
|
||||
AllZone.Phase.setNeedToNextPhase(true);
|
||||
}
|
||||
|
||||
public void declare_attackers() {
|
||||
@@ -161,12 +162,17 @@ public class ComputerAI_Burn2 implements Computer {
|
||||
for(int i = 0; i < 17; i++)
|
||||
library.add(cf.getCard("Mountain", Constant.Player.Computer));
|
||||
|
||||
if(library.size() != 40) throw new RuntimeException(
|
||||
"ComputerAI_Burn : getLibrary() error, library size is " + library.size());
|
||||
if(library.size() != 40)
|
||||
throw new RuntimeException("ComputerAI_Burn : getLibrary() error, library size is " + library.size());
|
||||
|
||||
return library.toArray();
|
||||
}
|
||||
|
||||
public void addNumberPlayLands(int n)
|
||||
{
|
||||
numberPlayLand += n;
|
||||
}
|
||||
|
||||
public void stack_not_empty() {
|
||||
//same as Input.stop() method
|
||||
//ends the method
|
||||
@@ -174,4 +180,4 @@ public class ComputerAI_Burn2 implements Computer {
|
||||
AllZone.InputControl.resetInput();
|
||||
AllZone.InputControl.updateObservers();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,8 @@ import java.util.TreeSet;
|
||||
|
||||
|
||||
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;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -17,23 +18,36 @@ public class ComputerAI_General implements Computer {
|
||||
}
|
||||
|
||||
public void main1() {
|
||||
if(playLand) {
|
||||
playLand = false;
|
||||
if(numberPlayLand > 0) {
|
||||
numberPlayLand--;
|
||||
ComputerUtil.playLand();
|
||||
for(String effect:AllZone.StateBasedEffects.getStateBasedMap().keySet()) {
|
||||
Command com = GameActionUtil.commands.get(effect);
|
||||
com.execute();
|
||||
}
|
||||
GameActionUtil.executeCardStateEffects();
|
||||
GameActionUtil.executeCardStateEffects();
|
||||
}
|
||||
|
||||
// AllZone.Phase.nextPhase();
|
||||
// AllZone.Phase.nextPhase();
|
||||
|
||||
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()
|
||||
|
||||
public void main2() {
|
||||
playLand = true;
|
||||
numberPlayLand = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer);
|
||||
|
||||
playCards(Constant.Phase.Main2);
|
||||
}
|
||||
@@ -292,6 +306,11 @@ public class ComputerAI_General implements Computer {
|
||||
return library.toArray();
|
||||
}
|
||||
|
||||
public void addNumberPlayLands(int n)
|
||||
{
|
||||
numberPlayLand += n;
|
||||
}
|
||||
|
||||
public void stack_not_empty() {
|
||||
//same as Input.stop() method
|
||||
//ends the method
|
||||
|
||||
@@ -21,6 +21,12 @@ public class ComputerAI_Input extends Input
|
||||
|
||||
think();
|
||||
}//getMessage();
|
||||
|
||||
public Computer getComputer()
|
||||
{
|
||||
return computer;
|
||||
}
|
||||
|
||||
private void think()
|
||||
{
|
||||
final String phase = AllZone.Phase.getPhase();
|
||||
|
||||
@@ -2,15 +2,15 @@ import java.util.*;
|
||||
|
||||
public class ComputerAI_Rats2 implements Computer
|
||||
{
|
||||
private boolean playLand = true;
|
||||
private int numberPlayLand = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer);
|
||||
|
||||
private static Random random = new Random();
|
||||
|
||||
public void main1()
|
||||
{
|
||||
if(playLand)
|
||||
if(numberPlayLand > 0)
|
||||
{
|
||||
playLand = false;
|
||||
numberPlayLand--;
|
||||
ComputerUtil.playLand();
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public class ComputerAI_Rats2 implements Computer
|
||||
}
|
||||
public void main2()
|
||||
{
|
||||
playLand = true;
|
||||
numberPlayLand = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer);
|
||||
|
||||
//AllZone.Phase.nextPhase();
|
||||
//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");
|
||||
AllZone.Phase.setNeedToNextPhase(true);
|
||||
}
|
||||
|
||||
public void addNumberPlayLands(int n)
|
||||
{
|
||||
numberPlayLand += n;
|
||||
}
|
||||
|
||||
public void stack_not_empty()
|
||||
{
|
||||
AllZone.InputControl.resetInput();
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
public class ComputerAI_Testing implements Computer
|
||||
{
|
||||
|
||||
private int numberPlayLand = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer);
|
||||
|
||||
//must shuffle this
|
||||
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");
|
||||
AllZone.Phase.setNeedToNextPhase(true);
|
||||
}
|
||||
|
||||
public void addNumberPlayLands(int n)
|
||||
{
|
||||
numberPlayLand += n;
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,9 @@
|
||||
boolean humanSkipsDrawPhase = humanCards.containsName("Necropotence") || humanCards.containsName("Yawgmoth's Bargain");
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
@@ -56,7 +58,9 @@
|
||||
|
||||
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();
|
||||
//for debugging: System.out.println("need to nextPhase(from Input_Draw on human's draw) = true");
|
||||
|
||||
@@ -5,7 +5,9 @@ public class Input_Main extends Input
|
||||
{
|
||||
private static final long serialVersionUID = -2162856359060870957L;
|
||||
//Input_Draw changes this
|
||||
public static boolean canPlayLand;
|
||||
//public static boolean canPlayLand;
|
||||
public static boolean firstLandHasBeenPlayed;
|
||||
public static int canPlayNumberOfLands;
|
||||
|
||||
public void showMessage()
|
||||
{
|
||||
@@ -18,7 +20,6 @@ public class Input_Main extends Input
|
||||
}
|
||||
public void selectButtonOK()
|
||||
{
|
||||
|
||||
//AllZone.Phase.nextPhase();
|
||||
//for debugging: System.out.println("need to nextPhase(Input_Main.selectButtonOK) = true");
|
||||
AllZone.Phase.setNeedToNextPhase(true);
|
||||
@@ -28,14 +29,26 @@ public class Input_Main extends Input
|
||||
//these if statements cannot be combined
|
||||
if(card.isLand() && zone.is(Constant.Zone.Hand, Constant.Player.Human))
|
||||
{
|
||||
if(canPlayLand)
|
||||
if(canPlayNumberOfLands > 0 )
|
||||
{
|
||||
InputUtil.playAnyCard(card, zone);
|
||||
canPlayLand = false;
|
||||
AllZone.GameAction.checkStateEffects();
|
||||
CardList fastbonds = CardFactoryUtil.getFastbonds(Constant.Player.Human);
|
||||
if (fastbonds.size() > 0){
|
||||
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
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -21,6 +21,21 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone
|
||||
super.add(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)
|
||||
{
|
||||
c.setSickness(true);// summoning sickness
|
||||
@@ -108,7 +123,23 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone
|
||||
|
||||
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)
|
||||
c.leavesPlay();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user