- Added all of the required checks into canPlayLand() so they can't be played illegally through alternate effects.

This commit is contained in:
jendave
2011-08-06 05:19:12 +00:00
parent 86d2743415
commit 4aa31e30d5
3 changed files with 11 additions and 7 deletions

View File

@@ -4189,11 +4189,17 @@ public class CardFactoryUtil {
} }
public static boolean canHumanPlayLand(){ public static boolean canHumanPlayLand(){
return (AllZone.GameInfo.humanNumberLandPlaysLeft() > 0 || CardFactoryUtil.getCards("Fastbond", "Human").size() > 0); // 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));
} }
public static boolean canComputerPlayLand(){ public static boolean canComputerPlayLand(){
return (AllZone.GameInfo.computerNumberLandPlaysLeft() > 0 || CardFactoryUtil.getCards("Fastbond", "Computer").size() > 0); // 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));
} }
public static void playLandEffects(Card c){ public static void playLandEffects(Card c){

View File

@@ -2738,8 +2738,7 @@ public class CardFactory_Creatures {
if(card.getController() == Constant.Player.Human) canPlayLand = CardFactoryUtil.canHumanPlayLand(); if(card.getController() == Constant.Player.Human) canPlayLand = CardFactoryUtil.canHumanPlayLand();
else canPlayLand = CardFactoryUtil.canComputerPlayLand(); else canPlayLand = CardFactoryUtil.canComputerPlayLand();
return (AllZone.GameAction.isCardInZone(card, play) && library.get(0).getType().contains("Land") && canPlayLand) return (AllZone.GameAction.isCardInZone(card, play) && library.get(0).getType().contains("Land") && canPlayLand);
&& (AllZone.Stack.size() == 0) && AllZone.GameAction.getLastPlayerToDraw().equals(card.getController());
} }
}; };
ability.setStackDescription(card.getController() + " - plays land from top of library."); ability.setStackDescription(card.getController() + " - plays land from top of library.");

View File

@@ -2235,9 +2235,8 @@ public class GameAction {
ArrayList<String> choices = new ArrayList<String>(); ArrayList<String> choices = new ArrayList<String>();
if(AllZone.Stack.size() == 0 && CardFactoryUtil.canHumanPlayLand() if(CardFactoryUtil.canHumanPlayLand())
&& (AllZone.Phase.getPhase().equals(Constant.Phase.Main1) || AllZone.Phase.getPhase().equals( choices.add("Play land");
Constant.Phase.Main2))) choices.add("Play land");
for(SpellAbility sa:sas) { for(SpellAbility sa:sas) {
if(sa.canPlay()) { if(sa.canPlay()) {