diff --git a/src/forge/AllZoneUtil.java b/src/forge/AllZoneUtil.java index 5e52b549715..a3a5a6cb4cd 100644 --- a/src/forge/AllZoneUtil.java +++ b/src/forge/AllZoneUtil.java @@ -120,7 +120,7 @@ public class AllZoneUtil { */ public static CardList getPlayerCardsInPlay(final Player player) { CardList cards = new CardList(); - if( player.equals(AllZone.HumanPlayer) || player.equals(AllZone.ComputerPlayer) ){ + if( player.isHuman() || player.isComputer() ){ PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, player); cards.addAll(play.getCards()); } @@ -284,7 +284,7 @@ public class AllZoneUtil { */ public static CardList getPlayerCardsInExile(final Player player) { CardList cards = new CardList(); - if( player.equals(AllZone.HumanPlayer) || player.equals(AllZone.ComputerPlayer) ){ + if( player.isHuman() || player.isComputer() ){ PlayerZone removed = AllZone.getZone(Constant.Zone.Exile, player); cards.addAll(removed.getCards()); } @@ -313,7 +313,7 @@ public class AllZoneUtil { */ public static CardList getPlayerCardsInLibrary(final Player player) { CardList cards = new CardList(); - if( player.equals(AllZone.HumanPlayer) || player.equals(AllZone.ComputerPlayer) ){ + if( player.isHuman() || player.isComputer() ){ PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player); cards.addAll(lib.getCards()); } @@ -334,7 +334,7 @@ public class AllZoneUtil { public static CardList getPlayerCardsInLibrary(final Player player, int numCards) { CardList cards = new CardList(); - if( player.equals(AllZone.HumanPlayer) || player.equals(AllZone.ComputerPlayer) ){ + if( player.isHuman() || player.isComputer() ){ PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player); if (lib.size() <= numCards) diff --git a/src/forge/CombatUtil.java b/src/forge/CombatUtil.java index b1133f93e9d..ebde8d269f7 100644 --- a/src/forge/CombatUtil.java +++ b/src/forge/CombatUtil.java @@ -1528,7 +1528,7 @@ public class CombatUtil { soldiers = soldiers.getType("Soldier"); if(soldiers.size() > 0) { - if(c.getController().equals(AllZone.HumanPlayer)) { + if(c.getController().isHuman()) { Object o = GuiUtils.getChoiceOptional("Pick a soldier to put onto the battlefield", soldiers.toArray()); if(o != null) { @@ -1540,7 +1540,7 @@ public class CombatUtil { card.setCreatureAttackedThisCombat(true); } - } else if(c.getController().equals(AllZone.ComputerPlayer)) { + } else if(c.getController().isComputer()) { Card card = CardFactoryUtil.AI_getBestCreature(soldiers); if (card != null){ AllZone.GameAction.moveToPlay(card); @@ -1602,7 +1602,7 @@ public class CombatUtil { ability.setStackDescription(sb.toString()); setLorthosCancelled(false); - if(c.getController().equals(AllZone.HumanPlayer)) { + if(c.getController().isHuman()) { AllZone.InputControl.setInput(new Input_PayManaCost_Ability("Activate " + c.getName() + "'s ability: " + "\r\n", ability.getManaCost(), paidCommand, unpaidCommand)); } else //computer diff --git a/src/forge/ComputerUtil_Attack2.java b/src/forge/ComputerUtil_Attack2.java index 464385e859d..b9019e00fa9 100644 --- a/src/forge/ComputerUtil_Attack2.java +++ b/src/forge/ComputerUtil_Attack2.java @@ -75,7 +75,7 @@ public class ComputerUtil_Attack2 { ArrayList registeredTriggers = AllZone.TriggerHandler.getRegisteredTriggers(); for(Trigger trigger : registeredTriggers) if (CombatUtil.combatTriggerWillTrigger(attacker,null,trigger, combat) - && trigger.getHostCard().getController().equals(AllZone.ComputerPlayer)) return true; + && trigger.getHostCard().getController().isComputer()) return true; return false; } diff --git a/src/forge/GameAction.java b/src/forge/GameAction.java index cf448ca017e..10036fe9dd7 100644 --- a/src/forge/GameAction.java +++ b/src/forge/GameAction.java @@ -256,11 +256,11 @@ public class GameAction { boolean shouldRecoverForAI = false; boolean shouldRecoverForHuman = false; - if(c.getOwner().equals(AllZone.HumanPlayer)) + if(c.getOwner().isHuman()) { shouldRecoverForHuman = GameActionUtil.showYesNoDialog(recoverable, question.toString()); } - else if(c.getOwner().equals(AllZone.ComputerPlayer)) + else if(c.getOwner().isComputer()) { shouldRecoverForAI = ComputerUtil.canPayCost(abRecover); } @@ -1001,7 +1001,7 @@ public class GameAction { final SpellAbility F_SpellAbility = SpellAbility[0]; if(k[7].contains("Choice_Instant") && k[4] != "Null") { - if(card.getController().equals(AllZone.HumanPlayer)) { + if(card.getController().isHuman()) { Object[] possibleValues = {"Yes", "No"}; Object q = JOptionPane.showOptionDialog(null, "Activate - " + card.getName(),card.getName() + " Ability", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, @@ -1084,7 +1084,7 @@ public class GameAction { public void execute() { String WhichInput = F_k[5].split("/")[1]; if(WhichInput.equals("Creature")) - if(F_card.getController().equals(AllZone.HumanPlayer)) + if(F_card.getController().isHuman()) AllZone.InputControl.setInput(CardFactoryUtil.input_targetCreature(F_SpellAbility, GetTargetsCommand)); else { CardList PossibleTargets = new CardList(); @@ -1094,7 +1094,7 @@ public class GameAction { if(Whenever_AI_GoodEffect(F_k)) { PossibleTargets = PossibleTargets.filter(new CardListFilter() { public boolean addCard(Card c) { - if(c.getController().equals(AllZone.ComputerPlayer)) return true; + if(c.getController().isComputer()) return true; return false; } }); @@ -1106,7 +1106,7 @@ public class GameAction { } else { PossibleTargets = PossibleTargets.filter(new CardListFilter() { public boolean addCard(Card c) { - if(c.getController().equals(AllZone.HumanPlayer)) return true; + if(c.getController().isHuman()) return true; return false; } }); @@ -1119,7 +1119,7 @@ public class GameAction { } if(WhichInput.equals("Player")) - if(F_card.getController().equals(AllZone.HumanPlayer)) + if(F_card.getController().isHuman()) AllZone.InputControl.setInput(CardFactoryUtil.input_targetPlayer(F_SpellAbility, GetTargetsCommand)); else { if(Whenever_AI_GoodEffect(F_k)) { @@ -1183,13 +1183,13 @@ public class GameAction { } Restriction_Count[0]++; } - if(F_card.getController().equals(AllZone.HumanPlayer)) + if(F_card.getController().isHuman()) AllZone.InputControl.setInput(CardFactoryUtil.input_targetSpecific(F_SpellAbility, Cards_inPlay, "Select a Valid Card", GetTargetsCommand, true, true)); else { if(Whenever_AI_GoodEffect(F_k)) { Cards_inPlay = Cards_inPlay.filter(new CardListFilter() { public boolean addCard(Card c) { - if(c.getController().equals(AllZone.ComputerPlayer)) return true; + if(c.getController().isComputer()) return true; return false; } }); @@ -1201,7 +1201,7 @@ public class GameAction { } else { Cards_inPlay = Cards_inPlay.filter(new CardListFilter() { public boolean addCard(Card c) { - if(c.getController().equals(AllZone.HumanPlayer)) return true; + if(c.getController().isHuman()) return true; return false; } }); @@ -1683,7 +1683,7 @@ public class GameAction { } } else if(AllZone.GameAction.isCardInZone(F_card,Required_Zone) || F_Zones.equals("Any")) { - if(F_card.getController().equals(AllZone.HumanPlayer)) { + if(F_card.getController().isHuman()) { for(int z = 0; z < Targets_Multi.length; z++) { if(!(Targets_Multi[z].equals(AllZone.HumanPlayer) || Targets_Multi[z].equals(AllZone.ComputerPlayer))) { if(AllZoneUtil.isCardInPlay((Card) Targets_Multi[z]) @@ -1697,7 +1697,7 @@ public class GameAction { } } } - if(F_card.getController().equals(AllZone.ComputerPlayer)) AllZone.HumanPlayer.addDamage(F_Amount[0]*F_Multiple_Targets, F_card); + if(F_card.getController().isComputer()) AllZone.HumanPlayer.addDamage(F_Amount[0]*F_Multiple_Targets, F_card); } } }; @@ -1706,7 +1706,7 @@ public class GameAction { Command_Effects[F_Target] = Proper_resolve; if(Check_if_All_Targets(F_card, F_k).size() > 0) StackDescription = StackDescription + "deals " + F_Amount[0]*F_Multiple_Targets + " damage" + " to all specified permanents/players"; else if(F_Multiple_Targets != 1) StackDescription = StackDescription + "deals " + F_Amount[0]*F_Multiple_Targets + " damage" + " divided among up to " + Multiple_Targets + " target creatures and/or players"; - else if(F_card.getController().equals(AllZone.ComputerPlayer)) StackDescription = StackDescription + "targeting Human "; + else if(F_card.getController().isComputer()) StackDescription = StackDescription + "targeting Human "; else StackDescription = StackDescription + "targeting " + ((F_TargetCard[y] != null)? F_TargetCard[y]:"") + ((F_TargetPlayer[y] != null)? F_TargetPlayer[y]:""); } @@ -1815,7 +1815,7 @@ public class GameAction { String SearchDescription = " "; boolean SearchLib = true; if(Keyword_Details[7].contains("Choice_Instant-SearchLibrary")) { - if(Source.getController().equals(AllZone.HumanPlayer)) { + if(Source.getController().isHuman()) { Object[] possibleValues = {"Yes", "No"}; Object q = JOptionPane.showOptionDialog(null, "Search Libraries?",Source.getName() + " F_SpellAbility", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, @@ -1946,7 +1946,7 @@ public class GameAction { String PayAmountParse = Keyword_Details[7]; S_Amount = PayAmountParse.split("/")[1]; - if(Source.getController().equals(AllZone.HumanPlayer)) { + if(Source.getController().isHuman()) { final Command paid = new Command() { private static final long serialVersionUID = 151367344511590317L; @@ -1971,7 +1971,7 @@ public class GameAction { PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, Source.getController()); CardList choice = new CardList(play.getCards()); choice = choice.getType(S_Amount); - if(Source.getController().equals(AllZone.HumanPlayer)) { + if(Source.getController().isHuman()) { AllZone.InputControl.setInput(CardFactoryUtil.Wheneverinput_sacrifice(ability, choice, "Select a " + S_Amount +" to sacrifice.",Proper_Resolve)); } /*else { if(choice.size() > 5) { @@ -1998,7 +1998,7 @@ public class GameAction { if(AllZoneUtil.isCardInZone(Required_Zone[0], Source) || Zones.equals("Any")) { if(Keyword_Details[7].equals("Yes_No")) { - if(Source.getController().equals(AllZone.HumanPlayer)) { + if(Source.getController().isHuman()) { Object[] possibleValues = {"Yes", "No"}; Object q = JOptionPane.showOptionDialog(null, "Activate - " + Source.getName(),Source.getName() + " Ability", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, @@ -2009,7 +2009,7 @@ public class GameAction { } } if(Keyword_Details[7].equals("Opponent_Yes_No")) { - if(!Source.getController().equals(AllZone.HumanPlayer)) { + if(!Source.getController().isHuman()) { Object[] possibleValues = {"Yes", "No"}; Object q = JOptionPane.showOptionDialog(null, "Activate - " + Source.getName(),Source.getName() + " Ability", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, @@ -2037,10 +2037,10 @@ public class GameAction { if(AllZoneUtil.isCardInZone(Required_Zone[0], Source) || Zones.equals("Any")) { if(Keyword_Details[6].equals("ASAP")) { - if(Keyword_Details[5].equals("InputType - CreatureORPlayer") && Source.getController().equals(AllZone.HumanPlayer)) { + if(Keyword_Details[5].equals("InputType - CreatureORPlayer") && Source.getController().isHuman()) { paidCommand.execute(); } - else if(Keyword_Details[5].equals("InputType - CreatureORPlayer") && Source.getController().equals(AllZone.ComputerPlayer)) + else if(Keyword_Details[5].equals("InputType - CreatureORPlayer") && Source.getController().isComputer()) AllZone.Stack.add(ability); else if(Keyword_Details[5].contains("NormalInput")) { paidCommand.execute(); @@ -3287,7 +3287,7 @@ public class GameAction { public void searchLibraryTwoLand(String type, Player player, String Zone1, boolean tapFirstLand, String Zone2, boolean tapSecondLand) { - if(player.equals(AllZone.HumanPlayer)) { + if(player.isHuman()) { humanSearchTwoLand(type, Zone1, tapFirstLand, Zone2, tapSecondLand); } else { aiSearchTwoLand(type, Zone1, tapFirstLand, Zone2, tapSecondLand); diff --git a/src/forge/GameActionUtil.java b/src/forge/GameActionUtil.java index e1443b76e36..90d391ee224 100644 --- a/src/forge/GameActionUtil.java +++ b/src/forge/GameActionUtil.java @@ -210,7 +210,7 @@ public class GameActionUtil { if (cascadedCard != null && !cascadedCard.isUnCastable()) { - if (cascadedCard.getController().equals(AllZone.HumanPlayer)) { + if (cascadedCard.getController().isHuman()) { StringBuilder title = new StringBuilder(); title.append(cascCard.getName()).append(" - Cascade Ability"); StringBuilder question = new StringBuilder(); @@ -270,11 +270,11 @@ public class GameActionUtil { Computer_ThrummingStone = Computer_ThrummingStone.getName("Thrumming Stone"); for (int i=0;i a = c.getKeyword(); for(int x = 0; x < a.size(); x++) @@ -320,7 +320,7 @@ public class GameActionUtil { for(int i = 0; i < RippleMax; i++) { if(RippledCards[i] != null && !RippledCards[i].isUnCastable()) { - if(RippledCards[i].getController().equals(AllZone.HumanPlayer)) { + if(RippledCards[i].getController().isHuman()) { Object[] possibleValues = {"Yes", "No"}; Object q = JOptionPane.showOptionDialog(null, "Cast " + RippledCards[i].getName() + "?", "Ripple", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, @@ -499,7 +499,7 @@ public class GameActionUtil { };//Input ability.setBeforePayMana(runtime); - if (controller.equals(AllZone.HumanPlayer)) + if (controller.isHuman()) AllZone.GameAction.playSpellAbility(ability); else { ability.chooseTargetAI(); @@ -594,7 +594,7 @@ public class GameActionUtil { } else target = AllZone.HumanPlayer; // check for target of spell/abilities should be here PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, target); CardList fullHand = new CardList(hand.getCards()); - if(fullHand.size() > 0 && target.equals(AllZone.ComputerPlayer)) GuiUtils.getChoice( + if(fullHand.size() > 0 && target.isComputer()) GuiUtils.getChoice( "Revealing hand", fullHand.toArray()); CardList discard = new CardList(hand.getCards()); discard = discard.filter(new CardListFilter() { @@ -896,7 +896,7 @@ public class GameActionUtil { final Ability destroyAbility = new Ability(c, c.getTabernacleUpkeepCost()) { @Override public void resolve() { - if(c.getController().equals(AllZone.HumanPlayer)) { + if(c.getController().isHuman()) { payManaDuringAbilityResolve(sb.toString(), c.getTabernacleUpkeepCost(), paidCommand, unpaidCommand); } else @@ -952,7 +952,7 @@ public class GameActionUtil { final Ability upkeepAbility = new Ability(c, c.getMagusTabernacleUpkeepCost()) { @Override public void resolve() { - if(c.getController().equals(AllZone.HumanPlayer)) { + if(c.getController().isHuman()) { payManaDuringAbilityResolve(sb.toString(), c.getMagusTabernacleUpkeepCost(), paidCommand, unpaidCommand); } else @@ -1011,7 +1011,7 @@ public class GameActionUtil { final Ability upkeepAbility = new Ability(c, c.getUpkeepCost()) { @Override public void resolve() { - if(c.getController().equals(AllZone.HumanPlayer)) { + if(c.getController().isHuman()) { payManaDuringAbilityResolve(sb.toString(), c.getUpkeepCost(), paidCommand, unpaidCommand); } else @@ -1058,7 +1058,7 @@ public class GameActionUtil { final Ability sacAbility = new Ability(c, "0") { @Override public void resolve() { - if(c.getController().equals(AllZone.HumanPlayer)) { + if(c.getController().isHuman()) { payManaDuringAbilityResolve(sb.toString(), c.getEchoCost(), paidCommand, unpaidCommand); } else //computer @@ -1165,7 +1165,7 @@ public class GameActionUtil { final Ability upkeepAbility = new Ability(c, c.getUpkeepCost()) { @Override public void resolve() { - if(c.getController().equals(AllZone.HumanPlayer)) { + if(c.getController().isHuman()) { payManaDuringAbilityResolve(sb.toString(), c.getUpkeepCost(), paidCommand, unpaidCommand); } else //computer @@ -1224,7 +1224,7 @@ public class GameActionUtil { final Ability upkeepAbility = new Ability(c, c.getUpkeepCost()) { @Override public void resolve() { - if(c.getController().equals(AllZone.HumanPlayer)) { + if(c.getController().isHuman()) { payManaDuringAbilityResolve(sb.toString(), c.getUpkeepCost(), paidCommand, unpaidCommand); } else //computer @@ -1288,7 +1288,7 @@ public class GameActionUtil { final Ability upkeepAbility = new Ability(c, c.getUpkeepCost()) { @Override public void resolve() { - if(c.getController().equals(AllZone.HumanPlayer)) { + if(c.getController().isHuman()) { payManaDuringAbilityResolve(sb.toString(), c.getUpkeepCost(), paidCommand, unpaidCommand); } @@ -1335,7 +1335,7 @@ public class GameActionUtil { final Ability sacrificeCreature = new Ability(abyss, "") { @Override public void resolve() { - if(player.equals(AllZone.HumanPlayer)) { + if(player.isHuman()) { if(abyss_getTargets(player, abyss).size() > 0) { AllZone.InputControl.setInput( new Input() { private static final long serialVersionUID = 4820011040853968644L; @@ -1346,7 +1346,7 @@ public class GameActionUtil { public void selectCard(Card selected, PlayerZone zone) { //probably need to restrict by controller also if(selected.isCreature() && !selected.isArtifact() && CardFactoryUtil.canTarget(abyss, selected) - && zone.is(Constant.Zone.Battlefield) && zone.getPlayer().equals(AllZone.HumanPlayer)) { + && zone.is(Constant.Zone.Battlefield) && zone.getPlayer().isHuman()) { AllZone.GameAction.destroyNoRegeneration(selected); stop(); } @@ -1489,7 +1489,7 @@ public class GameActionUtil { CardList artifacts = AllZoneUtil.getPlayerCardsInPlay(player); artifacts = artifacts.filter(AllZoneUtil.artifacts); - if(player.equals(AllZone.HumanPlayer)) { + if(player.isHuman()) { AllZone.InputControl.setInput( new Input() { private static final long serialVersionUID = -1698502376924356936L; public void showMessage() { @@ -1503,7 +1503,7 @@ public class GameActionUtil { public void selectCard(Card artifact, PlayerZone zone) { //probably need to restrict by controller also if(artifact.isArtifact() && zone.is(Constant.Zone.Battlefield) - && zone.getPlayer().equals(AllZone.HumanPlayer)) { + && zone.getPlayer().isHuman()) { AllZone.GameAction.sacrifice(artifact); stop(); } @@ -1555,7 +1555,7 @@ public class GameActionUtil { //TODO: this should handle the case where you sacrifice 2 LOTPs to each other CardList creatures = AllZoneUtil.getCreaturesInPlay(player); creatures.remove(c); - if(player.equals(AllZone.HumanPlayer)) { + if(player.isHuman()) { AllZone.InputControl.setInput(CardFactoryUtil.input_sacrificePermanent(creatures, c.getName()+" - Select a creature to sacrifice.")); } else { //computer @@ -1617,7 +1617,7 @@ public class GameActionUtil { if(creatures.size() > 0) { CardListUtil.sortAttackLowFirst(creatures); int power = creatures.get(0).getNetAttack(); - if(player.equals(AllZone.HumanPlayer)) { + if(player.isHuman()) { AllZone.InputControl.setInput(CardFactoryUtil.input_destroyNoRegeneration(getLowestPowerList(creatures), "Select creature with power: "+power+" to sacrifice.")); } else { //computer @@ -1642,7 +1642,7 @@ public class GameActionUtil { CardList options = getLowestPowerList(original); CardList humanCreatures = options.filter(new CardListFilter() { public boolean addCard(Card c) { - return c.getController().equals(AllZone.HumanPlayer); + return c.getController().isHuman(); } }); if(humanCreatures.isEmpty()) { @@ -1698,7 +1698,7 @@ public class GameActionUtil { } //end resolve() }; //end noPay ability - if (c.getController().equals(AllZone.HumanPlayer)) { + if (c.getController().isHuman()) { String question = "Pay Demonic Hordes upkeep cost?"; if (GameActionUtil.showYesNoDialog(c, question)) { final Ability pay = new Ability(c, "0") { @@ -1726,7 +1726,7 @@ public class GameActionUtil { } } //end human else { //computer - if((c.getController().equals(AllZone.ComputerPlayer) && (ComputerUtil.canPayCost(noPay)))) { + if((c.getController().isComputer() && (ComputerUtil.canPayCost(noPay)))) { final Ability computerPay = new Ability(c, "0") { private static final long serialVersionUID = 4820011440852868644L; public void resolve() { @@ -1778,7 +1778,7 @@ public class GameActionUtil { if (validTargets.size() == 0) return; - if (player.equals(AllZone.HumanPlayer)) + if (player.isHuman()) { Object o = GuiUtils.getChoiceOptional("Select creature for Wall of Reverence life gain", validTargets.toArray()); if (o != null) { @@ -2127,7 +2127,7 @@ public class GameActionUtil { sb.append(c.getName()).append(" - add one mana of any color to your mana pool."); ability.setStackDescription(sb.toString()); - if(c.getController().equals(AllZone.HumanPlayer)) { + if(c.getController().isHuman()) { if(showLandfallDialog(c)) AllZone.Stack.addSimultaneousStackEntry(ability); } else{ @@ -2307,7 +2307,7 @@ public class GameActionUtil { return; } - if(src.getController().equals(AllZone.HumanPlayer)) { + if(src.getController().isHuman()) { Object o = GuiUtils.getChoiceOptional("Select target card", list.toArray()); if(o != null) { ability.setTargetCard((Card) o); @@ -2511,7 +2511,7 @@ public class GameActionUtil { final Player player = crd.getController(); final Player opponent = player.getOpponent(); - if(opponent.equals(AllZone.HumanPlayer)) + if(opponent.isHuman()) AllZone.HumanPlayer.addPoisonCounters(poison); else AllZone.ComputerPlayer.addPoisonCounters(poison); @@ -2611,7 +2611,7 @@ public class GameActionUtil { private static void playerCombatDamage_Rootwater_Thief(Card c) { SpellAbility[] sa = c.getSpellAbility(); - if(c.getController().equals(AllZone.HumanPlayer)) AllZone.GameAction.playSpellAbility(sa[2]); //because sa[1] is the kpump u: flying + if(c.getController().isHuman()) AllZone.GameAction.playSpellAbility(sa[2]); //because sa[1] is the kpump u: flying else ComputerUtil.playNoStack(sa[2]); @@ -2619,14 +2619,14 @@ public class GameActionUtil { private static void playerCombatDamage_Treva(Card c) { SpellAbility[] sa = c.getSpellAbility(); - if(c.getController().equals(AllZone.HumanPlayer)) AllZone.GameAction.playSpellAbility(sa[1]); + if(c.getController().isHuman()) AllZone.GameAction.playSpellAbility(sa[1]); else ComputerUtil.playNoStack(sa[1]); } private static void playerCombatDamage_Rith(Card c) { SpellAbility[] sa = c.getSpellAbility(); - if(c.getController().equals(AllZone.HumanPlayer)) AllZone.GameAction.playSpellAbility(sa[1]); + if(c.getController().isHuman()) AllZone.GameAction.playSpellAbility(sa[1]); else ComputerUtil.playNoStack(sa[1]); } @@ -4012,7 +4012,7 @@ public class GameActionUtil { CardList graveyardCreatures = AllZoneUtil.getPlayerTypeInGraveyard(player, "Creature"); if(graveyardCreatures.size() >= 4) { - if(player.equals(AllZone.HumanPlayer)) { + if(player.isHuman()) { Object o = GuiUtils.getChoiceOptional("Pick a creature to return to hand", graveyardCreatures.toArray()); if(o != null) { @@ -4021,7 +4021,7 @@ public class GameActionUtil { AllZone.GameAction.moveToHand(card); } } - else if(player.equals(AllZone.ComputerPlayer)) { + else if(player.isComputer()) { Card card = graveyardCreatures.get(0); AllZone.GameAction.moveToHand(card); } @@ -4214,7 +4214,7 @@ public class GameActionUtil { CardList graveyardCreatures = AllZoneUtil.getPlayerTypeInGraveyard(player, "Creature"); if(AllZoneUtil.compareTypeAmountInGraveyard(player, "Creature") > 0) { - if(player.equals(AllZone.HumanPlayer)) { + if(player.isHuman()) { Object o = GuiUtils.getChoiceOptional("Pick a creature to return to hand", graveyardCreatures.toArray()); if(o != null) { @@ -4223,7 +4223,7 @@ public class GameActionUtil { AllZone.GameAction.moveToHand(card); } } - else if(player.equals(AllZone.ComputerPlayer)) { + else if(player.isComputer()) { Card card = graveyardCreatures.get(0); AllZone.GameAction.moveToHand(card); @@ -4890,7 +4890,7 @@ public class GameActionUtil { ability = new Ability(crd, "0") { @Override public void resolve() { - if(crd.getController().equals(AllZone.HumanPlayer)) { + if(crd.getController().isHuman()) { if(AllZone.Human_Hand.getCards().length == 0) AllZone.GameAction.sacrifice(crd); else AllZone.InputControl.setInput(discard); } else //comp @@ -5066,7 +5066,7 @@ public class GameActionUtil { //System.out.println("Creats size: " + creats.size()); - if(card.getController().equals(AllZone.HumanPlayer)) { + if(card.getController().isHuman()) { Object o = null; int creatsSize = creats.size(); diff --git a/src/forge/MagicStack.java b/src/forge/MagicStack.java index ff2f95e2c5b..ac9a9fb4170 100644 --- a/src/forge/MagicStack.java +++ b/src/forge/MagicStack.java @@ -312,7 +312,7 @@ public class MagicStack extends MyObservable { }; Card crd = sa.getSourceCard(); - if (sp.getSourceCard().getController().equals(AllZone.HumanPlayer)) { + if (sp.getSourceCard().getController().isHuman()) { AllZone.InputControl.setInput(new Input_PayManaCost_Ability("Pay X cost for " + sp.getSourceCard().getName() + " (X=" + crd.getXManaCostPaid() + ")\r\n", ability.getManaCost(), paidCommand, unpaidCommand, true)); @@ -536,7 +536,7 @@ public class MagicStack extends MyObservable { @Override public void selectCard(Card c, PlayerZone zone) { - if(zone.is(Constant.Zone.Battlefield) && c.getController().equals(AllZone.HumanPlayer) + if(zone.is(Constant.Zone.Battlefield) && c.getController().isHuman() && c.isLand()) { AllZone.GameAction.sacrifice(c); stop(); diff --git a/src/forge/Phase.java b/src/forge/Phase.java index bf0b95a253f..e484d07e6c4 100644 --- a/src/forge/Phase.java +++ b/src/forge/Phase.java @@ -409,7 +409,7 @@ public class Phase extends MyObservable if (vaults.size() > 0){ final Card crd = vaults.get(0); - if(turn.equals(AllZone.HumanPlayer)) { + if(turn.isHuman()) { if(GameActionUtil.showYesNoDialog(crd, "Untap " + crd + "?")) { crd.untap(); turn = extraTurns.isEmpty() ? turn.getOpponent() : extraTurns.pop(); diff --git a/src/forge/PhaseUtil.java b/src/forge/PhaseUtil.java index 4a23ddd9e77..084f6fb27a0 100644 --- a/src/forge/PhaseUtil.java +++ b/src/forge/PhaseUtil.java @@ -147,7 +147,7 @@ public class PhaseUtil { //end opponent untapping during your untap phase if( canOnlyUntapOneLand()) { - if( AllZone.Phase.getPlayerTurn().equals(AllZone.ComputerPlayer)) { + if( AllZone.Phase.getPlayerTurn().isComputer()) { //search for lands the computer has and only untap 1 CardList landList = AllZoneUtil.getPlayerLandsInPlay(AllZone.ComputerPlayer); landList = landList.filter(AllZoneUtil.tapped); @@ -196,7 +196,7 @@ public class PhaseUtil { public void selectButtonCancel() {stop();} public void selectCard(Card c, PlayerZone zone) { if(c.isArtifact() && zone.is(Constant.Zone.Battlefield) - && c.getController().equals(AllZone.HumanPlayer)) { + && c.getController().isHuman()) { c.untap(); stop(); } @@ -211,7 +211,7 @@ public class PhaseUtil { } } if((AllZoneUtil.isCardInPlay("Smoke") || AllZoneUtil.isCardInPlay("Stoic Angel")) ) { - if( AllZone.Phase.getPlayerTurn().equals(AllZone.ComputerPlayer) ) { + if( AllZone.Phase.getPlayerTurn().isComputer() ) { CardList creatures = AllZoneUtil.getCreaturesInPlay(AllZone.ComputerPlayer); creatures = creatures.filter(AllZoneUtil.tapped); if( creatures.size() > 0 ) { @@ -228,7 +228,7 @@ public class PhaseUtil { public void selectButtonCancel() {stop();} public void selectCard(Card c, PlayerZone zone) { if(c.isCreature() && zone.is(Constant.Zone.Battlefield) - && c.getController().equals(AllZone.HumanPlayer)) { + && c.getController().isHuman()) { c.untap(); stop(); } diff --git a/src/forge/RunTest.java b/src/forge/RunTest.java index ae67116511d..0853614b795 100644 --- a/src/forge/RunTest.java +++ b/src/forge/RunTest.java @@ -17,7 +17,7 @@ public class RunTest CardFactory cf = AllZone.CardFactory; //********* test Card c = cf.getCard("Elvish Warrior", AllZone.ComputerPlayer); - check("1", c.getOwner().equals(AllZone.ComputerPlayer)); + check("1", c.getOwner().isComputer()); check("1.1", c.getName().equals("Elvish Warrior")); check("2", c.getManaCost().equals("G G")); check("2.1", c.getType().contains("Creature")); diff --git a/src/forge/card/abilityFactory/AbilityFactory_Counters.java b/src/forge/card/abilityFactory/AbilityFactory_Counters.java index 9323e5b32df..23c1b5e824d 100644 --- a/src/forge/card/abilityFactory/AbilityFactory_Counters.java +++ b/src/forge/card/abilityFactory/AbilityFactory_Counters.java @@ -942,7 +942,7 @@ public class AbilityFactory_Counters { } }); - if (AF.getHostCard().getController().equals(AllZone.HumanPlayer)) { + if (AF.getHostCard().getController().isHuman()) { cperms.addAll(hperms.toArray()); final CardList unchosen = cperms; AllZone.InputControl.setInput(new Input() { @@ -974,12 +974,12 @@ public class AbilityFactory_Counters { boolean selHuman = false; @Override public void selectPlayer(Player player) { - if (player.equals(AllZone.HumanPlayer) && selHuman == false) { + if (player.isHuman() && selHuman == false) { selHuman = true; if (AllZone.HumanPlayer.getPoisonCounters() > 0) AllZone.HumanPlayer.addPoisonCounters(1); } - if (player.equals(AllZone.ComputerPlayer) && selComputer == false) { + if (player.isComputer() && selComputer == false) { selComputer = true; if (AllZone.ComputerPlayer.getPoisonCounters() > 0) AllZone.ComputerPlayer.addPoisonCounters(1); diff --git a/src/forge/card/abilityFactory/AbilityFactory_PermanentState.java b/src/forge/card/abilityFactory/AbilityFactory_PermanentState.java index 968923b425d..4e308527086 100644 --- a/src/forge/card/abilityFactory/AbilityFactory_PermanentState.java +++ b/src/forge/card/abilityFactory/AbilityFactory_PermanentState.java @@ -1044,12 +1044,12 @@ public class AbilityFactory_PermanentState { if(validTappables.size() > 0) { CardList human = validTappables.filter(new CardListFilter() { public boolean addCard(Card c) { - return c.getController().equals(AllZone.HumanPlayer); + return c.getController().isHuman(); } }); CardList compy = validTappables.filter(new CardListFilter() { public boolean addCard(Card c) { - return c.getController().equals(AllZone.HumanPlayer); + return c.getController().isHuman(); } }); if(human.size() > compy.size()) { @@ -1113,12 +1113,12 @@ public class AbilityFactory_PermanentState { if(validTappables.size() > 0) { CardList human = validTappables.filter(new CardListFilter() { public boolean addCard(Card c) { - return c.getController().equals(AllZone.HumanPlayer); + return c.getController().isHuman(); } }); CardList compy = validTappables.filter(new CardListFilter() { public boolean addCard(Card c) { - return c.getController().equals(AllZone.HumanPlayer); + return c.getController().isHuman(); } }); if(human.size() > compy.size()) { diff --git a/src/forge/card/abilityFactory/AbilityFactory_ZoneAffecting.java b/src/forge/card/abilityFactory/AbilityFactory_ZoneAffecting.java index fcef658d252..337fc1e7735 100644 --- a/src/forge/card/abilityFactory/AbilityFactory_ZoneAffecting.java +++ b/src/forge/card/abilityFactory/AbilityFactory_ZoneAffecting.java @@ -192,7 +192,7 @@ public class AbilityFactory_ZoneAffecting { if (tgt != null){ ArrayList players = tgt.getTargetPlayers(); - if (players.size() > 0 && players.get(0).equals(AllZone.HumanPlayer)) + if (players.size() > 0 && players.get(0).isHuman()) return true; } @@ -829,9 +829,8 @@ public class AbilityFactory_ZoneAffecting { else if(mode.equals("RevealYouChoose") || mode.equals("RevealOppChoose")) { // Is Reveal you choose right? I think the wrong player is being used? - PlayerZone pzH = AllZone.getZone(Constant.Zone.Hand, p); - if(pzH.size() != 0) { - CardList dPHand = new CardList(pzH.getCards()); + CardList dPHand = AllZoneUtil.getPlayerHand(p); + if(dPHand.size() != 0) { CardList dPChHand = new CardList(dPHand.toArray()); if (params.containsKey("DiscardValid")) { // Restrict card choices diff --git a/src/forge/card/cardFactory/CardFactory.java b/src/forge/card/cardFactory/CardFactory.java index c9d2646a967..63eecd759bc 100644 --- a/src/forge/card/cardFactory/CardFactory.java +++ b/src/forge/card/cardFactory/CardFactory.java @@ -259,7 +259,7 @@ public class CardFactory implements NewConstants { if(sa.isReplicate()) copySA.setIsReplicate(true); } - if(source.getController().equals(AllZone.HumanPlayer)) + if(source.getController().isHuman()) AllZone.GameAction.playSpellAbilityForFree(copySA); else if(copySA.canPlayAI()) @@ -328,12 +328,12 @@ public class CardFactory implements NewConstants { copySA.setTargetCard(sa.getTargetCard()); if(sa.getTargetPlayer() != null) { - if(sa.getTargetPlayer().equals(AllZone.HumanPlayer) - || (sa.getTargetPlayer().equals(AllZone.ComputerPlayer))) + if(sa.getTargetPlayer().isHuman() + || (sa.getTargetPlayer().isComputer())) copySA.setTargetPlayer(sa.getTargetPlayer()); } - if(source.getController().equals(AllZone.HumanPlayer)) + if(source.getController().isHuman()) AllZone.GameAction.playSpellAbilityForFree(copySA); else if(copySA.canPlayAI()) @@ -821,7 +821,7 @@ public class CardFactory implements NewConstants { //System.out.println("Creats size: " + creats.size()); - if(card.getController().equals(AllZone.HumanPlayer)) { + if(card.getController().isHuman()) { if (creats.size() > 0) { List selection = GuiUtils.getChoicesOptional("Select creatures to sacrifice", creats.toArray()); @@ -895,7 +895,7 @@ public class CardFactory implements NewConstants { public void execute() { // Target as Modular is Destroyed - if(card.getController().equals(AllZone.ComputerPlayer)) { + if(card.getController().isComputer()) { CardList choices = new CardList(AllZone.Computer_Battlefield.getCards()).filter(new CardListFilter() { public boolean addCard(Card c) { return c.isCreature() && c.isArtifact(); @@ -1090,7 +1090,7 @@ public class CardFactory implements NewConstants { final SpellAbility ability = new Ability_Static(card, "0") { @Override public void resolve() { - if(player.equals(AllZone.HumanPlayer)) { + if(player.isHuman()) { input[0] = JOptionPane.showInputDialog(null, "Which creature type?", "Pick type", JOptionPane.QUESTION_MESSAGE); @@ -1139,11 +1139,11 @@ public class CardFactory implements NewConstants { String imageName = ""; String color = ""; - if(player.equals(AllZone.ComputerPlayer)) { + if(player.isComputer()) { type = "Thrull"; imageName = "B 1 1 Thrull"; color = "B"; - } else if(player.equals(AllZone.HumanPlayer)) { + } else if(player.isHuman()) { Object q = GuiUtils.getChoiceOptional("Select type of creature", choices); if(q != null){ if(q.equals("Citizen")) { @@ -1452,7 +1452,7 @@ public class CardFactory implements NewConstants { { CardList newGrave; Card c = (Card)o; - if (c.getOwner().equals(AllZone.HumanPlayer)){ + if (c.getOwner().isHuman()){ newGrave = AllZoneUtil.getPlayerGraveyard(AllZone.HumanPlayer); } else { @@ -1744,7 +1744,7 @@ public class CardFactory implements NewConstants { @Override public boolean canPlayAI() { - return card.getController().equals(AllZone.HumanPlayer) && AllZone.ComputerPlayer.getLife() >= 9 && + return card.getController().isHuman() && AllZone.ComputerPlayer.getLife() >= 9 && super.canPlay() && AllZone.Computer_Hand.size() > 0; } @@ -1790,7 +1790,7 @@ public class CardFactory implements NewConstants { final SpellAbility ability = new Ability(card, "0") { @Override public void resolve() { - if(card.getController().equals(AllZone.HumanPlayer)) { + if(card.getController().isHuman()) { if(AllZone.Human_Hand.getCards().length == 0) AllZone.GameAction.sacrifice(card); else AllZone.InputControl.setInput(discard); } else { @@ -1977,7 +1977,7 @@ public class CardFactory implements NewConstants { return; } Card c = copyCard(getSourceCard().getAttachedCards()[0]); - if(getSourceCard().getController().equals(AllZone.ComputerPlayer)) + if(getSourceCard().getController().isComputer()) { for(SpellAbility sa:getSourceCard().getAttachedCards()[0].getSpellAbility()) if(sa.canPlayAI()) @@ -2046,7 +2046,7 @@ public class CardFactory implements NewConstants { final SpellAbility ability = new Ability(card, "0") { @Override public void resolve() { - if(card.getController().equals(AllZone.HumanPlayer)) { + if(card.getController().isHuman()) { if(AllZone.Human_Hand.getCards().length > 0) AllZone.InputControl.setInput(exile); } else { @@ -2179,7 +2179,7 @@ public class CardFactory implements NewConstants { CardList lands = new CardList(grave.getCards()); lands = lands.filter(AllZoneUtil.basicLands); - if(card.getController().equals(AllZone.HumanPlayer)){ + if(card.getController().isHuman()){ //now, select up to four lands int end = -1; end = Math.min(lands.size(), limit); @@ -2326,7 +2326,7 @@ public class CardFactory implements NewConstants { final Ability ability = new Ability(card, "0") { @Override public void resolve() { - if(card.getController().equals(AllZone.HumanPlayer)) { + if(card.getController().isHuman()) { String color = ""; String[] colors = Constant.Color.Colors; @@ -2422,7 +2422,7 @@ public class CardFactory implements NewConstants { @Override public void resolve() { String chosenType = ""; - if(card.getController().equals(AllZone.HumanPlayer)) { + if(card.getController().isHuman()) { chosenType = JOptionPane.showInputDialog(null, "Enter a creature type:", card.getName(), JOptionPane.QUESTION_MESSAGE); } @@ -2671,7 +2671,7 @@ public class CardFactory implements NewConstants { final String[] input = new String[1]; CardList allCards = factory.getAllCards(); input[0] = ""; - if(card.getController().equals(AllZone.HumanPlayer)) { + if(card.getController().isHuman()) { while(input[0] == "") { input[0] = JOptionPane.showInputDialog(null, "Which source?", "Pick a card",JOptionPane.QUESTION_MESSAGE); @@ -3439,13 +3439,13 @@ public class CardFactory implements NewConstants { public void execute() { Log.debug("HandSize", "Control changed: " + card.getController()); - if(card.getController().equals(AllZone.HumanPlayer)) { + if(card.getController().isHuman()) { AllZone.HumanPlayer.removeHandSizeOperation(Integer.parseInt(card.getSVar("HSStamp"))); AllZone.ComputerPlayer.addHandSizeOperation(new HandSizeOp(Mode,Amount,Integer.parseInt(card.getSVar("HSStamp")))); AllZone.ComputerPlayer.sortHandSizeOperations(); } - else if(card.getController().equals(AllZone.ComputerPlayer)) { + else if(card.getController().isComputer()) { AllZone.ComputerPlayer.removeHandSizeOperation(Integer.parseInt(card.getSVar("HSStamp"))); AllZone.HumanPlayer.addHandSizeOperation(new HandSizeOp(Mode,Amount,Integer.parseInt(card.getSVar("HSStamp")))); diff --git a/src/forge/card/cardFactory/CardFactoryUtil.java b/src/forge/card/cardFactory/CardFactoryUtil.java index 9393680a743..7ee56a30ad1 100644 --- a/src/forge/card/cardFactory/CardFactoryUtil.java +++ b/src/forge/card/cardFactory/CardFactoryUtil.java @@ -1132,7 +1132,7 @@ public class CardFactoryUtil { } if(mercs.size() == 0) return; - if(sourceCard.getController().equals(AllZone.ComputerPlayer)) { + if(sourceCard.getController().isComputer()) { Card merc = AI_getBestCreature(mercs); AllZone.GameAction.moveToPlay(merc); } else //human @@ -1226,7 +1226,7 @@ public class CardFactoryUtil { } if(rebels.size() == 0) return; - if(sourceCard.getController().equals(AllZone.ComputerPlayer)) { + if(sourceCard.getController().isComputer()) { Card rebel = AI_getBestCreature(rebels); AllZone.GameAction.moveToPlay(rebel); } else //human @@ -3910,7 +3910,7 @@ public class CardFactoryUtil { if (d[0].contains("UntapUpTo")) // 8/10 { int n = Integer.parseInt(d[1]); - if (dbPlayer.equals(AllZone.HumanPlayer)) + if (dbPlayer.isHuman()) AllZone.InputControl.setInput(CardFactoryUtil.input_UntapUpToNType(n, d[2])); else { diff --git a/src/forge/card/cardFactory/CardFactory_Creatures.java b/src/forge/card/cardFactory/CardFactory_Creatures.java index 494415cc5b4..6453e72e318 100644 --- a/src/forge/card/cardFactory/CardFactory_Creatures.java +++ b/src/forge/card/cardFactory/CardFactory_Creatures.java @@ -106,7 +106,7 @@ public class CardFactory_Creatures { PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player); Card c = lib.get(0); - if(card.getController().equals(AllZone.HumanPlayer)) { + if(card.getController().isHuman()) { if(GameActionUtil.showYesNoDialog(card, "Mill "+c.getName()+"?")) { AllZone.GameAction.moveToGraveyard(c); } @@ -774,7 +774,7 @@ public class CardFactory_Creatures { };//Input target - if(card.getController().equals(AllZone.HumanPlayer)) { + if(card.getController().isHuman()) { CardList artifacts = AllZoneUtil.getPlayerTypeInPlay(AllZone.HumanPlayer, "Artifact"); if(artifacts.size() != 0) AllZone.InputControl.setInput(target); @@ -929,7 +929,7 @@ public class CardFactory_Creatures { if(creature.size() == 0) { AllZone.GameAction.sacrifice(card); return; - } else if(s.equals(AllZone.HumanPlayer)) AllZone.InputControl.setInput(inputComes); + } else if(s.isHuman()) AllZone.InputControl.setInput(inputComes); else //computer { Card target; @@ -1469,7 +1469,7 @@ public class CardFactory_Creatures { public void execute() { index[0] = 0; - if(card.getController().equals(AllZone.HumanPlayer)) AllZone.InputControl.setInput(input); + if(card.getController().isHuman()) AllZone.InputControl.setInput(input); } }; @@ -1785,7 +1785,7 @@ public class CardFactory_Creatures { if(AllZoneUtil.isCardInPlay(card)) { card.addTempAttackBoost(1); card.addTempDefenseBoost(1); - if(card.getController().equals(AllZone.HumanPlayer)) { + if(card.getController().isHuman()) { String[] colors = Constant.Color.onlyColors; Object o = GuiUtils.getChoice("Choose color", colors); @@ -1863,7 +1863,7 @@ public class CardFactory_Creatures { @Override public void resolve() { if(AllZoneUtil.isCardInPlay(card)) { - if(card.getController().equals(AllZone.HumanPlayer)) { + if(card.getController().isHuman()) { String[] colors = Constant.Color.onlyColors; Object o = GuiUtils.getChoice("Choose color", colors); @@ -1938,7 +1938,7 @@ public class CardFactory_Creatures { private static final long serialVersionUID = -2823505283781217181L; public void execute() { - if(card.getController().equals(AllZone.HumanPlayer)) AllZone.InputControl.setInput(CardFactoryUtil.input_targetCreature(ability)); + if(card.getController().isHuman()) AllZone.InputControl.setInput(CardFactoryUtil.input_targetCreature(ability)); else if(ability.canPlayAI()) { ability.chooseTargetAI(); //need to add this to the stack @@ -1962,7 +1962,7 @@ public class CardFactory_Creatures { private static final long serialVersionUID = 333134223161L; public void execute() { - if(card.getController().equals(AllZone.HumanPlayer)) { + if(card.getController().isHuman()) { String[] colors = Constant.Color.onlyColors; Object o = GuiUtils.getChoice("Choose color", colors); @@ -2442,7 +2442,7 @@ public class CardFactory_Creatures { CardList cards = new CardList(lib.getCards()); if(cards.size() > 0) { - if(card.getController().equals(AllZone.HumanPlayer)) { + if(card.getController().isHuman()) { Object o = GuiUtils.getChoiceOptional("Select card to remove: ", cards.toArray()); Card c = (Card) o; @@ -2479,7 +2479,7 @@ public class CardFactory_Creatures { @Override public void resolve() { int lifeGain = 0; - if(card.getController().equals(AllZone.HumanPlayer)) { + if(card.getController().isHuman()) { String choices[] = {"white", "blue", "black", "red", "green"}; Object o = GuiUtils.getChoiceOptional("Select Color: ", choices); Log.debug("Treva, the Renewer", "Color:" + o); @@ -2518,7 +2518,7 @@ public class CardFactory_Creatures { @Override public void resolve() { int numberTokens = 0; - if(card.getController().equals(AllZone.HumanPlayer)) { + if(card.getController().isHuman()) { String choices[] = {"white", "blue", "black", "red", "green"}; Object o = GuiUtils.getChoiceOptional("Select Color: ", choices); //System.out.println("Color:" + o); @@ -2781,7 +2781,7 @@ public class CardFactory_Creatures { CardList sins = new CardList(graveyard.getCards()); sins = sins.getType("Assassin"); - if(card.getController().equals(AllZone.HumanPlayer)) { + if(card.getController().isHuman()) { Object o = GuiUtils.getChoiceOptional("Select an Assassin to exile", sins.toArray()); if(o != null) { @@ -3240,7 +3240,7 @@ public class CardFactory_Creatures { @Override public void resolve() { - if (card.getController().equals(AllZone.HumanPlayer)) { + if (card.getController().isHuman()) { StringBuilder question = new StringBuilder(); if (card.getName().equals("Academy Rector")) { question.append("Exile ").append(card.getName()).append(" and place "); @@ -3442,7 +3442,7 @@ public class CardFactory_Creatures { }); if(list.size() > 0) { - if(card.getController().equals(AllZone.HumanPlayer)) { + if(card.getController().isHuman()) { GuiUtils.getChoiceOptional("Revealing hand", list.toArray()); if(nonLandList.size() > 0) { Object o = GuiUtils.getChoiceOptional("Select nonland card", @@ -3470,10 +3470,10 @@ public class CardFactory_Creatures { private static final long serialVersionUID = -5052568979553782714L; public void execute() { - if(card.getController().equals(AllZone.HumanPlayer)) { + if(card.getController().isHuman()) { AllZone.InputControl.setInput(CardFactoryUtil.input_targetPlayer(ability)); ButtonUtil.disableAll(); - } else if(card.getController().equals(AllZone.ComputerPlayer)) { + } else if(card.getController().isComputer()) { ability.setTargetPlayer(AllZone.HumanPlayer); AllZone.Stack.addSimultaneousStackEntry(ability); @@ -3569,7 +3569,7 @@ public class CardFactory_Creatures { private static final long serialVersionUID = -4246229185669164581L; public void execute() { - if(card.getController().equals(AllZone.HumanPlayer)) AllZone.InputControl.setInput(inputComes); + if(card.getController().isHuman()) AllZone.InputControl.setInput(inputComes); else //computer { abilityComes.setTargetPlayer(AllZone.HumanPlayer); @@ -3614,7 +3614,7 @@ public class CardFactory_Creatures { final Ability ability = new Ability(card, "0") { @Override public void resolve() { - if(card.getController().equals(AllZone.HumanPlayer)) { + if(card.getController().isHuman()) { input[0] = JOptionPane.showInputDialog(null, "Which card?", "Pick card", JOptionPane.QUESTION_MESSAGE); card.setNamedCard(input[0]); @@ -3675,7 +3675,7 @@ public class CardFactory_Creatures { private static final long serialVersionUID = 3331342605626623161L; public void execute() { - if(card.getController().equals(AllZone.HumanPlayer)) { + if(card.getController().isHuman()) { String color = ""; String[] colors = Constant.Color.Colors; @@ -3978,7 +3978,7 @@ public class CardFactory_Creatures { final Ability ability = new Ability(card, "0") { @Override public void resolve() { - if (card.getController().equals(AllZone.ComputerPlayer)) + if (card.getController().isComputer()) setTargetPlayer(AllZone.HumanPlayer); getTargetPlayer().sacrificeCreature(); @@ -3991,7 +3991,7 @@ public class CardFactory_Creatures { public void execute() { if(card.isKicked()) { - if(card.getController().equals(AllZone.HumanPlayer)) AllZone.InputControl.setInput(CardFactoryUtil.input_targetPlayer(ability)); + if(card.getController().isHuman()) AllZone.InputControl.setInput(CardFactoryUtil.input_targetPlayer(ability)); else //computer { ability.setStackDescription("Gatekeeper of Malakir - targeting Human"); diff --git a/src/forge/card/cardFactory/CardFactory_Equipment.java b/src/forge/card/cardFactory/CardFactory_Equipment.java index b5f2fbdf250..f39a3e7cd9b 100644 --- a/src/forge/card/cardFactory/CardFactory_Equipment.java +++ b/src/forge/card/cardFactory/CardFactory_Equipment.java @@ -194,11 +194,10 @@ class CardFactory_Equipment { //not changed CardList getCreature() { - CardList list = new CardList(AllZone.Computer_Battlefield.getCards()); + CardList list = AllZoneUtil.getCreaturesInPlay(AllZone.ComputerPlayer); list = list.filter(new CardListFilter() { public boolean addCard(Card c) { - return c.isCreature() - && CardFactoryUtil.AI_doesCreatureAttack(c) + return CardFactoryUtil.AI_doesCreatureAttack(c) && CardFactoryUtil.canTarget(card, c) && (!c.getKeyword().contains("Defender")); } diff --git a/src/forge/card/cardFactory/CardFactory_Instants.java b/src/forge/card/cardFactory/CardFactory_Instants.java index 2bc0cf46245..d3347d868ea 100644 --- a/src/forge/card/cardFactory/CardFactory_Instants.java +++ b/src/forge/card/cardFactory/CardFactory_Instants.java @@ -72,7 +72,7 @@ public class CardFactory_Instants { String getChosenColor() { // Choose color for protection in Brave the Elements String color = ""; - if (card.getController().equals(AllZone.HumanPlayer)) { + if (card.getController().isHuman()) { // String[] colors = Constant.Color.Colors; // colors[colors.length-1] = null; @@ -474,7 +474,7 @@ public class CardFactory_Instants { GuiUtils.getChoice("Revealing top " + Count + " cards of library: ", cards.toArray()); //Human chooses - if(card.getController().equals(AllZone.ComputerPlayer)) { + if(card.getController().isComputer()) { for(int i = 0; i < Count; i++) { if(stop == false) { choice = GuiUtils.getChoiceOptional("Choose cards to put into the first pile: ", cards.toArray()); @@ -966,7 +966,7 @@ public class CardFactory_Instants { @Override public void resolve() { Player player = card.getController(); - if(player.equals(AllZone.HumanPlayer)) humanResolve(); + if(player.isHuman()) humanResolve(); else computerResolve(); player.shuffle(); } @@ -1264,7 +1264,7 @@ public class CardFactory_Instants { CardList graveList = new CardList(grave.getCards()); int X = Math.min(max, graveList.size()); - if( player.equals(AllZone.HumanPlayer)) { + if( player.isHuman()) { for(int i = 0; i < X; i++) { Object o = GuiUtils.getChoice("Remove from game", graveList.toArray()); if(o == null) break; @@ -1377,12 +1377,12 @@ public class CardFactory_Instants { public void resolve() { SpellAbility sa = AllZone.Stack.pop(); - if(card.getController().equals(AllZone.HumanPlayer)) + if(card.getController().isHuman()) { Phase.getManaDrain_BonusMana_Human().add(CardUtil.getConvertedManaCost(sa.getSourceCard())); Phase.getManaDrain_Source_Human().add(card); } - else if(card.getController().equals(AllZone.ComputerPlayer)) + else if(card.getController().isComputer()) { Phase.getManaDrain_BonusMana_AI().add(CardUtil.getConvertedManaCost(sa.getSourceCard())); Phase.getManaDrain_Source_AI().add(card); @@ -1548,7 +1548,7 @@ public class CardFactory_Instants { public void resolve() { CardList lands = AllZoneUtil.getPlayerLandsInPlay(getTargetPlayer()); for(Card c:lands) c.tap(); - if(getTargetPlayer().equals(AllZone.HumanPlayer)) AllZone.ManaPool.clearPool(); + if(getTargetPlayer().isHuman()) AllZone.ManaPool.clearPool(); }//resolve() };//SpellAbility diff --git a/src/forge/card/cardFactory/CardFactory_Lands.java b/src/forge/card/cardFactory/CardFactory_Lands.java index 9a536fa32f6..71a05c29346 100644 --- a/src/forge/card/cardFactory/CardFactory_Lands.java +++ b/src/forge/card/cardFactory/CardFactory_Lands.java @@ -47,7 +47,7 @@ class CardFactory_Lands { private static final long serialVersionUID = 7352127748114888255L; public void execute() { - if (card.getController().equals(AllZone.HumanPlayer)) humanExecute(); + if (card.getController().isHuman()) humanExecute(); else computerExecute(); } @@ -100,6 +100,7 @@ class CardFactory_Lands { } }; }; + a[0] = new Ability(card, "0") { @Override public void resolve() { @@ -112,60 +113,50 @@ class CardFactory_Lands { } } else { - CardList creature = new CardList(); - PlayerZone zone = AllZone.getZone(Constant.Zone.Battlefield, AllZone.ComputerPlayer); - if(zone != null) { - creature.addAll(zone.getCards()); - creature = creature.getType("Creature"); - creature = creature.filter(new CardListFilter() + CardList creature = AllZoneUtil.getCreaturesInPlay(AllZone.ComputerPlayer); + creature = creature.filter(new CardListFilter() + { + public boolean addCard(Card c) { - public boolean addCard(Card c) - { - return (AllZoneUtil.isCardInPlay(c) && CardFactoryUtil.canTarget(a[0], c) && !c.hasKeyword("Defender")); - } - }); - Card biggest = null; - if(creature.size() > 0) { - biggest = creature.get(0); - - for(int i = 0; i < creature.size(); i++) { - if(biggest.getNetAttack() < creature.get(i).getNetAttack()) biggest = creature.get(i); - } - setTargetCard(biggest); - + return CardFactoryUtil.canTarget(a[0], c) && !c.hasKeyword("Defender"); } + }); + Card biggest = null; + if(creature.size() > 0) { + biggest = creature.get(0); + + for(int i = 0; i < creature.size(); i++) { + if(biggest.getNetAttack() < creature.get(i).getNetAttack()) biggest = creature.get(i); + } + setTargetCard(biggest); + } - PlayerZone Hzone = AllZone.getZone(Constant.Zone.Battlefield, AllZone.HumanPlayer); - if(zone != null) { - CardList creature2 = new CardList(); - creature2.addAll(Hzone.getCards()); - creature2 = creature2.getType("Creature"); - creature2 = creature2.filter(new CardListFilter() + CardList creature2 = AllZoneUtil.getCreaturesInPlay(AllZone.HumanPlayer); + creature2 = creature2.filter(new CardListFilter() + { + public boolean addCard(Card c) { - public boolean addCard(Card c) - { - return (!c.isTapped() && !CardUtil.getColors(c).contains(Constant.Color.Colorless)); - } - }); - Card biggest2 = null; - if(creature2.size() > 0) { - biggest2 = creature2.get(0); - for(int i = 0; i < creature2.size(); i++) { - if(biggest2.getNetAttack() < creature2.get(i).getNetAttack()) biggest2 = creature2.get(i); - } - if(biggest2 != null) { - if(biggest2.isGreen()) Color = "green"; - if(biggest2.isBlue()) Color = "blue"; - if(biggest2.isWhite()) Color = "white"; - if(biggest2.isRed()) Color = "red"; - if(biggest2.isBlack()) Color = "black"; - } else { - Color = "black"; - } - - } else { - Color = "black"; + return (!c.isTapped() && !CardUtil.getColors(c).contains(Constant.Color.Colorless)); } + }); + Card biggest2 = null; + if(creature2.size() > 0) { + biggest2 = creature2.get(0); + for(int i = 0; i < creature2.size(); i++) { + if(biggest2.getNetAttack() < creature2.get(i).getNetAttack()) biggest2 = creature2.get(i); + } + if(biggest2 != null) { + if(biggest2.isGreen()) Color = "green"; + if(biggest2.isBlue()) Color = "blue"; + if(biggest2.isWhite()) Color = "white"; + if(biggest2.isRed()) Color = "red"; + if(biggest2.isBlack()) Color = "black"; + } else { + Color = "black"; + } + + } else { + Color = "black"; } } Card Target = getTargetCard(); @@ -188,16 +179,14 @@ class CardFactory_Lands { private static final long serialVersionUID = 5055232386220487221L; public void execute() { - CardList creats = new CardList( - AllZone.getZone(Constant.Zone.Battlefield, card.getController()).getCards()); - creats = creats.getType("Creature"); + CardList creats = AllZoneUtil.getCreaturesInPlay(card.getController()); StringBuilder sb = new StringBuilder(); sb.append(card.getName()).append(" - target creature you control gains protection from the color of your choice until end of turn"); a[0].setStackDescription(sb.toString()); if(card.getController().isHuman()) { AllZone.InputControl.setInput(CardFactoryUtil.input_targetSpecific(a[0], creats, "Select target creature you control", false, false)); } else { - AllZone.Stack.addSimultaneousStackEntry(a[0]); + AllZone.Stack.addSimultaneousStackEntry(a[0]); } } @@ -296,18 +285,17 @@ class CardFactory_Lands { @Override public boolean canPlayAI() { - if(!(AllZone.Phase.getPhase().equals(Constant.Phase.Main1) && AllZone.Phase.getPlayerTurn().equals( - AllZone.ComputerPlayer))) return false; + if(!(AllZone.Phase.getPhase().equals(Constant.Phase.Main1) && AllZone.Phase.getPlayerTurn().isComputer())) + return false; inPlay.clear(); - inPlay.addAll(AllZone.Computer_Battlefield.getCards()); + inPlay.add(AllZoneUtil.getPlayerCardsInPlay(AllZone.ComputerPlayer)); return (inPlay.filter(targets).size() > 1) && super.canPlayAI(); } @Override public void resolve() { inPlay.clear(); - inPlay.addAll(AllZone.Human_Battlefield.getCards()); - inPlay.addAll(AllZone.Computer_Battlefield.getCards()); + inPlay.add(AllZoneUtil.getCardsInPlay()); for(Card targ:inPlay.filter(targets)) targ.addCounter(Counters.P1P1, 1); } @@ -388,7 +376,7 @@ class CardFactory_Lands { public void execute() { final CardList land = AllZoneUtil.getPlayerCardsInPlay(player).getValidCards(type[0], player, card); - if( player.equals(AllZone.ComputerPlayer)) { + if( player.isComputer()) { if( land.size() > 0 ) { CardList tappedLand = new CardList(land.toArray()); tappedLand = tappedLand.filter(AllZoneUtil.tapped); @@ -464,7 +452,7 @@ class CardFactory_Lands { plains = plains.getType("Land"); plains = plains.getTapState("Untapped"); - if( player.equals(AllZone.ComputerPlayer)) { + if( player.isComputer()) { if( plains.size() > 1 ) { CardList tappedPlains = new CardList(plains.toArray()); tappedPlains = tappedPlains.getType("Basic"); @@ -849,7 +837,7 @@ class CardFactory_Lands { final Player player = card.getController(); final CardList land = AllZoneUtil.getPlayerCardsInPlay(player).getValidCards(type[0]+".untapped", player, card); - if( player.equals(AllZone.ComputerPlayer)) { + if( player.isComputer()) { if( land.size() > 0 ) { Card c = CardFactoryUtil.getWorstLand(land); AllZone.GameAction.moveToHand(c); diff --git a/src/forge/card/cardFactory/CardFactory_Planeswalkers.java b/src/forge/card/cardFactory/CardFactory_Planeswalkers.java index 3fc802175e6..ff30cd0e6dd 100644 --- a/src/forge/card/cardFactory/CardFactory_Planeswalkers.java +++ b/src/forge/card/cardFactory/CardFactory_Planeswalkers.java @@ -257,7 +257,7 @@ class CardFactory_Planeswalkers { public void execute() { Player player = card.getController(); CardList creatures; - if(player.equals(AllZone.HumanPlayer)) { + if(player.isHuman()) { creatures = new CardList(AllZone.Human_Battlefield.getCards()); } else { creatures = new CardList(AllZone.Computer_Battlefield.getCards()); @@ -281,7 +281,7 @@ class CardFactory_Planeswalkers { Player player = card.getController(); CardList creatures; - if(player.equals(AllZone.HumanPlayer)) { + if(player.isHuman()) { creatures = new CardList(AllZone.Human_Battlefield.getCards()); } else { creatures = new CardList(AllZone.Computer_Battlefield.getCards()); @@ -1016,7 +1016,7 @@ class CardFactory_Planeswalkers { Card c = lib.get(0); - if (card.getController().equals(AllZone.HumanPlayer)) { + if (card.getController().isHuman()) { StringBuilder question = new StringBuilder(); question.append("Put the card ").append(c).append(" on the bottom of the "); question.append(c.getController()).append("'s library?"); @@ -1067,7 +1067,7 @@ class CardFactory_Planeswalkers { card.getController().drawCards(3); Player player = card.getController(); - if(player.equals(AllZone.HumanPlayer)) humanResolve(); + if(player.isHuman()) humanResolve(); //else // computerResolve(); } @@ -1658,7 +1658,7 @@ class CardFactory_Planeswalkers { { public boolean addCard(Card c) { - return CardFactoryUtil.canTarget(card, c) && c.getOwner().equals(AllZone.ComputerPlayer) && + return CardFactoryUtil.canTarget(card, c) && c.getOwner().isComputer() && !c.equals(card); } }); @@ -1710,7 +1710,7 @@ class CardFactory_Planeswalkers { list.addAll(AllZone.Computer_Battlefield.getCards()); list = list.filter(new CardListFilter() { public boolean addCard(Card c) { - return c.isPermanent() && c.getOwner().equals(AllZone.HumanPlayer) + return c.isPermanent() && c.getOwner().isHuman() && CardFactoryUtil.canTarget(card, c); } }); diff --git a/src/forge/card/cardFactory/CardFactory_Sorceries.java b/src/forge/card/cardFactory/CardFactory_Sorceries.java index 5e4df0376ab..b054ac20942 100644 --- a/src/forge/card/cardFactory/CardFactory_Sorceries.java +++ b/src/forge/card/cardFactory/CardFactory_Sorceries.java @@ -790,7 +790,7 @@ public class CardFactory_Sorceries { GuiUtils.getChoice("Revealing top " + Count + " cards of library: ", cards.toArray()); //Human chooses - if(card.getController().equals(AllZone.ComputerPlayer)) { + if(card.getController().isComputer()) { for(int i = 0; i < Count; i++) { if(stop == false) { choice = GuiUtils.getChoiceOptional("Choose cards to put into the first pile: ", cards.toArray()); @@ -1825,7 +1825,7 @@ public class CardFactory_Sorceries { @Override public void selectCard(Card c, PlayerZone zone) { if(c.isLand() && zone.is(Constant.Zone.Battlefield) - && c.getController().equals(AllZone.HumanPlayer) + && c.getController().isHuman() /*&& c.getName().equals(humanBasic.get(count))*/ && c.getType().contains(humanBasic.get(count)) /*&& !saveList.contains(c) */) { @@ -1922,7 +1922,7 @@ public class CardFactory_Sorceries { @Override public void resolve() { Player player = card.getController(); - if(player.equals(AllZone.HumanPlayer)) humanResolve(); + if(player.isHuman()) humanResolve(); else computerResolve(); } @@ -2939,7 +2939,7 @@ public class CardFactory_Sorceries { int size = graveList.size(); int damage = 0; - if( player.equals(AllZone.HumanPlayer)) { + if( player.isHuman()) { for(int i = 0; i < size; i++) { Object o = GuiUtils.getChoice("Remove from game", graveList.toArray()); if(o == null) break; @@ -3249,7 +3249,7 @@ public class CardFactory_Sorceries { printCardTargets(); Log.debug("Fireball", "Fireball - player targets: "); printPlayerTargets(); - if(card.getController().equals(AllZone.ComputerPlayer)) { + if(card.getController().isComputer()) { StringBuilder sb = new StringBuilder(); sb.append(cardName+" - Computer causes "+damage+" to:\n\n"); for(int i = 0; i < targets.size(); i++) { @@ -3441,7 +3441,7 @@ public class CardFactory_Sorceries { int maxCards = AllZoneUtil.getPlayerHand(player).size(); if(numCards != 0) { numCards = Math.min(numCards, maxCards); - if(player.equals(AllZone.HumanPlayer)) { + if(player.isHuman()) { AllZone.InputControl.setInput(CardFactoryUtil.input_discardRecall(numCards, card, this)); } } diff --git a/src/forge/card/spellability/Cost_Payment.java b/src/forge/card/spellability/Cost_Payment.java index dd04255c9e6..c3995ad4a87 100644 --- a/src/forge/card/spellability/Cost_Payment.java +++ b/src/forge/card/spellability/Cost_Payment.java @@ -741,7 +741,7 @@ public class Cost_Payment { @Override public void selectPlayer(Player player) { - if(player.equals(AllZone.HumanPlayer)) + if(player.isHuman()) { if(manaCost.payPhyrexian()) { @@ -934,7 +934,7 @@ public class Cost_Payment { @Override public void showMessage() { Card card = sa.getSourceCard(); - if(card.getController().equals(AllZone.HumanPlayer) && AllZoneUtil.isCardInPlay(card)) { + if(card.getController().isHuman() && AllZoneUtil.isCardInPlay(card)) { StringBuilder sb = new StringBuilder(); sb.append(card.getName()); sb.append(" - Sacrifice?"); @@ -1088,7 +1088,7 @@ public class Cost_Payment { @Override public void showMessage() { Card card = sa.getSourceCard(); - if(card.getController().equals(AllZone.HumanPlayer) && AllZoneUtil.isCardInPlay(card)) { + if(card.getController().isHuman() && AllZoneUtil.isCardInPlay(card)) { StringBuilder sb = new StringBuilder(); sb.append(card.getName()); sb.append(" - Exile?"); @@ -1122,7 +1122,7 @@ public class Cost_Payment { @Override public void showMessage() { Card card = spell.getSourceCard(); - if(card.getController().equals(AllZone.HumanPlayer) && AllZoneUtil.isCardInPlayerHand(card.getController(), card)) { + if(card.getController().isHuman() && AllZoneUtil.isCardInPlayerHand(card.getController(), card)) { StringBuilder sb = new StringBuilder(); sb.append(card.getName()); sb.append(" - Exile?"); @@ -1155,7 +1155,7 @@ public class Cost_Payment { @Override public void showMessage() { Card card = spell.getSourceCard(); - if(card.getController().equals(AllZone.HumanPlayer) && AllZoneUtil.isCardInPlayerHand(card.getController(), card)) { + if(card.getController().isHuman() && AllZoneUtil.isCardInPlayerHand(card.getController(), card)) { //This can't really happen, but if for some reason it could.... if(AllZoneUtil.getPlayerCardsInLibrary(card.getController()).size() > 0) { payment.setPayExileFromTop(true); @@ -1182,7 +1182,7 @@ public class Cost_Payment { @Override public void showMessage() { Card card = spell.getSourceCard(); - if(card.getController().equals(AllZone.HumanPlayer) && AllZoneUtil.isCardInPlayerGraveyard(card.getController(), card)) { + if(card.getController().isHuman() && AllZoneUtil.isCardInPlayerGraveyard(card.getController(), card)) { StringBuilder sb = new StringBuilder(); sb.append(card.getName()); sb.append(" - Exile?"); @@ -1492,7 +1492,7 @@ public class Cost_Payment { @Override public void showMessage() { Card card = sa.getSourceCard(); - if(card.getController().equals(AllZone.HumanPlayer) && AllZoneUtil.isCardInPlay(card)) { + if(card.getController().isHuman() && AllZoneUtil.isCardInPlay(card)) { StringBuilder sb = new StringBuilder(); sb.append(card.getName()); sb.append(" - Return to Hand?"); diff --git a/src/forge/card/spellability/Spell_Permanent.java b/src/forge/card/spellability/Spell_Permanent.java index ea11e4c8bbf..cd3375f8091 100644 --- a/src/forge/card/spellability/Spell_Permanent.java +++ b/src/forge/card/spellability/Spell_Permanent.java @@ -72,7 +72,7 @@ public class Spell_Permanent extends Spell { if(creature.size() == 0) { AllZone.GameAction.sacrifice(getSourceCard()); return; - } else if(s.equals(AllZone.HumanPlayer)) { + } else if(s.isHuman()) { AllZone.InputControl.setInput(championInputComes); } else { //Computer diff --git a/src/forge/gui/game/CardDetailPanel.java b/src/forge/gui/game/CardDetailPanel.java index 75f3268470a..b1e997c05f1 100644 --- a/src/forge/gui/game/CardDetailPanel.java +++ b/src/forge/gui/game/CardDetailPanel.java @@ -139,7 +139,7 @@ public class CardDetailPanel extends JPanel implements CardContainer { cdLabel5.setText("Card ID " + card.getUniqueNumber()); //rarity and set of a face down card should not be visible to the opponent - if (!card.isFaceDown() || card.getController().equals(AllZone.HumanPlayer)) cdLabel7.setText(card.getCurSetCode()); + if (!card.isFaceDown() || card.getController().isHuman()) cdLabel7.setText(card.getCurSetCode()); if (!cdLabel7.getText().equals("")) { diff --git a/src/forge/gui/input/Input_Cleanup.java b/src/forge/gui/input/Input_Cleanup.java index 29e2a474ee8..79d3b4f9fc3 100644 --- a/src/forge/gui/input/Input_Cleanup.java +++ b/src/forge/gui/input/Input_Cleanup.java @@ -2,6 +2,7 @@ package forge.gui.input; import forge.AllZone; +import forge.AllZoneUtil; import forge.ButtonUtil; import forge.Card; import forge.CombatUtil; @@ -19,7 +20,7 @@ public class Input_Cleanup extends Input { } ButtonUtil.disableAll(); - int n = AllZone.Human_Hand.getCards().length; + int n = AllZoneUtil.getPlayerHand(AllZone.HumanPlayer).size(); //MUST showMessage() before stop() or it will overwrite the next Input's message StringBuffer sb = new StringBuffer(); @@ -47,7 +48,7 @@ public class Input_Cleanup extends Input { public void AI_CleanupDiscard(){ - int size = AllZone.Computer_Hand.getCards().length; + int size = AllZoneUtil.getPlayerHand(AllZone.ComputerPlayer).size(); if (AllZone.ComputerPlayer.getMaxHandSize() != -1){ int numDiscards = size - AllZone.ComputerPlayer.getMaxHandSize(); diff --git a/src/forge/gui/input/Input_PayManaCost.java b/src/forge/gui/input/Input_PayManaCost.java index 2ff94bea8fa..2b094547e8b 100644 --- a/src/forge/gui/input/Input_PayManaCost.java +++ b/src/forge/gui/input/Input_PayManaCost.java @@ -101,7 +101,7 @@ public class Input_PayManaCost extends Input { public void selectPlayer(Player player) { - if(player.equals(AllZone.HumanPlayer)) + if(player.isHuman()) { if(manaCost.payPhyrexian()) { diff --git a/src/forge/gui/input/Input_PayManaCostUtil.java b/src/forge/gui/input/Input_PayManaCostUtil.java index 86942f596c5..7754f6941e2 100644 --- a/src/forge/gui/input/Input_PayManaCostUtil.java +++ b/src/forge/gui/input/Input_PayManaCostUtil.java @@ -21,7 +21,7 @@ public class Input_PayManaCostUtil public static ManaCost activateManaAbility(SpellAbility sa, Card card, ManaCost manaCost) { //make sure computer's lands aren't selected - if(card.getController().equals(AllZone.ComputerPlayer)) + if(card.getController().isComputer()) return manaCost; if(card instanceof ManaPool)