mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
- Added playerTurn, a string to keep track of whose turn
- Replaced getLastPlayerToDraw with isPlayerTurn in a few locations to play nice with cards that skip draw phases. Note: Whenever keyword uses getLastPlayerToDraw but wasn't sure what it was doing. Probably should use isPlayerTurn instead.
This commit is contained in:
@@ -16241,7 +16241,7 @@ public class CardFactory implements NewConstants {
|
||||
|
||||
@Override
|
||||
public boolean canPlay() {
|
||||
if(AllZone.Human_Life.getLife() >= 5 && AllZone.GameAction.getLastPlayerToDraw().equals(Constant.Player.Human) && AllZone.GameAction.isCardInPlay(card) && super.canPlay())
|
||||
if(AllZone.Human_Life.getLife() >= 5 && AllZone.GameAction.isPlayerTurn(Constant.Player.Human) && super.canPlay())
|
||||
return true;
|
||||
else return false;
|
||||
}
|
||||
@@ -16249,7 +16249,7 @@ public class CardFactory implements NewConstants {
|
||||
@Override
|
||||
public boolean canPlayAI() {
|
||||
if (card.getController().equals(Constant.Player.Human) && AllZone.Computer_Life.getLife() >= 9 &&
|
||||
AllZone.GameAction.getLastPlayerToDraw().equals(Constant.Player.Computer) &&
|
||||
AllZone.GameAction.isPlayerTurn(Constant.Player.Computer) &&
|
||||
AllZone.GameAction.isCardInPlay(card))
|
||||
return true;
|
||||
else return false;
|
||||
@@ -17174,7 +17174,7 @@ public class CardFactory implements NewConstants {
|
||||
public boolean canPlay() {
|
||||
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController());
|
||||
|
||||
return AllZone.GameAction.isCardInZone(card, grave) && AllZone.GameAction.getLastPlayerToDraw().equals(card.getController());
|
||||
return AllZone.GameAction.isCardInZone(card, grave) && AllZone.GameAction.isPlayerTurn(card.getController());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -4219,15 +4219,13 @@ public class CardFactoryUtil {
|
||||
public static boolean canHumanPlayLand(){
|
||||
// LandsToPlay Left or Fastbond in play, Human's turn, Stack is Empty, In Main Phase
|
||||
return (AllZone.GameInfo.humanNumberLandPlaysLeft() > 0 || CardFactoryUtil.getCards("Fastbond", "Human").size() > 0) &&
|
||||
AllZone.GameAction.getLastPlayerToDraw().equals("Human") && (AllZone.Stack.size() == 0) &&
|
||||
(AllZone.Phase.getPhase().equals(Constant.Phase.Main1) || AllZone.Phase.getPhase().equals(Constant.Phase.Main2));
|
||||
Phase.canCastSorcery("Human");
|
||||
}
|
||||
|
||||
public static boolean canComputerPlayLand(){
|
||||
// LandsToPlay Left or Fastbond in play, Computer's turn, Stack is Empty, In Main Phase
|
||||
return (AllZone.GameInfo.computerNumberLandPlaysLeft() > 0 || CardFactoryUtil.getCards("Fastbond", "Computer").size() > 0) &&
|
||||
AllZone.GameAction.getLastPlayerToDraw().equals("Computer") && (AllZone.Stack.size() == 0) &&
|
||||
(AllZone.Phase.getPhase().equals(Constant.Phase.Main1) || AllZone.Phase.getPhase().equals(Constant.Phase.Main2));
|
||||
Phase.canCastSorcery("Computer");
|
||||
}
|
||||
|
||||
public static void playLandEffects(Card c){
|
||||
|
||||
@@ -11847,7 +11847,7 @@ public class CardFactory_Creatures {
|
||||
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController());
|
||||
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController());
|
||||
|
||||
return AllZone.GameAction.isCardInZone(card, grave) && AllZone.GameAction.getLastPlayerToDraw().equals(card.getController()) && hand.size() > 0;
|
||||
return AllZone.GameAction.isCardInZone(card, grave) && AllZone.GameAction.isPlayerTurn(card.getController()) && hand.size() > 0;
|
||||
}
|
||||
|
||||
};
|
||||
@@ -11880,7 +11880,7 @@ public class CardFactory_Creatures {
|
||||
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController());
|
||||
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController());
|
||||
|
||||
return AllZone.GameAction.isCardInZone(card, grave) && AllZone.GameAction.getLastPlayerToDraw().equals(card.getController()) && hand.size() > 0;
|
||||
return AllZone.GameAction.isCardInZone(card, grave) && AllZone.GameAction.isPlayerTurn(card.getController()) && hand.size() > 0;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -2193,6 +2193,15 @@ public class GameAction {
|
||||
removed.add(c);
|
||||
}
|
||||
|
||||
private String playerTurn = Constant.Player.Human;
|
||||
public boolean isPlayerTurn(String player) {
|
||||
return playerTurn.equals(player);
|
||||
}
|
||||
|
||||
public void setPlayerTurn(String s) {
|
||||
playerTurn = s;
|
||||
}
|
||||
|
||||
|
||||
private boolean shouldDraw = false; // Starts false to skip first draw
|
||||
private String lastPlayerToDraw = Constant.Player.Human;
|
||||
|
||||
@@ -15,6 +15,8 @@ public class Input_Draw extends Input {
|
||||
return;
|
||||
}
|
||||
|
||||
AllZone.GameInfo.setHumanPlayedLands(0);
|
||||
|
||||
//check if human should skip their draw phase
|
||||
CardList humanCards = new CardList();
|
||||
humanCards.addAll(AllZone.Human_Play.getCards());
|
||||
@@ -22,7 +24,6 @@ public class Input_Draw extends Input {
|
||||
|| humanCards.containsName("Yawgmoth's Bargain");
|
||||
|
||||
if(AllZone.Phase.getPhase().equals(Constant.Phase.Draw) && humanSkipsDrawPhase) {
|
||||
AllZone.GameInfo.setHumanPlayedLands(0);
|
||||
AllZone.Phase.setNeedToNextPhase(true);
|
||||
|
||||
} else { //continue with draw phase
|
||||
@@ -52,7 +53,6 @@ public class Input_Draw extends Input {
|
||||
if(drawCard && AllZone.Phase.getTurn() > 1) AllZone.GameAction.drawCard(Constant.Player.Human);
|
||||
|
||||
if(AllZone.Phase.getPhase().equals(Constant.Phase.Draw)) {
|
||||
AllZone.GameInfo.setHumanPlayedLands(0);
|
||||
|
||||
//AllZone.Phase.nextPhase();
|
||||
//for debugging: System.out.println("need to nextPhase(from Input_Draw on human's draw) = true");
|
||||
|
||||
@@ -12,6 +12,8 @@ public class Input_Untap extends Input {
|
||||
PlayerZone p = AllZone.getZone(Constant.Zone.Play, AllZone.Phase.getActivePlayer());
|
||||
Card[] c = p.getCards();
|
||||
|
||||
AllZone.GameAction.setPlayerTurn(AllZone.Phase.getActivePlayer());
|
||||
|
||||
if (AllZone.Phase.getTurn() != 1 &&
|
||||
!(AllZone.Phase.getActivePlayer().equals(Constant.Player.Human) && AllZone.Phase.getTurn() == 2) )
|
||||
{
|
||||
|
||||
@@ -30,8 +30,8 @@ public class Phase extends MyObservable
|
||||
private String phases[][] =
|
||||
{
|
||||
//human's turn
|
||||
{Constant.Player.Human , Constant.Phase.Untap} ,
|
||||
// {Constant.Player.Human , Constant.Phase.Upkeep} ,
|
||||
{Constant.Player.Human, Constant.Phase.Untap},
|
||||
// {Constant.Player.Human, Constant.Phase.Upkeep},
|
||||
{Constant.Player.Human, Constant.Phase.Draw},
|
||||
{Constant.Player.Human, Constant.Phase.Main1},
|
||||
{Constant.Player.Human, Constant.Phase.Combat_Declare_Attackers},
|
||||
@@ -45,12 +45,13 @@ public class Phase extends MyObservable
|
||||
{Constant.Player.Human, Constant.Phase.End_Of_Combat},
|
||||
{Constant.Player.Human, Constant.Phase.Main2},
|
||||
{Constant.Player.Human, Constant.Phase.At_End_Of_Turn},
|
||||
// {Constant.Player.Computer , Constant.Phase.End_Of_Turn} ,
|
||||
// {Constant.Player.Computer , Constant.Phase.End_Of_Turn},
|
||||
{Constant.Player.Human, Constant.Phase.Until_End_Of_Turn},
|
||||
{Constant.Player.Human, Constant.Phase.Cleanup},
|
||||
|
||||
//computer's turn
|
||||
{Constant.Player.Computer, Constant.Phase.Untap},
|
||||
// {Constant.Player.Computer, Constant.Phase.Upkeep},
|
||||
{Constant.Player.Computer, Constant.Phase.Draw},
|
||||
{Constant.Player.Computer, Constant.Phase.Main1},
|
||||
{Constant.Player.Human, Constant.Phase.Combat_Before_Declare_Attackers_InstantAbility},
|
||||
@@ -405,6 +406,6 @@ public class Phase extends MyObservable
|
||||
public static boolean canCastSorcery(String player)
|
||||
{
|
||||
return (AllZone.Phase.getPhase().equals(Constant.Phase.Main2) || (AllZone.Phase.getPhase().equals(Constant.Phase.Main1)
|
||||
&& AllZone.GameAction.getLastPlayerToDraw().equals(player)) && AllZone.Stack.size() == 0);
|
||||
&& AllZone.GameAction.isPlayerTurn(player)) && AllZone.Stack.size() == 0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user