mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- Migrate PlayLand from GameInfo to Player
- Cleanup some code near calls to playLand
This commit is contained in:
@@ -7925,13 +7925,8 @@ public class CardFactory implements NewConstants {
|
||||
Player player = card.getController();
|
||||
if(freeCard != null) {
|
||||
if(freeCard.isLand() == true) {
|
||||
if(CardFactoryUtil.canHumanPlayLand()) {
|
||||
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, player);
|
||||
PlayerZone orig = AllZone.getZone(freeCard);
|
||||
orig.remove(freeCard);
|
||||
play.add(freeCard);
|
||||
CardFactoryUtil.playLandEffects(freeCard);
|
||||
AllZone.GameInfo.incrementHumanPlayedLands();
|
||||
if(card.getController().canPlayLand()) {
|
||||
card.getController().playLand(freeCard);
|
||||
}
|
||||
else {
|
||||
JOptionPane.showMessageDialog(null, "You can't play any more lands this turn.", "", JOptionPane.INFORMATION_MESSAGE);
|
||||
|
||||
@@ -4288,7 +4288,6 @@ public class CardFactoryUtil {
|
||||
return getRandomCard(new CardList(zone.getCards()));
|
||||
}
|
||||
|
||||
|
||||
public static void revertManland(Card c, String[] removeTypes, String[] removeKeywords, String cost, long timeStamp) {
|
||||
c.setBaseAttack(0);
|
||||
c.setBaseDefense(0);
|
||||
@@ -4327,32 +4326,13 @@ public class CardFactoryUtil {
|
||||
long timestamp = c.addColor(cost, c, false, true);
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public static boolean canHumanPlayLand(){
|
||||
return canPlayerPlayLand(AllZone.HumanPlayer, AllZone.GameInfo.humanNumberLandPlaysLeft());
|
||||
}
|
||||
|
||||
public static boolean canComputerPlayLand(){
|
||||
return canPlayerPlayLand(AllZone.ComputerPlayer, AllZone.GameInfo.computerNumberLandPlaysLeft());
|
||||
}
|
||||
|
||||
public static boolean canPlayerPlayLand(Player player, int landPlaysLeft){
|
||||
// LandsToPlay Left or Fastbond in play, Computer's turn, Stack is Empty, In Main Phase
|
||||
return (Phase.canCastSorcery(player) && (landPlaysLeft > 0 ||
|
||||
AllZoneUtil.getPlayerCardsInPlay(player, "Fastbond").size() > 0));
|
||||
}
|
||||
|
||||
|
||||
public static void playLandEffects(Card c){
|
||||
final Player player = c.getController();
|
||||
CardList cityOfTraitors = AllZoneUtil.getPlayerCardsInPlay(player, "City of Traitors");
|
||||
cityOfTraitors.remove(c);
|
||||
boolean extraLand;
|
||||
if (player.equals(AllZone.HumanPlayer)){
|
||||
extraLand = AllZone.GameInfo.humanPlayedFirstLandThisTurn();
|
||||
}
|
||||
else{
|
||||
extraLand = AllZone.GameInfo.computerPlayedFirstLandThisTurn();
|
||||
}
|
||||
// > 0 because land amount isn't incremented until after playLandEffects
|
||||
boolean extraLand = player.getNumLandsPlayed() > 0;
|
||||
|
||||
if(extraLand) {
|
||||
CardList fastbonds = AllZoneUtil.getPlayerCardsInPlay(player, "Fastbond");
|
||||
|
||||
@@ -1354,30 +1354,14 @@ public class CardFactory_Creatures {
|
||||
|
||||
@Override
|
||||
public void resolve() {
|
||||
CardList library = new CardList(AllZone.getZone(Constant.Zone.Library, card.getController()).getCards());
|
||||
Card top = library.get(0);
|
||||
// todo: change to static ability?
|
||||
CardList library = AllZoneUtil.getPlayerCardsInLibrary(card.getController());
|
||||
if(library.size() == 0)
|
||||
return;
|
||||
|
||||
if(library.size() > 0 && top.getType().contains("Land") ) {
|
||||
boolean canPlayLand = false;
|
||||
boolean isHuman = false;
|
||||
if(card.getController() == AllZone.HumanPlayer){
|
||||
canPlayLand = CardFactoryUtil.canHumanPlayLand();
|
||||
isHuman = true;
|
||||
}
|
||||
else{
|
||||
canPlayLand = CardFactoryUtil.canComputerPlayLand();
|
||||
}
|
||||
if (canPlayLand){
|
||||
//todo(sol): would prefer to use GameAction.playLand(top, play) but it doesn't work
|
||||
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController());
|
||||
Card land = AllZone.GameAction.moveTo(play, top);
|
||||
CardFactoryUtil.playLandEffects(land);
|
||||
if (isHuman)
|
||||
AllZone.GameInfo.incrementHumanPlayedLands();
|
||||
else
|
||||
AllZone.GameInfo.incrementComputerPlayedLands();
|
||||
}
|
||||
}
|
||||
Card top = library.get(0);
|
||||
if(top.isLand())
|
||||
card.getController().playLand(top);
|
||||
}//resolve()
|
||||
|
||||
@Override
|
||||
@@ -1385,11 +1369,9 @@ public class CardFactory_Creatures {
|
||||
CardList library = new CardList(AllZone.getZone(Constant.Zone.Library, card.getController()).getCards());
|
||||
if(library.size() == 0) return false;
|
||||
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController());
|
||||
boolean canPlayLand = false;
|
||||
if(card.getController() == AllZone.HumanPlayer) canPlayLand = CardFactoryUtil.canHumanPlayLand();
|
||||
else canPlayLand = CardFactoryUtil.canComputerPlayLand();
|
||||
boolean canPlayLand = card.getController().canPlayLand();
|
||||
|
||||
return (AllZone.GameAction.isCardInZone(card, play) && library.get(0).getType().contains("Land") && canPlayLand);
|
||||
return (AllZone.GameAction.isCardInZone(card, play) && library.get(0).isLand() && canPlayLand);
|
||||
}
|
||||
};//SpellAbility
|
||||
|
||||
|
||||
@@ -991,14 +991,9 @@ public class CardFactory_Sorceries {
|
||||
if(target != null) c = AllZone.CardFactory.copyCard(target);
|
||||
|
||||
if(c != null) {
|
||||
if(c.isLand() == true) {
|
||||
if(CardFactoryUtil.canHumanPlayLand()) {
|
||||
// todo(sol): would prefer this in GameAction.playLand somehow
|
||||
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, player);
|
||||
play.add(c);
|
||||
card.unattachCard(c);
|
||||
CardFactoryUtil.playLandEffects(c);
|
||||
AllZone.GameInfo.incrementHumanPlayedLands();
|
||||
if(c.isLand()) {
|
||||
if(player.canPlayLand()) {
|
||||
player.playLand(c);
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(null, "You can't play any more lands this turn.", "", JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
@@ -1234,21 +1229,19 @@ public class CardFactory_Sorceries {
|
||||
}
|
||||
}
|
||||
|
||||
} else//Computer chooses (It picks the highest converted mana cost card and 1 random card.)
|
||||
{
|
||||
Card biggest = null;
|
||||
biggest = Exiled.get(0);
|
||||
}
|
||||
else{//Computer chooses (It picks the highest converted mana cost card and 1 random card.)
|
||||
Card biggest = Exiled.get(0);
|
||||
|
||||
for(int i = 0; i < Count; i++) {
|
||||
if(CardUtil.getConvertedManaCost(biggest.getManaCost()) >= CardUtil.getConvertedManaCost(biggest.getManaCost())) {
|
||||
biggest = cards.get(i);
|
||||
}
|
||||
}
|
||||
for(Card c : Exiled)
|
||||
if(CardUtil.getConvertedManaCost(biggest.getManaCost()) < CardUtil.getConvertedManaCost(c.getManaCost()))
|
||||
biggest = c;
|
||||
|
||||
Pile1.add(biggest);
|
||||
cards.remove(biggest);
|
||||
if(cards.size() > 0) {
|
||||
Card Random = CardUtil.getRandom(cards.toArray());
|
||||
Pile1.add(Random);
|
||||
if(cards.size() > 2) {
|
||||
Card Random = CardUtil.getRandom(cards.toArray());
|
||||
Pile1.add(Random);
|
||||
}
|
||||
for(int i = 0; i < Count; i++) if(!Pile1.contains(Exiled.get(i))) Pile2.add(Exiled.get(i));
|
||||
StringBuilder sb = new StringBuilder();
|
||||
@@ -1261,52 +1254,32 @@ public class CardFactory_Sorceries {
|
||||
Object q = JOptionPane.showOptionDialog(null, sb, "Brilliant Ultimatum",
|
||||
JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE,
|
||||
null, possibleValues, possibleValues[0]);
|
||||
boolean stop2 = false;
|
||||
if(q.equals(0)) {
|
||||
int Spells = Pile1.size();
|
||||
for( int i = 0; i < Spells; i++) {
|
||||
if(stop2 == false) {
|
||||
Object check = GuiUtils.getChoiceOptional("Select spells to play in reverse order: ", Pile1.toArray());
|
||||
if(check != null) {
|
||||
if(((Card) check).isLand() == true) {
|
||||
if(CardFactoryUtil.canHumanPlayLand()) {
|
||||
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController());
|
||||
GameAction.playLand((Card)check, play);
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(null, "You can't play any more lands this turn.", "", JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
} else if(((Card) check).isPermanent() == true && ((Card) check).isAura() == false) {
|
||||
AllZone.Stack.add(((Card) check).getSpellAbility()[0]);
|
||||
} else {
|
||||
AllZone.GameAction.playCardNoCost(((Card) check));
|
||||
}
|
||||
Pile1.remove((Card) check);
|
||||
}
|
||||
} else stop2 = true;
|
||||
}
|
||||
} else {
|
||||
int Spells = Pile2.size();
|
||||
for( int i = 0; i < Spells; i++) {
|
||||
if(stop2 == false) {
|
||||
Object check = GuiUtils.getChoiceOptional("Select spells to play in reverse order: ", Pile2.toArray());
|
||||
if(check != null) {
|
||||
if(((Card) check).isLand() == true) {
|
||||
if(CardFactoryUtil.canHumanPlayLand()) {
|
||||
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController());
|
||||
GameAction.playLand((Card)check, play);
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(null, "You can't play any more lands this turn.", "", JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
} else if(((Card) check).isPermanent() == true && ((Card) check).isAura() == false) {
|
||||
AllZone.Stack.add(((Card) check).getSpellAbility()[0]);
|
||||
} else {
|
||||
AllZone.GameAction.playCardNoCost(((Card) check));
|
||||
}
|
||||
Pile2.remove((Card) check);
|
||||
}
|
||||
} else stop2 = true;
|
||||
}
|
||||
}
|
||||
|
||||
CardList chosen;
|
||||
if (q.equals(0))
|
||||
chosen = Pile1;
|
||||
else
|
||||
chosen = Pile2;
|
||||
|
||||
int numChosen = chosen.size();
|
||||
for( int i = 0; i < numChosen; i++) {
|
||||
Object check = GuiUtils.getChoiceOptional("Select spells to play in reverse order: ", chosen.toArray());
|
||||
if (check == null)
|
||||
break;
|
||||
|
||||
Card playing = (Card)check;
|
||||
if(playing.isLand()) {
|
||||
if(card.getController().canPlayLand()) {
|
||||
card.getController().playLand(playing);
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(null, "You can't play any more lands this turn.", "", JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
} else {
|
||||
AllZone.GameAction.playCardNoCost(playing);
|
||||
}
|
||||
chosen.remove(playing);
|
||||
}
|
||||
|
||||
}
|
||||
Pile1.clear();
|
||||
Pile2.clear();
|
||||
@@ -4732,23 +4705,17 @@ public class CardFactory_Sorceries {
|
||||
|
||||
public void resolve() {
|
||||
final Player thePlayer = card.getController();
|
||||
if (thePlayer.equals(AllZone.HumanPlayer))
|
||||
AllZone.GameInfo.addHumanMaxPlayNumberOfLands(3);
|
||||
else
|
||||
AllZone.GameInfo.addComputerMaxPlayNumberOfLands(3);
|
||||
thePlayer.addMaxLandsToPlay(3);
|
||||
|
||||
Command untilEOT = new Command()
|
||||
{
|
||||
private static final long serialVersionUID = 1665720009691293263L;
|
||||
|
||||
public void execute(){
|
||||
if (thePlayer.equals(AllZone.HumanPlayer))
|
||||
AllZone.GameInfo.addHumanMaxPlayNumberOfLands(-3);
|
||||
else
|
||||
AllZone.GameInfo.addComputerMaxPlayNumberOfLands(-3);
|
||||
thePlayer.addMaxLandsToPlay(-3);
|
||||
}
|
||||
};
|
||||
AllZone.EndOfTurn.addUntil(untilEOT);
|
||||
AllZone.EndOfTurn.addUntil(untilEOT);
|
||||
}
|
||||
};
|
||||
card.clearSpellAbility();
|
||||
@@ -4782,10 +4749,7 @@ public class CardFactory_Sorceries {
|
||||
|
||||
public void resolve() {
|
||||
final Player thePlayer = card.getController();
|
||||
if (thePlayer.equals(AllZone.HumanPlayer))
|
||||
AllZone.GameInfo.addHumanMaxPlayNumberOfLands(1);
|
||||
else
|
||||
AllZone.GameInfo.addComputerMaxPlayNumberOfLands(1);
|
||||
thePlayer.addMaxLandsToPlay(1);
|
||||
|
||||
Command untilEOT = new Command()
|
||||
{
|
||||
@@ -4793,10 +4757,7 @@ public class CardFactory_Sorceries {
|
||||
private static final long serialVersionUID = -2618916698575607634L;
|
||||
|
||||
public void execute(){
|
||||
if (thePlayer.equals(AllZone.HumanPlayer))
|
||||
AllZone.GameInfo.addHumanMaxPlayNumberOfLands(-1);
|
||||
else
|
||||
AllZone.GameInfo.addComputerMaxPlayNumberOfLands(-1);
|
||||
thePlayer.addMaxLandsToPlay(-1);
|
||||
}
|
||||
};
|
||||
AllZone.EndOfTurn.addUntil(untilEOT);
|
||||
|
||||
@@ -27,6 +27,8 @@ public class ComputerUtil
|
||||
if(canPayCost(all[i]) && all[i].canPlay() && all[i].canPlayAI())
|
||||
{
|
||||
AllZone.Stack.freezeStack();
|
||||
|
||||
// todo(sol) this conditional will be removed when Stack Zone is in
|
||||
if(all[i].isSpell() && AllZone.GameAction.isCardInZone(all[i].getSourceCard(),AllZone.Computer_Hand))
|
||||
AllZone.Computer_Hand.remove(all[i].getSourceCard());
|
||||
|
||||
@@ -547,17 +549,17 @@ public class ComputerUtil
|
||||
//plays a land if one is available
|
||||
static public void chooseLandsToPlay()
|
||||
{
|
||||
Player computer = AllZone.ComputerPlayer;
|
||||
ArrayList<Card> landList = PlayerZoneUtil.getCardType(AllZone.Computer_Hand, "Land");
|
||||
|
||||
if (AllZoneUtil.getPlayerCardsInPlay(AllZone.ComputerPlayer, "Crucible of Worlds").size() > 0)
|
||||
if (AllZoneUtil.getPlayerCardsInPlay(computer, "Crucible of Worlds").size() > 0)
|
||||
{
|
||||
CardList lands = AllZoneUtil.getPlayerTypeInGraveyard(AllZone.ComputerPlayer, "Land");
|
||||
CardList lands = AllZoneUtil.getPlayerTypeInGraveyard(computer, "Land");
|
||||
for (Card crd : lands)
|
||||
landList.add(crd);
|
||||
}
|
||||
|
||||
while(!landList.isEmpty() && (AllZone.GameInfo.computerNumberLandPlaysLeft() > 0 ||
|
||||
AllZoneUtil.getPlayerCardsInPlay(AllZone.ComputerPlayer, "Fastbond").size() > 0)){
|
||||
|
||||
while(!landList.isEmpty() && computer.canPlayLand()){
|
||||
// play as many lands as you can
|
||||
int ix = 0;
|
||||
while (landList.get(ix).isReflectedLand() && (ix+1 < landList.size())) {
|
||||
@@ -567,21 +569,12 @@ public class ComputerUtil
|
||||
|
||||
Card land = landList.get(ix);
|
||||
landList.remove(ix);
|
||||
playLand(land, AllZone.getZone(land));
|
||||
computer.playLand(land);
|
||||
|
||||
AllZone.GameAction.checkStateEffects();
|
||||
}
|
||||
}
|
||||
|
||||
static public void playLand(Card land, PlayerZone zone)
|
||||
{
|
||||
AllZone.GameAction.moveToPlay(land);
|
||||
/*zone.remove(land);
|
||||
AllZone.Computer_Battlefield.add(land);*/
|
||||
CardFactoryUtil.playLandEffects(land);
|
||||
AllZone.GameInfo.incrementComputerPlayedLands();
|
||||
}
|
||||
|
||||
static public Card getCardPreference(Card activate, String pref, CardList typeList){
|
||||
String[] prefValid = activate.getSVar("AIPreference").split("\\$");
|
||||
if (prefValid[0].equals(pref)){
|
||||
|
||||
@@ -2223,9 +2223,6 @@ public class GameAction {
|
||||
// AllZone.Computer = new ComputerAI_Input(new ComputerAI_General());
|
||||
Constant.Quest.fantasyQuest[0] = false;
|
||||
|
||||
AllZone.GameInfo.setComputerMaxPlayNumberOfLands(1);
|
||||
AllZone.GameInfo.setHumanMaxPlayNumberOfLands(1);
|
||||
|
||||
AllZone.GameInfo.setPreventCombatDamageThisTurn(false);
|
||||
AllZone.GameInfo.setHumanNumberOfTimesMulliganed(0);
|
||||
AllZone.GameInfo.setHumanMulliganedToZero(false);
|
||||
@@ -2649,7 +2646,7 @@ public class GameAction {
|
||||
SpellAbility[] abilities = canPlaySpellAbility(c.getSpellAbility());
|
||||
ArrayList<String> choices = new ArrayList<String>();
|
||||
|
||||
if(c.isLand() && isCardInZone(c, AllZone.Human_Hand) && CardFactoryUtil.canHumanPlayLand())
|
||||
if(c.isLand() && isCardInZone(c, AllZone.Human_Hand) && AllZone.HumanPlayer.canPlayLand())
|
||||
choices.add("Play land");
|
||||
|
||||
for(SpellAbility sa:abilities) {
|
||||
@@ -2673,7 +2670,7 @@ public class GameAction {
|
||||
return false;
|
||||
|
||||
if(choice.equals("Play land")){
|
||||
playLand(c, AllZone.Human_Hand);
|
||||
AllZone.HumanPlayer.playLand(c);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2684,18 +2681,7 @@ public class GameAction {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static public void playLand(Card land, PlayerZone zone)
|
||||
{
|
||||
if (CardFactoryUtil.canHumanPlayLand()){
|
||||
AllZone.GameAction.moveToPlay(land);
|
||||
/*zone.remove(land);
|
||||
AllZone.Human_Battlefield.add(land);*/
|
||||
CardFactoryUtil.playLandEffects(land);
|
||||
AllZone.GameInfo.incrementHumanPlayedLands();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void playCardNoCost(Card c) {
|
||||
//SpellAbility[] choices = (SpellAbility[]) c.getSpells().toArray();
|
||||
ArrayList<SpellAbility> choices = c.getBasicSpells();
|
||||
|
||||
@@ -3,12 +3,6 @@ package forge;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class GameInfo {
|
||||
private int computerMaxPlayNumberOfLands = 1;
|
||||
private int humanMaxPlayNumberOfLands = 1;
|
||||
|
||||
private int computerLandsPlayedThisTurn = 0;
|
||||
private int humanLandsPlayedThisTurn = 0;
|
||||
|
||||
private boolean computerStartedThisGame = false;
|
||||
|
||||
private int humanNumberOfTimesMulliganed;
|
||||
@@ -20,68 +14,6 @@ public class GameInfo {
|
||||
|
||||
private ArrayList<Card_Color> globalColorChanges = new ArrayList<Card_Color>();
|
||||
|
||||
public void setComputerMaxPlayNumberOfLands(int n) {
|
||||
computerMaxPlayNumberOfLands = n;
|
||||
}
|
||||
|
||||
public void addComputerMaxPlayNumberOfLands(int n)
|
||||
{
|
||||
computerMaxPlayNumberOfLands += n;
|
||||
}
|
||||
|
||||
public void setHumanMaxPlayNumberOfLands(int n) {
|
||||
humanMaxPlayNumberOfLands = n;
|
||||
}
|
||||
|
||||
public void addHumanMaxPlayNumberOfLands(int n)
|
||||
{
|
||||
humanMaxPlayNumberOfLands += n;
|
||||
}
|
||||
|
||||
public void setComputerPlayedLands(int n) {
|
||||
computerLandsPlayedThisTurn = n;
|
||||
}
|
||||
|
||||
public int getComputerPlayedLands() {
|
||||
return computerLandsPlayedThisTurn;
|
||||
}
|
||||
|
||||
public void incrementComputerPlayedLands()
|
||||
{
|
||||
computerLandsPlayedThisTurn++;
|
||||
}
|
||||
|
||||
public void setHumanPlayedLands(int n) {
|
||||
humanLandsPlayedThisTurn = n;
|
||||
}
|
||||
|
||||
public int getHumanPlayedLands() {
|
||||
return humanLandsPlayedThisTurn;
|
||||
}
|
||||
|
||||
public void incrementHumanPlayedLands()
|
||||
{
|
||||
humanLandsPlayedThisTurn++;
|
||||
}
|
||||
|
||||
public int computerNumberLandPlaysLeft()
|
||||
{
|
||||
return computerMaxPlayNumberOfLands - computerLandsPlayedThisTurn;
|
||||
}
|
||||
|
||||
public int humanNumberLandPlaysLeft()
|
||||
{
|
||||
return humanMaxPlayNumberOfLands - humanLandsPlayedThisTurn;
|
||||
}
|
||||
|
||||
public boolean computerPlayedFirstLandThisTurn() {
|
||||
return (computerLandsPlayedThisTurn > 0);
|
||||
}
|
||||
|
||||
public boolean humanPlayedFirstLandThisTurn() {
|
||||
return (humanLandsPlayedThisTurn > 0);
|
||||
}
|
||||
|
||||
public int getHumanNumberOfTimesMulliganed()
|
||||
{
|
||||
return humanNumberOfTimesMulliganed;
|
||||
|
||||
@@ -155,8 +155,8 @@ public class GuiDisplay3 extends JFrame implements CardContainer, Display, NewCo
|
||||
sa[1].setActivatingPlayer(AllZone.HumanPlayer);
|
||||
if(sa[1].canPlay() && !c.isUnCastable()) AllZone.GameAction.playSpellAbility(sa[1]);
|
||||
}
|
||||
else if (CardFactoryUtil.canHumanPlayLand())
|
||||
GameAction.playLand(c, AllZone.Human_Graveyard);
|
||||
else // PlayLand checks if the land can be played
|
||||
AllZone.HumanPlayer.playLand(c);
|
||||
}
|
||||
};
|
||||
COMPUTER_GRAVEYARD_ACTION = new ZoneAction(AllZone.Computer_Graveyard, COMPUTER_GRAVEYARD);
|
||||
|
||||
@@ -149,8 +149,8 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
||||
sa[1].setActivatingPlayer(AllZone.HumanPlayer);
|
||||
if(sa[1].canPlay() && !c.isUnCastable()) AllZone.GameAction.playSpellAbility(sa[1]);
|
||||
}
|
||||
else if (CardFactoryUtil.canHumanPlayLand())
|
||||
GameAction.playLand(c, AllZone.Human_Graveyard);
|
||||
else // PlayLand checks if the land can be played
|
||||
AllZone.HumanPlayer.playLand(c);
|
||||
}
|
||||
};
|
||||
COMPUTER_GRAVEYARD_ACTION = new ZoneAction(AllZone.Computer_Graveyard, COMPUTER_GRAVEYARD);
|
||||
|
||||
@@ -143,10 +143,7 @@ public class Phase extends MyObservable
|
||||
PlayerCreatureSpellCount = 0;
|
||||
ComputerSpellCount = 0;
|
||||
ComputerCreatureSpellCount = 0;
|
||||
if (playerTurn.isHuman())
|
||||
AllZone.GameInfo.setHumanPlayedLands(0);
|
||||
else
|
||||
AllZone.GameInfo.setComputerPlayedLands(0);
|
||||
playerTurn.setNumLandsPlayed(0);
|
||||
}
|
||||
|
||||
public void handleBeginPhase(){
|
||||
|
||||
@@ -26,6 +26,9 @@ public abstract class Player extends MyObservable{
|
||||
protected int nTurns = 0;
|
||||
protected boolean skipNextUntap = false;
|
||||
|
||||
protected int maxLandsToPlay = 1;
|
||||
protected int numLandsPlayed = 0;
|
||||
|
||||
protected Card lastDrawnCard;
|
||||
protected int numDrawnThisTurn = 0;
|
||||
protected CardList slowtripList = new CardList();
|
||||
@@ -49,6 +52,8 @@ public abstract class Player extends MyObservable{
|
||||
altLose = false;
|
||||
winCondition = "";
|
||||
loseCondition = "";
|
||||
maxLandsToPlay = 1;
|
||||
numLandsPlayed = 0;
|
||||
|
||||
handSizeOperations = new ArrayList<HandSizeOp>();
|
||||
}
|
||||
@@ -66,6 +71,8 @@ public abstract class Player extends MyObservable{
|
||||
altLose = false;
|
||||
winCondition = "";
|
||||
loseCondition = "";
|
||||
maxLandsToPlay = 1;
|
||||
numLandsPlayed = 0;
|
||||
this.updateObservers();
|
||||
}
|
||||
|
||||
@@ -745,6 +752,19 @@ public abstract class Player extends MyObservable{
|
||||
}
|
||||
///////////////////////////////
|
||||
|
||||
public void playLand(Card land){
|
||||
if (canPlayLand()){
|
||||
AllZone.GameAction.moveToPlay(land);
|
||||
CardFactoryUtil.playLandEffects(land);
|
||||
numLandsPlayed++;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canPlayLand(){
|
||||
return Phase.canCastSorcery(this) && (numLandsPlayed < maxLandsToPlay ||
|
||||
AllZoneUtil.getPlayerCardsInPlay(this, "Fastbond").size() > 0);
|
||||
}
|
||||
|
||||
///////////////////////////////
|
||||
////
|
||||
//// properties about the player and his/her cards/game status
|
||||
@@ -1003,6 +1023,26 @@ public abstract class Player extends MyObservable{
|
||||
return channelCard;
|
||||
}
|
||||
|
||||
public int getMaxLandsToPlay(){
|
||||
return maxLandsToPlay;
|
||||
}
|
||||
|
||||
public void setMaxLandsToPlay(int n){
|
||||
maxLandsToPlay = n;
|
||||
}
|
||||
|
||||
public void addMaxLandsToPlay(int n){
|
||||
maxLandsToPlay += n;
|
||||
}
|
||||
|
||||
public int getNumLandsPlayed(){
|
||||
return numLandsPlayed;
|
||||
}
|
||||
|
||||
public void setNumLandsPlayed(int n){
|
||||
numLandsPlayed = n;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//
|
||||
// Clash
|
||||
|
||||
@@ -33,7 +33,7 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone {
|
||||
//cannot use addComesIntoPlayCommand - trigger might be set to false;
|
||||
// Keep track of max lands can play per turn
|
||||
int addMax = 0;
|
||||
boolean isHuman = c.getController().equals(AllZone.HumanPlayer);
|
||||
|
||||
boolean adjustLandPlays = false;
|
||||
boolean eachPlayer = false;
|
||||
|
||||
@@ -55,13 +55,11 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone {
|
||||
|
||||
if (adjustLandPlays){
|
||||
if (eachPlayer){
|
||||
AllZone.GameInfo.addHumanMaxPlayNumberOfLands(addMax);
|
||||
AllZone.GameInfo.addComputerMaxPlayNumberOfLands(addMax);
|
||||
AllZone.HumanPlayer.addMaxLandsToPlay(addMax);
|
||||
AllZone.ComputerPlayer.addMaxLandsToPlay(addMax);
|
||||
}
|
||||
else if (isHuman)
|
||||
AllZone.GameInfo.addHumanMaxPlayNumberOfLands(addMax);
|
||||
else
|
||||
AllZone.GameInfo.addComputerMaxPlayNumberOfLands(addMax);
|
||||
c.getController().addMaxLandsToPlay(addMax);
|
||||
}
|
||||
|
||||
if(trigger) {
|
||||
@@ -398,7 +396,7 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone {
|
||||
|
||||
// Keep track of max lands can play per turn
|
||||
int addMax = 0;
|
||||
boolean isHuman = c.getController().equals(AllZone.HumanPlayer);
|
||||
|
||||
boolean adjustLandPlays = false;
|
||||
boolean eachPlayer = false;
|
||||
|
||||
@@ -419,13 +417,11 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone {
|
||||
|
||||
if (adjustLandPlays){
|
||||
if (eachPlayer){
|
||||
AllZone.GameInfo.addHumanMaxPlayNumberOfLands(addMax);
|
||||
AllZone.GameInfo.addComputerMaxPlayNumberOfLands(addMax);
|
||||
AllZone.HumanPlayer.addMaxLandsToPlay(addMax);
|
||||
AllZone.ComputerPlayer.addMaxLandsToPlay(addMax);
|
||||
}
|
||||
else if (isHuman)
|
||||
AllZone.GameInfo.addHumanMaxPlayNumberOfLands(addMax);
|
||||
else
|
||||
AllZone.GameInfo.addComputerMaxPlayNumberOfLands(addMax);
|
||||
c.getController().addMaxLandsToPlay(addMax);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user