From 16ec02124cfbebd23c8f7a3693e7f353a1222728 Mon Sep 17 00:00:00 2001 From: Maxmtg Date: Fri, 5 Oct 2012 20:28:26 +0000 Subject: [PATCH] CardListUtil => CardLists (as they call Collections class) --- .gitattributes | 2 +- src/main/java/forge/AllZoneUtil.java | 20 +-- src/main/java/forge/Card.java | 4 +- .../{CardListUtil.java => CardLists.java} | 28 ++-- src/main/java/forge/CardUtil.java | 6 +- src/main/java/forge/GameActionUtil.java | 18 +-- .../card/abilityfactory/AbilityFactory.java | 6 +- .../abilityfactory/AbilityFactoryAttach.java | 46 +++---- .../AbilityFactoryChangeZone.java | 88 ++++++------ .../abilityfactory/AbilityFactoryChoose.java | 28 ++-- .../abilityfactory/AbilityFactoryClash.java | 8 +- .../abilityfactory/AbilityFactoryCombat.java | 10 +- .../abilityfactory/AbilityFactoryCopy.java | 8 +- .../AbilityFactoryCounters.java | 56 ++++---- .../AbilityFactoryDealDamage.java | 24 ++-- .../abilityfactory/AbilityFactoryDebuff.java | 26 ++-- .../abilityfactory/AbilityFactoryDestroy.java | 62 ++++----- .../abilityfactory/AbilityFactoryEffect.java | 10 +- .../AbilityFactoryGainControl.java | 14 +- .../abilityfactory/AbilityFactoryMana.java | 4 +- .../AbilityFactoryPermanentState.java | 70 +++++----- .../abilityfactory/AbilityFactoryPlay.java | 6 +- .../AbilityFactoryPreventDamage.java | 18 +-- .../AbilityFactoryProtection.java | 30 ++-- .../abilityfactory/AbilityFactoryPump.java | 76 +++++------ .../AbilityFactoryRegenerate.java | 28 ++-- .../abilityfactory/AbilityFactoryRepeat.java | 4 +- .../abilityfactory/AbilityFactoryReveal.java | 12 +- .../AbilityFactorySacrifice.java | 16 +-- .../AbilityFactorySetState.java | 4 +- .../AbilityFactoryZoneAffecting.java | 10 +- .../cardfactory/CardFactoryArtifacts.java | 6 +- .../card/cardfactory/CardFactoryAuras.java | 18 +-- .../cardfactory/CardFactoryCreatures.java | 58 ++++---- .../cardfactory/CardFactoryEnchantments.java | 10 +- .../card/cardfactory/CardFactoryInstants.java | 10 +- .../card/cardfactory/CardFactoryLands.java | 8 +- .../cardfactory/CardFactorySorceries.java | 40 +++--- .../card/cardfactory/CardFactoryUtil.java | 128 +++++++++--------- .../java/forge/card/cost/CostDiscard.java | 8 +- src/main/java/forge/card/cost/CostExile.java | 10 +- .../java/forge/card/cost/CostPutCounter.java | 8 +- .../forge/card/cost/CostRemoveCounter.java | 10 +- src/main/java/forge/card/cost/CostReturn.java | 6 +- src/main/java/forge/card/cost/CostReveal.java | 8 +- .../java/forge/card/cost/CostSacrifice.java | 14 +- .../java/forge/card/cost/CostTapType.java | 14 +- .../java/forge/card/cost/CostUntapType.java | 14 +- src/main/java/forge/card/cost/CostUtil.java | 10 +- .../card/replacement/ReplacementEffect.java | 6 +- .../java/forge/card/spellability/Spell.java | 4 +- .../spellability/SpellAbilityCondition.java | 4 +- .../spellability/SpellAbilityRestriction.java | 4 +- .../card/spellability/SpellPermanent.java | 14 +- .../card/spellability/TargetSelection.java | 12 +- .../StaticAbilityContinuous.java | 14 +- src/main/java/forge/card/trigger/Trigger.java | 6 +- .../forge/card/trigger/TriggerHandler.java | 6 +- .../forge/control/input/InputMulligan.java | 4 +- .../control/input/InputPayReturnCost.java | 4 +- .../forge/control/input/InputPaySacCost.java | 4 +- src/main/java/forge/game/phase/Combat.java | 6 +- .../java/forge/game/phase/CombatUtil.java | 26 ++-- src/main/java/forge/game/phase/EndOfTurn.java | 4 +- .../java/forge/game/phase/PhaseHandler.java | 6 +- src/main/java/forge/game/phase/PhaseUtil.java | 6 +- src/main/java/forge/game/phase/Untap.java | 22 +-- src/main/java/forge/game/phase/Upkeep.java | 48 +++---- src/main/java/forge/game/player/AIPlayer.java | 8 +- .../java/forge/game/player/ComputerUtil.java | 92 ++++++------- .../forge/game/player/ComputerUtilAttack.java | 24 ++-- .../forge/game/player/ComputerUtilBlock.java | 38 +++--- src/main/java/forge/game/player/Player.java | 12 +- .../java/forge/game/player/PlayerUtil.java | 8 +- src/main/java/forge/game/zone/MagicStack.java | 6 +- .../game/zone/PlayerZoneComesIntoPlay.java | 4 +- .../forge/gui/match/controllers/CDock.java | 4 +- 77 files changed, 759 insertions(+), 759 deletions(-) rename src/main/java/forge/{CardListUtil.java => CardLists.java} (90%) diff --git a/.gitattributes b/.gitattributes index 8309a68eb06..a2e15aa3fd6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -12343,7 +12343,7 @@ src/main/java/forge/CardCharacteristicName.java -text src/main/java/forge/CardColor.java svneol=native#text/plain src/main/java/forge/CardDamageHistory.java -text src/main/java/forge/CardKeywords.java svneol=native#text/plain -src/main/java/forge/CardListUtil.java svneol=native#text/plain +src/main/java/forge/CardLists.java svneol=native#text/plain src/main/java/forge/CardPowerToughness.java svneol=native#text/plain src/main/java/forge/CardPredicates.java svneol=native#text/plain src/main/java/forge/CardType.java svneol=native#text/plain diff --git a/src/main/java/forge/AllZoneUtil.java b/src/main/java/forge/AllZoneUtil.java index b7f0091a741..e21b92c2184 100644 --- a/src/main/java/forge/AllZoneUtil.java +++ b/src/main/java/forge/AllZoneUtil.java @@ -89,7 +89,7 @@ public abstract class AllZoneUtil { * @return a List with all cards currently in a graveyard */ public static List getCardsIn(final ZoneType zone, final String cardName) { - return CardListUtil.filter(AllZoneUtil.getCardsIn(zone), CardPredicates.nameEquals(cardName)); + return CardLists.filter(AllZoneUtil.getCardsIn(zone), CardPredicates.nameEquals(cardName)); } // ////////// Creatures @@ -102,7 +102,7 @@ public abstract class AllZoneUtil { */ public static List getCreaturesInPlay() { final List creats = AllZoneUtil.getCardsIn(ZoneType.Battlefield); - return CardListUtil.filter(creats, Presets.CREATURES); + return CardLists.filter(creats, Presets.CREATURES); } /** @@ -114,7 +114,7 @@ public abstract class AllZoneUtil { */ public static List getCreaturesInPlay(final Player player) { final List creats = player.getCardsIn(ZoneType.Battlefield); - return CardListUtil.filter(creats, Presets.CREATURES); + return CardLists.filter(creats, Presets.CREATURES); } // /////////////// Lands @@ -127,7 +127,7 @@ public abstract class AllZoneUtil { * @return a List containing all lands the given player has in play */ public static List getPlayerLandsInPlay(final Player player) { - return CardListUtil.filter(player.getCardsIn(ZoneType.Battlefield), Presets.LANDS); + return CardLists.filter(player.getCardsIn(ZoneType.Battlefield), Presets.LANDS); } /** @@ -136,7 +136,7 @@ public abstract class AllZoneUtil { * @return a List of all lands on the battlefield */ public static List getLandsInPlay() { - return CardListUtil.filter(AllZoneUtil.getCardsIn(ZoneType.Battlefield), Presets.LANDS); + return CardLists.filter(AllZoneUtil.getCardsIn(ZoneType.Battlefield), Presets.LANDS); } // ============================================================================= @@ -235,7 +235,7 @@ public abstract class AllZoneUtil { */ public static List getPlayerColorInPlay(final Player player, final String color) { List cards = player.getCardsIn(ZoneType.Battlefield); - cards = CardListUtil.filter(cards, new Predicate() { + cards = CardLists.filter(cards, new Predicate() { @Override public boolean apply(final Card c) { final List colorList = CardUtil.getColors(c); @@ -279,8 +279,8 @@ public abstract class AllZoneUtil { public static int compareTypeAmountInPlay(final Player player, final String type) { // returns the difference between player's final Player opponent = player.getOpponent(); - final List playerList = CardListUtil.getType(player.getCardsIn(ZoneType.Battlefield), type); - final List opponentList = CardListUtil.getType(opponent.getCardsIn(ZoneType.Battlefield), type); + final List playerList = CardLists.getType(player.getCardsIn(ZoneType.Battlefield), type); + final List opponentList = CardLists.getType(opponent.getCardsIn(ZoneType.Battlefield), type); return (playerList.size() - opponentList.size()); } @@ -298,8 +298,8 @@ public abstract class AllZoneUtil { public static int compareTypeAmountInGraveyard(final Player player, final String type) { // returns the difference between player's final Player opponent = player.getOpponent(); - final List playerList = CardListUtil.getType(player.getCardsIn(ZoneType.Graveyard), type); - final List opponentList = CardListUtil.getType(opponent.getCardsIn(ZoneType.Graveyard), type); + final List playerList = CardLists.getType(player.getCardsIn(ZoneType.Graveyard), type); + final List opponentList = CardLists.getType(opponent.getCardsIn(ZoneType.Graveyard), type); return (playerList.size() - opponentList.size()); } diff --git a/src/main/java/forge/Card.java b/src/main/java/forge/Card.java index f0c0b3272f7..767b61a02a5 100644 --- a/src/main/java/forge/Card.java +++ b/src/main/java/forge/Card.java @@ -6567,7 +6567,7 @@ public class Card extends GameEntity implements Comparable { } else if (property.startsWith("ControllerControls")) { final String type = property.substring(18); final List list = this.getController().getCardsIn(ZoneType.Battlefield); - if (CardListUtil.getType(list, type).isEmpty()) { + if (CardLists.getType(list, type).isEmpty()) { return false; } } else if (property.startsWith("Other")) { @@ -6670,7 +6670,7 @@ public class Card extends GameEntity implements Comparable { return false; } } else if (property.startsWith("TopGraveyardCreature")) { - List list = CardListUtil.filter(this.getOwner().getCardsIn(ZoneType.Graveyard), CardPredicates.Presets.CREATURES); + List list = CardLists.filter(this.getOwner().getCardsIn(ZoneType.Graveyard), CardPredicates.Presets.CREATURES); Collections.reverse(list); if (list.isEmpty() || !this.equals(list.get(0))) { return false; diff --git a/src/main/java/forge/CardListUtil.java b/src/main/java/forge/CardLists.java similarity index 90% rename from src/main/java/forge/CardListUtil.java rename to src/main/java/forge/CardLists.java index 89ce0b290d9..75232e0b3db 100644 --- a/src/main/java/forge/CardListUtil.java +++ b/src/main/java/forge/CardLists.java @@ -42,7 +42,7 @@ import forge.util.MyRandom; * @author Forge * @version $Id$ */ -public class CardListUtil { +public class CardLists { /** *

* filterToughness. @@ -55,7 +55,7 @@ public class CardListUtil { * @return a {@link forge.CardList} object. */ public static List filterToughness(final List in, final int atLeastToughness) { - return CardListUtil.filter(in, new Predicate() { + return CardLists.filter(in, new Predicate() { @Override public boolean apply(Card c) { return c.getNetDefense() <= atLeastToughness; @@ -169,7 +169,7 @@ public class CardListUtil { * a {@link forge.CardList} object. */ public static void sortNonFlyingFirst(final List list) { - CardListUtil.sortFlying(list); + CardLists.sortFlying(list); Collections.reverse(list); } // sortNonFlyingFirst @@ -209,7 +209,7 @@ public class CardListUtil { * @return a {@link forge.CardList} object. */ public static List getColor(final List list, final String color) { - return CardListUtil.filter(list, new Predicate() { + return CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { return CardUtil.getColors(c).contains(color); @@ -227,7 +227,7 @@ public class CardListUtil { * @return a {@link forge.CardList} object. */ public static List getGoldCards(final List list) { - return CardListUtil.filter(list, new Predicate() { + return CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { return CardUtil.getColors(c).size() >= 2; @@ -281,7 +281,7 @@ public class CardListUtil { final List subList = new ArrayList(); while (subList.size() < amount) { - CardListUtil.shuffle(c); + CardLists.shuffle(c); subList.add(c.get(0)); c.remove(0); } @@ -301,38 +301,38 @@ public class CardListUtil { } public static List filterControlledBy(List cardList, Player player) { - return CardListUtil.filter(cardList, CardPredicates.isController(player)); + return CardLists.filter(cardList, CardPredicates.isController(player)); } public static List getValidCards(List cardList, String[] restrictions, Player sourceController, Card source) { - return CardListUtil.filter(cardList, CardPredicates.restriction(restrictions, sourceController, source)); + return CardLists.filter(cardList, CardPredicates.restriction(restrictions, sourceController, source)); } public static List getValidCards(List cardList, String restriction, Player sourceController, Card source) { - return CardListUtil.filter(cardList, CardPredicates.restriction(restriction.split(","), sourceController, source)); + return CardLists.filter(cardList, CardPredicates.restriction(restriction.split(","), sourceController, source)); } public static List getTargetableCards(List cardList, SpellAbility source) { - return CardListUtil.filter(cardList, CardPredicates.isTargetableBy(source)); + return CardLists.filter(cardList, CardPredicates.isTargetableBy(source)); } public static List getKeyword(List cardList, String keyword) { - return CardListUtil.filter(cardList, CardPredicates.hasKeyword(keyword)); + return CardLists.filter(cardList, CardPredicates.hasKeyword(keyword)); } public static List getNotKeyword(List cardList, String keyword) { - return CardListUtil.filter(cardList, Predicates.not(CardPredicates.hasKeyword(keyword))); + return CardLists.filter(cardList, Predicates.not(CardPredicates.hasKeyword(keyword))); } // cardType is like "Land" or "Goblin", returns a new ArrayList that is a // subset of current CardList public static List getNotType(List cardList, String cardType) { - return CardListUtil.filter(cardList, Predicates.not(CardPredicates.isType(cardType))); + return CardLists.filter(cardList, Predicates.not(CardPredicates.isType(cardType))); } public static List getType(List cardList, String cardType) { - return CardListUtil.filter(cardList, CardPredicates.isType(cardType)); + return CardLists.filter(cardList, CardPredicates.isType(cardType)); } /** diff --git a/src/main/java/forge/CardUtil.java b/src/main/java/forge/CardUtil.java index 879ec632b85..ba5a5e03cbc 100644 --- a/src/main/java/forge/CardUtil.java +++ b/src/main/java/forge/CardUtil.java @@ -633,7 +633,7 @@ public final class CardUtil { res.addAll(((DefaultPlayerZone) AllZone.getStackZone()).getCardsAddedThisTurn(from)); } - res = CardListUtil.getValidCards(res, valid, src.getController(), src); + res = CardLists.getValidCards(res, valid, src.getController(), src); return res; } @@ -652,7 +652,7 @@ public final class CardUtil { res.addAll(AllZone.getStack().getCardsCastThisTurn()); - res = CardListUtil.getValidCards(res, valid, src.getController(), src); + res = CardLists.getValidCards(res, valid, src.getController(), src); return res; } @@ -671,7 +671,7 @@ public final class CardUtil { res.addAll(AllZone.getStack().getCardsCastLastTurn()); - res = CardListUtil.getValidCards(res, valid, src.getController(), src); + res = CardLists.getValidCards(res, valid, src.getController(), src); return res; } diff --git a/src/main/java/forge/GameActionUtil.java b/src/main/java/forge/GameActionUtil.java index 2128eaaf7b4..99f489c2177 100644 --- a/src/main/java/forge/GameActionUtil.java +++ b/src/main/java/forge/GameActionUtil.java @@ -194,7 +194,7 @@ public final class GameActionUtil { } } } - CardListUtil.shuffle(revealed); + CardLists.shuffle(revealed); for (final Card bottom : revealed) { Singletons.getModel().getGameAction().moveToBottomOfLibrary(bottom); } @@ -323,7 +323,7 @@ public final class GameActionUtil { } } } - CardListUtil.shuffle(revealed); + CardLists.shuffle(revealed); for (final Card bottom : revealed) { Singletons.getModel().getGameAction().moveToBottomOfLibrary(bottom); } @@ -864,7 +864,7 @@ public final class GameActionUtil { public void resolve() { for (int i = 0; i < damage; i++) { List nonTokens = player.getCardsIn(ZoneType.Battlefield); - nonTokens = CardListUtil.filter(nonTokens, Presets.NON_TOKEN); + nonTokens = CardLists.filter(nonTokens, Presets.NON_TOKEN); if (nonTokens.size() == 0) { player.loseConditionMet(GameLossReason.SpellEffect, lich.getName()); } else { @@ -1159,7 +1159,7 @@ public final class GameActionUtil { produces.put("Swamp", "B"); List lands = AllZoneUtil.getCardsInGame(); - lands = CardListUtil.filter(lands, Presets.LANDS); + lands = CardLists.filter(lands, Presets.LANDS); // remove all abilities granted by this Command for (final Card land : lands) { @@ -1230,7 +1230,7 @@ public final class GameActionUtil { // add +1/+1 to cards list.clear(); final int num = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Coat of Arms").size(); - final List creatures = CardListUtil.filter(AllZoneUtil.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES); + final List creatures = CardLists.filter(AllZoneUtil.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES); for (Card c : creatures) { for (Card c2 : creatures) { @@ -1310,7 +1310,7 @@ public final class GameActionUtil { public void execute() { List list = AllZoneUtil.getCardsIn(ZoneType.Battlefield); - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { return c.getName().equals("Avatar") && c.getImageName().equals("W N N Avatar"); @@ -1372,7 +1372,7 @@ public final class GameActionUtil { private boolean getsBonus(final Card c) { List list = c.getController().getCardsIn(ZoneType.Battlefield); - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { return c.getName().equals("Guan Yu, Sainted Warrior") @@ -1392,7 +1392,7 @@ public final class GameActionUtil { @Override public void execute() { List list = AllZoneUtil.getCardsIn(ZoneType.Battlefield); - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { return c.getName().equals("Wolf") @@ -1522,7 +1522,7 @@ public final class GameActionUtil { public static void doPowerSink(final Player p) { // get all lands with mana abilities List lands = AllZoneUtil.getPlayerLandsInPlay(p); - lands = CardListUtil.filter(lands, new Predicate() { + lands = CardLists.filter(lands, new Predicate() { @Override public boolean apply(final Card c) { return c.getManaAbility().size() > 0; diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactory.java b/src/main/java/forge/card/abilityfactory/AbilityFactory.java index 3720801c88f..b4800875dac 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactory.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactory.java @@ -25,7 +25,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardUtil; import forge.Command; import forge.GameActionUtil; @@ -2486,7 +2486,7 @@ public class AbilityFactory { if (threatParams.containsKey("Defined")) { objects = AbilityFactory.getDefinedObjects(source, threatParams.get("Defined"), topStack); } else if (threatParams.containsKey("ValidCards")) { - List cards = CardListUtil.getValidCards(AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield), threatParams.get("ValidCards").split(","), source.getController(), source); + List cards = CardLists.getValidCards(AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield), threatParams.get("ValidCards").split(","), source.getController(), source); for (Card card : cards) { objects.add(card); } @@ -2762,7 +2762,7 @@ public class AbilityFactory { if (valid.contains("EQX")) { valid = valid.replace("X", Integer.toString(AbilityFactory.calculateAmount(source, "X", sa))); } - return CardListUtil.getValidCards(list, valid.split(","), sa.getActivatingPlayer(), source); + return CardLists.getValidCards(list, valid.split(","), sa.getActivatingPlayer(), source); } /** diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryAttach.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryAttach.java index 1b7b0321509..a6e9a5c5992 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryAttach.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryAttach.java @@ -31,7 +31,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates; import forge.CardPredicates.Presets; import forge.CardUtil; @@ -349,9 +349,9 @@ public class AbilityFactoryAttach { } List list = AllZoneUtil.getCardsIn(tgt.getZone()); - list = CardListUtil.getValidCards(list, tgt.getValidTgts(), sa.getActivatingPlayer(), attachSource); + list = CardLists.getValidCards(list, tgt.getValidTgts(), sa.getActivatingPlayer(), attachSource); if (params.containsKey("AITgts")) { - list = CardListUtil.getValidCards(list, params.get("AITgts"), sa.getActivatingPlayer(), attachSource); + list = CardLists.getValidCards(list, params.get("AITgts"), sa.getActivatingPlayer(), attachSource); } // TODO If Attaching without casting, don't need to actually target. @@ -359,9 +359,9 @@ public class AbilityFactoryAttach { // check that when starting that work // But we shouldn't attach to things with Protection if (tgt.getZone().contains(ZoneType.Battlefield) && !mandatory) { - list = CardListUtil.getTargetableCards(list, sa); + list = CardLists.getTargetableCards(list, sa); } else { - list = CardListUtil.filter(list, Predicates.not(CardPredicates.isProtectedFrom(attachSource))); + list = CardLists.filter(list, Predicates.not(CardPredicates.isProtectedFrom(attachSource))); } if (list.size() == 0) { @@ -371,7 +371,7 @@ public class AbilityFactoryAttach { Card c = AbilityFactoryAttach.attachGeneralAI(sa, list, mandatory, attachSource, params.get("AILogic")); if ((c == null) && mandatory) { - CardListUtil.shuffle(list); + CardLists.shuffle(list); c = list.get(0); } @@ -401,7 +401,7 @@ public class AbilityFactoryAttach { } // Some ChangeType cards are beneficial, and PrefPlayer should be // changed to represent that - final List prefList = CardListUtil.filterControlledBy(list, prefPlayer); + final List prefList = CardLists.filterControlledBy(list, prefPlayer); // If there are no preferred cards, and not mandatory bail out if (prefList.size() == 0) { @@ -503,9 +503,9 @@ public class AbilityFactoryAttach { public static Card attachAIAnimatePreference(final SpellAbility sa, final List list, final boolean mandatory, final Card attachSource) { // AI For choosing a Card to Animate. - List betterList = CardListUtil.getNotType(list, "Creature"); + List betterList = CardLists.getNotType(list, "Creature"); if (sa.getSourceCard().getName().equals("Animate Artifact")) { - betterList = CardListUtil.filter(betterList, new Predicate() { + betterList = CardLists.filter(betterList, new Predicate() { @Override public boolean apply(final Card c) { return c.getCMC() > 0; @@ -697,7 +697,7 @@ public class AbilityFactoryAttach { String stCheck = null; if (attachSource.isAura()) { stCheck = "EnchantedBy"; - magnetList = CardListUtil.filter(list, new Predicate() { + magnetList = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { if ( !c.isCreature() ) return false; @@ -707,7 +707,7 @@ public class AbilityFactoryAttach { }); } else if (attachSource.isEquipment()) { stCheck = "EquippedBy"; - magnetList = CardListUtil.filter(list, new Predicate() { + magnetList = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { if ( !c.isCreature() ) return false; @@ -722,7 +722,7 @@ public class AbilityFactoryAttach { // Probably want to "weight" the list by amount of Enchantments and // choose the "lightest" - magnetList = CardListUtil.filter(magnetList, new Predicate() { + magnetList = CardLists.filter(magnetList, new Predicate() { @Override public boolean apply(final Card c) { return CombatUtil.canAttack(c); @@ -774,7 +774,7 @@ public class AbilityFactoryAttach { if (totToughness < 0) { // Don't kill my own stuff with Negative toughness Auras final int tgh = totToughness; - prefList = CardListUtil.filter(prefList, new Predicate() { + prefList = CardLists.filter(prefList, new Predicate() { @Override public boolean apply(final Card c) { return c.getLethalDamage() > Math.abs(tgh); @@ -784,7 +784,7 @@ public class AbilityFactoryAttach { //only add useful keywords unless P/T bonus is significant if (totToughness + totPower < 4 && !keywords.isEmpty()) { - prefList = CardListUtil.filter(prefList, new Predicate() { + prefList = CardLists.filter(prefList, new Predicate() { @Override public boolean apply(final Card c) { return containsUsefulKeyword(keywords, c, sa); @@ -793,7 +793,7 @@ public class AbilityFactoryAttach { } // Don't pump cards that will die. - prefList = CardListUtil.filter(prefList, new Predicate() { + prefList = CardLists.filter(prefList, new Predicate() { @Override public boolean apply(final Card c) { return !c.getSVar("Targeting").equals("Dies"); @@ -803,13 +803,13 @@ public class AbilityFactoryAttach { if (attachSource.isAura()) { // TODO For Auras like Rancor, that aren't as likely to lead to // card disadvantage, this check should be skipped - prefList = CardListUtil.filter(prefList, Predicates.not(Presets.ENCHANTED)); + prefList = CardLists.filter(prefList, Predicates.not(Presets.ENCHANTED)); } if (!grantingAbilities) { // Probably prefer to Enchant Creatures that Can Attack // Filter out creatures that can't Attack or have Defender - prefList = CardListUtil.filter(prefList, new Predicate() { + prefList = CardLists.filter(prefList, new Predicate() { @Override public boolean apply(final Card c) { return !c.isCreature() || CombatUtil.canAttackNextTurn(c); @@ -892,7 +892,7 @@ public class AbilityFactoryAttach { if (totToughness < 0) { // Kill a creature if we can final int tgh = totToughness; - prefList = CardListUtil.filter(list, new Predicate() { + prefList = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { if (!c.hasKeyword("Indestructible") && (c.getLethalDamage() <= Math.abs(tgh))) { @@ -918,7 +918,7 @@ public class AbilityFactoryAttach { // things to begin with if (keywords.contains("CARDNAME can't attack.") || keywords.contains("Defender") || keywords.contains("CARDNAME attacks each turn if able.")) { - prefList = CardListUtil.filter(prefList, new Predicate() { + prefList = CardLists.filter(prefList, new Predicate() { @Override public boolean apply(final Card c) { return !(c.hasKeyword("CARDNAME can't attack.") || c.hasKeyword("Defender")); @@ -962,7 +962,7 @@ public class AbilityFactoryAttach { } } - list = CardListUtil.getNotType(list, type); // Filter out Basic Lands that have the + list = CardLists.getNotType(list, type); // Filter out Basic Lands that have the // same type as the changing type final Card c = CardFactoryUtil.getBestAI(list); @@ -996,7 +996,7 @@ public class AbilityFactoryAttach { public static Card attachAIKeepTappedPreference(final SpellAbility sa, final List list, final boolean mandatory, final Card attachSource) { // AI For Cards like Paralyzing Grasp and Glimmerdust Nap - final List prefList = CardListUtil.filter(list, new Predicate() { + final List prefList = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { // Don't do Untapped Vigilance cards @@ -1419,7 +1419,7 @@ public class AbilityFactoryAttach { } } else { List list = AllZoneUtil.getCardsIn(tgt.getZone()); - list = CardListUtil.getValidCards(list, tgt.getValidTgts(), aura.getActivatingPlayer(), source); + list = CardLists.getValidCards(list, tgt.getValidTgts(), aura.getActivatingPlayer(), source); final Object o = GuiChoose.one(source + " - Select a card to attach to.", list); if (o instanceof Card) { @@ -1712,7 +1712,7 @@ public class AbilityFactoryAttach { for (final Object o : targets) { String valid = params.get("UnattachValid"); List unattachList = AllZoneUtil.getCardsIn(ZoneType.Battlefield); - unattachList = CardListUtil.getValidCards(unattachList, valid.split(","), source.getController(), source); + unattachList = CardLists.getValidCards(unattachList, valid.split(","), source.getController(), source); for (final Card c : unattachList) { AbilityFactoryAttach.handleUnattachment(o, c, af); } diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryChangeZone.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryChangeZone.java index 0cbdd841238..9dc3379bbc9 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryChangeZone.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryChangeZone.java @@ -31,7 +31,7 @@ import forge.AllZoneUtil; import forge.Card; import forge.CardCharacteristicName; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates; import forge.CardPredicates.Presets; import forge.CardUtil; @@ -573,7 +573,7 @@ public final class AbilityFactoryChangeZone { if ((type != null) && p.isComputer()) { // AI only "knows" about his information - list = CardListUtil.getValidCards(list, type, source.getController(), source); + list = CardLists.getValidCards(list, type, source.getController(), source); } if (list.isEmpty()) { @@ -1173,11 +1173,11 @@ public final class AbilityFactoryChangeZone { } else if (defined) { c = fetchList.get(0); } else { - CardListUtil.shuffle(fetchList); + CardLists.shuffle(fetchList); // Save a card as a default, in case we can't find anything suitable. Card first = fetchList.get(0); if (ZoneType.Battlefield.equals(destination)) { - fetchList = CardListUtil.filter(fetchList, new Predicate() { + fetchList = CardLists.filter(fetchList, new Predicate() { @Override public boolean apply(final Card c) { if (c.isType("Legendary")) { @@ -1189,7 +1189,7 @@ public final class AbilityFactoryChangeZone { } }); if (player.isHuman() && params.containsKey("GainControl")) { - fetchList = CardListUtil.filter(fetchList, new Predicate() { + fetchList = CardLists.filter(fetchList, new Predicate() { @Override public boolean apply(final Card c) { if (!c.getSVar("RemAIDeck").equals("") || !c.getSVar("RemRandomDeck").equals("")) { @@ -1210,21 +1210,21 @@ public final class AbilityFactoryChangeZone { } else if (origin.contains(ZoneType.Library) && (type.contains("Basic") || AbilityFactoryChangeZone.areAllBasics(type))) { c = AbilityFactoryChangeZone.basicManaFixing(fetchList); - } else if (ZoneType.Hand.equals(destination) && CardListUtil.getNotType(fetchList, "Creature").size() == 0) { + } else if (ZoneType.Hand.equals(destination) && CardLists.getNotType(fetchList, "Creature").size() == 0) { c = AbilityFactoryChangeZone.chooseCreature(fetchList); } else if (ZoneType.Battlefield.equals(destination) || ZoneType.Graveyard.equals(destination)) { c = CardFactoryUtil.getBestAI(fetchList); } else { // Don't fetch another tutor with the same name - List sameNamed = CardListUtil.filter(fetchList, Predicates.not(CardPredicates.nameEquals(card.getName()))); + List sameNamed = CardLists.filter(fetchList, Predicates.not(CardPredicates.nameEquals(card.getName()))); if (origin.contains(ZoneType.Library) && !sameNamed.isEmpty()) { fetchList = sameNamed; } Player ai = AllZone.getComputerPlayer(); // Does AI need a land? List hand = ai.getCardsIn(ZoneType.Hand); - System.out.println("Lands in hand = " + CardListUtil.filter(hand, Presets.LANDS).size() + ", on battlefield = " + CardListUtil.filter(ai.getCardsIn(ZoneType.Battlefield), Presets.LANDS).size()); - if (CardListUtil.filter(hand, Presets.LANDS).size() == 0 && CardListUtil.filter(ai.getCardsIn(ZoneType.Battlefield), Presets.LANDS).size() < 4) { + System.out.println("Lands in hand = " + CardLists.filter(hand, Presets.LANDS).size() + ", on battlefield = " + CardLists.filter(ai.getCardsIn(ZoneType.Battlefield), Presets.LANDS).size()); + if (CardLists.filter(hand, Presets.LANDS).size() == 0 && CardLists.filter(ai.getCardsIn(ZoneType.Battlefield), Presets.LANDS).size() < 4) { boolean canCastSomething = false; for (Card cardInHand : hand) { canCastSomething |= ComputerUtil.payManaCost(cardInHand.getFirstSpellAbility(), AllZone.getComputerPlayer(), true, 0, false); @@ -1236,15 +1236,15 @@ public final class AbilityFactoryChangeZone { } if (c == null) { System.out.println("Don't need a land or none available; trying for a creature."); - fetchList = CardListUtil.getNotType(fetchList, "Land"); + fetchList = CardLists.getNotType(fetchList, "Land"); // Prefer to pull a creature, generally more useful for AI. - c = chooseCreature(CardListUtil.filter(fetchList, CardPredicates.Presets.CREATURES)); + c = chooseCreature(CardLists.filter(fetchList, CardPredicates.Presets.CREATURES)); } if (c == null) { // Could not find a creature. if (ai.getLife() <= 5) { // Desperate? // Get something AI can cast soon. System.out.println("5 Life or less, trying to find something castable."); - CardListUtil.sortByMostExpensive(fetchList); + CardLists.sortByMostExpensive(fetchList); for (Card potentialCard : fetchList) { if (ComputerUtil.payManaCost(potentialCard.getFirstSpellAbility(), AllZone.getComputerPlayer(), true, 0, false)) { c = potentialCard; @@ -1368,7 +1368,7 @@ public final class AbilityFactoryChangeZone { // what types can I go get? for (final String name : Constant.Color.BASIC_LANDS) { - if (!CardListUtil.getType(list, name).isEmpty()) { + if (!CardLists.getType(list, name).isEmpty()) { basics.add(name); } } @@ -1380,7 +1380,7 @@ public final class AbilityFactoryChangeZone { for (int i = 0; i < basics.size(); i++) { final String b = basics.get(i); - final int num = CardListUtil.getType(combined, b).size(); + final int num = CardLists.getType(combined, b).size(); if (num < minSize) { minType = b; minSize = num; @@ -1389,7 +1389,7 @@ public final class AbilityFactoryChangeZone { List result = list; if (minType != null) { - result = CardListUtil.getType(list, minType); + result = CardLists.getType(list, minType); } return result.get(0); @@ -1441,7 +1441,7 @@ public final class AbilityFactoryChangeZone { if (CombatUtil.lifeInDanger(combat)) { // need something AI can cast now - CardListUtil.sortByEvaluateCreature(list); + CardLists.sortByEvaluateCreature(list); for (Card c : list) { if (ComputerUtil.payManaCost(c.getFirstSpellAbility(), AllZone.getComputerPlayer(), true, 0, false)) { card = c; @@ -1638,9 +1638,9 @@ public final class AbilityFactoryChangeZone { } List list = AllZoneUtil.getCardsIn(origin); - list = CardListUtil.getValidCards(list, tgt.getValidTgts(), AllZone.getComputerPlayer(), source); + list = CardLists.getValidCards(list, tgt.getValidTgts(), AllZone.getComputerPlayer(), source); if (source.isInZone(ZoneType.Hand)) { - list = CardListUtil.filter(list, Predicates.not(CardPredicates.nameEquals(source.getName()))); // Don't get the same card back. + list = CardLists.filter(list, Predicates.not(CardPredicates.nameEquals(source.getName()))); // Don't get the same card back. } if (list.size() < tgt.getMinTargets(sa.getSourceCard(), sa)) { @@ -1650,11 +1650,11 @@ public final class AbilityFactoryChangeZone { // Narrow down the list: if (origin.equals(ZoneType.Battlefield)) { // filter out untargetables - list = CardListUtil.getTargetableCards(list, sa); - List aiPermanents = CardListUtil.filterControlledBy(list, AllZone.getComputerPlayer()); + list = CardLists.getTargetableCards(list, sa); + List aiPermanents = CardLists.filterControlledBy(list, AllZone.getComputerPlayer()); // Don't blink cards that will die. - aiPermanents = CardListUtil.filter(aiPermanents, new Predicate() { + aiPermanents = CardLists.filter(aiPermanents, new Predicate() { @Override public boolean apply(final Card c) { return !c.getSVar("Targeting").equals("Dies"); @@ -1687,8 +1687,8 @@ public final class AbilityFactoryChangeZone { } // Save combatants else if (Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) { - final List combatants = CardListUtil.filter(aiPermanents, CardPredicates.Presets.CREATURES); - CardListUtil.sortByEvaluateCreature(combatants); + final List combatants = CardLists.filter(aiPermanents, CardPredicates.Presets.CREATURES); + CardLists.sortByEvaluateCreature(combatants); for (final Card c : combatants) { if ((c.getShield() == 0) && CombatUtil.combatantWouldBeDestroyed(c)) { @@ -1699,7 +1699,7 @@ public final class AbilityFactoryChangeZone { } // Blink permanents with ETB triggers else if (sa.isAbility() && (sa.getPayCosts() != null) && AbilityFactory.playReusable(sa)) { - aiPermanents = CardListUtil.filter(aiPermanents, new Predicate() { + aiPermanents = CardLists.filter(aiPermanents, new Predicate() { @Override public boolean apply(final Card c) { if (c.getNumberOfCounters() > 0) { @@ -1722,7 +1722,7 @@ public final class AbilityFactoryChangeZone { } else if (origin.equals(ZoneType.Graveyard)) { if (destination.equals(ZoneType.Hand)) { // only retrieve cards from computer graveyard - list = CardListUtil.filterControlledBy(list, AllZone.getComputerPlayer()); + list = CardLists.filterControlledBy(list, AllZone.getComputerPlayer()); System.out.println("changeZone:" + list); } @@ -1747,8 +1747,8 @@ public final class AbilityFactoryChangeZone { && AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer()).isEmpty()) { return false; } - list = CardListUtil.filterControlledBy(list, AllZone.getHumanPlayer()); - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filterControlledBy(list, AllZone.getHumanPlayer()); + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { for (Card aura : c.getEnchantedBy()) { @@ -1763,7 +1763,7 @@ public final class AbilityFactoryChangeZone { // Only care about combatants during combat if (Singletons.getModel().getGameState().getPhaseHandler().inCombat()) { - CardListUtil.getValidCards(list, "Card.attacking,Card.blocking", null, null); + CardLists.getValidCards(list, "Card.attacking,Card.blocking", null, null); } if (list.isEmpty()) { @@ -1794,14 +1794,14 @@ public final class AbilityFactoryChangeZone { choice = mostExpensive; } } else if (destination.equals(ZoneType.Hand) || destination.equals(ZoneType.Library)) { - List nonLands = CardListUtil.getNotType(list, "Land"); + List nonLands = CardLists.getNotType(list, "Land"); // Prefer to pull a creature, generally more useful for AI. - choice = chooseCreature(CardListUtil.filter(nonLands, CardPredicates.Presets.CREATURES)); + choice = chooseCreature(CardLists.filter(nonLands, CardPredicates.Presets.CREATURES)); if (choice == null) { // Could not find a creature. if (AllZone.getComputerPlayer().getLife() <= 5) { // Desperate? // Get something AI can cast soon. System.out.println("5 Life or less, trying to find something castable."); - CardListUtil.sortByMostExpensive(nonLands); + CardLists.sortByMostExpensive(nonLands); for (Card potentialCard : nonLands) { if (ComputerUtil.payManaCost(potentialCard.getFirstSpellAbility(), AllZone.getComputerPlayer(), true, 0, false)) { choice = potentialCard; @@ -1816,7 +1816,7 @@ public final class AbilityFactoryChangeZone { } if (choice == null) { // No creatures or spells? - CardListUtil.shuffle(list); + CardLists.shuffle(list); choice = list.get(0); } } else { @@ -1870,12 +1870,12 @@ public final class AbilityFactoryChangeZone { final Target tgt = sa.getTarget(); List list = AllZoneUtil.getCardsIn(origin); - list = CardListUtil.getValidCards(list, tgt.getValidTgts(), AllZone.getComputerPlayer(), source); + list = CardLists.getValidCards(list, tgt.getValidTgts(), AllZone.getComputerPlayer(), source); // Narrow down the list: if (origin.equals(ZoneType.Battlefield)) { // filter out untargetables - list = CardListUtil.getTargetableCards(list, sa); + list = CardLists.getTargetableCards(list, sa); // if Destination is hand, either bounce opponents dangerous stuff // or save my about to die stuff @@ -1907,14 +1907,14 @@ public final class AbilityFactoryChangeZone { } else if (destination.equals(ZoneType.Battlefield) || origin.equals(ZoneType.Battlefield)) { choice = CardFactoryUtil.getMostExpensivePermanentAI(list, sa, false); } else if (destination.equals(ZoneType.Hand) || destination.equals(ZoneType.Library)) { - List nonLands = CardListUtil.getNotType(list, "Land"); + List nonLands = CardLists.getNotType(list, "Land"); // Prefer to pull a creature, generally more useful for AI. - choice = chooseCreature(CardListUtil.filter(nonLands, CardPredicates.Presets.CREATURES)); + choice = chooseCreature(CardLists.filter(nonLands, CardPredicates.Presets.CREATURES)); if (choice == null) { // Could not find a creature. if (AllZone.getComputerPlayer().getLife() <= 5) { // Desperate? // Get something AI can cast soon. System.out.println("5 Life or less, trying to find something castable."); - CardListUtil.sortByMostExpensive(nonLands); + CardLists.sortByMostExpensive(nonLands); for (Card potentialCard : nonLands) { if (ComputerUtil.payManaCost(potentialCard.getFirstSpellAbility(), AllZone.getComputerPlayer(), true, 0, false)) { choice = potentialCard; @@ -1929,7 +1929,7 @@ public final class AbilityFactoryChangeZone { } if (choice == null) { // No creatures or spells? - CardListUtil.shuffle(list); + CardLists.shuffle(list); choice = list.get(0); } } else { @@ -2617,7 +2617,7 @@ public final class AbilityFactoryChangeZone { tgt.addTarget(AllZone.getHumanPlayer()); computerType.clear(); } - if ((CardListUtil.getNotType(humanType, "Creature").size() == 0) && (CardListUtil.getNotType(computerType, "Creature").size() == 0)) { + if ((CardLists.getNotType(humanType, "Creature").size() == 0) && (CardLists.getNotType(computerType, "Creature").size() == 0)) { if ((CardFactoryUtil.evaluateCreatureList(computerType) + 200) >= CardFactoryUtil .evaluateCreatureList(humanType)) { return false; @@ -2655,7 +2655,7 @@ public final class AbilityFactoryChangeZone { if (destination.equals(ZoneType.Battlefield)) { if (params.get("GainControl") != null) { // Check if the cards are valuable enough - if ((CardListUtil.getNotType(humanType, "Creature").size() == 0) && (CardListUtil.getNotType(computerType, "Creature").size() == 0)) { + if ((CardLists.getNotType(humanType, "Creature").size() == 0) && (CardLists.getNotType(computerType, "Creature").size() == 0)) { if ((CardFactoryUtil.evaluateCreatureList(computerType) + CardFactoryUtil .evaluateCreatureList(humanType)) < 400) { return false; @@ -2668,7 +2668,7 @@ public final class AbilityFactoryChangeZone { } } else { // don't activate if human gets more back than AI does - if ((CardListUtil.getNotType(humanType, "Creature").size() == 0) && (CardListUtil.getNotType(computerType, "Creature").size() == 0)) { + if ((CardLists.getNotType(humanType, "Creature").size() == 0) && (CardLists.getNotType(computerType, "Creature").size() == 0)) { if (CardFactoryUtil.evaluateCreatureList(computerType) <= (CardFactoryUtil .evaluateCreatureList(humanType) + 100)) { return false; @@ -2771,7 +2771,7 @@ public final class AbilityFactoryChangeZone { // if the AI is using it defensively, then something else needs to occur // if only creatures are affected evaluate both lists and pass only // if human creatures are more valuable - if ((CardListUtil.getNotType(humanType, "Creature").isEmpty()) && (CardListUtil.getNotType(computerType, "Creature").isEmpty())) { + if ((CardLists.getNotType(humanType, "Creature").isEmpty()) && (CardLists.getNotType(computerType, "Creature").isEmpty())) { if (CardFactoryUtil.evaluateCreatureList(computerType) >= CardFactoryUtil .evaluateCreatureList(humanType)) { return false; @@ -2805,7 +2805,7 @@ public final class AbilityFactoryChangeZone { if (destination.equals(ZoneType.Battlefield)) { if (params.get("GainControl") != null) { // Check if the cards are valuable enough - if ((CardListUtil.getNotType(humanType, "Creature").size() == 0) && (CardListUtil.getNotType(computerType, "Creature").size() == 0)) { + if ((CardLists.getNotType(humanType, "Creature").size() == 0) && (CardLists.getNotType(computerType, "Creature").size() == 0)) { if ((CardFactoryUtil.evaluateCreatureList(computerType) + CardFactoryUtil .evaluateCreatureList(humanType)) < 1) { return false; @@ -2818,7 +2818,7 @@ public final class AbilityFactoryChangeZone { } } else { // don't activate if human gets more back than AI does - if ((CardListUtil.getNotType(humanType, "Creature").isEmpty()) && (CardListUtil.getNotType(computerType, "Creature").isEmpty())) { + if ((CardLists.getNotType(humanType, "Creature").isEmpty()) && (CardLists.getNotType(computerType, "Creature").isEmpty())) { if (CardFactoryUtil.evaluateCreatureList(computerType) <= CardFactoryUtil .evaluateCreatureList(humanType)) { return false; diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryChoose.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryChoose.java index 50ee5be23c4..6b4167e7d88 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryChoose.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryChoose.java @@ -34,7 +34,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates; import forge.CardPredicates.Presets; import forge.CardUtil; @@ -390,11 +390,11 @@ public final class AbilityFactoryChoose { chosen = CardFactoryUtil.getMostProminentCreatureType(AllZone.getHumanPlayer() .getCardsIn(ZoneType.Battlefield)); if (!CardUtil.isACreatureType(chosen) || invalidTypes.contains(chosen)) { - chosen = CardFactoryUtil.getMostProminentCreatureType(CardListUtil.filterControlledBy(AllZoneUtil.getCardsInGame(), AllZone.getHumanPlayer())); + chosen = CardFactoryUtil.getMostProminentCreatureType(CardLists.filterControlledBy(AllZoneUtil.getCardsInGame(), AllZone.getHumanPlayer())); } } if (logic.equals("MostProminentInComputerDeck")) { - chosen = CardFactoryUtil.getMostProminentCreatureType(CardListUtil.filterControlledBy(AllZoneUtil.getCardsInGame(), AllZone.getComputerPlayer())); + chosen = CardFactoryUtil.getMostProminentCreatureType(CardLists.filterControlledBy(AllZoneUtil.getCardsInGame(), AllZone.getComputerPlayer())); } if (logic.equals("MostProminentInComputerGraveyard")) { chosen = CardFactoryUtil.getMostProminentCreatureType(AllZone.getComputerPlayer() @@ -728,11 +728,11 @@ public final class AbilityFactoryChoose { if (params.containsKey("AILogic")) { final String logic = params.get("AILogic"); if (logic.equals("MostProminentInHumanDeck")) { - chosen.add(CardFactoryUtil.getMostProminentColor(CardListUtil.filterControlledBy(AllZoneUtil.getCardsInGame(), AllZone.getHumanPlayer()))); + chosen.add(CardFactoryUtil.getMostProminentColor(CardLists.filterControlledBy(AllZoneUtil.getCardsInGame(), AllZone.getHumanPlayer()))); } else if (logic.equals("MostProminentInComputerDeck")) { - chosen.add(CardFactoryUtil.getMostProminentColor(CardListUtil.filterControlledBy(AllZoneUtil.getCardsInGame(), AllZone.getComputerPlayer()))); + chosen.add(CardFactoryUtil.getMostProminentColor(CardLists.filterControlledBy(AllZoneUtil.getCardsInGame(), AllZone.getComputerPlayer()))); } else if (logic.equals("MostProminentDualInComputerDeck")) { - List prominence = CardFactoryUtil.getColorByProminence(CardListUtil.filterControlledBy(AllZoneUtil.getCardsInGame(), AllZone.getComputerPlayer())); + List prominence = CardFactoryUtil.getColorByProminence(CardLists.filterControlledBy(AllZoneUtil.getCardsInGame(), AllZone.getComputerPlayer())); chosen.add(prominence.get(0)); chosen.add(prominence.get(1)); } @@ -742,7 +742,7 @@ public final class AbilityFactoryChoose { else if (logic.equals("MostProminentHumanCreatures")) { List list = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer()); if (list.isEmpty()) { - list = CardListUtil.filter(CardListUtil.filterControlledBy(AllZoneUtil.getCardsInGame(), AllZone.getHumanPlayer()), CardPredicates.Presets.CREATURES); + list = CardLists.filter(CardLists.filterControlledBy(AllZoneUtil.getCardsInGame(), AllZone.getHumanPlayer()), CardPredicates.Presets.CREATURES); } chosen.add(CardFactoryUtil.getMostProminentColor(list)); } @@ -1647,8 +1647,8 @@ public final class AbilityFactoryChoose { .getCardsIn(ZoneType.Library)); } } else { - List list = CardListUtil.filterControlledBy(AllZoneUtil.getCardsInGame(), AllZone.getHumanPlayer()); - list = CardListUtil.filter(list, Predicates.not(Presets.LANDS)); + List list = CardLists.filterControlledBy(AllZoneUtil.getCardsInGame(), AllZone.getHumanPlayer()); + list = CardLists.filter(list, Predicates.not(Presets.LANDS)); if (!list.isEmpty()) { chosen = list.get(0).getName(); } @@ -1875,7 +1875,7 @@ public final class AbilityFactoryChoose { } List choices = AllZoneUtil.getCardsIn(choiceZone); if (params.containsKey("Choices")) { - choices = CardListUtil.getValidCards(choices, params.get("Choices"), host.getController(), host); + choices = CardLists.getValidCards(choices, params.get("Choices"), host.getController(), host); } if (params.get("AILogic").equals("AtLeast1")) { if (choices.size() < 1) { @@ -1941,7 +1941,7 @@ public final class AbilityFactoryChoose { } List choices = AllZoneUtil.getCardsIn(choiceZone); if (params.containsKey("Choices")) { - choices = CardListUtil.getValidCards(choices, params.get("Choices"), host.getController(), host); + choices = CardLists.getValidCards(choices, params.get("Choices"), host.getController(), host); } final String numericAmount = params.containsKey("Amount") ? params.get("Amount") : "1"; @@ -1953,7 +1953,7 @@ public final class AbilityFactoryChoose { final ArrayList basic = CardUtil.getBasicTypes(); for (final String type : basic) { - final List cl = CardListUtil.getType(land, type); + final List cl = CardLists.getType(land, type); if (cl.size() > 0) { final String prompt = "Choose a" + (type.equals("Island") ? "n " : " ") + type; final Object o = GuiChoose.one(prompt, cl); @@ -1981,8 +1981,8 @@ public final class AbilityFactoryChoose { } } else { // Computer if (params.containsKey("AILogic") && params.get("AILogic").equals("BestBlocker")) { - if (CardListUtil.filter(choices, Presets.UNTAPPED).isEmpty()) { - choices = CardListUtil.filter(choices, Presets.UNTAPPED); + if (CardLists.filter(choices, Presets.UNTAPPED).isEmpty()) { + choices = CardLists.filter(choices, Presets.UNTAPPED); } chosen.add(CardFactoryUtil.getBestCreatureAI(choices)); } else { diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryClash.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryClash.java index 331ad537f00..e2fb723d8da 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryClash.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryClash.java @@ -26,7 +26,7 @@ import javax.swing.JOptionPane; import forge.AllZone; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.GameActionUtil; import forge.card.cardfactory.CardFactoryUtil; import forge.card.spellability.AbilityActivated; @@ -709,7 +709,7 @@ public final class AbilityFactoryClash { } else { pool = p.getCardsIn(zone); } - pool = CardListUtil.getValidCards(pool, valid, card.getController(), card); + pool = CardLists.getValidCards(pool, valid, card.getController(), card); int size = pool.size(); return size > 2; } @@ -762,7 +762,7 @@ public final class AbilityFactoryClash { } else { pool = p.getCardsIn(zone); } - pool = CardListUtil.getValidCards(pool, valid, card.getController(), card); + pool = CardLists.getValidCards(pool, valid, card.getController(), card); int size = pool.size(); // first, separate the cards into piles @@ -901,7 +901,7 @@ public final class AbilityFactoryClash { } else { int cmc1 = CardFactoryUtil.evaluatePermanentList(new ArrayList(pile1)); int cmc2 = CardFactoryUtil.evaluatePermanentList(new ArrayList(pile2)); - if (CardListUtil.getNotType(pool, "Creature").isEmpty()) { + if (CardLists.getNotType(pool, "Creature").isEmpty()) { cmc1 = CardFactoryUtil.evaluateCreatureList(new ArrayList(pile1)); cmc2 = CardFactoryUtil.evaluateCreatureList(new ArrayList(pile2)); System.out.println("value:" + cmc1 + " " + cmc2); diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryCombat.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryCombat.java index ff9b523466c..c6cbc3dcb4e 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryCombat.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryCombat.java @@ -26,7 +26,7 @@ import com.google.common.base.Predicate; import forge.AllZone; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates; import forge.Singletons; import forge.card.cardfactory.CardFactoryUtil; @@ -1062,10 +1062,10 @@ public final class AbilityFactoryCombat { boolean chance = false; if (abTgt != null) { - List list = CardListUtil.filter(AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES); - list = CardListUtil.getTargetableCards(list, sa); - list = CardListUtil.getValidCards(list, abTgt.getValidTgts(), source.getController(), source); - list = CardListUtil.filter(list, new Predicate() { + List list = CardLists.filter(AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES); + list = CardLists.getTargetableCards(list, sa); + list = CardLists.getValidCards(list, abTgt.getValidTgts(), source.getController(), source); + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { boolean tapped = c.isTapped(); diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryCopy.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryCopy.java index 46abd5bb1ea..3bc436989d6 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryCopy.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryCopy.java @@ -29,7 +29,7 @@ import forge.AllZoneUtil; import forge.Card; import forge.CardCharacteristicName; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates.Presets; import forge.Command; import forge.Singletons; @@ -308,8 +308,8 @@ public final class AbilityFactoryCopy { if (abTgt != null) { List list = AllZoneUtil.getCardsIn(ZoneType.Battlefield); - list = CardListUtil.getValidCards(list, abTgt.getValidTgts(), source.getController(), source); - list = CardListUtil.getTargetableCards(list, sa); + list = CardLists.getValidCards(list, abTgt.getValidTgts(), source.getController(), source); + list = CardLists.getTargetableCards(list, sa); abTgt.resetTargets(); // target loop while (abTgt.getNumTargeted() < abTgt.getMaxTargets(sa.getSourceCard(), sa)) { @@ -325,7 +325,7 @@ public final class AbilityFactoryCopy { } Card choice; - if (CardListUtil.filter(list, Presets.CREATURES).size() > 0) { + if (CardLists.filter(list, Presets.CREATURES).size() > 0) { choice = CardFactoryUtil.getBestCreatureAI(list); } else { choice = CardFactoryUtil.getMostExpensivePermanentAI(list, sa, true); diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryCounters.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryCounters.java index 663f4da4701..1e326859129 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryCounters.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryCounters.java @@ -30,7 +30,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.Counters; import forge.Singletons; import forge.card.cardfactory.CardFactoryUtil; @@ -313,7 +313,7 @@ public class AbilityFactoryCounters { final Player player = af.isCurse() ? AllZone.getHumanPlayer() : AllZone.getComputerPlayer(); list = player.getCardsIn(ZoneType.Battlefield); - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { return c.canBeTargetedBy(sa) && !c.hasKeyword("CARDNAME can't have counters placed on it.") @@ -322,7 +322,7 @@ public class AbilityFactoryCounters { }); if (abTgt != null) { - list = CardListUtil.getValidCards(list, abTgt.getValidTgts(), source.getController(), source); + list = CardLists.getValidCards(list, abTgt.getValidTgts(), source.getController(), source); if (list.size() < abTgt.getMinTargets(source, sa)) { return false; @@ -468,7 +468,7 @@ public class AbilityFactoryCounters { list = player.getCardsIn(ZoneType.Battlefield); if (abTgt != null) { - list = CardListUtil.getValidCards(list, abTgt.getValidTgts(), source.getController(), source); + list = CardLists.getValidCards(list, abTgt.getValidTgts(), source.getController(), source); if (list.size() == 0) { return false; @@ -477,7 +477,7 @@ public class AbilityFactoryCounters { abTgt.resetTargets(); // target loop while (abTgt.getNumTargeted() < abTgt.getMaxTargets(sa.getSourceCard(), sa)) { - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { return sa.canTarget(c); @@ -579,17 +579,17 @@ public class AbilityFactoryCounters { } } else { list = player.getCardsIn(ZoneType.Battlefield); - list = CardListUtil.getTargetableCards(list, sa); + list = CardLists.getTargetableCards(list, sa); if (abTgt != null) { - list = CardListUtil.getValidCards(list, abTgt.getValidTgts(), source.getController(), source); + list = CardLists.getValidCards(list, abTgt.getValidTgts(), source.getController(), source); } if (list.isEmpty() && mandatory) { // If there isn't any prefered cards to target, gotta choose // non-preferred ones list = player.getOpponent().getCardsIn(ZoneType.Battlefield); - list = CardListUtil.getTargetableCards(list, sa); + list = CardLists.getTargetableCards(list, sa); if (abTgt != null) { - list = CardListUtil.getValidCards(list, abTgt.getValidTgts(), source.getController(), source); + list = CardLists.getValidCards(list, abTgt.getValidTgts(), source.getController(), source); } preferred = false; } @@ -659,7 +659,7 @@ public class AbilityFactoryCounters { Card choice; if (type.equals("M1M1")) { // try to kill the best killable creature, or reduce the best one - final List killable = CardListUtil.filter(list, new Predicate() { + final List killable = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { return c.getNetDefense() <= amount; @@ -693,7 +693,7 @@ public class AbilityFactoryCounters { if (type.equals("P1P1")) { choice = CardFactoryUtil.getBestCreatureAI(list); } else if (type.equals("DIVINITY")) { - final List boon = CardListUtil.filter(list, new Predicate() { + final List boon = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { return c.getCounters(Counters.DIVINITY) == 0; @@ -1448,7 +1448,7 @@ public class AbilityFactoryCounters { } List hperms = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield); List cperms = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield); - cperms = CardListUtil.filter(cperms, new Predicate() { + cperms = CardLists.filter(cperms, new Predicate() { @Override public boolean apply(final Card crd) { for (final Counters c1 : Counters.values()) { @@ -1460,7 +1460,7 @@ public class AbilityFactoryCounters { } }); - hperms = CardListUtil.filter(hperms, new Predicate() { + hperms = CardLists.filter(hperms, new Predicate() { @Override public boolean apply(final Card crd) { for (final Counters c1 : Counters.values()) { @@ -1576,7 +1576,7 @@ public class AbilityFactoryCounters { } }); } else { // Compy - cperms = CardListUtil.filter(cperms, new Predicate() { + cperms = CardLists.filter(cperms, new Predicate() { @Override public boolean apply(final Card crd) { for (final Counters c1 : Counters.values()) { @@ -1590,7 +1590,7 @@ public class AbilityFactoryCounters { } }); - hperms = CardListUtil.filter(hperms, new Predicate() { + hperms = CardLists.filter(hperms, new Predicate() { @Override public boolean apply(final Card crd) { for (final Counters c1 : Counters.values()) { @@ -1871,8 +1871,8 @@ public class AbilityFactoryCounters { hList = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield); cList = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield); - hList = CardListUtil.getValidCards(hList, valid, source.getController(), source); - cList = CardListUtil.getValidCards(cList, valid, source.getController(), source); + hList = CardLists.getValidCards(hList, valid, source.getController(), source); + cList = CardLists.getValidCards(cList, valid, source.getController(), source); if (abCost != null) { // AI currently disabled for these costs @@ -1899,8 +1899,8 @@ public class AbilityFactoryCounters { tgt.addTarget(pl); - hList = CardListUtil.filterControlledBy(hList, pl); - cList = CardListUtil.filterControlledBy(cList, pl); + hList = CardLists.filterControlledBy(hList, pl); + cList = CardLists.filterControlledBy(cList, pl); } // TODO improve X value to don't overpay when extra mana won't do @@ -1919,7 +1919,7 @@ public class AbilityFactoryCounters { if (curse) { if (type.equals("M1M1")) { - final List killable = CardListUtil.filter(hList, new Predicate() { + final List killable = CardLists.filter(hList, new Predicate() { @Override public boolean apply(final Card c) { return c.getNetDefense() <= amount; @@ -2007,12 +2007,12 @@ public class AbilityFactoryCounters { final ZoneType zone = params.containsKey("ValidZone") ? ZoneType.smartValueOf(params.get("ValidZone")) : ZoneType.Battlefield; List cards = AllZoneUtil.getCardsIn(zone); - cards = CardListUtil.getValidCards(cards, valid, sa.getSourceCard().getController(), sa.getSourceCard()); + cards = CardLists.getValidCards(cards, valid, sa.getSourceCard().getController(), sa.getSourceCard()); final Target tgt = sa.getTarget(); if (tgt != null) { final Player pl = sa.getTargetPlayer(); - cards = CardListUtil.filterControlledBy(cards, pl); + cards = CardLists.filterControlledBy(cards, pl); } for (final Card tgtCard : cards) { @@ -2262,12 +2262,12 @@ public class AbilityFactoryCounters { final ZoneType zone = params.containsKey("ValidZone") ? ZoneType.smartValueOf(params.get("ValidZone")) : ZoneType.Battlefield; List cards = AllZoneUtil.getCardsIn(zone); - cards = CardListUtil.getValidCards(cards, valid, sa.getSourceCard().getController(), sa.getSourceCard()); + cards = CardLists.getValidCards(cards, valid, sa.getSourceCard().getController(), sa.getSourceCard()); final Target tgt = sa.getTarget(); if (tgt != null) { final Player pl = sa.getTargetPlayer(); - cards = CardListUtil.filterControlledBy(cards, pl); + cards = CardLists.filterControlledBy(cards, pl); } for (final Card tgtCard : cards) { @@ -2585,14 +2585,14 @@ public class AbilityFactoryCounters { } else { // targeted final Player player = af.isCurse() ? AllZone.getHumanPlayer() : AllZone.getComputerPlayer(); List list = player.getCardsIn(ZoneType.Battlefield); - list = CardListUtil.getTargetableCards(list, sa); - list = CardListUtil.getValidCards(list, abTgt.getValidTgts(), host.getController(), host); + list = CardLists.getTargetableCards(list, sa); + list = CardLists.getValidCards(list, abTgt.getValidTgts(), host.getController(), host); if (list.isEmpty() && mandatory) { // If there isn't any prefered cards to target, gotta choose // non-preferred ones list = player.getOpponent().getCardsIn(ZoneType.Battlefield); - list = CardListUtil.getTargetableCards(list, sa); - list = CardListUtil.getValidCards(list, abTgt.getValidTgts(), host.getController(), host); + list = CardLists.getTargetableCards(list, sa); + list = CardLists.getValidCards(list, abTgt.getValidTgts(), host.getController(), host); preferred = false; } // Not mandatory, or the the list was regenerated and is still diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryDealDamage.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryDealDamage.java index f2bf7656666..61e1447056f 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryDealDamage.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryDealDamage.java @@ -29,7 +29,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates; import forge.CardUtil; import forge.Singletons; @@ -528,7 +528,7 @@ public class AbilityFactoryDealDamage { final Card source = saMe.getSourceCard(); final HashMap params = this.abilityFactory.getMapParams(); List hPlay = pl.getCardsIn(ZoneType.Battlefield); - hPlay = CardListUtil.getValidCards(hPlay, tgt.getValidTgts(), AllZone.getComputerPlayer(), source); + hPlay = CardLists.getValidCards(hPlay, tgt.getValidTgts(), AllZone.getComputerPlayer(), source); final ArrayList objects = tgt.getTargets(); if (params.containsKey("TargetUnique")) { @@ -542,9 +542,9 @@ public class AbilityFactoryDealDamage { } } } - hPlay = CardListUtil.getTargetableCards(hPlay, saMe); + hPlay = CardLists.getTargetableCards(hPlay, saMe); - final List killables = CardListUtil.filter(hPlay, new Predicate() { + final List killables = CardLists.filter(hPlay, new Predicate() { @Override public boolean apply(final Card c) { return (c.getEnoughDamageToKill(d, source, false, noPrevention) <= d) && !ComputerUtil.canRegenerate(c) @@ -1251,7 +1251,7 @@ public class AbilityFactoryDealDamage { // TODO: X may be something different than X paid List list = player.getCardsIn(ZoneType.Battlefield); - list = CardListUtil.getValidCards(list, validC.split(","), source.getController(), source); + list = CardLists.getValidCards(list, validC.split(","), source.getController(), source); final Predicate filterKillable = new Predicate() { @Override @@ -1260,8 +1260,8 @@ public class AbilityFactoryDealDamage { } }; - list = CardListUtil.getNotKeyword(list, "Indestructible"); - list = CardListUtil.filter(list, filterKillable); + list = CardLists.getNotKeyword(list, "Indestructible"); + list = CardLists.filter(list, filterKillable); return list; } @@ -1380,7 +1380,7 @@ public class AbilityFactoryDealDamage { } if (targetPlayer != null) { - list = CardListUtil.filterControlledBy(list, targetPlayer); + list = CardLists.filterControlledBy(list, targetPlayer); } list = AbilityFactory.filterListByType(list, params.get("ValidCards"), sa); @@ -1642,7 +1642,7 @@ public class AbilityFactoryDealDamage { List sources = AllZoneUtil.getCardsIn(ZoneType.Battlefield); if (params.containsKey("ValidCards")) { - sources = CardListUtil.getValidCards(sources, params.get("ValidCards"), card.getController(), card); + sources = CardLists.getValidCards(sources, params.get("ValidCards"), card.getController(), card); } ArrayList tgts = new ArrayList(); @@ -1901,8 +1901,8 @@ public class AbilityFactoryDealDamage { tgt.resetTargets(); List aiCreatures = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer()); - aiCreatures = CardListUtil.getTargetableCards(aiCreatures, sa); - aiCreatures = CardListUtil.filter(aiCreatures, new Predicate() { + aiCreatures = CardLists.getTargetableCards(aiCreatures, sa); + aiCreatures = CardLists.filter(aiCreatures, new Predicate() { @Override public boolean apply(final Card c) { return !c.getSVar("Targeting").equals("Dies"); @@ -1910,7 +1910,7 @@ public class AbilityFactoryDealDamage { }); List humCreatures = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer()); - humCreatures = CardListUtil.getTargetableCards(humCreatures, sa); + humCreatures = CardLists.getTargetableCards(humCreatures, sa); final Random r = MyRandom.getRandom(); if (r.nextFloat() > Math.pow(.6667, sa.getActivationsThisTurn())) { diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryDebuff.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryDebuff.java index 38979cd51fd..c1099546897 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryDebuff.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryDebuff.java @@ -30,7 +30,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.Command; import forge.Singletons; import forge.card.cardfactory.CardFactoryUtil; @@ -394,7 +394,7 @@ public final class AbilityFactoryDebuff { final Target tgt = sa.getTarget(); tgt.resetTargets(); List list = AbilityFactoryDebuff.getCurseCreatures(af, sa, kws); - list = CardListUtil.getValidCards(list, tgt.getValidTgts(), sa.getActivatingPlayer(), sa.getSourceCard()); + list = CardLists.getValidCards(list, tgt.getValidTgts(), sa.getActivatingPlayer(), sa.getSourceCard()); // several uses here: // 1. make human creatures lose evasion when they are attacking @@ -449,10 +449,10 @@ public final class AbilityFactoryDebuff { private static List getCurseCreatures(final AbilityFactory af, final SpellAbility sa, final ArrayList kws) { List list = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer()); - list = CardListUtil.getTargetableCards(list, sa); + list = CardLists.getTargetableCards(list, sa); if (!list.isEmpty()) { - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { return c.hasAnyKeyword(kws); // don't add duplicate negative @@ -480,7 +480,7 @@ public final class AbilityFactoryDebuff { private static boolean debuffMandatoryTarget(final AbilityFactory af, final SpellAbility sa, final boolean mandatory) { List list = AllZoneUtil.getCardsIn(ZoneType.Battlefield); final Target tgt = sa.getTarget(); - list = CardListUtil.getValidCards(list, tgt.getValidTgts(), sa.getActivatingPlayer(), sa.getSourceCard()); + list = CardLists.getValidCards(list, tgt.getValidTgts(), sa.getActivatingPlayer(), sa.getSourceCard()); if (list.size() < tgt.getMinTargets(sa.getSourceCard(), sa)) { tgt.resetTargets(); @@ -492,8 +492,8 @@ public final class AbilityFactoryDebuff { list.remove(c); } - final List pref = CardListUtil.filterControlledBy(list, AllZone.getHumanPlayer()); - final List forced = CardListUtil.filterControlledBy(list, AllZone.getComputerPlayer()); + final List pref = CardLists.filterControlledBy(list, AllZone.getHumanPlayer()); + final List forced = CardLists.filterControlledBy(list, AllZone.getComputerPlayer()); final Card source = sa.getSourceCard(); while (tgt.getNumTargeted() < tgt.getMaxTargets(source, sa)) { @@ -502,7 +502,7 @@ public final class AbilityFactoryDebuff { } Card c; - if (CardListUtil.getNotType(pref, "Creature").size() == 0) { + if (CardLists.getNotType(pref, "Creature").size() == 0) { c = CardFactoryUtil.getBestCreatureAI(pref); } else { c = CardFactoryUtil.getMostExpensivePermanentAI(pref, sa, true); @@ -521,7 +521,7 @@ public final class AbilityFactoryDebuff { // TODO - if forced targeting, just pick something without the given // keyword Card c; - if (CardListUtil.getNotType(forced, "Creature").size() == 0) { + if (CardLists.getNotType(forced, "Creature").size() == 0) { c = CardFactoryUtil.getWorstCreatureAI(forced); } else { c = CardFactoryUtil.getCheapestPermanentAI(forced, sa, true); @@ -794,14 +794,14 @@ public final class AbilityFactoryDebuff { } List comp = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield); - comp = CardListUtil.getValidCards(comp, valid, hostCard.getController(), hostCard); + comp = CardLists.getValidCards(comp, valid, hostCard.getController(), hostCard); List human = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield); - human = CardListUtil.getValidCards(human, valid, hostCard.getController(), hostCard); + human = CardLists.getValidCards(human, valid, hostCard.getController(), hostCard); // TODO - add blocking situations here also // only count creatures that can attack - human = CardListUtil.filter(human, new Predicate() { + human = CardLists.filter(human, new Predicate() { @Override public boolean apply(final Card c) { return CombatUtil.canAttack(c); @@ -841,7 +841,7 @@ public final class AbilityFactoryDebuff { } List list = AllZoneUtil.getCardsIn(ZoneType.Battlefield); - list = CardListUtil.getValidCards(list, valid.split(","), hostCard.getController(), hostCard); + list = CardLists.getValidCards(list, valid.split(","), hostCard.getController(), hostCard); for (final Card tgtC : list) { final ArrayList hadIntrinsic = new ArrayList(); diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryDestroy.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryDestroy.java index ca1c95ed64a..9b97768bbd8 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryDestroy.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryDestroy.java @@ -29,7 +29,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardUtil; import forge.Counters; import forge.Singletons; @@ -249,14 +249,14 @@ public class AbilityFactoryDestroy { if (abTgt != null) { abTgt.resetTargets(); list = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield); - list = CardListUtil.getTargetableCards(list, sa); - list = CardListUtil.getValidCards(list, abTgt.getValidTgts(), source.getController(), source); + list = CardLists.getTargetableCards(list, sa); + list = CardLists.getValidCards(list, abTgt.getValidTgts(), source.getController(), source); if (params.containsKey("AITgts")) { - list = CardListUtil.getValidCards(list, params.get("AITgts"), sa.getActivatingPlayer(), source); + list = CardLists.getValidCards(list, params.get("AITgts"), sa.getActivatingPlayer(), source); } - list = CardListUtil.getNotKeyword(list, "Indestructible"); + list = CardLists.getNotKeyword(list, "Indestructible"); if (!AbilityFactory.playReusable(sa)) { - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { return (!c.hasKeyword("Undying") || c.getCounters(Counters.P1P1) > 0); @@ -268,7 +268,7 @@ public class AbilityFactoryDestroy { // regeneration shield if (!noRegen) { // TODO filter out things that might be tougher? - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { return ((c.getShield() == 0) && !ComputerUtil.canRegenerate(c)); @@ -295,9 +295,9 @@ public class AbilityFactoryDestroy { Card choice = null; // If the targets are only of one type, take the best - if (CardListUtil.getNotType(list, "Creature").isEmpty()) { + if (CardLists.getNotType(list, "Creature").isEmpty()) { choice = CardFactoryUtil.getBestCreatureAI(list); - } else if (CardListUtil.getNotType(list, "Land").isEmpty()) { + } else if (CardLists.getNotType(list, "Land").isEmpty()) { choice = CardFactoryUtil.getBestLandAI(list); } else { choice = CardFactoryUtil.getMostExpensivePermanentAI(list, sa, true); @@ -320,8 +320,8 @@ public class AbilityFactoryDestroy { if (params.containsKey("Defined")) { list = new ArrayList(AbilityFactory.getDefinedCards(af.getHostCard(), params.get("Defined"), sa)); if (list.isEmpty() - || !CardListUtil.filterControlledBy(list, AllZone.getComputerPlayer()).isEmpty() - || CardListUtil.getNotKeyword(list, "Indestructible").isEmpty()) { + || !CardLists.filterControlledBy(list, AllZone.getComputerPlayer()).isEmpty() + || CardLists.getNotKeyword(list, "Indestructible").isEmpty()) { return false; } } @@ -378,8 +378,8 @@ public class AbilityFactoryDestroy { if (tgt != null) { List list; list = AllZoneUtil.getCardsIn(ZoneType.Battlefield); - list = CardListUtil.getTargetableCards(list, sa); - list = CardListUtil.getValidCards(list, tgt.getValidTgts(), source.getController(), source); + list = CardLists.getTargetableCards(list, sa); + list = CardLists.getValidCards(list, tgt.getValidTgts(), source.getController(), source); if ((list.size() == 0) || (list.size() < tgt.getMinTargets(sa.getSourceCard(), sa))) { return false; @@ -387,15 +387,15 @@ public class AbilityFactoryDestroy { tgt.resetTargets(); - List preferred = CardListUtil.getNotKeyword(list, "Indestructible"); - preferred = CardListUtil.filterControlledBy(preferred, AllZone.getHumanPlayer()); + List preferred = CardLists.getNotKeyword(list, "Indestructible"); + preferred = CardLists.filterControlledBy(preferred, AllZone.getHumanPlayer()); // If NoRegen is not set, filter out creatures that have a // regeneration shield if (!noRegen) { // TODO filter out things that could regenerate in response? // might be tougher? - preferred = CardListUtil.filter(preferred, new Predicate() { + preferred = CardLists.filter(preferred, new Predicate() { @Override public boolean apply(final Card c) { return c.getShield() == 0; @@ -422,9 +422,9 @@ public class AbilityFactoryDestroy { } } else { Card c; - if (CardListUtil.getNotType(preferred, "Creature").size() == 0) { + if (CardLists.getNotType(preferred, "Creature").size() == 0) { c = CardFactoryUtil.getBestCreatureAI(preferred); - } else if (CardListUtil.getNotType(preferred, "Land").size() == 0) { + } else if (CardLists.getNotType(preferred, "Land").size() == 0) { c = CardFactoryUtil.getBestLandAI(preferred); } else { c = CardFactoryUtil.getMostExpensivePermanentAI(preferred, sa, false); @@ -439,7 +439,7 @@ public class AbilityFactoryDestroy { break; } else { Card c; - if (CardListUtil.getNotType(list, "Creature").size() == 0) { + if (CardLists.getNotType(list, "Creature").size() == 0) { c = CardFactoryUtil.getWorstCreatureAI(list); } else { c = CardFactoryUtil.getCheapestPermanentAI(list, sa, false); @@ -861,15 +861,15 @@ public class AbilityFactoryDestroy { if (mandatory) { return true; } - humanlist = CardListUtil.getValidCards(humanlist, valid.split(","), source.getController(), source); - computerlist = CardListUtil.getValidCards(computerlist, valid.split(","), source.getController(), source); - humanlist = CardListUtil.filter(humanlist, new Predicate() { + humanlist = CardLists.getValidCards(humanlist, valid.split(","), source.getController(), source); + computerlist = CardLists.getValidCards(computerlist, valid.split(","), source.getController(), source); + humanlist = CardLists.filter(humanlist, new Predicate() { @Override public boolean apply(final Card c) { return !(c.hasKeyword("Indestructible") || c.getSVar("SacMe").length() > 0); } }); - computerlist = CardListUtil.filter(computerlist, new Predicate() { + computerlist = CardLists.filter(computerlist, new Predicate() { @Override public boolean apply(final Card c) { return !(c.hasKeyword("Indestructible") || c.getSVar("SacMe").length() > 0); @@ -881,7 +881,7 @@ public class AbilityFactoryDestroy { // if only creatures are affected evaluate both lists and pass only if // human creatures are more valuable - if ((CardListUtil.getNotType(humanlist, "Creature").size() == 0) && (CardListUtil.getNotType(computerlist, "Creature").size() == 0)) { + if ((CardLists.getNotType(humanlist, "Creature").size() == 0) && (CardLists.getNotType(computerlist, "Creature").size() == 0)) { if (CardFactoryUtil.evaluateCreatureList(computerlist) >= CardFactoryUtil.evaluateCreatureList(humanlist) && !computerlist.isEmpty()) { return false; @@ -943,16 +943,16 @@ public class AbilityFactoryDestroy { computerlist.clear(); } - humanlist = CardListUtil.getValidCards(humanlist, valid.split(","), source.getController(), source); - computerlist = CardListUtil.getValidCards(computerlist, valid.split(","), source.getController(), source); + humanlist = CardLists.getValidCards(humanlist, valid.split(","), source.getController(), source); + computerlist = CardLists.getValidCards(computerlist, valid.split(","), source.getController(), source); - humanlist = CardListUtil.filter(humanlist, new Predicate() { + humanlist = CardLists.filter(humanlist, new Predicate() { @Override public boolean apply(final Card c) { return !(c.hasKeyword("Indestructible") || c.getSVar("SacMe").length() > 0); } }); - computerlist = CardListUtil.filter(computerlist, new Predicate() { + computerlist = CardLists.filter(computerlist, new Predicate() { @Override public boolean apply(final Card c) { return !(c.hasKeyword("Indestructible") || c.getSVar("SacMe").length() > 0); @@ -972,13 +972,13 @@ public class AbilityFactoryDestroy { // if only creatures are affected evaluate both lists and pass only if // human creatures are more valuable - if ((CardListUtil.getNotType(humanlist, "Creature").size() == 0) && (CardListUtil.getNotType(computerlist, "Creature").size() == 0)) { + if ((CardLists.getNotType(humanlist, "Creature").size() == 0) && (CardLists.getNotType(computerlist, "Creature").size() == 0)) { if ((CardFactoryUtil.evaluateCreatureList(computerlist) + 200) >= CardFactoryUtil .evaluateCreatureList(humanlist)) { return false; } } // only lands involved - else if ((CardListUtil.getNotType(humanlist, "Land").size() == 0) && (CardListUtil.getNotType(computerlist, "Land").size() == 0)) { + else if ((CardLists.getNotType(humanlist, "Land").size() == 0) && (CardLists.getNotType(computerlist, "Land").size() == 0)) { if ((CardFactoryUtil.evaluatePermanentList(computerlist) + 1) >= CardFactoryUtil .evaluatePermanentList(humanlist)) { return false; @@ -1041,7 +1041,7 @@ public class AbilityFactoryDestroy { List list = AllZoneUtil.getCardsIn(ZoneType.Battlefield); if (targetPlayer != null) { - list = CardListUtil.filterControlledBy(list, targetPlayer); + list = CardLists.filterControlledBy(list, targetPlayer); } list = AbilityFactory.filterListByType(list, valid, sa); diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryEffect.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryEffect.java index 68ed2e3e894..fc0880dddd8 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryEffect.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryEffect.java @@ -28,7 +28,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates; import forge.Command; import forge.Singletons; @@ -288,8 +288,8 @@ public class AbilityFactoryEffect { if (tgt != null) { tgt.resetTargets(); List list = AllZone.getCombat().getAttackerList(); - list = CardListUtil.getValidCards(list, tgt.getValidTgts(), sa.getActivatingPlayer(), sa.getSourceCard()); - list = CardListUtil.getTargetableCards(list, sa); + list = CardLists.getValidCards(list, tgt.getValidTgts(), sa.getActivatingPlayer(), sa.getSourceCard()); + list = CardLists.getTargetableCards(list, sa); Card target = CardFactoryUtil.getBestCreatureAI(list); if (target == null) { return false; @@ -304,13 +304,13 @@ public class AbilityFactoryEffect { List human = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer()); // only count creatures that can attack or block - comp = CardListUtil.filter(comp, new Predicate() { + comp = CardLists.filter(comp, new Predicate() { @Override public boolean apply(final Card c) { return CombatUtil.canAttack(c); } }); - human = CardListUtil.filter(human, new Predicate() { + human = CardLists.filter(human, new Predicate() { @Override public boolean apply(final Card c) { return CombatUtil.canBlock(c); diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryGainControl.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryGainControl.java index 8c062c8735c..29abc445645 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryGainControl.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryGainControl.java @@ -29,7 +29,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.Command; import forge.GameEntity; import forge.Singletons; @@ -336,10 +336,10 @@ public class AbilityFactoryGainControl { } List list = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield); - list = CardListUtil.getValidCards(list, tgt.getValidTgts(), sa.getSourceCard().getController(), sa.getSourceCard()); + list = CardLists.getValidCards(list, tgt.getValidTgts(), sa.getSourceCard().getController(), sa.getSourceCard()); // AI won't try to grab cards that are filtered out of AI decks on // purpose - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { final Map vars = c.getSVars(); @@ -561,7 +561,7 @@ public class AbilityFactoryGainControl { private boolean gainControlDrawbackAI(final SpellAbility sa) { if ((sa.getTarget() == null) || !sa.getTarget().doesTarget()) { if (this.params.containsKey("AllValid")) { - List tgtCards = CardListUtil.filterControlledBy(AllZoneUtil.getCardsIn(ZoneType.Battlefield), AllZone.getHumanPlayer()); + List tgtCards = CardLists.filterControlledBy(AllZoneUtil.getCardsIn(ZoneType.Battlefield), AllZone.getHumanPlayer()); tgtCards = AbilityFactory.filterListByType(tgtCards, this.params.get("AllValid"), sa); if (tgtCards.isEmpty()) { return false; @@ -856,10 +856,10 @@ public class AbilityFactoryGainControl { tgt.resetTargets(); List list = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield); - list = CardListUtil.getValidCards(list, tgt.getValidTgts(), AllZone.getComputerPlayer(), sa.getSourceCard()); + list = CardLists.getValidCards(list, tgt.getValidTgts(), AllZone.getComputerPlayer(), sa.getSourceCard()); // AI won't try to grab cards that are filtered out of AI decks on // purpose - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { final Map vars = c.getSVars(); @@ -871,7 +871,7 @@ public class AbilityFactoryGainControl { object2 = AbilityFactory.getDefinedCards(sa.getSourceCard(), params.get("Defined"), sa).get(0); } else if (tgt.getMinTargets(sa.getSourceCard(), sa) > 1) { List list2 = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield); - list2 = CardListUtil.getValidCards(list2, tgt.getValidTgts(), AllZone.getComputerPlayer(), sa.getSourceCard()); + list2 = CardLists.getValidCards(list2, tgt.getValidTgts(), AllZone.getComputerPlayer(), sa.getSourceCard()); object2 = CardFactoryUtil.getWorstAI(list2); tgt.addTarget(object2); } diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryMana.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryMana.java index 4089887bd68..253f4e77dd1 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryMana.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryMana.java @@ -29,7 +29,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates; import forge.Constant; import forge.Counters; @@ -772,7 +772,7 @@ public class AbilityFactoryMana { cards.add(c); } } else { - cards = CardListUtil.getValidCards(AllZoneUtil.getCardsIn(ZoneType.Battlefield), validCard, abMana.getActivatingPlayer(), card); + cards = CardLists.getValidCards(AllZoneUtil.getCardsIn(ZoneType.Battlefield), validCard, abMana.getActivatingPlayer(), card); } // remove anything cards that is already in parents diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryPermanentState.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryPermanentState.java index ec50d0d9119..8da190ac137 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryPermanentState.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryPermanentState.java @@ -30,7 +30,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates; import forge.CardPredicates.Presets; import forge.Singletons; @@ -406,14 +406,14 @@ public class AbilityFactoryPermanentState { } List untapList = targetController.getCardsIn(ZoneType.Battlefield); - untapList = CardListUtil.getTargetableCards(untapList, sa); - untapList = CardListUtil.getValidCards(untapList, tgt.getValidTgts(), source.getController(), source); + untapList = CardLists.getTargetableCards(untapList, sa); + untapList = CardLists.getValidCards(untapList, tgt.getValidTgts(), source.getController(), source); - untapList = CardListUtil.filter(untapList, Presets.TAPPED); + untapList = CardLists.filter(untapList, Presets.TAPPED); // filter out enchantments and planeswalkers, their tapped state doesn't // matter. final String[] tappablePermanents = { "Creature", "Land", "Artifact" }; - untapList = CardListUtil.getValidCards(untapList, tappablePermanents, source.getController(), source); + untapList = CardLists.getValidCards(untapList, tappablePermanents, source.getController(), source); if (untapList.size() == 0) { return false; @@ -432,7 +432,7 @@ public class AbilityFactoryPermanentState { } } - if (CardListUtil.getNotType(untapList, "Creature").size() == 0) { + if (CardLists.getNotType(untapList, "Creature").size() == 0) { choice = CardFactoryUtil.getBestCreatureAI(untapList); // if // only // creatures @@ -479,20 +479,20 @@ public class AbilityFactoryPermanentState { List list = AllZoneUtil.getCardsIn(ZoneType.Battlefield); - list = CardListUtil.getValidCards(list, tgt.getValidTgts(), source.getController(), source); - list = CardListUtil.getTargetableCards(list, sa); + list = CardLists.getValidCards(list, tgt.getValidTgts(), source.getController(), source); + list = CardLists.getTargetableCards(list, sa); // filter by enchantments and planeswalkers, their tapped state doesn't // matter. final String[] tappablePermanents = { "Enchantment", "Planeswalker" }; - List tapList = CardListUtil.getValidCards(list, tappablePermanents, source.getController(), source); + List tapList = CardLists.getValidCards(list, tappablePermanents, source.getController(), source); if (AbilityFactoryPermanentState.untapTargetList(source, tgt, af, sa, mandatory, tapList)) { return true; } // try to just tap already tapped things - tapList = CardListUtil.filter(list, Presets.UNTAPPED); + tapList = CardLists.filter(list, Presets.UNTAPPED); if (AbilityFactoryPermanentState.untapTargetList(source, tgt, af, sa, mandatory, tapList)) { return true; @@ -552,7 +552,7 @@ public class AbilityFactoryPermanentState { } } - if (CardListUtil.getNotType(tapList, "Creature").size() == 0) { + if (CardLists.getNotType(tapList, "Creature").size() == 0) { choice = CardFactoryUtil.getBestCreatureAI(tapList); // if only // creatures // take @@ -639,8 +639,8 @@ public class AbilityFactoryPermanentState { AllZone.getInputControl().setInput(CardFactoryUtil.inputUntapUpToNType(num, valid)); } else { List list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield); - list = CardListUtil.getType(list, valid); - list = CardListUtil.filter(list, Presets.TAPPED); + list = CardLists.getType(list, valid); + list = CardLists.filter(list, Presets.TAPPED); int count = 0; while ((list.size() != 0) && (count < num)) { @@ -1002,12 +1002,12 @@ public class AbilityFactoryPermanentState { private static boolean tapPrefTargeting(final Card source, final Target tgt, final AbilityFactory af, final SpellAbility sa, final boolean mandatory) { List tapList = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield); - tapList = CardListUtil.filter(tapList, Presets.UNTAPPED); - tapList = CardListUtil.getValidCards(tapList, tgt.getValidTgts(), source.getController(), source); + tapList = CardLists.filter(tapList, Presets.UNTAPPED); + tapList = CardLists.getValidCards(tapList, tgt.getValidTgts(), source.getController(), source); // filter out enchantments and planeswalkers, their tapped state doesn't matter. final String[] tappablePermanents = { "Creature", "Land", "Artifact" }; - tapList = CardListUtil.getValidCards(tapList, tappablePermanents, source.getController(), source); - tapList = CardListUtil.getTargetableCards(tapList, sa); + tapList = CardLists.getValidCards(tapList, tappablePermanents, source.getController(), source); + tapList = CardLists.getTargetableCards(tapList, sa); if (tapList.size() == 0) { return false; @@ -1038,7 +1038,7 @@ public class AbilityFactoryPermanentState { if (phase.getPhase().isAfter(PhaseType.COMBAT_DECLARE_ATTACKERS)) { //Combat has already started final List attackers = AllZone.getCombat().getAttackerList(); - List creatureList = CardListUtil.filter(tapList, new Predicate() { + List creatureList = CardLists.filter(tapList, new Predicate() { @Override public boolean apply(final Card c) { if (c.isCreature()) { @@ -1053,7 +1053,7 @@ public class AbilityFactoryPermanentState { } else { final List attackers = ComputerUtil.getPossibleAttackers(); attackers.remove(sa.getSourceCard()); - List creatureList = CardListUtil.filter(tapList, new Predicate() { + List creatureList = CardLists.filter(tapList, new Predicate() { @Override public boolean apply(final Card c) { if (c.isCreature()) { @@ -1070,7 +1070,7 @@ public class AbilityFactoryPermanentState { && phase.getPhase().isBefore(PhaseType.COMBAT_DECLARE_ATTACKERS)) { // Tap creatures possible blockers before combat during AI's turn. if (Iterables.any(tapList, CardPredicates.Presets.CREATURES)) { - List creatureList = CardListUtil.filter(tapList, CardPredicates.Presets.CREATURES_CAN_ATTACK); + List creatureList = CardLists.filter(tapList, CardPredicates.Presets.CREATURES_CAN_ATTACK); choice = CardFactoryUtil.getBestCreatureAI(creatureList); } else { // no creatures available choice = CardFactoryUtil.getMostExpensivePermanentAI(tapList, sa, false); @@ -1119,19 +1119,19 @@ public class AbilityFactoryPermanentState { final Target tgt = sa.getTarget(); List list = AllZoneUtil.getCardsIn(ZoneType.Battlefield); - list = CardListUtil.getValidCards(list, tgt.getValidTgts(), source.getController(), source); - list = CardListUtil.getTargetableCards(list, sa); + list = CardLists.getValidCards(list, tgt.getValidTgts(), source.getController(), source); + list = CardLists.getTargetableCards(list, sa); // filter by enchantments and planeswalkers, their tapped state doesn't matter. final String[] tappablePermanents = { "Enchantment", "Planeswalker" }; - List tapList = CardListUtil.getValidCards(list, tappablePermanents, source.getController(), source); + List tapList = CardLists.getValidCards(list, tappablePermanents, source.getController(), source); if (AbilityFactoryPermanentState.tapTargetList(af, sa, tapList, mandatory)) { return true; } // try to just tap already tapped things - tapList = CardListUtil.filter(list, Presets.TAPPED); + tapList = CardLists.filter(list, Presets.TAPPED); if (AbilityFactoryPermanentState.tapTargetList(af, sa, tapList, mandatory)) { return true; @@ -1192,7 +1192,7 @@ public class AbilityFactoryPermanentState { } } - if (CardListUtil.getNotType(tapList, "Creature").size() == 0) { + if (CardLists.getNotType(tapList, "Creature").size() == 0) { // if only creatures take the best choice = CardFactoryUtil.getBestCreatureAI(tapList); } else { @@ -1442,7 +1442,7 @@ public class AbilityFactoryPermanentState { } else { list = tgtPlayers.get(0).getCardsIn(ZoneType.Battlefield); } - list = CardListUtil.getValidCards(list, valid.split(","), card.getController(), card); + list = CardLists.getValidCards(list, valid.split(","), card.getController(), card); for (int i = 0; i < list.size(); i++) { list.get(i).untap(); @@ -1749,8 +1749,8 @@ public class AbilityFactoryPermanentState { validTappables = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield); } - validTappables = CardListUtil.getValidCards(validTappables, valid, source.getController(), source); - validTappables = CardListUtil.filter(validTappables, Presets.UNTAPPED); + validTappables = CardLists.getValidCards(validTappables, valid, source.getController(), source); + validTappables = CardLists.filter(validTappables, Presets.UNTAPPED); final Random r = MyRandom.getRandom(); boolean rr = false; @@ -1759,13 +1759,13 @@ public class AbilityFactoryPermanentState { } if (validTappables.size() > 0) { - final List human = CardListUtil.filter(validTappables, new Predicate() { + final List human = CardLists.filter(validTappables, new Predicate() { @Override public boolean apply(final Card c) { return c.getController().isHuman(); } }); - final List compy = CardListUtil.filter(validTappables, new Predicate() { + final List compy = CardLists.filter(validTappables, new Predicate() { @Override public boolean apply(final Card c) { return c.getController().isComputer(); @@ -1791,8 +1791,8 @@ public class AbilityFactoryPermanentState { */ private static List getTapAllTargets(final String valid, final Card source) { List tmpList = AllZoneUtil.getCardsIn(ZoneType.Battlefield); - tmpList = CardListUtil.getValidCards(tmpList, valid, source.getController(), source); - tmpList = CardListUtil.filter(tmpList, Presets.UNTAPPED); + tmpList = CardLists.getValidCards(tmpList, valid, source.getController(), source); + tmpList = CardLists.filter(tmpList, Presets.UNTAPPED); return tmpList; } @@ -1874,13 +1874,13 @@ public class AbilityFactoryPermanentState { } if (validTappables.size() > 0) { - final List human = CardListUtil.filter(validTappables, new Predicate() { + final List human = CardLists.filter(validTappables, new Predicate() { @Override public boolean apply(final Card c) { return c.getController().isHuman(); } }); - final List compy = CardListUtil.filter(validTappables, new Predicate() { + final List compy = CardLists.filter(validTappables, new Predicate() { @Override public boolean apply(final Card c) { return c.getController().isComputer(); @@ -2619,7 +2619,7 @@ public class AbilityFactoryPermanentState { final Target tgt = sa.getTarget(); List list = AllZoneUtil.getCardsIn(ZoneType.Battlefield); - list = CardListUtil.getTargetableCards(CardListUtil.getValidCards(list, tgt.getValidTgts(), source.getController(), source), sa); + list = CardLists.getTargetableCards(CardLists.getValidCards(list, tgt.getValidTgts(), source.getController(), source), sa); return false; } diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryPlay.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryPlay.java index a875fafd29d..15e9b219e12 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryPlay.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryPlay.java @@ -30,7 +30,7 @@ import forge.AllZoneUtil; import forge.Card; import forge.CardCharacteristicName; -import forge.CardListUtil; +import forge.CardLists; import forge.GameActionUtil; import forge.Singletons; import forge.card.cardfactory.CardFactoryUtil; @@ -304,7 +304,7 @@ public final class AbilityFactoryPlay { if (tgt != null) { ZoneType zone = tgt.getZone().get(0); cards = AllZoneUtil.getCardsIn(zone); - cards = CardListUtil.getValidCards(cards, tgt.getValidTgts(), AllZone.getComputerPlayer(), source); + cards = CardLists.getValidCards(cards, tgt.getValidTgts(), AllZone.getComputerPlayer(), source); if (cards.isEmpty()) { return false; } @@ -401,7 +401,7 @@ public final class AbilityFactoryPlay { tgtCard = GuiChoose.one("Select a card to play", tgtCards); } else { // AI - tgtCards = CardListUtil.filter(tgtCards, new Predicate() { + tgtCards = CardLists.filter(tgtCards, new Predicate() { @Override public boolean apply(final Card c) { ArrayList spellAbilities = c.getBasicSpells(); diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryPreventDamage.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryPreventDamage.java index 1d3aa53b7bf..311f50e9a13 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryPreventDamage.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryPreventDamage.java @@ -25,7 +25,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates; import forge.CardUtil; import forge.Singletons; @@ -352,7 +352,7 @@ public class AbilityFactoryPreventDamage { final List threatenedTargets = new ArrayList(); // filter AIs battlefield by what I can target List targetables = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield); - targetables = CardListUtil.getValidCards(targetables, tgt.getValidTgts(), AllZone.getComputerPlayer(), hostCard); + targetables = CardLists.getValidCards(targetables, tgt.getValidTgts(), AllZone.getComputerPlayer(), hostCard); for (final Card c : targetables) { if (objects.contains(c)) { @@ -376,13 +376,13 @@ public class AbilityFactoryPreventDamage { } else { // filter AIs battlefield by what I can target List targetables = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield); - targetables = CardListUtil.getValidCards(targetables, tgt.getValidTgts(), AllZone.getComputerPlayer(), hostCard); + targetables = CardLists.getValidCards(targetables, tgt.getValidTgts(), AllZone.getComputerPlayer(), hostCard); if (targetables.size() == 0) { return false; } - final List combatants = CardListUtil.filter(targetables, CardPredicates.Presets.CREATURES); - CardListUtil.sortByEvaluateCreature(combatants); + final List combatants = CardLists.filter(targetables, CardPredicates.Presets.CREATURES); + CardLists.sortByEvaluateCreature(combatants); for (final Card c : combatants) { if (CombatUtil.combatantWouldBeDestroyed(c)) { @@ -459,8 +459,8 @@ public class AbilityFactoryPreventDamage { tgt.resetTargets(); // filter AIs battlefield by what I can target List targetables = AllZoneUtil.getCardsIn(ZoneType.Battlefield); - targetables = CardListUtil.getValidCards(targetables, tgt.getValidTgts(), AllZone.getComputerPlayer(), hostCard); - final List compTargetables = CardListUtil.filterControlledBy(targetables, AllZone.getComputerPlayer()); + targetables = CardLists.getValidCards(targetables, tgt.getValidTgts(), AllZone.getComputerPlayer(), hostCard); + final List compTargetables = CardLists.filterControlledBy(targetables, AllZone.getComputerPlayer()); if (targetables.size() == 0) { return false; @@ -471,8 +471,8 @@ public class AbilityFactoryPreventDamage { } if (compTargetables.size() > 0) { - final List combatants = CardListUtil.filter(compTargetables, CardPredicates.Presets.CREATURES); - CardListUtil.sortByEvaluateCreature(combatants); + final List combatants = CardLists.filter(compTargetables, CardPredicates.Presets.CREATURES); + CardLists.sortByEvaluateCreature(combatants); if (Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) { for (final Card c : combatants) { if (CombatUtil.combatantWouldBeDestroyed(c)) { diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryProtection.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryProtection.java index 7de74ac099a..a1c4da7d2d0 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryProtection.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryProtection.java @@ -31,7 +31,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardUtil; import forge.Command; import forge.Constant; @@ -250,7 +250,7 @@ public final class AbilityFactoryProtection { final ArrayList gains = AbilityFactoryProtection.getProtectionList(hostCard, af.getMapParams()); List list = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer()); - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { if (!c.canBeTargetedBy(sa)) { @@ -385,7 +385,7 @@ public final class AbilityFactoryProtection { tgt.resetTargets(); List list = AbilityFactoryProtection.getProtectCreatures(af, sa); - list = CardListUtil.getValidCards(list, tgt.getValidTgts(), sa.getActivatingPlayer(), sa.getSourceCard()); + list = CardLists.getValidCards(list, tgt.getValidTgts(), sa.getActivatingPlayer(), sa.getSourceCard()); /* * TODO - What this should probably do is if it's time for instants and @@ -418,7 +418,7 @@ public final class AbilityFactoryProtection { } // Don't target cards that will die. - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { System.out.println("Not Protecting"); @@ -472,7 +472,7 @@ public final class AbilityFactoryProtection { List list = AllZoneUtil.getCardsIn(ZoneType.Battlefield); final Target tgt = sa.getTarget(); - list = CardListUtil.getValidCards(list, tgt.getValidTgts(), sa.getActivatingPlayer(), sa.getSourceCard()); + list = CardLists.getValidCards(list, tgt.getValidTgts(), sa.getActivatingPlayer(), sa.getSourceCard()); if (list.size() < tgt.getMinTargets(sa.getSourceCard(), sa)) { tgt.resetTargets(); @@ -484,23 +484,23 @@ public final class AbilityFactoryProtection { list.remove(c); } - List pref = CardListUtil.filterControlledBy(list, AllZone.getComputerPlayer()); - pref = CardListUtil.filter(pref, new Predicate() { + List pref = CardLists.filterControlledBy(list, AllZone.getComputerPlayer()); + pref = CardLists.filter(pref, new Predicate() { @Override public boolean apply(final Card c) { return !AbilityFactoryProtection.hasProtectionFromAll(c, AbilityFactoryProtection.getProtectionList(host, params)); } }); - final List pref2 = CardListUtil.filterControlledBy(list, AllZone.getComputerPlayer()); - pref = CardListUtil.filter(pref, new Predicate() { + final List pref2 = CardLists.filterControlledBy(list, AllZone.getComputerPlayer()); + pref = CardLists.filter(pref, new Predicate() { @Override public boolean apply(final Card c) { return !AbilityFactoryProtection.hasProtectionFromAny(c, AbilityFactoryProtection.getProtectionList(host, params)); } }); - final List forced = CardListUtil.filterControlledBy(list, AllZone.getHumanPlayer()); + final List forced = CardLists.filterControlledBy(list, AllZone.getHumanPlayer()); final Card source = sa.getSourceCard(); while (tgt.getNumTargeted() < tgt.getMaxTargets(source, sa)) { @@ -509,7 +509,7 @@ public final class AbilityFactoryProtection { } Card c; - if (CardListUtil.getNotType(pref, "Creature").size() == 0) { + if (CardLists.getNotType(pref, "Creature").size() == 0) { c = CardFactoryUtil.getBestCreatureAI(pref); } else { c = CardFactoryUtil.getMostExpensivePermanentAI(pref, sa, true); @@ -526,7 +526,7 @@ public final class AbilityFactoryProtection { } Card c; - if (CardListUtil.getNotType(pref2, "Creature").size() == 0) { + if (CardLists.getNotType(pref2, "Creature").size() == 0) { c = CardFactoryUtil.getBestCreatureAI(pref2); } else { c = CardFactoryUtil.getMostExpensivePermanentAI(pref2, sa, true); @@ -543,7 +543,7 @@ public final class AbilityFactoryProtection { } Card c; - if (CardListUtil.getNotType(forced, "Creature").size() == 0) { + if (CardLists.getNotType(forced, "Creature").size() == 0) { c = CardFactoryUtil.getWorstCreatureAI(forced); } else { c = CardFactoryUtil.getCheapestPermanentAI(forced, sa, true); @@ -745,7 +745,7 @@ public final class AbilityFactoryProtection { if (logic.equals("MostProminentHumanCreatures")) { List list = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer()); if (list.isEmpty()) { - list = CardListUtil.filterControlledBy(AllZoneUtil.getCardsInGame(), AllZone.getHumanPlayer()); + list = CardLists.filterControlledBy(AllZoneUtil.getCardsInGame(), AllZone.getHumanPlayer()); } if (!list.isEmpty()) { choice = CardFactoryUtil.getMostProminentColor(list); @@ -1191,7 +1191,7 @@ public final class AbilityFactoryProtection { } if (!valid.equals("")) { List list = AllZoneUtil.getCardsIn(ZoneType.Battlefield); - list = CardListUtil.getValidCards(list, valid, sa.getActivatingPlayer(), host); + list = CardLists.getValidCards(list, valid, sa.getActivatingPlayer(), host); for (final Card tgtC : list) { if (AllZoneUtil.isCardInPlay(tgtC)) { diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryPump.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryPump.java index bfdbb20e83c..378814117e0 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryPump.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryPump.java @@ -30,7 +30,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates; import forge.CardUtil; import forge.Command; @@ -341,7 +341,7 @@ public class AbilityFactoryPump { return false; } - List attackers = CardListUtil.filter(AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.possibleAttackers); + List attackers = CardLists.filter(AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.possibleAttackers); if (!CombatUtil.canBlockAtLeastOne(card, attackers)) { return false; } @@ -352,7 +352,7 @@ public class AbilityFactoryPump { return false; } - List attackers = CardListUtil.filter(AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.possibleAttackers); + List attackers = CardLists.filter(AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.possibleAttackers); if (!CombatUtil.canBlockAtLeastOne(card, attackers)) { return false; } @@ -367,7 +367,7 @@ public class AbilityFactoryPump { || card.getNetCombatDamage() <= 0 || ph.getPhase().isAfter(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY) || ph.getPhase().isBefore(PhaseType.MAIN1) - || CardListUtil.getNotKeyword(AllZoneUtil.getCreaturesInPlay(computer), "Defender").isEmpty())) { + || CardLists.getNotKeyword(AllZoneUtil.getCreaturesInPlay(computer), "Defender").isEmpty())) { return false; } if (ph.isPlayerTurn(human) && (!card.isAttacking() @@ -410,7 +410,7 @@ public class AbilityFactoryPump { } Predicate opBlockers = CardPredicates.possibleBlockers(card); - List cardsCanBlock = CardListUtil.filter(AllZoneUtil.getCreaturesInPlay(human), opBlockers); + List cardsCanBlock = CardLists.filter(AllZoneUtil.getCreaturesInPlay(human), opBlockers); final boolean evasive = (keyword.endsWith("Unblockable") || keyword.endsWith("Fear") || keyword.endsWith("Intimidate") || keyword.endsWith("Shadow")); @@ -427,7 +427,7 @@ public class AbilityFactoryPump { } else if (keyword.endsWith("Flying")) { if (ph.isPlayerTurn(human) && ph.getPhase().equals(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY) - && !CardListUtil.getKeyword(AllZone.getCombat().getAttackerList(), "Flying").isEmpty() + && !CardLists.getKeyword(AllZone.getCombat().getAttackerList(), "Flying").isEmpty() && !card.hasKeyword("Reach") && CombatUtil.canBlock(card) && CombatUtil.lifeInDanger(AllZone.getCombat())) { @@ -442,7 +442,7 @@ public class AbilityFactoryPump { } else if (keyword.endsWith("Horsemanship")) { if (ph.isPlayerTurn(human) && ph.getPhase().equals(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY) - && !CardListUtil.getKeyword(AllZone.getCombat().getAttackerList(), "Horsemanship").isEmpty() + && !CardLists.getKeyword(AllZone.getCombat().getAttackerList(), "Horsemanship").isEmpty() && CombatUtil.canBlock(card) && CombatUtil.lifeInDanger(AllZone.getCombat())) { return true; @@ -450,7 +450,7 @@ public class AbilityFactoryPump { if (ph.isPlayerTurn(human) || !(CombatUtil.canAttack(card) || card.isAttacking()) || ph.getPhase().isAfter(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY) || card.getNetCombatDamage() <= 0 - || CardListUtil.getNotKeyword(cardsCanBlock, "Horsemanship").isEmpty()) { + || CardLists.getNotKeyword(cardsCanBlock, "Horsemanship").isEmpty()) { return false; } } else if (keyword.endsWith("Haste")) { @@ -506,7 +506,7 @@ public class AbilityFactoryPump { } else if (keyword.startsWith("Flanking")) { if (ph.isPlayerTurn(human) || !(CombatUtil.canAttack(card) || card.isAttacking()) || ph.getPhase().isAfter(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY) - || CardListUtil.getNotKeyword(cardsCanBlock, "Flanking").isEmpty()) { + || CardLists.getNotKeyword(cardsCanBlock, "Flanking").isEmpty()) { return false; } } else if (keyword.startsWith("Trample")) { @@ -550,13 +550,13 @@ public class AbilityFactoryPump { } else if (keyword.equals("Vigilance")) { if (ph.isPlayerTurn(human) || !CombatUtil.canAttack(card) || ph.getPhase().isAfter(PhaseType.COMBAT_DECLARE_ATTACKERS) - || CardListUtil.getNotKeyword(AllZoneUtil.getCreaturesInPlay(human), "Defender").size() < 1) { + || CardLists.getNotKeyword(AllZoneUtil.getCreaturesInPlay(human), "Defender").size() < 1) { return false; } } else if (keyword.equals("Reach")) { if (ph.isPlayerTurn(computer) || !ph.getPhase().equals(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY) - || CardListUtil.getKeyword(AllZone.getCombat().getAttackerList(), "Flying").isEmpty() + || CardLists.getKeyword(AllZone.getCombat().getAttackerList(), "Flying").isEmpty() || card.hasKeyword("Flying") || !CombatUtil.canBlock(card)) { return false; @@ -587,7 +587,7 @@ public class AbilityFactoryPump { if (ph.isPlayerTurn(human) || !(CombatUtil.canAttack(card) || card.isAttacking()) || ph.getPhase().isAfter(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY) || card.getNetCombatDamage() <= 0 - || CardListUtil.getType(AllZoneUtil.getPlayerLandsInPlay(human), "Island").isEmpty() + || CardLists.getType(AllZoneUtil.getPlayerLandsInPlay(human), "Island").isEmpty() || cardsCanBlock.isEmpty()) { return false; } @@ -595,7 +595,7 @@ public class AbilityFactoryPump { if (ph.isPlayerTurn(human) || !(CombatUtil.canAttack(card) || card.isAttacking()) || ph.getPhase().isAfter(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY) || card.getNetCombatDamage() <= 0 - || CardListUtil.getType(AllZoneUtil.getPlayerLandsInPlay(human), "Swamp").isEmpty() + || CardLists.getType(AllZoneUtil.getPlayerLandsInPlay(human), "Swamp").isEmpty() || cardsCanBlock.isEmpty()) { return false; } @@ -603,7 +603,7 @@ public class AbilityFactoryPump { if (ph.isPlayerTurn(human) || !(CombatUtil.canAttack(card) || card.isAttacking()) || ph.getPhase().isAfter(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY) || card.getNetCombatDamage() <= 0 - || CardListUtil.getType(AllZoneUtil.getPlayerLandsInPlay(human), "Mountain").isEmpty() + || CardLists.getType(AllZoneUtil.getPlayerLandsInPlay(human), "Mountain").isEmpty() || cardsCanBlock.isEmpty()) { return false; } @@ -611,7 +611,7 @@ public class AbilityFactoryPump { if (ph.isPlayerTurn(human) || !(CombatUtil.canAttack(card) || card.isAttacking()) || ph.getPhase().isAfter(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY) || card.getNetCombatDamage() <= 0 - || CardListUtil.getType(AllZoneUtil.getPlayerLandsInPlay(human), "Forest").isEmpty() + || CardLists.getType(AllZoneUtil.getPlayerLandsInPlay(human), "Forest").isEmpty() || cardsCanBlock.isEmpty()) { return false; } @@ -702,7 +702,7 @@ public class AbilityFactoryPump { private List getPumpCreatures(final SpellAbility sa) { List list = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer()); - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { return shouldPumpCard(sa, c); @@ -726,11 +726,11 @@ public class AbilityFactoryPump { */ private List getCurseCreatures(final SpellAbility sa, final int defense, final int attack) { List list = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer()); - list = CardListUtil.getTargetableCards(list, sa); + list = CardLists.getTargetableCards(list, sa); if ((defense < 0) && !list.isEmpty()) { // with spells that give -X/-X, // compi will try to destroy a // creature - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { if (c.getNetDefense() <= -defense) { @@ -754,7 +754,7 @@ public class AbilityFactoryPump { } else { // Human active, only curse attacking creatures if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_DECLARE_BLOCKERS)) { - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { if (!c.isAttacking()) { @@ -781,7 +781,7 @@ public class AbilityFactoryPump { final boolean addsKeywords = this.keywords.size() > 0; if (addsKeywords) { - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { return containsUsefulKeyword(keywords, c, sa); @@ -978,9 +978,9 @@ public class AbilityFactoryPump { List list = new ArrayList(); if (this.abilityFactory.getMapParams().containsKey("AILogic")) { if (this.abilityFactory.getMapParams().get("AILogic").equals("HighestPower")) { - list = CardListUtil.getValidCards(AllZoneUtil.getCreaturesInPlay(), tgt.getValidTgts(), sa.getActivatingPlayer(), sa.getSourceCard()); - list = CardListUtil.getTargetableCards(list, sa); - CardListUtil.sortAttack(list); + list = CardLists.getValidCards(AllZoneUtil.getCreaturesInPlay(), tgt.getValidTgts(), sa.getActivatingPlayer(), sa.getSourceCard()); + list = CardLists.getTargetableCards(list, sa); + CardLists.sortAttack(list); if (!list.isEmpty()) { tgt.addTarget(list.get(0)); return true; @@ -1007,7 +1007,7 @@ public class AbilityFactoryPump { } } - list = CardListUtil.getValidCards(list, tgt.getValidTgts(), sa.getActivatingPlayer(), sa.getSourceCard()); + list = CardLists.getValidCards(list, tgt.getValidTgts(), sa.getActivatingPlayer(), sa.getSourceCard()); if (AllZone.getStack().size() == 0) { // If the cost is tapping, don't activate before declare // attack/block @@ -1029,7 +1029,7 @@ public class AbilityFactoryPump { if (!this.abilityFactory.isCurse()) { // Don't target cards that will die. - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { return !c.getSVar("Targeting").equals("Dies"); @@ -1079,8 +1079,8 @@ public class AbilityFactoryPump { private boolean pumpMandatoryTarget(final AbilityFactory af, final SpellAbility sa, final boolean mandatory) { List list = AllZoneUtil.getCardsIn(ZoneType.Battlefield); final Target tgt = sa.getTarget(); - list = CardListUtil.getValidCards(list, tgt.getValidTgts(), sa.getActivatingPlayer(), sa.getSourceCard()); - list = CardListUtil.getTargetableCards(list, sa); + list = CardLists.getValidCards(list, tgt.getValidTgts(), sa.getActivatingPlayer(), sa.getSourceCard()); + list = CardLists.getTargetableCards(list, sa); if (list.size() < tgt.getMinTargets(sa.getSourceCard(), sa)) { tgt.resetTargets(); @@ -1097,11 +1097,11 @@ public class AbilityFactoryPump { final Card source = sa.getSourceCard(); if (af.isCurse()) { - pref = CardListUtil.filterControlledBy(list, AllZone.getHumanPlayer()); - forced = CardListUtil.filterControlledBy(list, AllZone.getComputerPlayer()); + pref = CardLists.filterControlledBy(list, AllZone.getHumanPlayer()); + forced = CardLists.filterControlledBy(list, AllZone.getComputerPlayer()); } else { - pref = CardListUtil.filterControlledBy(list, AllZone.getComputerPlayer()); - forced = CardListUtil.filterControlledBy(list, AllZone.getHumanPlayer()); + pref = CardLists.filterControlledBy(list, AllZone.getComputerPlayer()); + forced = CardLists.filterControlledBy(list, AllZone.getHumanPlayer()); } while (tgt.getNumTargeted() < tgt.getMaxTargets(source, sa)) { @@ -1110,7 +1110,7 @@ public class AbilityFactoryPump { } Card c; - if (CardListUtil.getNotType(pref, "Creature").size() == 0) { + if (CardLists.getNotType(pref, "Creature").size() == 0) { c = CardFactoryUtil.getBestCreatureAI(pref); } else { c = CardFactoryUtil.getMostExpensivePermanentAI(pref, sa, true); @@ -1127,7 +1127,7 @@ public class AbilityFactoryPump { } Card c; - if (CardListUtil.getNotType(forced, "Creature").size() == 0) { + if (CardLists.getNotType(forced, "Creature").size() == 0) { c = CardFactoryUtil.getWorstCreatureAI(forced); } else { c = CardFactoryUtil.getCheapestPermanentAI(forced, sa, true); @@ -1725,9 +1725,9 @@ public class AbilityFactoryPump { } List comp = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield); - comp = CardListUtil.getValidCards(comp, valid, source.getController(), source); + comp = CardLists.getValidCards(comp, valid, source.getController(), source); List human = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield); - human = CardListUtil.getValidCards(human, valid, source.getController(), source); + human = CardLists.getValidCards(human, valid, source.getController(), source); final Target tgt = sa.getTarget(); if (tgt != null && sa.canTarget(AllZone.getHumanPlayer()) && params.containsKey("IsCurse")) { @@ -1738,7 +1738,7 @@ public class AbilityFactoryPump { if (this.abilityFactory.isCurse()) { if (defense < 0) { // try to destroy creatures - comp = CardListUtil.filter(comp, new Predicate() { + comp = CardLists.filter(comp, new Predicate() { @Override public boolean apply(final Card c) { if (c.getNetDefense() <= -defense) { @@ -1747,7 +1747,7 @@ public class AbilityFactoryPump { return ((c.getKillDamage() <= -defense) && !c.hasKeyword("Indestructible")); } }); // leaves all creatures that will be destroyed - human = CardListUtil.filter(human, new Predicate() { + human = CardLists.filter(human, new Predicate() { @Override public boolean apply(final Card c) { if (c.getNetDefense() <= -defense) { @@ -1772,7 +1772,7 @@ public class AbilityFactoryPump { } // only count creatures that can attack - comp = CardListUtil.filter(comp, new Predicate() { + comp = CardLists.filter(comp, new Predicate() { @Override public boolean apply(final Card c) { if (power <= 0 && !containsUsefulKeyword(keywords, c, sa)) { diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryRegenerate.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryRegenerate.java index 514d1c3ffaa..e9be0099546 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryRegenerate.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryRegenerate.java @@ -26,7 +26,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates; import forge.Command; import forge.Singletons; @@ -316,7 +316,7 @@ public class AbilityFactoryRegenerate { tgt.resetTargets(); // filter AIs battlefield by what I can target List targetables = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield); - targetables = CardListUtil.getValidCards(targetables, tgt.getValidTgts(), AllZone.getComputerPlayer(), hostCard); + targetables = CardLists.getValidCards(targetables, tgt.getValidTgts(), AllZone.getComputerPlayer(), hostCard); if (targetables.size() == 0) { return false; @@ -342,8 +342,8 @@ public class AbilityFactoryRegenerate { } } else { if (Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) { - final List combatants = CardListUtil.filter(targetables, CardPredicates.Presets.CREATURES); - CardListUtil.sortByEvaluateCreature(combatants); + final List combatants = CardLists.filter(targetables, CardPredicates.Presets.CREATURES); + CardLists.sortByEvaluateCreature(combatants); for (final Card c : combatants) { if ((c.getShield() == 0) && CombatUtil.combatantWouldBeDestroyed(c)) { @@ -419,8 +419,8 @@ public class AbilityFactoryRegenerate { tgt.resetTargets(); // filter AIs battlefield by what I can target List targetables = AllZoneUtil.getCardsIn(ZoneType.Battlefield); - targetables = CardListUtil.getValidCards(targetables, tgt.getValidTgts(), AllZone.getComputerPlayer(), hostCard); - final List compTargetables = CardListUtil.filterControlledBy(targetables, AllZone.getComputerPlayer()); + targetables = CardLists.getValidCards(targetables, tgt.getValidTgts(), AllZone.getComputerPlayer(), hostCard); + final List compTargetables = CardLists.filterControlledBy(targetables, AllZone.getComputerPlayer()); if (targetables.size() == 0) { return false; @@ -431,8 +431,8 @@ public class AbilityFactoryRegenerate { } if (compTargetables.size() > 0) { - final List combatants = CardListUtil.filter(compTargetables, CardPredicates.Presets.CREATURES); - CardListUtil.sortByEvaluateCreature(combatants); + final List combatants = CardLists.filter(compTargetables, CardPredicates.Presets.CREATURES); + CardLists.sortByEvaluateCreature(combatants); if (Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) { for (final Card c : combatants) { if ((c.getShield() == 0) && CombatUtil.combatantWouldBeDestroyed(c)) { @@ -446,7 +446,7 @@ public class AbilityFactoryRegenerate { // can target // choose my best X without regen - if (CardListUtil.getNotType(compTargetables, "Creature").size() == 0) { + if (CardLists.getNotType(compTargetables, "Creature").size() == 0) { for (final Card c : combatants) { if (c.getShield() == 0) { tgt.addTarget(c); @@ -456,7 +456,7 @@ public class AbilityFactoryRegenerate { tgt.addTarget(combatants.get(0)); return true; } else { - CardListUtil.sortByMostExpensive(compTargetables); + CardLists.sortByMostExpensive(compTargetables); for (final Card c : compTargetables) { if (c.getShield() == 0) { tgt.addTarget(c); @@ -728,8 +728,8 @@ public class AbilityFactoryRegenerate { } List list = AllZoneUtil.getCardsIn(ZoneType.Battlefield); - list = CardListUtil.getValidCards(list, valid.split(","), hostCard.getController(), hostCard); - list = CardListUtil.filter(list, CardPredicates.isController(AllZone.getComputerPlayer())); + list = CardLists.getValidCards(list, valid.split(","), hostCard.getController(), hostCard); + list = CardLists.filter(list, CardPredicates.isController(AllZone.getComputerPlayer())); if (list.size() == 0) { return false; @@ -746,7 +746,7 @@ public class AbilityFactoryRegenerate { } } else { if (Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) { - final List combatants = CardListUtil.filter(list, CardPredicates.Presets.CREATURES); + final List combatants = CardLists.filter(list, CardPredicates.Presets.CREATURES); for (final Card c : combatants) { if (c.getShield() == 0 && CombatUtil.combatantWouldBeDestroyed(c)) { @@ -817,7 +817,7 @@ public class AbilityFactoryRegenerate { } List list = AllZoneUtil.getCardsIn(ZoneType.Battlefield); - list = CardListUtil.getValidCards(list, valid.split(","), hostCard.getController(), hostCard); + list = CardLists.getValidCards(list, valid.split(","), hostCard.getController(), hostCard); for (final Card c : list) { final Command untilEOT = new Command() { diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryRepeat.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryRepeat.java index 0d37cf882d0..14d3442e4ff 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryRepeat.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryRepeat.java @@ -24,7 +24,7 @@ import java.util.List; import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.card.cost.Cost; import forge.GameActionUtil; @@ -280,7 +280,7 @@ public final class AbilityFactoryRepeat { list = AllZoneUtil.getCardsIn(ZoneType.Battlefield); } - list = CardListUtil.getValidCards(list, repeatPresent.split(","), sa.getActivatingPlayer(), sa.getSourceCard()); + list = CardLists.getValidCards(list, repeatPresent.split(","), sa.getActivatingPlayer(), sa.getSourceCard()); int right; final String rightString = repeatCompare.substring(2); diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryReveal.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryReveal.java index 589eb493a79..b781aecb8f4 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryReveal.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryReveal.java @@ -32,7 +32,7 @@ import forge.AllZoneUtil; import forge.Card; import forge.CardCharacteristicName; -import forge.CardListUtil; +import forge.CardLists; import forge.CardUtil; import forge.GameActionUtil; import forge.Singletons; @@ -454,7 +454,7 @@ public final class AbilityFactoryReveal { } } else if (params.containsKey("RevealValid")) { final String revealValid = params.get("RevealValid"); - final List toReveal = CardListUtil.getValidCards(top, revealValid, host.getController(), host); + final List toReveal = CardLists.getValidCards(top, revealValid, host.getController(), host); if (!toReveal.isEmpty()) { GuiChoose.one("Revealing cards from library", toReveal); if (params.containsKey("RememberRevealed")) { @@ -488,9 +488,9 @@ public final class AbilityFactoryReveal { if (changeValid.contains("ChosenType")) { changeValid = changeValid.replace("ChosenType", host.getChosenType()); } - valid = CardListUtil.getValidCards(top, changeValid.split(","), host.getController(), host); + valid = CardLists.getValidCards(top, changeValid.split(","), host.getController(), host); if (!andOrValid.equals("")) { - andOrCards = CardListUtil.getValidCards(top, andOrValid.split(","), host.getController(), host); + andOrCards = CardLists.getValidCards(top, andOrValid.split(","), host.getController(), host); andOrCards.removeAll(valid); valid.addAll(andOrCards); } @@ -505,7 +505,7 @@ public final class AbilityFactoryReveal { movedCards.addAll(valid); } else if (params.containsKey("RandomChange")) { int numChanging = Math.min(destZone1ChangeNum, valid.size()); - movedCards = CardListUtil.getRandomSubList(valid, numChanging); + movedCards = CardLists.getRandomSubList(valid, numChanging); } else { int j = 0; if (choser.isHuman()) { @@ -2378,7 +2378,7 @@ public final class AbilityFactoryReveal { List valid = new ArrayList(handChoices); int max = 1; if (params.containsKey("RevealValid")) { - valid = CardListUtil.getValidCards(valid, params.get("RevealValid"), p, host); + valid = CardLists.getValidCards(valid, params.get("RevealValid"), p, host); } if (params.containsKey("AnyNumber")) { max = valid.size(); diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactorySacrifice.java b/src/main/java/forge/card/abilityfactory/AbilityFactorySacrifice.java index faf2250ad0b..7e29ddbb224 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactorySacrifice.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactorySacrifice.java @@ -26,7 +26,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardUtil; import forge.Singletons; import forge.card.cardfactory.CardFactoryUtil; @@ -287,7 +287,7 @@ public class AbilityFactorySacrifice { final int amount = AbilityFactory.calculateAmount(sa.getSourceCard(), num, sa); List list = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield); - list = CardListUtil.getValidCards(list, valid.split(","), sa.getActivatingPlayer(), sa.getSourceCard()); + list = CardLists.getValidCards(list, valid.split(","), sa.getActivatingPlayer(), sa.getSourceCard()); if (list.size() == 0) { return false; @@ -427,12 +427,12 @@ public class AbilityFactorySacrifice { } List humanList = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield); - humanList = CardListUtil.getValidCards(humanList, valid.split(","), sa.getActivatingPlayer(), sa.getSourceCard()); + humanList = CardLists.getValidCards(humanList, valid.split(","), sa.getActivatingPlayer(), sa.getSourceCard()); List computerList = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield); if (defined.equals("Opponent")) { computerList = new ArrayList(); } - computerList = CardListUtil.getValidCards(computerList, valid.split(","), sa.getActivatingPlayer(), sa.getSourceCard()); + computerList = CardLists.getValidCards(computerList, valid.split(","), sa.getActivatingPlayer(), sa.getSourceCard()); // Since all of the cards have remAIDeck:True, I enabled 1 for 1 // (or X for X) trades for special decks @@ -851,8 +851,8 @@ public class AbilityFactorySacrifice { List humanlist = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield); List computerlist = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield); - humanlist = CardListUtil.getValidCards(humanlist, valid.split(","), source.getController(), source); - computerlist = CardListUtil.getValidCards(computerlist, valid.split(","), source.getController(), source); + humanlist = CardLists.getValidCards(humanlist, valid.split(","), source.getController(), source); + computerlist = CardLists.getValidCards(computerlist, valid.split(","), source.getController(), source); if (abCost != null) { // AI currently disabled for some costs @@ -866,13 +866,13 @@ public class AbilityFactorySacrifice { // if only creatures are affected evaluate both lists and pass only if // human creatures are more valuable - if ((CardListUtil.getNotType(humanlist, "Creature").size() == 0) && (CardListUtil.getNotType(computerlist, "Creature").size() == 0)) { + if ((CardLists.getNotType(humanlist, "Creature").size() == 0) && (CardLists.getNotType(computerlist, "Creature").size() == 0)) { if ((CardFactoryUtil.evaluateCreatureList(computerlist) + 200) >= CardFactoryUtil .evaluateCreatureList(humanlist)) { return false; } } // only lands involved - else if ((CardListUtil.getNotType(humanlist, "Land").size() == 0) && (CardListUtil.getNotType(computerlist, "Land").size() == 0)) { + else if ((CardLists.getNotType(humanlist, "Land").size() == 0) && (CardLists.getNotType(computerlist, "Land").size() == 0)) { if ((CardFactoryUtil.evaluatePermanentList(computerlist) + 1) >= CardFactoryUtil .evaluatePermanentList(humanlist)) { return false; diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactorySetState.java b/src/main/java/forge/card/abilityfactory/AbilityFactorySetState.java index cd421d875e2..3f74a79eafc 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactorySetState.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactorySetState.java @@ -27,7 +27,7 @@ import forge.AllZoneUtil; import forge.Card; import forge.CardCharacteristicName; -import forge.CardListUtil; +import forge.CardLists; import forge.card.spellability.AbilityActivated; import forge.card.spellability.AbilitySub; import forge.card.spellability.Spell; @@ -474,7 +474,7 @@ public class AbilityFactorySetState { List list = AllZoneUtil.getCardsIn(ZoneType.Battlefield); if (targetPlayer != null) { - list = CardListUtil.filterControlledBy(list, targetPlayer); + list = CardLists.filterControlledBy(list, targetPlayer); } list = AbilityFactory.filterListByType(list, valid, sa); diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryZoneAffecting.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryZoneAffecting.java index 9c9048137a6..1f068f1bdaa 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryZoneAffecting.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryZoneAffecting.java @@ -28,7 +28,7 @@ import java.util.Random; import forge.AllZone; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardUtil; import forge.GameActionUtil; import forge.Singletons; @@ -1374,7 +1374,7 @@ public class AbilityFactoryZoneAffecting { valid = valid.replace("X", Integer.toString(AbilityFactory.calculateAmount(source, "X", sa))); } - final List dPChHand = CardListUtil.getValidCards(dPHand, valid.split(","), source.getController(), source); + final List dPChHand = CardLists.getValidCards(dPHand, valid.split(","), source.getController(), source); // Reveal cards that will be discarded? for (final Card c : dPChHand) { p.discard(c, sa); @@ -1395,7 +1395,7 @@ public class AbilityFactoryZoneAffecting { String[] dValid = null; if (params.containsKey("DiscardValid")) { // Restrict card choices dValid = params.get("DiscardValid").split(","); - dPChHand = CardListUtil.getValidCards(dPHand, dValid, source.getController(), source); + dPChHand = CardLists.getValidCards(dPHand, dValid, source.getController(), source); } Player chooser = p; if (mode.equals("RevealYouChoose")) { @@ -1433,9 +1433,9 @@ public class AbilityFactoryZoneAffecting { } } - Collections.sort(dPChHand, CardListUtil.TextLenReverseComparator); + Collections.sort(dPChHand, CardLists.TextLenReverseComparator); - CardListUtil.sortCMC(dPChHand); + CardLists.sortCMC(dPChHand); dChoices.add(dPChHand.get(0)); final Card dC = dChoices.get(CardUtil.getRandomIndex(dChoices)); diff --git a/src/main/java/forge/card/cardfactory/CardFactoryArtifacts.java b/src/main/java/forge/card/cardfactory/CardFactoryArtifacts.java index 6d298b1e169..c2bb774e084 100644 --- a/src/main/java/forge/card/cardfactory/CardFactoryArtifacts.java +++ b/src/main/java/forge/card/cardfactory/CardFactoryArtifacts.java @@ -9,7 +9,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates; import forge.CardPredicates.Presets; import forge.Command; @@ -271,7 +271,7 @@ class CardFactoryArtifacts { final Player player = this.getTargetPlayer(); List lands = player.getCardsIn(ZoneType.Graveyard); - lands = CardListUtil.filter(lands, Presets.BASIC_LANDS); + lands = CardLists.filter(lands, Presets.BASIC_LANDS); if (card.getController().isHuman()) { // now, select up to four lands int end = -1; @@ -316,7 +316,7 @@ class CardFactoryArtifacts { private List getComputerLands() { final List list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Graveyard); - return CardListUtil.filter(list, CardPredicates.Presets.BASIC_LANDS); + return CardLists.filter(list, CardPredicates.Presets.BASIC_LANDS); } } final Cost abCost = new Cost(card, "1 T Sac<1/CARDNAME>", true); diff --git a/src/main/java/forge/card/cardfactory/CardFactoryAuras.java b/src/main/java/forge/card/cardfactory/CardFactoryAuras.java index 5d43ecd3ce1..7d6062e15b2 100644 --- a/src/main/java/forge/card/cardfactory/CardFactoryAuras.java +++ b/src/main/java/forge/card/cardfactory/CardFactoryAuras.java @@ -29,7 +29,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates.Presets; import forge.CardUtil; import forge.Command; @@ -114,7 +114,7 @@ class CardFactoryAuras { newType[0] = landTypes[minAt]; List list = AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer()); - list = CardListUtil.getNotType(list, newType[0]); // Don't enchant lands + list = CardLists.getNotType(list, newType[0]); // Don't enchant lands // that already have the // type if (list.isEmpty()) { @@ -267,7 +267,7 @@ class CardFactoryAuras { @Override public boolean canPlayAI() { List list = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer()); - list = CardListUtil.getKeyword(list, "Flying"); + list = CardLists.getKeyword(list, "Flying"); if (list.isEmpty()) { return false; } @@ -279,9 +279,9 @@ class CardFactoryAuras { } }; if (Iterables.any(list, f)) { - list = CardListUtil.filter(list, f); + list = CardLists.filter(list, f); } - CardListUtil.sortAttack(list); + CardLists.sortAttack(list); for (int i = 0; i < list.size(); i++) { if (list.get(i).canBeTargetedBy(this)) { @@ -383,8 +383,8 @@ class CardFactoryAuras { } // else - CardListUtil.sortAttack(list); - CardListUtil.sortFlying(list); + CardLists.sortAttack(list); + CardLists.sortFlying(list); for (int i = 0; i < list.size(); i++) { if (list.get(i).canBeTargetedBy(this) @@ -425,7 +425,7 @@ class CardFactoryAuras { // This includes creatures Animate Dead can't enchant once // in play. // The human may try to Animate them, the AI will not. - return CardListUtil.filter(AllZoneUtil.getCardsIn(ZoneType.Graveyard), Presets.CREATURES); + return CardLists.filter(AllZoneUtil.getCardsIn(ZoneType.Graveyard), Presets.CREATURES); } @Override @@ -437,7 +437,7 @@ class CardFactoryAuras { public boolean canPlayAI() { List cList = this.getCreturesInGrave(); // AI will only target something that will stick in play. - cList = CardListUtil.getTargetableCards(cList, this); + cList = CardLists.getTargetableCards(cList, this); if (cList.size() == 0) { return false; } diff --git a/src/main/java/forge/card/cardfactory/CardFactoryCreatures.java b/src/main/java/forge/card/cardfactory/CardFactoryCreatures.java index 3045df2123a..b0c695124ff 100644 --- a/src/main/java/forge/card/cardfactory/CardFactoryCreatures.java +++ b/src/main/java/forge/card/cardfactory/CardFactoryCreatures.java @@ -31,7 +31,7 @@ import forge.AllZoneUtil; import forge.Card; import forge.CardCharacteristicName; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates; import forge.CardPredicates.Presets; import forge.CardUtil; @@ -121,20 +121,20 @@ public class CardFactoryCreatures { @Override public void chooseTargetAI() { List perms = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield); - perms = CardListUtil.filter(CardListUtil.getTargetableCards(perms, this), new Predicate() { + perms = CardLists.filter(CardLists.getTargetableCards(perms, this), new Predicate() { @Override public boolean apply(final Card c) { return (c.sumAllCounters() > 0); } }); - CardListUtil.shuffle(perms); + CardLists.shuffle(perms); this.setTargetCard(perms.get(0)); // TODO improve this. } @Override public boolean canPlayAI() { List perms = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield); - perms = CardListUtil.filter(CardListUtil.getTargetableCards(perms, this), new Predicate() { + perms = CardLists.filter(CardLists.getTargetableCards(perms, this), new Predicate() { @Override public boolean apply(final Card c) { return (c.sumAllCounters() > 0); @@ -165,7 +165,7 @@ public class CardFactoryCreatures { public void execute() { if (card.getController().isHuman()) { - final List artifacts = CardListUtil.filter(AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.ARTIFACTS); + final List artifacts = CardLists.filter(AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.ARTIFACTS); if (artifacts.size() != 0) { final Card c = GuiChoose.one("Select an artifact put a phylactery counter on", artifacts); @@ -176,10 +176,10 @@ public class CardFactoryCreatures { } else { // computer List art = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield); - art = CardListUtil.filter(art, Presets.ARTIFACTS); + art = CardLists.filter(art, Presets.ARTIFACTS); List list = new ArrayList(art); - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { return c.getIntrinsicKeyword().contains("Indestructible"); @@ -272,10 +272,10 @@ public class CardFactoryCreatures { color[0] = Constant.Color.WHITE; int max = 0; - CardListUtil.filter(list, CardPredicates.containsKeyword(color[0])).size(); + CardLists.filter(list, CardPredicates.containsKeyword(color[0])).size(); for (final String c : Constant.Color.ONLY_COLORS) { - final int cmp = CardListUtil.filter(list, CardPredicates.containsKeyword(c)).size(); + final int cmp = CardLists.filter(list, CardPredicates.containsKeyword(c)).size(); if (cmp > max) { max = cmp; color[0] = c; @@ -374,7 +374,7 @@ public class CardFactoryCreatures { @Override public void resolve() { List allTokens = AllZoneUtil.getCreaturesInPlay(card.getController()); - allTokens = CardListUtil.filter(allTokens, Presets.TOKEN); + allTokens = CardLists.filter(allTokens, Presets.TOKEN); CardFactoryUtil.copyTokens(allTokens); } @@ -382,7 +382,7 @@ public class CardFactoryCreatures { @Override public boolean canPlayAI() { List allTokens = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer()); - allTokens = CardListUtil.filter(allTokens, Presets.TOKEN); + allTokens = CardLists.filter(allTokens, Presets.TOKEN); return allTokens.size() >= 2; } @@ -456,7 +456,7 @@ public class CardFactoryCreatures { @Override public boolean canPlayAI() { - List wolves = CardListUtil.getType(AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield), "Wolf"); + List wolves = CardLists.getType(AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield), "Wolf"); Iterable untappedWolves = Iterables.filter(wolves, untappedCreature); final int totalPower = Aggregates.sum(untappedWolves, CardPredicates.Accessors.fnGetNetAttack); @@ -466,7 +466,7 @@ public class CardFactoryCreatures { List targetables = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield); - targetables = CardListUtil.filter(CardListUtil.getTargetableCards(targetables, this), new Predicate() { + targetables = CardLists.filter(CardLists.getTargetableCards(targetables, this), new Predicate() { @Override public boolean apply(final Card c) { return c.isCreature() && (c.getNetDefense() <= totalPower); @@ -485,8 +485,8 @@ public class CardFactoryCreatures { @Override public void resolve() { - List wolves = CardListUtil.getType(card.getController().getCardsIn(ZoneType.Battlefield), "Wolf"); - wolves = CardListUtil.filter(wolves, untappedCreature); + List wolves = CardLists.getType(card.getController().getCardsIn(ZoneType.Battlefield), "Wolf"); + wolves = CardLists.filter(wolves, untappedCreature); final Card target = this.getTargetCard(); @@ -518,7 +518,7 @@ public class CardFactoryCreatures { })); } } else { // AI Choose spread Damage - final List damageableWolves = CardListUtil.filter(wolves, new Predicate() { + final List damageableWolves = CardLists.filter(wolves, new Predicate() { @Override public boolean apply(final Card c) { return (c.predictDamage(target.getNetAttack(), target, false) > 0); @@ -531,7 +531,7 @@ public class CardFactoryCreatures { return; } - List wolvesLeft = CardListUtil.filter(damageableWolves, new Predicate() { + List wolvesLeft = CardLists.filter(damageableWolves, new Predicate() { @Override public boolean apply(final Card c) { return !c.hasKeyword("Indestructible"); @@ -539,7 +539,7 @@ public class CardFactoryCreatures { }); for (int i = 0; i < target.getNetAttack(); i++) { - wolvesLeft = CardListUtil.filter(wolvesLeft, new Predicate() { + wolvesLeft = CardLists.filter(wolvesLeft, new Predicate() { @Override public boolean apply(final Card c) { return (c.getKillDamage() > 0) @@ -558,20 +558,20 @@ public class CardFactoryCreatures { } else { // Add -1/-1s to Random Indestructibles if (target.hasKeyword("Infect") || target.hasKeyword("Wither")) { - final List indestructibles = CardListUtil.filter(damageableWolves, new Predicate() { + final List indestructibles = CardLists.filter(damageableWolves, new Predicate() { @Override public boolean apply(final Card c) { return c.hasKeyword("Indestructible"); } }); - CardListUtil.shuffle(indestructibles); + CardLists.shuffle(indestructibles); indestructibles.get(0).addDamage(1, target); } // Then just add Damage randomnly else { - CardListUtil.shuffle(damageableWolves); + CardLists.shuffle(damageableWolves); wolves.get(0).addDamage(1, target); } } @@ -633,7 +633,7 @@ public class CardFactoryCreatures { public int countKithkin() { List kithkin = card.getController().getCardsIn(ZoneType.Battlefield); - kithkin = CardListUtil.filter(kithkin, new Predicate() { + kithkin = CardLists.filter(kithkin, new Predicate() { @Override public boolean apply(final Card c) { @@ -744,7 +744,7 @@ public class CardFactoryCreatures { // Dark Depths: List list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield, "Dark Depths"); - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card crd) { return crd.getCounters(Counters.ICE) >= 3; @@ -758,7 +758,7 @@ public class CardFactoryCreatures { // Get rid of Planeswalkers: list = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield); - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card crd) { return crd.isPlaneswalker() && (crd.getCounters(Counters.LOYALTY) >= 5); @@ -802,7 +802,7 @@ public class CardFactoryCreatures { int intermSumToughness = 0; // intermSumPower = intermSumToughness = 0; List creats = card.getController().getCardsIn(ZoneType.Graveyard); - creats = CardListUtil.filter(creats, new Predicate() { + creats = CardLists.filter(creats, new Predicate() { @Override public boolean apply(final Card c) { return c.isCreature() && !c.equals(card); @@ -854,7 +854,7 @@ public class CardFactoryCreatures { public boolean canPlayAI() { // get all creatures List list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Graveyard); - list = CardListUtil.filter(list, Presets.CREATURES); + list = CardLists.filter(list, Presets.CREATURES); return 0 < list.size(); } }); @@ -876,12 +876,12 @@ public class CardFactoryCreatures { final Player opp = player.getOpponent(); int max = 0; List play = opp.getCardsIn(ZoneType.Battlefield); - play = CardListUtil.filter(play, Presets.NON_TOKEN); - play = CardListUtil.filter(play, Presets.WHITE); + play = CardLists.filter(play, Presets.NON_TOKEN); + play = CardLists.filter(play, Presets.WHITE); max += play.size(); List grave = opp.getCardsIn(ZoneType.Graveyard); - grave = CardListUtil.filter(grave, Presets.WHITE); + grave = CardLists.filter(grave, Presets.WHITE); max += grave.size(); final String[] life = new String[max + 1]; diff --git a/src/main/java/forge/card/cardfactory/CardFactoryEnchantments.java b/src/main/java/forge/card/cardfactory/CardFactoryEnchantments.java index ef5bffca430..40578a5aec0 100644 --- a/src/main/java/forge/card/cardfactory/CardFactoryEnchantments.java +++ b/src/main/java/forge/card/cardfactory/CardFactoryEnchantments.java @@ -8,7 +8,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.Command; import forge.GameActionUtil; import forge.Singletons; @@ -74,7 +74,7 @@ class CardFactoryEnchantments { public boolean canPlay() { boolean haveGraveWithSomeCreatures = false; for( Player p : AllZone.getPlayersInGame()) { - Iterable grave = CardListUtil.filter(p.getCardsIn(ZoneType.Graveyard), CardPredicates.Presets.CREATURES); + Iterable grave = CardLists.filter(p.getCardsIn(ZoneType.Graveyard), CardPredicates.Presets.CREATURES); if( Iterables.size(grave) > 1) { haveGraveWithSomeCreatures = true; @@ -93,8 +93,8 @@ class CardFactoryEnchantments { public void showMessage() { List grave = AllZone.getHumanPlayer().getCardsIn(ZoneType.Graveyard); List aiGrave = AllZone.getComputerPlayer().getCardsIn(ZoneType.Graveyard); - grave = CardListUtil.filter(grave, CardPredicates.Presets.CREATURES); - aiGrave = CardListUtil.filter(aiGrave, CardPredicates.Presets.CREATURES); + grave = CardLists.filter(grave, CardPredicates.Presets.CREATURES); + aiGrave = CardLists.filter(aiGrave, CardPredicates.Presets.CREATURES); if (this.once || ((grave.size() < 2) && (aiGrave.size() < 2))) { this.once = false; @@ -112,7 +112,7 @@ class CardFactoryEnchantments { final Card c = GuiChoose.one("Choose first creature to exile", chooseGrave); if (c != null) { - List newGrave = CardListUtil.filter(c.getOwner().getCardsIn(ZoneType.Graveyard), CardPredicates.Presets.CREATURES); + List newGrave = CardLists.filter(c.getOwner().getCardsIn(ZoneType.Graveyard), CardPredicates.Presets.CREATURES); newGrave.remove(c); final Object o2 = GuiChoose.one("Choose second creature to exile", newGrave); diff --git a/src/main/java/forge/card/cardfactory/CardFactoryInstants.java b/src/main/java/forge/card/cardfactory/CardFactoryInstants.java index c9bd0b964b5..96ba40f07db 100644 --- a/src/main/java/forge/card/cardfactory/CardFactoryInstants.java +++ b/src/main/java/forge/card/cardfactory/CardFactoryInstants.java @@ -27,7 +27,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates; import forge.CardPredicates.Presets; import forge.Command; @@ -96,7 +96,7 @@ public class CardFactoryInstants { public void resolve() { Player player = getTargetPlayer(); List artifacts = AllZoneUtil.getCardsIn(ZoneType.Battlefield); - artifacts = CardListUtil.filter(artifacts, CardPredicates.Presets.ARTIFACTS); + artifacts = CardLists.filter(artifacts, CardPredicates.Presets.ARTIFACTS); for (int i = 0; i < artifacts.size(); i++) { Card thisArtifact = artifacts.get(i); @@ -423,8 +423,8 @@ public class CardFactoryInstants { @Override public void resolve() { final Player you = card.getController(); - final List ens = CardListUtil.filter(AllZoneUtil.getCardsIn(ZoneType.Battlefield), Presets.ENCHANTMENTS); - final List toReturn = CardListUtil.filter(ens, new Predicate() { + final List ens = CardLists.filter(AllZoneUtil.getCardsIn(ZoneType.Battlefield), Presets.ENCHANTMENTS); + final List toReturn = CardLists.filter(ens, new Predicate() { @Override public boolean apply(final Card c) { final Card enchanting = c.getEnchantingCard(); @@ -481,7 +481,7 @@ public class CardFactoryInstants { final String[] choices = new String[] { "Artifact", "Creature", "Land" }; final Object o = GuiChoose.one("Select permanent type", choices); final String cardType = (String) o; - final List list = CardListUtil.getType(this.getTargetPlayer().getCardsIn(ZoneType.Battlefield), cardType); + final List list = CardLists.getType(this.getTargetPlayer().getCardsIn(ZoneType.Battlefield), cardType); final String[] tapOrUntap = new String[] { "Tap", "Untap" }; final Object z = GuiChoose.one("Tap or Untap?", tapOrUntap); diff --git a/src/main/java/forge/card/cardfactory/CardFactoryLands.java b/src/main/java/forge/card/cardfactory/CardFactoryLands.java index 4a8d0a1794f..b5325215f11 100644 --- a/src/main/java/forge/card/cardfactory/CardFactoryLands.java +++ b/src/main/java/forge/card/cardfactory/CardFactoryLands.java @@ -28,7 +28,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.Command; import forge.Counters; import forge.GameActionUtil; @@ -173,14 +173,14 @@ class CardFactoryLands { } this.inPlay.clear(); this.inPlay.addAll(AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield)); - return (CardListUtil.filter(this.inPlay, targets).size() > 1) && super.canPlayAI(); + return (CardLists.filter(this.inPlay, targets).size() > 1) && super.canPlayAI(); } @Override public void resolve() { this.inPlay.clear(); this.inPlay.addAll(AllZoneUtil.getCardsIn(ZoneType.Battlefield)); - for (final Card targ : CardListUtil.filter(this.inPlay, targets)) { + for (final Card targ : CardLists.filter(this.inPlay, targets)) { targ.addCounter(Counters.P1P1, 1); } } @@ -489,7 +489,7 @@ class CardFactoryLands { public void computerExecute() { List hand = AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand); - hand = CardListUtil.getType(hand, type); + hand = CardLists.getType(hand, type); if (hand.size() > 0) { this.revealCard(hand.get(0)); } else { diff --git a/src/main/java/forge/card/cardfactory/CardFactorySorceries.java b/src/main/java/forge/card/cardfactory/CardFactorySorceries.java index 0c73d163599..517adc6e822 100644 --- a/src/main/java/forge/card/cardfactory/CardFactorySorceries.java +++ b/src/main/java/forge/card/cardfactory/CardFactorySorceries.java @@ -34,7 +34,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates; import forge.CardPredicates.Presets; import forge.CardUtil; @@ -259,8 +259,8 @@ public class CardFactorySorceries { @Override public boolean canPlayAI() { - List humTokenCreats = CardListUtil.filter(AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer()), Presets.TOKEN); - List compTokenCreats = CardListUtil.filter(AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer()), Presets.TOKEN); + List humTokenCreats = CardLists.filter(AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer()), Presets.TOKEN); + List compTokenCreats = CardLists.filter(AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer()), Presets.TOKEN); return compTokenCreats.size() > humTokenCreats.size(); } // canPlayAI() @@ -268,7 +268,7 @@ public class CardFactorySorceries { @Override public void resolve() { List tokens = AllZoneUtil.getCreaturesInPlay(); - tokens = CardListUtil.filter(tokens, Presets.TOKEN); + tokens = CardLists.filter(tokens, Presets.TOKEN); CardFactoryUtil.copyTokens(tokens); @@ -318,7 +318,7 @@ public class CardFactorySorceries { List land = AllZoneUtil.getPlayerLandsInPlay(AllZone.getComputerPlayer()); for (final String element : Constant.Color.BASIC_LANDS) { - final List cl = CardListUtil.getType(land, element); + final List cl = CardLists.getType(land, element); if (!cl.isEmpty()) { // remove one land of this basic type from this list // the computer AI should really jump in here and @@ -334,7 +334,7 @@ public class CardFactorySorceries { } // need to sacrifice the other non-basic land types - land = CardListUtil.filter(land, new Predicate() { + land = CardLists.filter(land, new Predicate() { @Override public boolean apply(final Card c) { if (c.getName().contains("Dryad Arbor")) { @@ -400,8 +400,8 @@ public class CardFactorySorceries { // get all other basic[count] lands human player // controls and add them to target List land = AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer()); - List cl = CardListUtil.getType(land, humanBasic.get(this.count)); - cl = CardListUtil.filter(cl, new Predicate() { + List cl = CardLists.getType(land, humanBasic.get(this.count)); + cl = CardLists.filter(cl, new Predicate() { @Override public boolean apply(final Card crd) { return !saveList.contains(crd); @@ -422,7 +422,7 @@ public class CardFactorySorceries { } // need to sacrifice the other non-basic land types - land = CardListUtil.filter(land, new Predicate() { + land = CardLists.filter(land, new Predicate() { @Override public boolean apply(final Card c) { if (c.getName().contains("Dryad Arbor")) { @@ -450,7 +450,7 @@ public class CardFactorySorceries { final List land = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield); for (final String element : Constant.Color.BASIC_LANDS) { - final List c = CardListUtil.getType(land, element); + final List c = CardLists.getType(land, element); if (!c.isEmpty()) { humanBasic.add(element); countBase[0]++; @@ -577,7 +577,7 @@ public class CardFactorySorceries { final List compLand = AllZoneUtil.getPlayerLandsInPlay(AllZone.getComputerPlayer()); if (compLand.size() > humLand.size()) { - CardListUtil.shuffle(compLand); + CardLists.shuffle(compLand); for (int i = 0; i < (compLand.size() - humLand.size()); i++) { Singletons.getModel().getGameAction().sacrifice(compLand.get(i), this); } @@ -602,8 +602,8 @@ public class CardFactorySorceries { final List compCreats = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer()); if (compCreats.size() > humCreats.size()) { - CardListUtil.sortAttackLowFirst(compCreats); - CardListUtil.sortCMC(compCreats); + CardLists.sortAttackLowFirst(compCreats); + CardLists.sortCMC(compCreats); Collections.reverse(compCreats); for (int i = 0; i < (compCreats.size() - humCreats.size()); i++) { Singletons.getModel().getGameAction().sacrifice(compCreats.get(i), this); @@ -623,7 +623,7 @@ public class CardFactorySorceries { final List humCreats = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer()); List compCreats = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer()); - compCreats = CardListUtil.filter(compCreats, CardPredicates.Presets.CREATURES); + compCreats = CardLists.filter(compCreats, CardPredicates.Presets.CREATURES); diff += 1.5 * (humCreats.size() - compCreats.size()); final List humHand = AllZone.getHumanPlayer().getCardsIn(ZoneType.Hand); @@ -796,7 +796,7 @@ public class CardFactorySorceries { } // Actually put everything on the battlefield - List bidded = CardListUtil.filter(AllZoneUtil.getCardsIn(ZoneType.Graveyard), CardPredicates.Presets.CREATURES); + List bidded = CardLists.filter(AllZoneUtil.getCardsIn(ZoneType.Graveyard), CardPredicates.Presets.CREATURES); for (final Card c : bidded) { if (c.isType(input[1]) || (!input[0].equals("") && c.isType(input[0]))) { Singletons.getModel().getGameAction().moveToPlay(c); @@ -1120,8 +1120,8 @@ public class CardFactorySorceries { @Override public void showMessage() { List grave = card.getController().getCardsIn(ZoneType.Graveyard); - grave = CardListUtil.filter(grave, Presets.CREATURES); - grave = CardListUtil.filter(grave, new Predicate() { + grave = CardLists.filter(grave, Presets.CREATURES); + grave = CardLists.filter(grave, new Predicate() { @Override public boolean apply(final Card c) { return c.getCMC() <= x[0]; @@ -1269,7 +1269,7 @@ public class CardFactorySorceries { // get all final List creatures = AllZoneUtil.getCreaturesInPlay(); List grave = card.getController().getCardsIn(ZoneType.Graveyard); - grave = CardListUtil.filter(grave, Presets.CREATURES); + grave = CardLists.filter(grave, Presets.CREATURES); if (AllZone.getHumanPlayer().canBeTargetedBy(spell) || AllZone.getComputerPlayer().canBeTargetedBy(spell)) { @@ -1349,7 +1349,7 @@ public class CardFactorySorceries { // Sacrifice an artifact List arts = p.getCardsIn(ZoneType.Battlefield); - arts = CardListUtil.filter(arts, Presets.ARTIFACTS); + arts = CardLists.filter(arts, Presets.ARTIFACTS); final Object toSac = GuiChoose.oneOrNone("Sacrifice an artifact", arts); if (toSac != null) { final Card c = (Card) toSac; @@ -1362,7 +1362,7 @@ public class CardFactorySorceries { // Search your library for an artifact final List lib = p.getCardsIn(ZoneType.Library); GuiChoose.oneOrNone("Looking at Library", lib); - final List libArts = CardListUtil.filter(lib, Presets.ARTIFACTS); + final List libArts = CardLists.filter(lib, Presets.ARTIFACTS); final Object o = GuiChoose.oneOrNone("Search for artifact", libArts); if (o != null) { newArtifact[0] = (Card) o; diff --git a/src/main/java/forge/card/cardfactory/CardFactoryUtil.java b/src/main/java/forge/card/cardfactory/CardFactoryUtil.java index d60ea9f1997..a2eb09e7362 100644 --- a/src/main/java/forge/card/cardfactory/CardFactoryUtil.java +++ b/src/main/java/forge/card/cardfactory/CardFactoryUtil.java @@ -36,7 +36,7 @@ import forge.Card; import forge.CardCharacteristicName; import forge.CardColor; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates; import forge.CardPredicates.Presets; import forge.CardUtil; @@ -110,7 +110,7 @@ public class CardFactoryUtil { public static Card getMostExpensivePermanentAI(final List list, final SpellAbility spell, final boolean targeted) { List all = list; if (targeted) { - all = CardListUtil.filter(all, new Predicate() { + all = CardLists.filter(all, new Predicate() { @Override public boolean apply(final Card c) { return c.canBeTargetedBy(spell); @@ -142,8 +142,8 @@ public class CardFactoryUtil { // Add all cost of all auras with the same controller final List auras = new ArrayList(card.getEnchantedBy()); - CardListUtil.filterControlledBy(auras, card.getController()); - curCMC += CardListUtil.sumCMC(auras) + auras.size(); + CardLists.filterControlledBy(auras, card.getController()); + curCMC += CardLists.sumCMC(auras) + auras.size(); if (curCMC >= bigCMC) { bigCMC = curCMC; @@ -169,7 +169,7 @@ public class CardFactoryUtil { * @return a {@link forge.Card} object. */ public static Card getCheapestCreatureAI(List list, final SpellAbility spell, final boolean targeted) { - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { return c.isCreature(); @@ -194,7 +194,7 @@ public class CardFactoryUtil { public static Card getCheapestPermanentAI(final List list, final SpellAbility spell, final boolean targeted) { List all = list; if (targeted) { - all = CardListUtil.filter(all, new Predicate() { + all = CardLists.filter(all, new Predicate() { @Override public boolean apply(final Card c) { return c.canBeTargetedBy(spell); @@ -229,13 +229,13 @@ public class CardFactoryUtil { * @return a {@link forge.Card} object. */ public static Card getBestLandAI(final List list) { - final List land = CardListUtil.filter(list, CardPredicates.Presets.LANDS); + final List land = CardLists.filter(list, CardPredicates.Presets.LANDS); if (!(land.size() > 0)) { return null; } // prefer to target non basic lands - final List nbLand = CardListUtil.filter(land, Predicates.not(CardPredicates.Presets.BASIC_LANDS)); + final List nbLand = CardLists.filter(land, Predicates.not(CardPredicates.Presets.BASIC_LANDS)); if (nbLand.size() > 0) { // TODO - Rank non basics? @@ -248,7 +248,7 @@ public class CardFactoryUtil { // lands of one type.... int n = 0; for (String name : Constant.Color.BASIC_LANDS) { - n = CardListUtil.getType(land, name).size(); + n = CardLists.getType(land, name).size(); if ((n < iminBL) && (n > 0)) { // if two or more are tied, only the // first @@ -261,7 +261,7 @@ public class CardFactoryUtil { return null; // no basic land was a minimum } - final List bLand = CardListUtil.getType(land, sminBL); + final List bLand = CardLists.getType(land, sminBL); for( Card ut : Iterables.filter(bLand, CardPredicates.Presets.UNTAPPED) ) { @@ -287,9 +287,9 @@ public class CardFactoryUtil { * @return a {@link forge.Card} object. */ public static Card getBestEnchantmentAI(final List list, final SpellAbility spell, final boolean targeted) { - List all = CardListUtil.filter(list, CardPredicates.Presets.ENCHANTMENTS); + List all = CardLists.filter(list, CardPredicates.Presets.ENCHANTMENTS); if (targeted) { - all = CardListUtil.filter(all, new Predicate() { + all = CardLists.filter(all, new Predicate() { @Override public boolean apply(final Card c) { @@ -313,7 +313,7 @@ public class CardFactoryUtil { * @return a {@link forge.Card} object. */ public static Card getBestArtifactAI(final List list) { - List all = CardListUtil.filter(list, CardPredicates.Presets.ARTIFACTS); + List all = CardLists.filter(list, CardPredicates.Presets.ARTIFACTS); if (all.size() == 0) { return null; } @@ -591,11 +591,11 @@ public class CardFactoryUtil { public static Card getBestAI(final List list) { // Get Best will filter by appropriate getBest list if ALL of the list // is of that type - if (CardListUtil.getNotType(list, "Creature").size() == 0) { + if (CardLists.getNotType(list, "Creature").size() == 0) { return CardFactoryUtil.getBestCreatureAI(list); } - if (CardListUtil.getNotType(list, "Land").size() == 0) { + if (CardLists.getNotType(list, "Land").size() == 0) { return CardFactoryUtil.getBestLandAI(list); } @@ -612,7 +612,7 @@ public class CardFactoryUtil { * @return the card */ public static Card getBestCreatureAI(final List list) { - List all = CardListUtil.filter(list, CardPredicates.Presets.CREATURES); + List all = CardLists.filter(list, CardPredicates.Presets.CREATURES); return Aggregates.itemWithMax(all, CardPredicates.Accessors.fnEvaluateCreature); } @@ -628,7 +628,7 @@ public class CardFactoryUtil { */ public static Card getBestCreatureToBounceAI(final List list) { final int tokenBonus = 40; - List all = CardListUtil.filter(list, CardPredicates.Presets.CREATURES); + List all = CardLists.filter(list, CardPredicates.Presets.CREATURES); Card biggest = null; // returns null if list.size() == 0 int biggestvalue = 0; int newvalue = 0; @@ -677,7 +677,7 @@ public class CardFactoryUtil { * @return a {@link forge.Card} object. */ public static Card getWorstCreatureAI(final List list) { - List all = CardListUtil.filter(list, CardPredicates.Presets.CREATURES); + List all = CardLists.filter(list, CardPredicates.Presets.CREATURES); // get smallest creature return Aggregates.itemWithMin(all, CardPredicates.Accessors.fnEvaluateCreature); } @@ -707,28 +707,28 @@ public class CardFactoryUtil { System.out.println("getWorstPermanentAI: " + list); if (biasEnch && Iterables.any(list, CardPredicates.Presets.ENCHANTMENTS)) { - return CardFactoryUtil.getCheapestPermanentAI(CardListUtil.filter(list, CardPredicates.Presets.ENCHANTMENTS), null, false); + return CardFactoryUtil.getCheapestPermanentAI(CardLists.filter(list, CardPredicates.Presets.ENCHANTMENTS), null, false); } if (biasArt && Iterables.any(list, CardPredicates.Presets.ARTIFACTS)) { - return CardFactoryUtil.getCheapestPermanentAI(CardListUtil.filter(list, CardPredicates.Presets.ARTIFACTS), null, false); + return CardFactoryUtil.getCheapestPermanentAI(CardLists.filter(list, CardPredicates.Presets.ARTIFACTS), null, false); } if (biasLand && Iterables.any(list, CardPredicates.Presets.LANDS)) { - return CardFactoryUtil.getWorstLand(CardListUtil.filter(list, CardPredicates.Presets.LANDS)); + return CardFactoryUtil.getWorstLand(CardLists.filter(list, CardPredicates.Presets.LANDS)); } if (biasCreature && Iterables.any(list, CardPredicates.Presets.CREATURES)) { - return CardFactoryUtil.getWorstCreatureAI(CardListUtil.filter(list, CardPredicates.Presets.CREATURES)); + return CardFactoryUtil.getWorstCreatureAI(CardLists.filter(list, CardPredicates.Presets.CREATURES)); } - List lands = CardListUtil.filter(list, CardPredicates.Presets.LANDS); + List lands = CardLists.filter(list, CardPredicates.Presets.LANDS); if (lands.size() > 6) { return CardFactoryUtil.getWorstLand(lands); } - if ((CardListUtil.getType(list, "Artifact").size() > 0) || (CardListUtil.getType(list, "Enchantment").size() > 0)) { - return CardFactoryUtil.getCheapestPermanentAI(CardListUtil.filter(list, new Predicate() { + if ((CardLists.getType(list, "Artifact").size() > 0) || (CardLists.getType(list, "Enchantment").size() > 0)) { + return CardFactoryUtil.getCheapestPermanentAI(CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { return c.isArtifact() || c.isEnchantment(); @@ -736,8 +736,8 @@ public class CardFactoryUtil { }), null, false); } - if (CardListUtil.getType(list, "Creature").size() > 0) { - return CardFactoryUtil.getWorstCreatureAI(CardListUtil.getType(list, "Creature")); + if (CardLists.getType(list, "Creature").size() > 0) { + return CardFactoryUtil.getWorstCreatureAI(CardLists.getType(list, "Creature")); } // Planeswalkers fall through to here, lands will fall through if there @@ -1574,7 +1574,7 @@ public class CardFactoryUtil { public static List getHumanCreatureAI(final SpellAbility spell, final boolean targeted) { List creature = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer()); if (targeted) { - creature = CardListUtil.getTargetableCards(creature, spell); + creature = CardLists.getTargetableCards(creature, spell); } return creature; } @@ -1882,11 +1882,11 @@ public class CardFactoryUtil { // Only check the top card of the library if (zone.is(ZoneType.Library) && !cl.isEmpty()) { - cl = CardListUtil.createCardList(cl.get(0)); + cl = CardLists.createCardList(cl.get(0)); } if (activator.isPlayer(zone.getPlayer())) { - cl = CardListUtil.filter(cl, new Predicate() { + cl = CardLists.filter(cl, new Predicate() { @Override public boolean apply(final Card c) { if (zone.is(ZoneType.Graveyard) && c.hasUnearth()) { @@ -1920,7 +1920,7 @@ public class CardFactoryUtil { }); } else { // the activator is not the owner of the card - cl = CardListUtil.filter(cl, new Predicate() { + cl = CardLists.filter(cl, new Predicate() { @Override public boolean apply(final Card c) { @@ -2033,7 +2033,7 @@ public class CardFactoryUtil { final String restrictions = l[0].replace("Valid ", ""); final String[] rest = restrictions.split(","); List cardsonbattlefield = AllZoneUtil.getCardsIn(ZoneType.Battlefield); - cardsonbattlefield = CardListUtil.getValidCards(cardsonbattlefield, rest, players.get(0), source); + cardsonbattlefield = CardLists.getValidCards(cardsonbattlefield, rest, players.get(0), source); n = cardsonbattlefield.size(); @@ -2055,7 +2055,7 @@ public class CardFactoryUtil { final String[] basic = { "Forest", "Plains", "Mountain", "Island", "Swamp" }; for (int i = 0; i < basic.length; i++) { - if (!CardListUtil.getType(someCards, basic[i]).isEmpty()) { + if (!CardLists.getType(someCards, basic[i]).isEmpty()) { n++; } } @@ -2075,7 +2075,7 @@ public class CardFactoryUtil { } if (sq[0].contains("LandsInGraveyard")) { if (players.size() > 0) { - return CardFactoryUtil.doXMath(CardListUtil.getType(players.get(0).getCardsIn(ZoneType.Graveyard), "Land").size(), m, + return CardFactoryUtil.doXMath(CardLists.getType(players.get(0).getCardsIn(ZoneType.Graveyard), "Land").size(), m, source); } } @@ -2100,7 +2100,7 @@ public class CardFactoryUtil { if (sq[0].contains("TopOfLibraryCMC")) { if (players.size() > 0) { - return CardFactoryUtil.doXMath(CardListUtil.sumCMC(players.get(0).getCardsIn(ZoneType.Library, 1)), + return CardFactoryUtil.doXMath(CardLists.sumCMC(players.get(0).getCardsIn(ZoneType.Library, 1)), m, source); } } @@ -2241,7 +2241,7 @@ public class CardFactoryUtil { restrictions = restrictions.replace("Count$", ""); final String[] rest = restrictions.split(","); List cards = AllZoneUtil.getCardsIn(ZoneType.Graveyard); - cards = CardListUtil.getValidCards(cards, rest, cardController, c); + cards = CardLists.getValidCards(cards, rest, cardController, c); n = cards.size(); @@ -2253,7 +2253,7 @@ public class CardFactoryUtil { restrictions = restrictions.replace("Count$", ""); final String[] rest = restrictions.split(","); List cardsonbattlefield = AllZoneUtil.getCardsIn(ZoneType.Battlefield); - cardsonbattlefield = CardListUtil.getValidCards(cardsonbattlefield, rest, cardController, c); + cardsonbattlefield = CardLists.getValidCards(cardsonbattlefield, rest, cardController, c); n = cardsonbattlefield.size(); @@ -2383,7 +2383,7 @@ public class CardFactoryUtil { if (sq[0].contains("Domain")) { someCards.addAll(cardController.getCardsIn(ZoneType.Battlefield)); for (String basic : Constant.Color.BASIC_LANDS) { - if (!CardListUtil.getType(someCards, basic).isEmpty()) { + if (!CardLists.getType(someCards, basic).isEmpty()) { n++; } } @@ -2394,7 +2394,7 @@ public class CardFactoryUtil { if (sq[0].contains("OpponentDom")) { someCards.addAll(cardController.getOpponent().getCardsIn(ZoneType.Battlefield)); for (String basic : Constant.Color.BASIC_LANDS) { - if (!CardListUtil.getType(someCards, basic).isEmpty()) { + if (!CardLists.getType(someCards, basic).isEmpty()) { n++; } } @@ -2404,12 +2404,12 @@ public class CardFactoryUtil { // Count$ColoredCreatures *a DOMAIN for creatures* if (sq[0].contains("ColoredCreatures")) { someCards.addAll(cardController.getCardsIn(ZoneType.Battlefield)); - someCards = CardListUtil.filter(someCards, Presets.CREATURES); + someCards = CardLists.filter(someCards, Presets.CREATURES); final String[] colors = { "green", "white", "red", "blue", "black" }; for (final String color : colors) { - if (!CardListUtil.getColor(someCards, color).isEmpty()) { + if (!CardLists.getColor(someCards, color).isEmpty()) { n++; } } @@ -2515,7 +2515,7 @@ public class CardFactoryUtil { // Count$TopOfLibraryCMC if (sq[0].contains("TopOfLibraryCMC")) { final List topcard = cardController.getCardsIn(ZoneType.Library, 1); - return CardFactoryUtil.doXMath(CardListUtil.sumCMC(topcard), m, c); + return CardFactoryUtil.doXMath(CardLists.sumCMC(topcard), m, c); } // Count$EnchantedControllerCreatures @@ -2523,7 +2523,7 @@ public class CardFactoryUtil { List enchantedControllerInPlay = new ArrayList(); if (c.getEnchantingCard() != null) { enchantedControllerInPlay = c.getEnchantingCard().getController().getCardsIn(ZoneType.Battlefield); - enchantedControllerInPlay = CardListUtil.getType(enchantedControllerInPlay, "Creature"); + enchantedControllerInPlay = CardLists.getType(enchantedControllerInPlay, "Creature"); } return enchantedControllerInPlay.size(); } @@ -2615,7 +2615,7 @@ public class CardFactoryUtil { final String validDevoured = l[0].split(" ")[1]; final Card csource = c; List cl = c.getDevoured(); - cl = CardListUtil.getValidCards(cl, validDevoured.split(","), csource.getController(), csource); + cl = CardLists.getValidCards(cl, validDevoured.split(","), csource.getController(), csource); return CardFactoryUtil.doXMath(cl.size(), m, c); } @@ -2636,7 +2636,7 @@ public class CardFactoryUtil { final String[] restrictions = l[0].split("_"); final String[] rest = restrictions[1].split(","); List cardsonbattlefield = AllZoneUtil.getCardsIn(ZoneType.Battlefield); - List filteredCards = CardListUtil.getValidCards(cardsonbattlefield, rest, cardController, c); + List filteredCards = CardLists.getValidCards(cardsonbattlefield, rest, cardController, c); int sumPower = 0; for (int i = 0; i < filteredCards.size(); i++) { sumPower += filteredCards.get(i).getManaCost().getCMC(); @@ -2656,8 +2656,8 @@ public class CardFactoryUtil { final String[] restrictions = l[0].split("_"); final String[] rest = restrictions[1].split(","); List cardsonbattlefield = AllZoneUtil.getCardsIn(ZoneType.Battlefield); - List filteredCards = CardListUtil.getValidCards(cardsonbattlefield, rest, cardController, c); - return CardListUtil.sumCMC(filteredCards); + List filteredCards = CardLists.getValidCards(cardsonbattlefield, rest, cardController, c); + return CardLists.sumCMC(filteredCards); } // Count$CardNumColors if (sq[0].contains("CardNumColors")) { @@ -2677,7 +2677,7 @@ public class CardFactoryUtil { final Counters cType = Counters.getType(restrictions[1]); final String[] validFilter = restrictions[2].split(","); List validCards = AllZoneUtil.getCardsIn(ZoneType.Battlefield); - validCards = CardListUtil.getValidCards(validCards, validFilter, cardController, c); + validCards = CardLists.getValidCards(validCards, validFilter, cardController, c); int cCount = 0; for (final Card card : validCards) { cCount += card.getCounters(cType); @@ -2896,7 +2896,7 @@ public class CardFactoryUtil { // "Clerics you control" - Count$TypeYouCtrl.Cleric if (sq[0].contains("Type")) { - someCards = CardListUtil.filter(someCards, CardPredicates.isType(sq[1])); + someCards = CardLists.filter(someCards, CardPredicates.isType(sq[1])); } // "Named in all graveyards" - Count$NamedAllYards. @@ -2905,18 +2905,18 @@ public class CardFactoryUtil { if (sq[1].equals("CARDNAME")) { sq[1] = c.getName(); } - someCards = CardListUtil.filter(someCards, CardPredicates.nameEquals(sq[1])); + someCards = CardLists.filter(someCards, CardPredicates.nameEquals(sq[1])); } // Refined qualities // "Untapped Lands" - Count$UntappedTypeYouCtrl.Land if (sq[0].contains("Untapped")) { - someCards = CardListUtil.filter(someCards, Presets.UNTAPPED); + someCards = CardLists.filter(someCards, Presets.UNTAPPED); } if (sq[0].contains("Tapped")) { - someCards = CardListUtil.filter(someCards, Presets.TAPPED); + someCards = CardLists.filter(someCards, Presets.TAPPED); } // String sq0 = sq[0].toLowerCase(); @@ -2926,27 +2926,27 @@ public class CardFactoryUtil { // } // "White Creatures" - Count$WhiteTypeYouCtrl.Creature if (sq[0].contains("White")) { - someCards = CardListUtil.filter(someCards, Presets.WHITE); + someCards = CardLists.filter(someCards, Presets.WHITE); } if (sq[0].contains("Blue")) { - someCards = CardListUtil.filter(someCards, Presets.BLUE); + someCards = CardLists.filter(someCards, Presets.BLUE); } if (sq[0].contains("Black")) { - someCards = CardListUtil.filter(someCards, Presets.BLACK); + someCards = CardLists.filter(someCards, Presets.BLACK); } if (sq[0].contains("Red")) { - someCards = CardListUtil.filter(someCards, Presets.RED); + someCards = CardLists.filter(someCards, Presets.RED); } if (sq[0].contains("Green")) { - someCards = CardListUtil.filter(someCards, Presets.GREEN); + someCards = CardLists.filter(someCards, Presets.GREEN); } if (sq[0].contains("Multicolor")) { - someCards = CardListUtil.filter(someCards, new Predicate() { + someCards = CardLists.filter(someCards, new Predicate() { @Override public boolean apply(final Card c) { return (CardUtil.getColors(c).size() > 1); @@ -2955,7 +2955,7 @@ public class CardFactoryUtil { } if (sq[0].contains("Monocolor")) { - someCards = CardListUtil.filter(someCards, new Predicate() { + someCards = CardLists.filter(someCards, new Predicate() { @Override public boolean apply(final Card c) { return (CardUtil.getColors(c).size() == 1); @@ -3111,7 +3111,7 @@ public class CardFactoryUtil { if (l.length > 1) { m[0] = l[1]; } - final List list = CardListUtil.getValidCards(paidList, valid, source.getController(), source); + final List list = CardLists.getValidCards(paidList, valid, source.getController(), source); return CardFactoryUtil.doXMath(list.size(), m, source); } @@ -3334,7 +3334,7 @@ public class CardFactoryUtil { */ public static int getUsableManaSources(final Player player) { List list = player.getCardsIn(ZoneType.Battlefield); - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { for (final AbilityMana am : c.getAIPlayableMana()) { @@ -4209,7 +4209,7 @@ public class CardFactoryUtil { AllZone.getInputControl().setInput(target); } else { // AI choosing what to haunt - final List oppCreats = CardListUtil.filterControlledBy(creats, AllZone.getHumanPlayer()); + final List oppCreats = CardLists.filterControlledBy(creats, AllZone.getHumanPlayer()); if (oppCreats.size() != 0) { haunterDiesWork.setTargetCard(CardFactoryUtil.getWorstCreatureAI(oppCreats)); } else { @@ -4754,7 +4754,7 @@ public class CardFactoryUtil { @Override public void execute() { - final List cardsInPlay = CardListUtil.getType(AllZoneUtil.getCardsIn(ZoneType.Battlefield), "World"); + final List cardsInPlay = CardLists.getType(AllZoneUtil.getCardsIn(ZoneType.Battlefield), "World"); cardsInPlay.remove(card); for (int i = 0; i < cardsInPlay.size(); i++) { Singletons.getModel().getGameAction().sacrificeDestroy(cardsInPlay.get(i)); @@ -4911,7 +4911,7 @@ public class CardFactoryUtil { // Target as Modular is Destroyed if (card.getController().isComputer()) { List choices = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield); - choices = CardListUtil.filter(choices, new Predicate() { + choices = CardLists.filter(choices, new Predicate() { @Override public boolean apply(final Card c) { return c.isCreature() && c.isArtifact(); diff --git a/src/main/java/forge/card/cost/CostDiscard.java b/src/main/java/forge/card/cost/CostDiscard.java index 40f0b425cd1..0e921c60476 100644 --- a/src/main/java/forge/card/cost/CostDiscard.java +++ b/src/main/java/forge/card/cost/CostDiscard.java @@ -25,7 +25,7 @@ import forge.AllZone; import forge.Card; import forge.CardPredicates; -import forge.CardListUtil; +import forge.CardLists; import forge.card.abilityfactory.AbilityFactory; import forge.card.spellability.SpellAbility; import forge.control.input.Input; @@ -137,7 +137,7 @@ public class CostDiscard extends CostPartWithList { type = type.replace("+WithSameName", ""); } if (!type.equals("Random")) { - handList = CardListUtil.getValidCards(handList, type.split(";"), activator, source); + handList = CardLists.getValidCards(handList, type.split(";"), activator, source); } if (sameName) { for (Card c : handList) { @@ -228,7 +228,7 @@ public class CostDiscard extends CostPartWithList { type = type.replace("+WithSameName", ""); } final String[] validType = type.split(";"); - handList = CardListUtil.getValidCards(handList, validType, activator, ability.getSourceCard()); + handList = CardLists.getValidCards(handList, validType, activator, ability.getSourceCard()); final List landList2 = handList; if (sameName) { handList = CardListUtil.filter(handList, new Predicate() { @@ -308,7 +308,7 @@ public class CostDiscard extends CostPartWithList { } if (type.equals("Random")) { - this.setList(CardListUtil.getRandomSubList(hand, c)); + this.setList(CardLists.getRandomSubList(hand, c)); } else { this.setList(ComputerUtil.discardNumTypeAI(c, type.split(";"), ability)); } diff --git a/src/main/java/forge/card/cost/CostExile.java b/src/main/java/forge/card/cost/CostExile.java index 744e481bc98..b16fd55857b 100644 --- a/src/main/java/forge/card/cost/CostExile.java +++ b/src/main/java/forge/card/cost/CostExile.java @@ -26,7 +26,7 @@ import javax.swing.JOptionPane; import forge.AllZone; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.GameActionUtil; import forge.Singletons; import forge.card.abilityfactory.AbilityFactory; @@ -155,7 +155,7 @@ public class CostExile extends CostPartWithList { typeList = activator.getCardsIn(this.getFrom()); } if (!this.getThis()) { - typeList = CardListUtil.getValidCards(typeList, this.getType().split(";"), activator, source); + typeList = CardLists.getValidCards(typeList, this.getType().split(";"), activator, source); final Integer amount = this.convertAmount(); if ((amount != null) && (typeList.size() < amount)) { @@ -203,7 +203,7 @@ public class CostExile extends CostPartWithList { Integer c = this.convertAmount(); final Player activator = ability.getActivatingPlayer(); List list = activator.getCardsIn(this.getFrom()); - list = CardListUtil.getValidCards(list, this.getType().split(";"), activator, source); + list = CardLists.getValidCards(list, this.getType().split(";"), activator, source); if (c == null) { final String sVar = ability.getSVar(amount); // Generalize this @@ -339,7 +339,7 @@ public class CostExile extends CostPartWithList { } this.typeList = sa.getActivatingPlayer().getCardsIn(part.getFrom()); - this.typeList = CardListUtil.getValidCards(this.typeList, type.split(";"), sa.getActivatingPlayer(), sa.getSourceCard()); + this.typeList = CardLists.getValidCards(this.typeList, type.split(";"), sa.getActivatingPlayer(), sa.getSourceCard()); for (int i = 0; i < nNeeded; i++) { if (this.typeList.size() == 0) { @@ -519,7 +519,7 @@ public class CostExile extends CostPartWithList { msg.append(" from the Stack"); } this.typeList = sa.getActivatingPlayer().getCardsIn(part.getFrom()); - this.typeList = CardListUtil.getValidCards(this.typeList, type.split(";"), sa.getActivatingPlayer(), sa.getSourceCard()); + this.typeList = CardLists.getValidCards(this.typeList, type.split(";"), sa.getActivatingPlayer(), sa.getSourceCard()); CMatchUI.SINGLETON_INSTANCE.showMessage(msg.toString()); ButtonUtil.enableOnlyCancel(); } diff --git a/src/main/java/forge/card/cost/CostPutCounter.java b/src/main/java/forge/card/cost/CostPutCounter.java index 7789edd1c5d..23c0ead6c47 100644 --- a/src/main/java/forge/card/cost/CostPutCounter.java +++ b/src/main/java/forge/card/cost/CostPutCounter.java @@ -21,7 +21,7 @@ import java.util.List; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.Counters; import forge.card.abilityfactory.AbilityFactory; import forge.card.cardfactory.CardFactoryUtil; @@ -138,7 +138,7 @@ public class CostPutCounter extends CostPartWithList { } } else { // 3 Cards have Put a -1/-1 Counter on a Creature you control. - final List typeList = CardListUtil.getValidCards(activator.getCardsIn(ZoneType.Battlefield), this.getType().split(";"), activator, source); + final List typeList = CardLists.getValidCards(activator.getCardsIn(ZoneType.Battlefield), this.getType().split(";"), activator, source); if (typeList.size() == 0) { return false; @@ -216,7 +216,7 @@ public class CostPutCounter extends CostPartWithList { c = AbilityFactory.calculateAmount(source, this.getAmount(), ability); } - final List typeList = CardListUtil.getValidCards(activator.getCardsIn(ZoneType.Battlefield), this.getType().split(";"), activator, source); + final List typeList = CardLists.getValidCards(activator.getCardsIn(ZoneType.Battlefield), this.getType().split(";"), activator, source); Card card = null; if (this.getType().equals("Creature.YouCtrl")) { @@ -269,7 +269,7 @@ public class CostPutCounter extends CostPartWithList { msg.append("s"); } - this.typeList = CardListUtil.getValidCards(sa.getActivatingPlayer().getCardsIn(ZoneType.Battlefield), type.split(";"), sa.getActivatingPlayer(), sa.getSourceCard()); + this.typeList = CardLists.getValidCards(sa.getActivatingPlayer().getCardsIn(ZoneType.Battlefield), type.split(";"), sa.getActivatingPlayer(), sa.getSourceCard()); CMatchUI.SINGLETON_INSTANCE.showMessage(msg.toString()); ButtonUtil.enableOnlyCancel(); } diff --git a/src/main/java/forge/card/cost/CostRemoveCounter.java b/src/main/java/forge/card/cost/CostRemoveCounter.java index 9b7d43cbfe4..7e03788a3a4 100644 --- a/src/main/java/forge/card/cost/CostRemoveCounter.java +++ b/src/main/java/forge/card/cost/CostRemoveCounter.java @@ -22,7 +22,7 @@ import java.util.List; import forge.Card; import forge.AllZone; -import forge.CardListUtil; +import forge.CardLists; import forge.Counters; import forge.card.abilityfactory.AbilityFactory; import forge.card.spellability.SpellAbility; @@ -166,7 +166,7 @@ public class CostRemoveCounter extends CostPartWithList { } } else { - final List typeList = CardListUtil.getValidCards(activator.getCardsIn(this.getZone()), this.getType().split(";"), activator, source); + final List typeList = CardLists.getValidCards(activator.getCardsIn(this.getZone()), this.getType().split(";"), activator, source); if (amount != null) { for (Card c : typeList) { if (c.getCounters(cntrs) - amount >= 0) { @@ -287,7 +287,7 @@ public class CostRemoveCounter extends CostPartWithList { if (!this.getThis()) { this.getList().clear(); - final List typeList = CardListUtil + final List typeList = CardLists .getValidCards(computer.getCardsIn(this.getZone()), this.getType().split(";"), computer, source); for (Card card : typeList) { if (card.getCounters(this.getCounter()) >= c) { @@ -344,7 +344,7 @@ public class CostRemoveCounter extends CostPartWithList { msg.append("s"); } - this.typeList = CardListUtil.getValidCards(sa.getActivatingPlayer().getCardsIn(costRemoveCounter.getZone()), type.split(";"), sa.getActivatingPlayer(), sa.getSourceCard()); + this.typeList = CardLists.getValidCards(sa.getActivatingPlayer().getCardsIn(costRemoveCounter.getZone()), type.split(";"), sa.getActivatingPlayer(), sa.getSourceCard()); CMatchUI.SINGLETON_INSTANCE.showMessage(msg.toString()); ButtonUtil.enableOnlyCancel(); } @@ -418,7 +418,7 @@ public class CostRemoveCounter extends CostPartWithList { } this.typeList = sa.getActivatingPlayer().getCardsIn(costRemoveCounter.getZone()); - this.typeList = CardListUtil.getValidCards(this.typeList, type.split(";"), sa.getActivatingPlayer(), sa.getSourceCard()); + this.typeList = CardLists.getValidCards(this.typeList, type.split(";"), sa.getActivatingPlayer(), sa.getSourceCard()); for (int i = 0; i < nNeeded; i++) { if (this.typeList.size() == 0) { diff --git a/src/main/java/forge/card/cost/CostReturn.java b/src/main/java/forge/card/cost/CostReturn.java index c47e3b90f8b..5a1bcf481aa 100644 --- a/src/main/java/forge/card/cost/CostReturn.java +++ b/src/main/java/forge/card/cost/CostReturn.java @@ -24,7 +24,7 @@ import javax.swing.JOptionPane; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.Singletons; import forge.card.abilityfactory.AbilityFactory; import forge.card.spellability.SpellAbility; @@ -110,7 +110,7 @@ public class CostReturn extends CostPartWithList { public final boolean canPay(final SpellAbility ability, final Card source, final Player activator, final Cost cost) { if (!this.getThis()) { List typeList = activator.getCardsIn(ZoneType.Battlefield); - typeList = CardListUtil.getValidCards(typeList, this.getType().split(";"), activator, source); + typeList = CardLists.getValidCards(typeList, this.getType().split(";"), activator, source); final Integer amount = this.convertAmount(); if ((amount != null) && (typeList.size() < amount)) { @@ -233,7 +233,7 @@ public class CostReturn extends CostPartWithList { } this.typeList = sa.getActivatingPlayer().getCardsIn(ZoneType.Battlefield); - this.typeList = CardListUtil.getValidCards(this.typeList, type.split(";"), sa.getActivatingPlayer(), sa.getSourceCard()); + this.typeList = CardLists.getValidCards(this.typeList, type.split(";"), sa.getActivatingPlayer(), sa.getSourceCard()); CMatchUI.SINGLETON_INSTANCE.showMessage(msg.toString()); ButtonUtil.enableOnlyCancel(); } diff --git a/src/main/java/forge/card/cost/CostReveal.java b/src/main/java/forge/card/cost/CostReveal.java index f53b3943df1..581274f8444 100644 --- a/src/main/java/forge/card/cost/CostReveal.java +++ b/src/main/java/forge/card/cost/CostReveal.java @@ -22,7 +22,7 @@ import java.util.List; import forge.AllZone; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.card.abilityfactory.AbilityFactory; import forge.card.spellability.SpellAbility; import forge.control.input.Input; @@ -77,7 +77,7 @@ public class CostReveal extends CostPartWithList { if (ability.isSpell()) { handList.remove(source); // can't pay for itself } - handList = CardListUtil.getValidCards(handList, type.split(";"), activator, source); + handList = CardLists.getValidCards(handList, type.split(";"), activator, source); if ((amount != null) && (amount > handList.size())) { // not enough cards in hand to pay return false; @@ -112,7 +112,7 @@ public class CostReveal extends CostPartWithList { this.setList(activator.getCardsIn(ZoneType.Hand)); return true; } else { - hand = CardListUtil.getValidCards(hand, type.split(";"), activator, source); + hand = CardLists.getValidCards(hand, type.split(";"), activator, source); Integer c = this.convertAmount(); if (c == null) { final String sVar = ability.getSVar(this.getAmount()); @@ -162,7 +162,7 @@ public class CostReveal extends CostPartWithList { Integer num = this.convertAmount(); List handList = activator.getCardsIn(ZoneType.Hand); - handList = CardListUtil.getValidCards(handList, this.getType().split(";"), activator, ability.getSourceCard()); + handList = CardLists.getValidCards(handList, this.getType().split(";"), activator, ability.getSourceCard()); if (num == null) { final String sVar = ability.getSVar(amount); diff --git a/src/main/java/forge/card/cost/CostSacrifice.java b/src/main/java/forge/card/cost/CostSacrifice.java index 37aeaa1056b..5b310017247 100644 --- a/src/main/java/forge/card/cost/CostSacrifice.java +++ b/src/main/java/forge/card/cost/CostSacrifice.java @@ -24,7 +24,7 @@ import javax.swing.JOptionPane; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.Singletons; import forge.card.abilityfactory.AbilityFactory; import forge.card.spellability.SpellAbility; @@ -103,12 +103,12 @@ public class CostSacrifice extends CostPartWithList { // You can always sac all if (!this.getThis()) { List typeList = activator.getCardsIn(ZoneType.Battlefield); - typeList = CardListUtil.getValidCards(typeList, this.getType().split(";"), activator, source); + typeList = CardLists.getValidCards(typeList, this.getType().split(";"), activator, source); final Integer amount = this.convertAmount(); if (activator.hasKeyword("You can't sacrifice creatures to cast spells or activate abilities.")) { - typeList = CardListUtil.getNotType(typeList, "Creature"); + typeList = CardLists.getNotType(typeList, "Creature"); } if ((amount != null) && (typeList.size() < amount)) { @@ -158,9 +158,9 @@ public class CostSacrifice extends CostPartWithList { final String type = this.getType(); final Player activator = ability.getActivatingPlayer(); List list = activator.getCardsIn(ZoneType.Battlefield); - list = CardListUtil.getValidCards(list, type.split(";"), activator, source); + list = CardLists.getValidCards(list, type.split(";"), activator, source); if (activator.hasKeyword("You can't sacrifice creatures to cast spells or activate abilities.")) { - list = CardListUtil.getNotType(list, "Creature"); + list = CardLists.getNotType(list, "Creature"); } if (this.getThis()) { @@ -206,9 +206,9 @@ public class CostSacrifice extends CostPartWithList { this.getList().add(source); } else if (this.getAmount().equals("All")) { List typeList = activator.getCardsIn(ZoneType.Battlefield); - typeList = CardListUtil.getValidCards(typeList, this.getType().split(";"), activator, source); + typeList = CardLists.getValidCards(typeList, this.getType().split(";"), activator, source); if (activator.hasKeyword("You can't sacrifice creatures to cast spells or activate abilities.")) { - typeList = CardListUtil.getNotType(typeList, "Creature"); + typeList = CardLists.getNotType(typeList, "Creature"); } // Does the AI want to use Sacrifice All? return false; diff --git a/src/main/java/forge/card/cost/CostTapType.java b/src/main/java/forge/card/cost/CostTapType.java index 4a44000da24..9db9200f700 100644 --- a/src/main/java/forge/card/cost/CostTapType.java +++ b/src/main/java/forge/card/cost/CostTapType.java @@ -21,7 +21,7 @@ import java.util.List; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates.Presets; import forge.card.abilityfactory.AbilityFactory; import forge.card.spellability.SpellAbility; @@ -117,12 +117,12 @@ public class CostTapType extends CostPartWithList { public final boolean canPay(final SpellAbility ability, final Card source, final Player activator, final Cost cost) { List typeList = activator.getCardsIn(ZoneType.Battlefield); - typeList = CardListUtil.getValidCards(typeList, this.getType().split(";"), activator, source); + typeList = CardLists.getValidCards(typeList, this.getType().split(";"), activator, source); if (cost.getTap()) { typeList.remove(source); } - typeList = CardListUtil.filter(typeList, Presets.UNTAPPED); + typeList = CardLists.filter(typeList, Presets.UNTAPPED); final Integer amount = this.convertAmount(); if ((typeList.size() == 0) || ((amount != null) && (typeList.size() < amount))) { @@ -155,8 +155,8 @@ public class CostTapType extends CostPartWithList { @Override public final boolean payHuman(final SpellAbility ability, final Card source, final CostPayment payment) { List typeList = ability.getActivatingPlayer().getCardsIn(ZoneType.Battlefield); - typeList = CardListUtil.getValidCards(typeList, this.getType().split(";"), ability.getActivatingPlayer(), ability.getSourceCard()); - typeList = CardListUtil.filter(typeList, Presets.UNTAPPED); + typeList = CardLists.getValidCards(typeList, this.getType().split(";"), ability.getActivatingPlayer(), ability.getSourceCard()); + typeList = CardLists.filter(typeList, Presets.UNTAPPED); final String amount = this.getAmount(); Integer c = this.convertAmount(); if (c == null) { @@ -189,8 +189,8 @@ public class CostTapType extends CostPartWithList { final String sVar = ability.getSVar(amount); if (sVar.equals("XChoice")) { List typeList = ability.getActivatingPlayer().getCardsIn(ZoneType.Battlefield); - typeList = CardListUtil.getValidCards(typeList, this.getType().split(";"), ability.getActivatingPlayer(), ability.getSourceCard()); - typeList = CardListUtil.filter(typeList, Presets.UNTAPPED); + typeList = CardLists.getValidCards(typeList, this.getType().split(";"), ability.getActivatingPlayer(), ability.getSourceCard()); + typeList = CardLists.filter(typeList, Presets.UNTAPPED); c = typeList.size(); source.setSVar("ChosenX", "Number$" + Integer.toString(c)); } else { diff --git a/src/main/java/forge/card/cost/CostUntapType.java b/src/main/java/forge/card/cost/CostUntapType.java index 8df88a9ad89..383be4201da 100644 --- a/src/main/java/forge/card/cost/CostUntapType.java +++ b/src/main/java/forge/card/cost/CostUntapType.java @@ -22,7 +22,7 @@ import java.util.List; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates.Presets; import forge.card.abilityfactory.AbilityFactory; import forge.card.spellability.SpellAbility; @@ -122,12 +122,12 @@ public class CostUntapType extends CostPartWithList { public final boolean canPay(final SpellAbility ability, final Card source, final Player activator, final Cost cost) { List typeList = AllZoneUtil.getCardsIn(ZoneType.Battlefield); - typeList = CardListUtil.getValidCards(typeList, this.getType().split(";"), activator, source); + typeList = CardLists.getValidCards(typeList, this.getType().split(";"), activator, source); if (cost.getUntap()) { typeList.remove(source); } - typeList = CardListUtil.filter(typeList, Presets.TAPPED); + typeList = CardLists.filter(typeList, Presets.TAPPED); final Integer amount = this.convertAmount(); if ((typeList.size() == 0) || ((amount != null) && (typeList.size() < amount))) { @@ -161,8 +161,8 @@ public class CostUntapType extends CostPartWithList { public final boolean payHuman(final SpellAbility ability, final Card source, final CostPayment payment) { final boolean untap = payment.getCost().getUntap(); List typeList = AllZoneUtil.getCardsIn(ZoneType.Battlefield); - typeList = CardListUtil.getValidCards(typeList, this.getType().split(";"), ability.getActivatingPlayer(), ability.getSourceCard()); - typeList = CardListUtil.filter(typeList, Presets.TAPPED); + typeList = CardLists.getValidCards(typeList, this.getType().split(";"), ability.getActivatingPlayer(), ability.getSourceCard()); + typeList = CardLists.filter(typeList, Presets.TAPPED); if (untap) { typeList.remove(source); } @@ -198,11 +198,11 @@ public class CostUntapType extends CostPartWithList { final String sVar = ability.getSVar(amount); if (sVar.equals("XChoice")) { List typeList = AllZoneUtil.getCardsIn(ZoneType.Battlefield); - typeList = CardListUtil.getValidCards(typeList, this.getType().split(";"), ability.getActivatingPlayer(), ability.getSourceCard()); + typeList = CardLists.getValidCards(typeList, this.getType().split(";"), ability.getActivatingPlayer(), ability.getSourceCard()); if (untap) { typeList.remove(source); } - typeList = CardListUtil.filter(typeList, Presets.TAPPED); + typeList = CardLists.filter(typeList, Presets.TAPPED); c = typeList.size(); source.setSVar("ChosenX", "Number$" + Integer.toString(c)); } else { diff --git a/src/main/java/forge/card/cost/CostUtil.java b/src/main/java/forge/card/cost/CostUtil.java index d2a54934f9c..c2f9653a0d5 100644 --- a/src/main/java/forge/card/cost/CostUtil.java +++ b/src/main/java/forge/card/cost/CostUtil.java @@ -24,7 +24,7 @@ import java.util.Random; import forge.AllZone; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.Counters; import forge.card.abilityfactory.AbilityFactory; import forge.card.mana.ManaCost; @@ -80,14 +80,14 @@ public class CostUtil { return false; } List auras = new ArrayList(source.getEnchantedBy()); - if (!CardListUtil.filterControlledBy(auras, source.getController()).isEmpty()) { + if (!CardLists.filterControlledBy(auras, source.getController()).isEmpty()) { return false; } continue; } List typeList = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield); - typeList = CardListUtil.getValidCards(typeList, type.split(","), source.getController(), source); + typeList = CardLists.getValidCards(typeList, type.split(","), source.getController(), source); if (ComputerUtil.getCardPreference(source, "SacCost", typeList) == null) { return false; } @@ -122,7 +122,7 @@ public class CostUtil { } List typeList = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield); - typeList = CardListUtil.getValidCards(typeList, type.split(","), source.getController(), source); + typeList = CardLists.getValidCards(typeList, type.split(","), source.getController(), source); if (ComputerUtil.getCardPreference(source, "SacCost", typeList) == null) { return false; } @@ -220,7 +220,7 @@ public class CostUtil { if (typeList.size() > AllZone.getComputerPlayer().getMaxHandSize()) { continue; } - typeList = CardListUtil.getValidCards(typeList, type.split(","), source.getController(), source); + typeList = CardLists.getValidCards(typeList, type.split(","), source.getController(), source); if (ComputerUtil.getCardPreference(source, "DiscardCost", typeList) == null) { return false; } diff --git a/src/main/java/forge/card/replacement/ReplacementEffect.java b/src/main/java/forge/card/replacement/ReplacementEffect.java index 03d53ea7a41..829ec118b2c 100644 --- a/src/main/java/forge/card/replacement/ReplacementEffect.java +++ b/src/main/java/forge/card/replacement/ReplacementEffect.java @@ -24,7 +24,7 @@ import java.util.List; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardUtil; import forge.card.TriggerReplacementBase; import forge.card.abilityfactory.AbilityFactory; @@ -263,7 +263,7 @@ public abstract class ReplacementEffect extends TriggerReplacementBase { list.addAll(this.getHostCard().getController().getOpponent().getCardsIn(presentZone)); } - list = CardListUtil.getValidCards(list, sIsPresent.split(","), this.getHostCard().getController(), this.getHostCard()); + list = CardLists.getValidCards(list, sIsPresent.split(","), this.getHostCard().getController(), this.getHostCard()); int right = 1; final String rightString = presentCompare.substring(2); @@ -302,7 +302,7 @@ public abstract class ReplacementEffect extends TriggerReplacementBase { list.addAll(this.getHostCard().getController().getOpponent().getCardsIn(presentZone)); } - list = CardListUtil.getValidCards(list, sIsPresent.split(","), this.getHostCard().getController(), this.getHostCard()); + list = CardLists.getValidCards(list, sIsPresent.split(","), this.getHostCard().getController(), this.getHostCard()); int right = 1; final String rightString = presentCompare.substring(2); diff --git a/src/main/java/forge/card/spellability/Spell.java b/src/main/java/forge/card/spellability/Spell.java index 5d868acc6b5..ab2c358fe24 100644 --- a/src/main/java/forge/card/spellability/Spell.java +++ b/src/main/java/forge/card/spellability/Spell.java @@ -24,7 +24,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.card.cardfactory.CardFactoryUtil; import forge.card.cost.Cost; import forge.card.cost.CostPayment; @@ -144,7 +144,7 @@ public abstract class Spell extends SpellAbility implements java.io.Serializable final String needsToPlay = card.getSVar("NeedsToPlay"); List list = AllZoneUtil.getCardsIn(ZoneType.Battlefield); - list = CardListUtil.getValidCards(list, needsToPlay.split(","), card.getController(), card); + list = CardLists.getValidCards(list, needsToPlay.split(","), card.getController(), card); if (list.isEmpty()) { return false; } diff --git a/src/main/java/forge/card/spellability/SpellAbilityCondition.java b/src/main/java/forge/card/spellability/SpellAbilityCondition.java index 2719516d517..0ae7aba6791 100644 --- a/src/main/java/forge/card/spellability/SpellAbilityCondition.java +++ b/src/main/java/forge/card/spellability/SpellAbilityCondition.java @@ -24,7 +24,7 @@ import java.util.List; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.Singletons; import forge.card.abilityfactory.AbilityFactory; import forge.card.cardfactory.CardFactoryUtil; @@ -259,7 +259,7 @@ public class SpellAbilityCondition extends SpellAbilityVariables { list = AllZoneUtil.getCardsIn(ZoneType.Battlefield); } - list = CardListUtil.getValidCards(list, this.getIsPresent().split(","), sa.getActivatingPlayer(), sa.getSourceCard()); + list = CardLists.getValidCards(list, this.getIsPresent().split(","), sa.getActivatingPlayer(), sa.getSourceCard()); int right; final String rightString = this.getPresentCompare().substring(2); diff --git a/src/main/java/forge/card/spellability/SpellAbilityRestriction.java b/src/main/java/forge/card/spellability/SpellAbilityRestriction.java index 23d0bd0a458..6f670627526 100644 --- a/src/main/java/forge/card/spellability/SpellAbilityRestriction.java +++ b/src/main/java/forge/card/spellability/SpellAbilityRestriction.java @@ -25,7 +25,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.Singletons; import forge.card.abilityfactory.AbilityFactory; import forge.card.cardfactory.CardFactoryUtil; @@ -357,7 +357,7 @@ public class SpellAbilityRestriction extends SpellAbilityVariables { if (this.getIsPresent() != null) { List list = AllZoneUtil.getCardsIn(this.getPresentZone()); - list = CardListUtil.getValidCards(list, this.getIsPresent().split(","), activator, c); + list = CardLists.getValidCards(list, this.getIsPresent().split(","), activator, c); int right = 1; final String rightString = this.getPresentCompare().substring(2); diff --git a/src/main/java/forge/card/spellability/SpellPermanent.java b/src/main/java/forge/card/spellability/SpellPermanent.java index 8bb00f7e340..5f083decdea 100644 --- a/src/main/java/forge/card/spellability/SpellPermanent.java +++ b/src/main/java/forge/card/spellability/SpellPermanent.java @@ -26,7 +26,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates; import forge.Command; import forge.CommandReturn; @@ -85,7 +85,7 @@ public class SpellPermanent extends Spell { @Override public Object execute() { final List cards = SpellPermanent.this.getSourceCard().getController().getCardsIn(ZoneType.Battlefield); - return CardListUtil.getValidCards(cards, SpellPermanent.this.championValid, SpellPermanent.this.getSourceCard() + return CardLists.getValidCards(cards, SpellPermanent.this.championValid, SpellPermanent.this.getSourceCard() .getController(), SpellPermanent.this.getSourceCard()); } }; // CommandReturn @@ -107,10 +107,10 @@ public class SpellPermanent extends Spell { AllZone.getInputControl().setInput(SpellPermanent.this.championInputComes); } else { // Computer List computer = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield); - computer = CardListUtil.getValidCards(computer, SpellPermanent.this.championValid, controller, source); + computer = CardLists.getValidCards(computer, SpellPermanent.this.championValid, controller, source); computer.remove(source); - CardListUtil.shuffle(computer); + CardLists.shuffle(computer); if (computer.size() != 0) { final Card c = computer.get(0); source.setChampionedCard(c); @@ -359,12 +359,12 @@ public class SpellPermanent extends Spell { } if (card.isPlaneswalker()) { List list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield); - list = CardListUtil.filter(list, CardPredicates.Presets.PLANEWALKERS); + list = CardLists.filter(list, CardPredicates.Presets.PLANEWALKERS); for (int i = 0; i < list.size(); i++) { List type = card.getType(); final String subtype = type.get(type.size() - 1); - final List cl = CardListUtil.getType(list, subtype); + final List cl = CardLists.getType(list, subtype); if (cl.size() > 0) { return false; @@ -373,7 +373,7 @@ public class SpellPermanent extends Spell { } if (card.isType("World")) { List list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield); - list = CardListUtil.getType(list, "World"); + list = CardLists.getType(list, "World"); if (list.size() > 0) { return false; } diff --git a/src/main/java/forge/card/spellability/TargetSelection.java b/src/main/java/forge/card/spellability/TargetSelection.java index 9f3bb09af0c..a0c426fae86 100644 --- a/src/main/java/forge/card/spellability/TargetSelection.java +++ b/src/main/java/forge/card/spellability/TargetSelection.java @@ -27,7 +27,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.card.abilityfactory.AbilityFactory; import forge.control.input.Input; import forge.game.player.Player; @@ -269,7 +269,7 @@ public class TargetSelection { return; } - List choices = CardListUtil.getTargetableCards(CardListUtil.getValidCards(AllZoneUtil + List choices = CardLists.getTargetableCards(CardLists.getValidCards(AllZoneUtil .getCardsIn(zone), this.target.getValidTgts(), this.ability.getActivatingPlayer(), this.ability.getSourceCard()), this.ability); ArrayList objects = new ArrayList(); @@ -292,16 +292,16 @@ public class TargetSelection { // If all cards must be from the same zone if (tgt.isSingleZone() && !targeted.isEmpty()) { - choices = CardListUtil.filterControlledBy(choices, targeted.get(0).getController()); + choices = CardLists.filterControlledBy(choices, targeted.get(0).getController()); } // If all cards must be from different zones if (tgt.isDifferentZone() && !targeted.isEmpty()) { - choices = CardListUtil.filterControlledBy(choices, targeted.get(0).getController().getOpponent()); + choices = CardLists.filterControlledBy(choices, targeted.get(0).getController().getOpponent()); } // If the cards can't share a creature type if (tgt.isWithoutSameCreatureType() && !targeted.isEmpty()) { final Card card = targeted.get(0); - choices = CardListUtil.filter(choices, new Predicate() { + choices = CardLists.filter(choices, new Predicate() { @Override public boolean apply(final Card c) { return !c.sharesCreatureTypeWith(card); @@ -313,7 +313,7 @@ public class TargetSelection { ArrayList pl = AbilityFactory.getDefinedPlayers(card, tgt.getDefinedController(), this.ability); if (pl != null && !pl.isEmpty()) { Player controller = pl.get(0); - choices = CardListUtil.filterControlledBy(choices, controller); + choices = CardLists.filterControlledBy(choices, controller); } else { choices.clear(); } diff --git a/src/main/java/forge/card/staticability/StaticAbilityContinuous.java b/src/main/java/forge/card/staticability/StaticAbilityContinuous.java index 0985c4bbbc6..cd078d35aa0 100644 --- a/src/main/java/forge/card/staticability/StaticAbilityContinuous.java +++ b/src/main/java/forge/card/staticability/StaticAbilityContinuous.java @@ -26,7 +26,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardUtil; import forge.StaticEffect; import forge.card.abilityfactory.AbilityFactory; @@ -232,7 +232,7 @@ public class StaticAbilityContinuous { } List cardsIGainedAbilitiesFrom = AllZoneUtil.getCardsIn(validZones); - cardsIGainedAbilitiesFrom = CardListUtil.getValidCards(cardsIGainedAbilitiesFrom, valids, hostCard.getController(), hostCard); + cardsIGainedAbilitiesFrom = CardLists.getValidCards(cardsIGainedAbilitiesFrom, valids, hostCard.getController(), hostCard); if (cardsIGainedAbilitiesFrom.size() > 0) { @@ -424,7 +424,7 @@ public class StaticAbilityContinuous { final Player controller = hostCard.getController(); if (params.containsKey("CharacteristicDefining")) { - return CardListUtil.createCardList(hostCard); // will always be the card itself + return CardLists.createCardList(hostCard); // will always be the card itself } // non - CharacteristicDefining @@ -438,11 +438,11 @@ public class StaticAbilityContinuous { if (params.containsKey("Affected") && !params.get("Affected").contains(",")) { if (params.get("Affected").contains("Self")) { - affectedCards = CardListUtil.createCardList(hostCard); + affectedCards = CardLists.createCardList(hostCard); } else if (params.get("Affected").contains("EnchantedBy")) { - affectedCards = CardListUtil.createCardList(hostCard.getEnchantingCard()); + affectedCards = CardLists.createCardList(hostCard.getEnchantingCard()); } else if (params.get("Affected").contains("EquippedBy")) { - affectedCards = CardListUtil.createCardList(hostCard.getEquippingCard()); + affectedCards = CardLists.createCardList(hostCard.getEquippingCard()); } else if (params.get("Affected").equals("EffectSource")) { affectedCards = new ArrayList(AbilityFactory.getDefinedCards(hostCard, params.get("Affected"), null)); return affectedCards; @@ -450,7 +450,7 @@ public class StaticAbilityContinuous { } if (params.containsKey("Affected")) { - affectedCards = CardListUtil.getValidCards(affectedCards, params.get("Affected").split(","), controller, hostCard); + affectedCards = CardLists.getValidCards(affectedCards, params.get("Affected").split(","), controller, hostCard); } return affectedCards; diff --git a/src/main/java/forge/card/trigger/Trigger.java b/src/main/java/forge/card/trigger/Trigger.java index ce65bbbdb1b..6eba51e5362 100644 --- a/src/main/java/forge/card/trigger/Trigger.java +++ b/src/main/java/forge/card/trigger/Trigger.java @@ -25,7 +25,7 @@ import java.util.Map; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardUtil; import forge.Singletons; import forge.card.TriggerReplacementBase; @@ -353,7 +353,7 @@ public abstract class Trigger extends TriggerReplacementBase { list.addAll(this.getHostCard().getController().getOpponent().getCardsIn(presentZone)); } - list = CardListUtil.getValidCards(list, sIsPresent.split(","), this.getHostCard().getController(), this.getHostCard()); + list = CardLists.getValidCards(list, sIsPresent.split(","), this.getHostCard().getController(), this.getHostCard()); int right = 1; final String rightString = presentCompare.substring(2); @@ -392,7 +392,7 @@ public abstract class Trigger extends TriggerReplacementBase { list.addAll(this.getHostCard().getController().getOpponent().getCardsIn(presentZone)); } - list = CardListUtil.getValidCards(list, sIsPresent.split(","), this.getHostCard().getController(), this.getHostCard()); + list = CardLists.getValidCards(list, sIsPresent.split(","), this.getHostCard().getController(), this.getHostCard()); int right = 1; final String rightString = presentCompare.substring(2); diff --git a/src/main/java/forge/card/trigger/TriggerHandler.java b/src/main/java/forge/card/trigger/TriggerHandler.java index 84181672439..db75fc57c50 100644 --- a/src/main/java/forge/card/trigger/TriggerHandler.java +++ b/src/main/java/forge/card/trigger/TriggerHandler.java @@ -26,7 +26,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.Command; import forge.CommandArgs; import forge.GameActionUtil; @@ -317,7 +317,7 @@ public class TriggerHandler { // AP allCards = playerAP.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES); - allCards.addAll(CardListUtil.filterControlledBy(AllZoneUtil.getCardsIn(ZoneType.Stack), playerAP)); + allCards.addAll(CardLists.filterControlledBy(AllZoneUtil.getCardsIn(ZoneType.Stack), playerAP)); // add cards that move to hidden zones if (runParams.containsKey("Destination") && runParams.containsKey("Card")) { Card card = (Card) runParams.get("Card"); @@ -343,7 +343,7 @@ public class TriggerHandler { // NAP allCards = playerAP.getOpponent().getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES); - allCards.addAll(CardListUtil.filterControlledBy(AllZoneUtil.getCardsIn(ZoneType.Stack), playerAP.getOpponent())); + allCards.addAll(CardLists.filterControlledBy(AllZoneUtil.getCardsIn(ZoneType.Stack), playerAP.getOpponent())); // add cards that move to hidden zones if (runParams.containsKey("Destination") && runParams.containsKey("Card")) { Card card = (Card) runParams.get("Card"); diff --git a/src/main/java/forge/control/input/InputMulligan.java b/src/main/java/forge/control/input/InputMulligan.java index dcd83a4a1de..c6e0a5e4a52 100644 --- a/src/main/java/forge/control/input/InputMulligan.java +++ b/src/main/java/forge/control/input/InputMulligan.java @@ -24,7 +24,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.GameAction; import forge.GameActionUtil; import forge.Singletons; @@ -142,7 +142,7 @@ public class InputMulligan extends Input { while (aiTakesMulligan) { final List handList = aiPlayer.getCardsIn(ZoneType.Hand); - final boolean hasLittleCmc0Cards = CardListUtil.getValidCards(handList, "Card.cmcEQ0", aiPlayer, null).size() < 2; + final boolean hasLittleCmc0Cards = CardLists.getValidCards(handList, "Card.cmcEQ0", aiPlayer, null).size() < 2; aiTakesMulligan = (handList.size() > InputMulligan.AI_MULLIGAN_THRESHOLD) && hasLittleCmc0Cards; if (aiTakesMulligan) { diff --git a/src/main/java/forge/control/input/InputPayReturnCost.java b/src/main/java/forge/control/input/InputPayReturnCost.java index 6f85b491470..749855c6e3f 100644 --- a/src/main/java/forge/control/input/InputPayReturnCost.java +++ b/src/main/java/forge/control/input/InputPayReturnCost.java @@ -22,7 +22,7 @@ import java.util.List; import forge.AllZone; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.Command; import forge.Singletons; import forge.card.cardfactory.CardFactoryUtil; @@ -77,7 +77,7 @@ public class InputPayReturnCost extends Input { this.ability = sa; this.returnCost = cost; - this.choiceList = CardListUtil.getValidCards(AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield), cost.getType().split(";"), AllZone.getHumanPlayer(), source); + this.choiceList = CardLists.getValidCards(AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield), cost.getType().split(";"), AllZone.getHumanPlayer(), source); String amountString = cost.getAmount(); this.numRequired = amountString.matches("[0-9][0-9]?") ? Integer.parseInt(amountString) : CardFactoryUtil.xCount(source, source.getSVar(amountString)); diff --git a/src/main/java/forge/control/input/InputPaySacCost.java b/src/main/java/forge/control/input/InputPaySacCost.java index 00ec8b2ec71..3f3c00d157e 100644 --- a/src/main/java/forge/control/input/InputPaySacCost.java +++ b/src/main/java/forge/control/input/InputPaySacCost.java @@ -22,7 +22,7 @@ import java.util.List; import forge.AllZone; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.Command; import forge.Singletons; import forge.card.cardfactory.CardFactoryUtil; @@ -77,7 +77,7 @@ public class InputPaySacCost extends Input { this.ability = sa; this.sacCost = cost; - this.choiceList = CardListUtil.getValidCards(AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield), cost.getType().split(";"), AllZone.getHumanPlayer(), source); + this.choiceList = CardLists.getValidCards(AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield), cost.getType().split(";"), AllZone.getHumanPlayer(), source); String amountString = cost.getAmount(); this.numRequired = amountString.matches("[0-9][0-9]?") ? Integer.parseInt(amountString) : CardFactoryUtil.xCount(source, source.getSVar(amountString)); diff --git a/src/main/java/forge/game/phase/Combat.java b/src/main/java/forge/game/phase/Combat.java index 51c557e09f2..17a68eba485 100644 --- a/src/main/java/forge/game/phase/Combat.java +++ b/src/main/java/forge/game/phase/Combat.java @@ -30,7 +30,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates; import forge.GameActionUtil; import forge.GameEntity; @@ -113,7 +113,7 @@ public class Combat { this.defenders.add(defender); this.defenderMap.put(defender, new ArrayList()); List planeswalkers = defender.getCardsIn(ZoneType.Battlefield); - planeswalkers = CardListUtil.filter(planeswalkers, CardPredicates.Presets.PLANEWALKERS); + planeswalkers = CardLists.filter(planeswalkers, CardPredicates.Presets.PLANEWALKERS); for (final Card pw : planeswalkers) { this.defenders.add(pw); this.defenderMap.put(pw, new ArrayList()); @@ -472,7 +472,7 @@ public class Combat { this.blocked.add(attacker); this.attackerMap.get(attacker).add(blocker); if (!this.blockerMap.containsKey(blocker)) { - this.blockerMap.put(blocker, CardListUtil.createCardList(attacker)); + this.blockerMap.put(blocker, CardLists.createCardList(attacker)); } else { this.blockerMap.get(blocker).add(attacker); diff --git a/src/main/java/forge/game/phase/CombatUtil.java b/src/main/java/forge/game/phase/CombatUtil.java index c618a362dcb..fcc51449532 100644 --- a/src/main/java/forge/game/phase/CombatUtil.java +++ b/src/main/java/forge/game/phase/CombatUtil.java @@ -32,7 +32,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates; import forge.Command; import forge.Constant; @@ -398,7 +398,7 @@ public class CombatUtil { if (CombatUtil.canBlock(attacker, blocker, combat)) { boolean must = true; if (attacker.hasKeyword("CARDNAME can't be blocked except by two or more creatures.")) { - final List possibleBlockers = CardListUtil.filter(combat.getDefendingPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES); + final List possibleBlockers = CardLists.filter(combat.getDefendingPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES); possibleBlockers.remove(blocker); if (!CombatUtil.canBeBlocked(attacker, possibleBlockers)) { must = false; @@ -521,7 +521,7 @@ public class CombatUtil { if (CombatUtil.canBeBlocked(attacker, combat) && CombatUtil.canBlock(attacker, blocker)) { boolean canBe = true; if (attacker.hasKeyword("CARDNAME can't be blocked except by two or more creatures.")) { - final List blockers = CardListUtil.filter(combat.getDefendingPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES); + final List blockers = CardLists.filter(combat.getDefendingPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES); blockers.remove(blocker); if (!CombatUtil.canBeBlocked(attacker, blockers)) { canBe = false; @@ -538,7 +538,7 @@ public class CombatUtil { if (CombatUtil.canBeBlocked(attacker, combat) && CombatUtil.canBlock(attacker, blocker)) { boolean canBe = true; if (attacker.hasKeyword("CARDNAME can't be blocked except by two or more creatures.")) { - final List blockers = CardListUtil.filter(combat.getDefendingPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES); + final List blockers = CardLists.filter(combat.getDefendingPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES); blockers.remove(blocker); if (!CombatUtil.canBeBlocked(attacker, blockers)) { canBe = false; @@ -881,7 +881,7 @@ public class CombatUtil { powerLimit[0] = Integer.parseInt((asSeparateWords[12]).trim()); List list = AllZoneUtil.getCreaturesInPlay(c.getController().getOpponent()); - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card ct) { return ((ct.isUntapped() && (ct.getNetAttack() >= powerLimit[0]) && asSeparateWords[14] @@ -905,32 +905,32 @@ public class CombatUtil { } else if (keyword.equals("Defender") && !c.hasKeyword("CARDNAME can attack as though it didn't have defender.")) { return false; } else if (keyword.equals("CARDNAME can't attack unless defending player controls an Island.")) { - temp = CardListUtil.getType(list, "Island"); + temp = CardLists.getType(list, "Island"); if (temp.isEmpty()) { return false; } } else if (keyword.equals("CARDNAME can't attack unless defending player controls a Forest.")) { - temp = CardListUtil.getType(list, "Forest"); + temp = CardLists.getType(list, "Forest"); if (temp.isEmpty()) { return false; } } else if (keyword.equals("CARDNAME can't attack unless defending player controls a Swamp.")) { - temp = CardListUtil.getType(list, "Swamp"); + temp = CardLists.getType(list, "Swamp"); if (temp.isEmpty()) { return false; } } else if (keyword.equals("CARDNAME can't attack unless defending player controls a Mountain.")) { - temp = CardListUtil.getType(list, "Mountain"); + temp = CardLists.getType(list, "Mountain"); if (temp.isEmpty()) { return false; } } else if (keyword.equals("CARDNAME can't attack unless defending player controls a snow land.")) { - temp = CardListUtil.filter(list, CardPredicates.Presets.SNOW_LANDS); + temp = CardLists.filter(list, CardPredicates.Presets.SNOW_LANDS); if (temp.isEmpty()) { return false; } } else if (keyword.equals("CARDNAME can't attack unless defending player controls a blue permanent.")) { - temp = CardListUtil.getColor(list, Constant.Color.BLUE); + temp = CardLists.getColor(list, Constant.Color.BLUE); if (temp.isEmpty()) { return false; } @@ -960,7 +960,7 @@ public class CombatUtil { final Card att = attacker; List list = AllZoneUtil.getCreaturesInPlay(player); - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { return CombatUtil.canBlock(att, c) && (c.hasFirstStrike() || c.hasDoubleStrike()); @@ -3079,7 +3079,7 @@ public class CombatUtil { @Override public void resolve() { List enchantments = attacker.getController().getCardsIn(ZoneType.Library); - enchantments = CardListUtil.filter(enchantments, new Predicate() { + enchantments = CardLists.filter(enchantments, new Predicate() { @Override public boolean apply(final Card c) { if (attacker.hasKeyword("Protection from enchantments") diff --git a/src/main/java/forge/game/phase/EndOfTurn.java b/src/main/java/forge/game/phase/EndOfTurn.java index a6d1c72f745..ef834d3e7e5 100644 --- a/src/main/java/forge/game/phase/EndOfTurn.java +++ b/src/main/java/forge/game/phase/EndOfTurn.java @@ -25,7 +25,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.Counters; import forge.Singletons; import forge.card.spellability.Ability; @@ -235,7 +235,7 @@ public class EndOfTurn extends Phase implements java.io.Serializable { final Player opponent = player.getOpponent(); List list = opponent.getCardsIn(ZoneType.Battlefield); - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { return c.getName().equals("Lighthouse Chronologist") && (c.getCounters(Counters.LEVEL) >= 7); diff --git a/src/main/java/forge/game/phase/PhaseHandler.java b/src/main/java/forge/game/phase/PhaseHandler.java index cbe819b8dab..8c7f5c3bfe5 100644 --- a/src/main/java/forge/game/phase/PhaseHandler.java +++ b/src/main/java/forge/game/phase/PhaseHandler.java @@ -27,7 +27,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates; import forge.GameActionUtil; import forge.Singletons; @@ -662,7 +662,7 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable { private boolean skipTurnTimeVault(Player turn) { // time vault: List vaults = turn.getCardsIn(ZoneType.Battlefield, "Time Vault"); - vaults = CardListUtil.filter(vaults, CardPredicates.Presets.TAPPED); + vaults = CardLists.filter(vaults, CardPredicates.Presets.TAPPED); if (vaults.size() > 0) { final Card crd = vaults.get(0); @@ -833,7 +833,7 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable { // resets the status of attacked/blocked this phase List list = player.getCardsIn(ZoneType.Battlefield); - list = CardListUtil.filter(list, CardPredicates.Presets.CREATURES); + list = CardLists.filter(list, CardPredicates.Presets.CREATURES); for (int i = 0; i < list.size(); i++) { final Card c = list.get(i); diff --git a/src/main/java/forge/game/phase/PhaseUtil.java b/src/main/java/forge/game/phase/PhaseUtil.java index 590ca479842..2ba259d76c1 100644 --- a/src/main/java/forge/game/phase/PhaseUtil.java +++ b/src/main/java/forge/game/phase/PhaseUtil.java @@ -27,7 +27,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates.Presets; import forge.Singletons; import forge.card.trigger.TriggerType; @@ -106,7 +106,7 @@ public class PhaseUtil { Singletons.getModel().getGameAction().resetActivationsPerTurn(); - final List lands = CardListUtil.filter(AllZoneUtil.getPlayerLandsInPlay(turn), Presets.UNTAPPED); + final List lands = CardLists.filter(AllZoneUtil.getPlayerLandsInPlay(turn), Presets.UNTAPPED); turn.setNumPowerSurgeLands(lands.size()); // anything before this point happens regardless of whether the Untap @@ -375,7 +375,7 @@ public class PhaseUtil { List list = new ArrayList(); list.addAll(AllZone.getCombat().getAllBlockers()); - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { return !c.getDamageHistory().getCreatureBlockedThisCombat(); diff --git a/src/main/java/forge/game/phase/Untap.java b/src/main/java/forge/game/phase/Untap.java index 5147a9b7334..d9214b9d59e 100644 --- a/src/main/java/forge/game/phase/Untap.java +++ b/src/main/java/forge/game/phase/Untap.java @@ -26,7 +26,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates.Presets; import forge.Counters; import forge.GameActionUtil; @@ -122,7 +122,7 @@ public class Untap extends Phase implements java.io.Serializable { } } - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { if (!Untap.canUntap(c)) { @@ -202,7 +202,7 @@ public class Untap extends Phase implements java.io.Serializable { // search for lands the computer has and only untap 1 List landList = AllZoneUtil.getPlayerLandsInPlay(player); - landList = CardListUtil.filter(landList, tappedCanUntap); + landList = CardLists.filter(landList, tappedCanUntap); if (landList.size() > 0) { landList.get(0).untap(); } @@ -230,7 +230,7 @@ public class Untap extends Phase implements java.io.Serializable { } // selectCard() }; // Input List landList = AllZoneUtil.getPlayerLandsInPlay(player); - landList = CardListUtil.filter(landList, tappedCanUntap); + landList = CardLists.filter(landList, tappedCanUntap); if (landList.size() > 0) { AllZone.getInputControl().setInput(target); } @@ -239,8 +239,8 @@ public class Untap extends Phase implements java.io.Serializable { if (AllZoneUtil.isCardInPlay("Damping Field") || AllZoneUtil.isCardInPlay("Imi Statue")) { if (Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn().isComputer()) { List artList = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield); - artList = CardListUtil.filter(artList, Presets.ARTIFACTS); - artList = CardListUtil.filter(artList, tappedCanUntap); + artList = CardLists.filter(artList, Presets.ARTIFACTS); + artList = CardLists.filter(artList, tappedCanUntap); if (artList.size() > 0) { CardFactoryUtil.getBestArtifactAI(artList).untap(); } @@ -269,8 +269,8 @@ public class Untap extends Phase implements java.io.Serializable { } // selectCard() }; // Input List artList = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield); - artList = CardListUtil.filter(artList, Presets.ARTIFACTS); - artList = CardListUtil.filter(artList, tappedCanUntap); + artList = CardLists.filter(artList, Presets.ARTIFACTS); + artList = CardLists.filter(artList, tappedCanUntap); if (artList.size() > 0) { AllZone.getInputControl().setInput(target); } @@ -279,7 +279,7 @@ public class Untap extends Phase implements java.io.Serializable { if ((AllZoneUtil.isCardInPlay("Smoke") || AllZoneUtil.isCardInPlay("Stoic Angel"))) { if (player.isComputer()) { List creatures = AllZoneUtil.getCreaturesInPlay(player); - creatures = CardListUtil.filter(creatures, tappedCanUntap); + creatures = CardLists.filter(creatures, tappedCanUntap); if (creatures.size() > 0) { creatures.get(0).untap(); } @@ -308,7 +308,7 @@ public class Untap extends Phase implements java.io.Serializable { } // selectCard() }; // Input List creatures = AllZoneUtil.getCreaturesInPlay(player); - creatures = CardListUtil.filter(creatures, tappedCanUntap); + creatures = CardLists.filter(creatures, tappedCanUntap); if (creatures.size() > 0) { AllZone.getInputControl().setInput(target); } @@ -343,7 +343,7 @@ public class Untap extends Phase implements java.io.Serializable { private static void doPhasing(final Player turn) { // Needs to include phased out cards - final List list = CardListUtil.filter(turn.getCardsIncludePhasingIn(ZoneType.Battlefield), new Predicate() { + final List list = CardLists.filter(turn.getCardsIncludePhasingIn(ZoneType.Battlefield), new Predicate() { @Override public boolean apply(final Card c) { diff --git a/src/main/java/forge/game/phase/Upkeep.java b/src/main/java/forge/game/phase/Upkeep.java index cd947638cc7..db99b39c121 100644 --- a/src/main/java/forge/game/phase/Upkeep.java +++ b/src/main/java/forge/game/phase/Upkeep.java @@ -27,7 +27,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates; import forge.CardPredicates.Presets; import forge.Command; @@ -166,7 +166,7 @@ public class Upkeep extends Phase implements java.io.Serializable { */ private static void upkeepEcho() { List list = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn().getCardsIn(ZoneType.Battlefield); - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { return c.hasStartOfKeyword("(Echo unpaid)"); @@ -485,12 +485,12 @@ public class Upkeep extends Phase implements java.io.Serializable { for (final Card c : cards) { final Card abyss = c; - final List abyssGetTargets = CardListUtil.filter(AllZoneUtil.getCreaturesInPlay(player), Presets.NON_ARTIFACTS); + final List abyssGetTargets = CardLists.filter(AllZoneUtil.getCreaturesInPlay(player), Presets.NON_ARTIFACTS); final Ability sacrificeCreature = new Ability(abyss, "") { @Override public void resolve() { - final List targets = CardListUtil.getTargetableCards(abyssGetTargets, this); + final List targets = CardLists.getTargetableCards(abyssGetTargets, this); if (player.isHuman()) { if (targets.size() > 0) { AllZone.getInputControl().setInput(new Input() { @@ -517,7 +517,7 @@ public class Upkeep extends Phase implements java.io.Serializable { } } else { // computer - final List indestruct = CardListUtil.getKeyword(targets, "Indestructible"); + final List indestruct = CardLists.getKeyword(targets, "Indestructible"); if (indestruct.size() > 0) { Singletons.getModel().getGameAction().destroyNoRegeneration(indestruct.get(0)); } else if (targets.size() > 0) { @@ -563,7 +563,7 @@ public class Upkeep extends Phase implements java.io.Serializable { public void resolve() { final List creatures = AllZoneUtil.getCreaturesInPlay(); if (creatures.size() > 0) { - CardListUtil.sortAttackLowFirst(creatures); + CardLists.sortAttackLowFirst(creatures); final int power = creatures.get(0).getNetAttack(); if (player.isHuman()) { AllZone.getInputControl().setInput( @@ -589,17 +589,17 @@ public class Upkeep extends Phase implements java.io.Serializable { private Card getCompyCardToDestroy(final List original) { final List options = this.getLowestPowerList(original); - final List humanCreatures = CardListUtil.filter(options, new Predicate() { + final List humanCreatures = CardLists.filter(options, new Predicate() { @Override public boolean apply(final Card c) { return c.getController().isHuman(); } }); if (humanCreatures.isEmpty()) { - CardListUtil.shuffle(options); + CardLists.shuffle(options); return options.get(0); } else { - CardListUtil.shuffle(humanCreatures); + CardLists.shuffle(humanCreatures); return humanCreatures.get(0); } } @@ -1215,12 +1215,12 @@ public class Upkeep extends Phase implements java.io.Serializable { final String[] smallCreatures = { "Creature.toughnessLE2" }; List humanCreatures = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer()); - humanCreatures = CardListUtil.getValidCards(humanCreatures, smallCreatures, k.getController(), k); - humanCreatures = CardListUtil.getNotKeyword(humanCreatures, "Indestructible"); + humanCreatures = CardLists.getValidCards(humanCreatures, smallCreatures, k.getController(), k); + humanCreatures = CardLists.getNotKeyword(humanCreatures, "Indestructible"); List computerCreatures = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer()); - computerCreatures = CardListUtil.getValidCards(computerCreatures, smallCreatures, k.getController(), k); - computerCreatures = CardListUtil.getNotKeyword(computerCreatures, "Indestructible"); + computerCreatures = CardLists.getValidCards(computerCreatures, smallCreatures, k.getController(), k); + computerCreatures = CardLists.getNotKeyword(computerCreatures, "Indestructible"); // We assume that both players will want to peek, ask if // they want to reveal. @@ -1829,7 +1829,7 @@ public class Upkeep extends Phase implements java.io.Serializable { List list = player.getCardsIn(ZoneType.Exile); - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { return c.hasSuspend(); @@ -1857,7 +1857,7 @@ public class Upkeep extends Phase implements java.io.Serializable { final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn(); List list = player.getCardsIn(ZoneType.Battlefield); - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { return CardFactoryUtil.hasKeyword(c, "Vanishing") != -1; @@ -1894,7 +1894,7 @@ public class Upkeep extends Phase implements java.io.Serializable { final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn(); List list = player.getCardsIn(ZoneType.Battlefield); - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { return CardFactoryUtil.hasKeyword(c, "Fading") != -1; @@ -1959,8 +1959,8 @@ public class Upkeep extends Phase implements java.io.Serializable { oathFlag = false; } } else { // if player == Computer - final List creaturesInLibrary = CardListUtil.filter(player.getCardsIn(ZoneType.Library), CardPredicates.Presets.CREATURES); - final List creaturesInBattlefield = CardListUtil.filter(player.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES); + final List creaturesInLibrary = CardLists.filter(player.getCardsIn(ZoneType.Library), CardPredicates.Presets.CREATURES); + final List creaturesInBattlefield = CardLists.filter(player.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES); // if there are at least 3 creatures in library, // or none in play with one in library, oath @@ -2026,7 +2026,7 @@ public class Upkeep extends Phase implements java.io.Serializable { final Ability ability = new Ability(oathList.get(0), "0") { @Override public void resolve() { - final List graveyardCreatures = CardListUtil.filter(player.getCardsIn(ZoneType.Graveyard), CardPredicates.Presets.CREATURES); + final List graveyardCreatures = CardLists.filter(player.getCardsIn(ZoneType.Graveyard), CardPredicates.Presets.CREATURES); if (AllZoneUtil.compareTypeAmountInGraveyard(player, "Creature") > 0) { if (player.isHuman()) { @@ -2065,7 +2065,7 @@ public class Upkeep extends Phase implements java.io.Serializable { private static void upkeepKarma() { final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn(); final List karmas = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Karma"); - final List swamps = CardListUtil.getType(player.getCardsIn(ZoneType.Battlefield), "Swamp"); + final List swamps = CardLists.getType(player.getCardsIn(ZoneType.Battlefield), "Swamp"); // determine how much damage to deal the current player final int damage = swamps.size(); @@ -2146,7 +2146,7 @@ public class Upkeep extends Phase implements java.io.Serializable { @Override public void resolve() { final int num = source.getCounters(Counters.FADE); - final List list = CardListUtil.filter(player.getCardsIn(ZoneType.Battlefield), new Predicate() { + final List list = CardLists.filter(player.getCardsIn(ZoneType.Battlefield), new Predicate() { @Override public boolean apply(final Card c) { return (c.isArtifact() || c.isLand() || c.isCreature()) && c.isUntapped(); @@ -2157,7 +2157,7 @@ public class Upkeep extends Phase implements java.io.Serializable { if (player.isComputer()) { Card toTap = CardFactoryUtil.getWorstPermanentAI(list, false, false, false, false); // try to find non creature cards without tap abilities - List betterList = CardListUtil.filter(list, new Predicate() { + List betterList = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { if (c.isCreature()) { @@ -2232,7 +2232,7 @@ public class Upkeep extends Phase implements java.io.Serializable { final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn(); List blaze = player.getCardsIn(ZoneType.Battlefield); - blaze = CardListUtil.filter(blaze, new Predicate() { + blaze = CardLists.filter(blaze, new Predicate() { @Override public boolean apply(final Card c) { return c.isLand() && (c.getCounters(Counters.BLAZE) > 0); @@ -2276,7 +2276,7 @@ public class Upkeep extends Phase implements java.io.Serializable { public void resolve() { List enchantmentsInLibrary = source.getController().getCardsIn(ZoneType.Library); final List enchantmentsAttached = new ArrayList(source.getEnchantingPlayer().getEnchantedBy()); - enchantmentsInLibrary = CardListUtil.filter(enchantmentsInLibrary, new Predicate() { + enchantmentsInLibrary = CardLists.filter(enchantmentsInLibrary, new Predicate() { @Override public boolean apply(final Card c) { return c.isEnchantment() && c.hasKeyword("Enchant player") diff --git a/src/main/java/forge/game/player/AIPlayer.java b/src/main/java/forge/game/player/AIPlayer.java index 25b9cef2c8a..dc8d92caa80 100644 --- a/src/main/java/forge/game/player/AIPlayer.java +++ b/src/main/java/forge/game/player/AIPlayer.java @@ -25,7 +25,7 @@ import com.google.common.collect.Iterables; import forge.AllZone; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates; import forge.Singletons; import forge.card.cardfactory.CardFactoryUtil; @@ -140,7 +140,7 @@ public class AIPlayer extends Player { // use dredge if there are more than one of them in your graveyard if ((dredgers.size() > 1) || ((dredgers.size() == 1) && random.nextBoolean())) { - CardListUtil.shuffle(dredgers); + CardLists.shuffle(dredgers); final Card c = dredgers.get(0); // rule 702.49a if (this.getDredgeNumber(c) <= this.getCardsIn(ZoneType.Library).size()) { @@ -180,7 +180,7 @@ public class AIPlayer extends Player { @Override public final void discardUnless(final int num, final String uType, final SpellAbility sa) { final List hand = this.getCardsIn(ZoneType.Hand); - final List tHand = CardListUtil.getType(hand, uType); + final List tHand = CardLists.getType(hand, uType); if (tHand.size() > 0) { Card toDiscard = Aggregates.itemWithMin(tHand, CardPredicates.Accessors.fnGetCmc); @@ -207,7 +207,7 @@ public class AIPlayer extends Player { // probably don't need more } else if (topN.get(i).isCreature()) { List cl = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield); - cl = CardListUtil.filter(cl, CardPredicates.Presets.CREATURES); + cl = CardLists.filter(cl, CardPredicates.Presets.CREATURES); bottom = cl.size() > 5; // if control more than 5 Creatures, // probably don't need more } diff --git a/src/main/java/forge/game/player/ComputerUtil.java b/src/main/java/forge/game/player/ComputerUtil.java index e002087e745..44caad9e47d 100644 --- a/src/main/java/forge/game/player/ComputerUtil.java +++ b/src/main/java/forge/game/player/ComputerUtil.java @@ -32,7 +32,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates; import forge.CardPredicates.Presets; import forge.CardUtil; @@ -1008,7 +1008,7 @@ public class ComputerUtil { */ public static List getAvailableMana(final Player player, final boolean checkPlayable) { final List list = player.getCardsIn(ZoneType.Battlefield); - final List manaSources = CardListUtil.filter(list, new Predicate() { + final List manaSources = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { if (checkPlayable) { @@ -1115,7 +1115,7 @@ public class ComputerUtil { sortedManaSources.addAll(fiveManaSources); sortedManaSources.addAll(anyColorManaSources); //use better creatures later - CardListUtil.sortByEvaluateCreature(otherManaSources); + CardLists.sortByEvaluateCreature(otherManaSources); Collections.reverse(otherManaSources); sortedManaSources.addAll(otherManaSources); return sortedManaSources; @@ -1305,8 +1305,8 @@ public class ComputerUtil { return false; } final List hand = AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand); - List landList = CardListUtil.filter(hand, Presets.LANDS); - List nonLandList = CardListUtil.filter(hand, Predicates.not(CardPredicates.Presets.LANDS)); + List landList = CardLists.filter(hand, Presets.LANDS); + List nonLandList = CardLists.filter(hand, Predicates.not(CardPredicates.Presets.LANDS)); final List lands = computer.getCardsIn(ZoneType.Graveyard); for (final Card crd : lands) { @@ -1319,7 +1319,7 @@ public class ComputerUtil { } if (landList.size() == 1 && nonLandList.size() < 3) { List cardsInPlay = computer.getCardsIn(ZoneType.Battlefield); - List landsInPlay = CardListUtil.filter(cardsInPlay, Presets.LANDS); + List landsInPlay = CardLists.filter(cardsInPlay, Presets.LANDS); List allCards = computer.getCardsIn(ZoneType.Graveyard); allCards.addAll(cardsInPlay); int maxCmcInHand = Aggregates.max(hand, CardPredicates.Accessors.fnGetCmc); @@ -1340,14 +1340,14 @@ public class ComputerUtil { } } - landList = CardListUtil.filter(landList, new Predicate() { + landList = CardLists.filter(landList, new Predicate() { @Override public boolean apply(final Card c) { if (c.getSVar("NeedsToPlay").length() > 0) { final String needsToPlay = c.getSVar("NeedsToPlay"); List list = AllZoneUtil.getCardsIn(ZoneType.Battlefield); - list = CardListUtil.getValidCards(list, needsToPlay.split(","), c.getController(), c); + list = CardLists.getValidCards(list, needsToPlay.split(","), c.getController(), c); if (list.isEmpty()) { return false; } @@ -1366,7 +1366,7 @@ public class ComputerUtil { final List hand = AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand); List lands = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield); lands.addAll(hand); - lands = CardListUtil.filter(lands, CardPredicates.Presets.LANDS); + lands = CardLists.filter(lands, CardPredicates.Presets.LANDS); int maxCmcInHand = Aggregates.max(hand, CardPredicates.Accessors.fnGetCmc); for (final SpellAbility sa : spellAbilities) { if (sa.isCycling()) { @@ -1397,7 +1397,7 @@ public class ComputerUtil { // what types can I go get? for (final String name : Constant.CardTypes.BASIC_TYPES) { - if (!CardListUtil.getType(landList, name).isEmpty()) { + if (!CardLists.getType(landList, name).isEmpty()) { basics.add(name); } } @@ -1409,7 +1409,7 @@ public class ComputerUtil { for (int i = 0; i < basics.size(); i++) { final String b = basics.get(i); - final int num = CardListUtil.getType(combined, b).size(); + final int num = CardLists.getType(combined, b).size(); if (num < minSize) { minType = b; minSize = num; @@ -1417,7 +1417,7 @@ public class ComputerUtil { } if (minType != null) { - landList = CardListUtil.getType(landList, minType); + landList = CardLists.getType(landList, minType); } land = landList.get(0); @@ -1450,9 +1450,9 @@ public class ComputerUtil { if (activate != null) { final String[] prefValid = activate.getSVar("AIPreference").split("\\$"); if (prefValid[0].equals(pref)) { - final List prefList = CardListUtil.getValidCards(typeList, prefValid[1].split(","), activate.getController(), activate); + final List prefList = CardLists.getValidCards(typeList, prefValid[1].split(","), activate.getController(), activate); if (prefList.size() != 0) { - CardListUtil.shuffle(prefList); + CardLists.shuffle(prefList); return prefList.get(0); } } @@ -1461,14 +1461,14 @@ public class ComputerUtil { for (int ip = 0; ip < 6; ip++) { // priority 0 is the lowest, // priority 5 the highest final int priority = 6 - ip; - final List sacMeList = CardListUtil.filter(typeList, new Predicate() { + final List sacMeList = CardLists.filter(typeList, new Predicate() { @Override public boolean apply(final Card c) { return (!c.getSVar("SacMe").equals("") && (Integer.parseInt(c.getSVar("SacMe")) == priority)); } }); if (sacMeList.size() != 0) { - CardListUtil.shuffle(sacMeList); + CardLists.shuffle(sacMeList); return sacMeList.get(0); } } @@ -1491,10 +1491,10 @@ public class ComputerUtil { } // Discard lands - final List landsInHand = CardListUtil.getType(typeList, "Land"); + final List landsInHand = CardLists.getType(typeList, "Land"); if (!landsInHand.isEmpty()) { - final List landsInPlay = CardListUtil.getType(AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield), "Land"); - final List nonLandsInHand = CardListUtil.getNotType(AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand), "Land"); + final List landsInPlay = CardLists.getType(AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield), "Land"); + final List nonLandsInHand = CardLists.getNotType(AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand), "Land"); final int highestCMC = Math.max(6, Aggregates.max(nonLandsInHand, CardPredicates.Accessors.fnGetCmc)); if (landsInPlay.size() >= highestCMC || (landsInPlay.size() + landsInHand.size() > 6 && landsInHand.size() > 1)) { @@ -1526,9 +1526,9 @@ public class ComputerUtil { final int amount) { Player activator = AllZone.getComputerPlayer(); List typeList = activator.getCardsIn(ZoneType.Battlefield); - typeList = CardListUtil.getValidCards(typeList, type.split(";"), activate.getController(), activate); + typeList = CardLists.getValidCards(typeList, type.split(";"), activate.getController(), activate); if (activator.hasKeyword("You can't sacrifice creatures to cast spells or activate abilities.")) { - typeList = CardListUtil.getNotType(typeList, "Creature"); + typeList = CardLists.getNotType(typeList, "Creature"); } if ((target != null) && target.getController().isComputer() && typeList.contains(target)) { @@ -1553,7 +1553,7 @@ public class ComputerUtil { } } - CardListUtil.sortAttackLowFirst(typeList); + CardLists.sortAttackLowFirst(typeList); for (int i = count; i < amount; i++) { sacList.add(typeList.get(i)); @@ -1580,7 +1580,7 @@ public class ComputerUtil { Card sourceCard = null; if ((uTypes != null) && (sa != null)) { - hand = CardListUtil.getValidCards(hand, uTypes, sa.getActivatingPlayer(), sa.getSourceCard()); + hand = CardLists.getValidCards(hand, uTypes, sa.getActivatingPlayer(), sa.getSourceCard()); } if (hand.size() < numDiscard) { @@ -1626,7 +1626,7 @@ public class ComputerUtil { } List aiCards = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield); final int numLandsInPlay = Iterables.size(Iterables.filter(aiCards, CardPredicates.Presets.LANDS)); - final List landsInHand = CardListUtil.filter(hand, CardPredicates.Presets.LANDS); + final List landsInHand = CardLists.filter(hand, CardPredicates.Presets.LANDS); final int numLandsInHand = landsInHand.size(); // Discard a land @@ -1636,7 +1636,7 @@ public class ComputerUtil { discardList.add(landsInHand.get(0)); hand.remove(landsInHand.get(0)); } else { // Discard other stuff - CardListUtil.sortCMC(hand); + CardLists.sortCMC(hand); int numLandsAvailable = numLandsInPlay; if (numLandsInHand > 0) { numLandsAvailable++; @@ -1758,11 +1758,11 @@ public class ComputerUtil { if (zone.equals(ZoneType.Stack)) { for (int i = 0; i < AllZone.getStack().size(); i++) { typeList.add(AllZone.getStack().peekAbility(i).getSourceCard()); - typeList = CardListUtil.getValidCards(typeList, type.split(","), activate.getController(), activate); + typeList = CardLists.getValidCards(typeList, type.split(","), activate.getController(), activate); } } else { typeList = AllZone.getComputerPlayer().getCardsIn(zone); - typeList = CardListUtil.getValidCards(typeList, type.split(","), activate.getController(), activate); + typeList = CardLists.getValidCards(typeList, type.split(","), activate.getController(), activate); } if ((target != null) && target.getController().isComputer() && typeList.contains(target)) { typeList.remove(target); // don't exile the card we're pumping @@ -1772,7 +1772,7 @@ public class ComputerUtil { return null; } - CardListUtil.sortAttackLowFirst(typeList); + CardLists.sortAttackLowFirst(typeList); final List exileList = new ArrayList(); for (int i = 0; i < amount; i++) { @@ -1798,10 +1798,10 @@ public class ComputerUtil { */ public static List chooseTapType(final String type, final Card activate, final boolean tap, final int amount) { List typeList = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield); - typeList = CardListUtil.getValidCards(typeList, type.split(","), activate.getController(), activate); + typeList = CardLists.getValidCards(typeList, type.split(","), activate.getController(), activate); // is this needed? - typeList = CardListUtil.filter(typeList, Presets.UNTAPPED); + typeList = CardLists.filter(typeList, Presets.UNTAPPED); if (tap) { typeList.remove(activate); @@ -1811,7 +1811,7 @@ public class ComputerUtil { return null; } - CardListUtil.sortAttackLowFirst(typeList); + CardLists.sortAttackLowFirst(typeList); final List tapList = new ArrayList(); @@ -1838,10 +1838,10 @@ public class ComputerUtil { */ public static List chooseUntapType(final String type, final Card activate, final boolean untap, final int amount) { List typeList = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield); - typeList = CardListUtil.getValidCards(typeList, type.split(","), activate.getController(), activate); + typeList = CardLists.getValidCards(typeList, type.split(","), activate.getController(), activate); // is this needed? - typeList = CardListUtil.filter(typeList, Presets.TAPPED); + typeList = CardLists.filter(typeList, Presets.TAPPED); if (untap) { typeList.remove(activate); @@ -1851,7 +1851,7 @@ public class ComputerUtil { return null; } - CardListUtil.sortAttack(typeList); + CardLists.sortAttack(typeList); final List untapList = new ArrayList(); @@ -1878,7 +1878,7 @@ public class ComputerUtil { */ public static List chooseReturnType(final String type, final Card activate, final Card target, final int amount) { List typeList = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield); - typeList = CardListUtil.getValidCards(typeList, type.split(","), activate.getController(), activate); + typeList = CardLists.getValidCards(typeList, type.split(","), activate.getController(), activate); if ((target != null) && target.getController().isComputer() && typeList.contains(target)) { // bounce // the @@ -1892,7 +1892,7 @@ public class ComputerUtil { return null; } - CardListUtil.sortAttackLowFirst(typeList); + CardLists.sortAttackLowFirst(typeList); final List returnList = new ArrayList(); for (int i = 0; i < amount; i++) { @@ -1910,7 +1910,7 @@ public class ComputerUtil { */ public static List getPossibleAttackers() { List list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield); - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { return CombatUtil.canAttack(c); @@ -2029,14 +2029,14 @@ public class ComputerUtil { max = amount; } - CardListUtil.sortCMC(list); + CardLists.sortCMC(list); Collections.reverse(list); for (int i = 0; i < max; i++) { Card c = null; if (destroy) { - final List indestructibles = CardListUtil.getKeyword(list, "Indestructible"); + final List indestructibles = CardLists.getKeyword(list, "Indestructible"); if (!indestructibles.isEmpty()) { c = indestructibles.get(0); } @@ -2052,9 +2052,9 @@ public class ComputerUtil { } if (c == null) { - if (CardListUtil.getNotType(list, "Creature").size() == 0) { + if (CardLists.getNotType(list, "Creature").size() == 0) { c = CardFactoryUtil.getWorstCreatureAI(list); - } else if (CardListUtil.getNotType(list, "Land").size() == 0) { + } else if (CardLists.getNotType(list, "Land").size() == 0) { c = CardFactoryUtil.getWorstLand(AllZone.getComputerPlayer()); } else { c = CardFactoryUtil.getWorstPermanentAI(list, false, false, false, false); @@ -2124,7 +2124,7 @@ public class ComputerUtil { final Target tgt = sa.getTarget(); if (tgt != null) { - if (CardListUtil.getValidCards(AllZoneUtil.getCardsIn(ZoneType.Battlefield), tgt.getValidTgts(), controller, sa.getSourceCard()).contains(card)) { + if (CardLists.getValidCards(AllZoneUtil.getCardsIn(ZoneType.Battlefield), tgt.getValidTgts(), controller, sa.getSourceCard()).contains(card)) { return true; } } else if (AbilityFactory.getDefinedCards(sa.getSourceCard(), mapParams.get("Defined"), sa) @@ -2173,7 +2173,7 @@ public class ComputerUtil { } final Target tgt = sa.getTarget(); if (tgt != null) { - if (CardListUtil.getValidCards(AllZoneUtil.getCardsIn(ZoneType.Battlefield), tgt.getValidTgts(), controller, af.getHostCard()).contains(card)) { + if (CardLists.getValidCards(AllZoneUtil.getCardsIn(ZoneType.Battlefield), tgt.getValidTgts(), controller, af.getHostCard()).contains(card)) { prevented += AbilityFactory.calculateAmount(af.getHostCard(), mapParams.get("Amount"), sa); } @@ -2297,9 +2297,9 @@ public class ComputerUtil { if (!discard.getSVar("DiscardMe").equals("")) { return true; } - final List landsInPlay = CardListUtil.filter(AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.LANDS); - final List landsInHand = CardListUtil.filter(AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand), CardPredicates.Presets.LANDS); - final List nonLandsInHand = CardListUtil.getNotType(AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand), "Land"); + final List landsInPlay = CardLists.filter(AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.LANDS); + final List landsInHand = CardLists.filter(AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand), CardPredicates.Presets.LANDS); + final List nonLandsInHand = CardLists.getNotType(AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand), "Land"); final int highestCMC = Math.max(6, Aggregates.max(nonLandsInHand, CardPredicates.Accessors.fnGetCmc)); final int discardCMC = discard.getCMC(); if (discard.isLand()) { diff --git a/src/main/java/forge/game/player/ComputerUtilAttack.java b/src/main/java/forge/game/player/ComputerUtilAttack.java index 610a3d0ea65..2a4b5b6f11b 100644 --- a/src/main/java/forge/game/player/ComputerUtilAttack.java +++ b/src/main/java/forge/game/player/ComputerUtilAttack.java @@ -27,7 +27,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates; import forge.Counters; import forge.GameEntity; @@ -77,10 +77,10 @@ public class ComputerUtilAttack { */ public ComputerUtilAttack(final List possibleAttackers, final List possibleBlockers) { this.humanList = new ArrayList(possibleBlockers); - this.humanList = CardListUtil.filter(this.humanList, CardPredicates.Presets.CREATURES); + this.humanList = CardLists.filter(this.humanList, CardPredicates.Presets.CREATURES); this.computerList = new ArrayList(possibleAttackers); - this.computerList = CardListUtil.filter(this.computerList, CardPredicates.Presets.CREATURES); + this.computerList = CardLists.filter(this.computerList, CardPredicates.Presets.CREATURES); this.attackers = this.getPossibleAttackers(possibleAttackers); this.blockers = this.getPossibleBlockers(possibleBlockers, this.attackers); @@ -168,7 +168,7 @@ public class ComputerUtilAttack { */ public final List getPossibleAttackers(final List in) { List list = new ArrayList(in); - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { return CombatUtil.canAttack(c); @@ -190,7 +190,7 @@ public class ComputerUtilAttack { */ public final List getPossibleBlockers(final List blockers, final List attackers) { List possibleBlockers = new ArrayList(blockers); - possibleBlockers = CardListUtil.filter(possibleBlockers, new Predicate() { + possibleBlockers = CardLists.filter(possibleBlockers, new Predicate() { @Override public boolean apply(final Card c) { return canBlockAnAttacker(c, attackers); @@ -264,7 +264,7 @@ public class ComputerUtilAttack { } } } - CardListUtil.sortAttackLowFirst(attackers); + CardLists.sortAttackLowFirst(attackers); int blockersNeeded = this.humanList.size(); // don't hold back creatures that can't block any of the human creatures @@ -392,7 +392,7 @@ public class ComputerUtilAttack { } } - CardListUtil.sortAttack(this.attackers); + CardLists.sortAttack(this.attackers); final List unblockedAttackers = new ArrayList(); final List remainingAttackers = new ArrayList(this.attackers); @@ -542,7 +542,7 @@ public class ComputerUtilAttack { } if (bAssault) { System.out.println("Assault"); - CardListUtil.sortAttack(attackersLeft); + CardLists.sortAttack(attackersLeft); for (Card attacker : attackersLeft) { if (CombatUtil.canAttack(attacker, combat) && this.isEffectiveAttacker(attacker, combat)) { combat.addAttacker(attacker); @@ -574,7 +574,7 @@ public class ComputerUtilAttack { } } if (exalted) { - CardListUtil.sortAttack(this.attackers); + CardLists.sortAttack(this.attackers); System.out.println("Exalted"); this.aiAggression = 6; for (Card attacker : this.attackers) { @@ -682,7 +682,7 @@ public class ComputerUtilAttack { // ********************* boolean doAttritionalAttack = false; // get list of attackers ordered from low power to high - CardListUtil.sortAttackLowFirst(this.attackers); + CardLists.sortAttackLowFirst(this.attackers); // get player life total int humanLife = AllZone.getHumanPlayer().getLife(); // get the list of attackers up to the first blocked one @@ -818,7 +818,7 @@ public class ComputerUtilAttack { int attackNum = 0; int damage = 0; List attacking = combat.getAttackersByDefenderSlot(combat.getCurrentDefenderNumber()); - CardListUtil.sortAttackLowFirst(attacking); + CardLists.sortAttackLowFirst(attacking); for (Card atta : attacking) { if (attackNum >= blockNum || !CombatUtil.canBeBlocked(attacker, this.blockers)) { damage += CombatUtil.damageIfUnblocked(atta, AllZone.getHumanPlayer(), null); @@ -848,7 +848,7 @@ public class ComputerUtilAttack { */ public final int countExaltedBonus(final Player player) { List list = player.getCardsIn(ZoneType.Battlefield); - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { return c.hasKeyword("Exalted"); diff --git a/src/main/java/forge/game/player/ComputerUtilBlock.java b/src/main/java/forge/game/player/ComputerUtilBlock.java index e6fd4392175..e6134e67f98 100644 --- a/src/main/java/forge/game/player/ComputerUtilBlock.java +++ b/src/main/java/forge/game/player/ComputerUtilBlock.java @@ -26,7 +26,7 @@ import com.google.common.base.Predicates; import forge.AllZone; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates; import forge.Counters; import forge.GameEntity; @@ -281,8 +281,8 @@ public class ComputerUtilBlock { // Begin with the attackers that pose the biggest threat - CardListUtil.sortByEvaluateCreature(firstAttacker); - CardListUtil.sortAttack(firstAttacker); + CardLists.sortByEvaluateCreature(firstAttacker); + CardLists.sortAttack(firstAttacker); // If I don't have any planeswalkers than sorting doesn't really matter if (defenders.size() == 1) { @@ -298,7 +298,7 @@ public class ComputerUtilBlock { // if planeswalker will be too difficult to defend don't even bother for (List attacker : attackerLists) { // Begin with the attackers that pose the biggest threat - CardListUtil.sortAttack(attacker); + CardLists.sortAttack(attacker); for (final Card c : attacker) { sortedAttackers.add(c); } @@ -404,7 +404,7 @@ public class ComputerUtilBlock { final static Predicate rampagesOrNeedsManyToBlock = Predicates.or( CardPredicates.containsKeyword("Rampage"), CardPredicates.containsKeyword("CARDNAME can't be blocked by more than one creature.")); private static Combat makeGangBlocks(final Combat combat) { - List currentAttackers = CardListUtil.filter(ComputerUtilBlock.getAttackersLeft(), Predicates.not(rampagesOrNeedsManyToBlock)); + List currentAttackers = CardLists.filter(ComputerUtilBlock.getAttackersLeft(), Predicates.not(rampagesOrNeedsManyToBlock)); List blockers; // Try to block an attacker without first strike with a gang of first strikers @@ -420,7 +420,7 @@ public class ComputerUtilBlock { } if (firstStrikeBlockers.size() > 1) { - CardListUtil.sortAttack(firstStrikeBlockers); + CardLists.sortAttack(firstStrikeBlockers); for (final Card blocker : firstStrikeBlockers) { final int damageNeeded = attacker.getKillDamage() + CombatUtil.predictToughnessBonusOfAttacker(attacker, blocker, combat); @@ -460,7 +460,7 @@ public class ComputerUtilBlock { // than the attacker // Don't use blockers without First Strike or Double Strike if // attacker has it - usableBlockers = CardListUtil.filter(blockers, new Predicate() { + usableBlockers = CardLists.filter(blockers, new Predicate() { @Override public boolean apply(final Card c) { if ((attacker.hasKeyword("First Strike") || attacker.hasKeyword("Double Strike")) @@ -600,8 +600,8 @@ public class ComputerUtilBlock { List chumpBlockers; - List tramplingAttackers = CardListUtil.getKeyword(ComputerUtilBlock.getAttackers(), "Trample"); - tramplingAttackers = CardListUtil.filter(tramplingAttackers, Predicates.not(rampagesOrNeedsManyToBlock)); + List tramplingAttackers = CardLists.getKeyword(ComputerUtilBlock.getAttackers(), "Trample"); + tramplingAttackers = CardLists.filter(tramplingAttackers, Predicates.not(rampagesOrNeedsManyToBlock)); // TODO - should check here for a "rampage-like" trigger that replaced // the keyword: @@ -648,7 +648,7 @@ public class ComputerUtilBlock { List safeBlockers; List blockers; - List targetAttackers = CardListUtil.filter(ComputerUtilBlock.getBlockedButUnkilled(), Predicates.not(rampagesOrNeedsManyToBlock)); + List targetAttackers = CardLists.filter(ComputerUtilBlock.getBlockedButUnkilled(), Predicates.not(rampagesOrNeedsManyToBlock)); // TODO - should check here for a "rampage-like" trigger that replaced // the keyword: @@ -678,8 +678,8 @@ public class ComputerUtilBlock { // Don't use blockers without First Strike or Double Strike if // attacker has it if (attacker.hasKeyword("First Strike") || attacker.hasKeyword("Double Strike")) { - safeBlockers = CardListUtil.getKeyword(blockers, "First Strike"); - safeBlockers.addAll(CardListUtil.getKeyword(blockers, "Double Strike")); + safeBlockers = CardLists.getKeyword(blockers, "First Strike"); + safeBlockers.addAll(CardLists.getKeyword(blockers, "Double Strike")); } else { safeBlockers = new ArrayList(blockers); } @@ -800,7 +800,7 @@ public class ComputerUtilBlock { } // Begin with the weakest blockers - CardListUtil.sortAttackLowFirst(ComputerUtilBlock.getBlockersLeft()); + CardLists.sortAttackLowFirst(ComputerUtilBlock.getBlockersLeft()); // == 1. choose best blocks first == combat = ComputerUtilBlock.makeGoodBlocks(combat); @@ -887,7 +887,7 @@ public class ComputerUtilBlock { } // assign blockers that have to block - chumpBlockers = CardListUtil.getKeyword(ComputerUtilBlock.getBlockersLeft(), "CARDNAME blocks each turn if able."); + chumpBlockers = CardLists.getKeyword(ComputerUtilBlock.getBlockersLeft(), "CARDNAME blocks each turn if able."); // if an attacker with lure attacks - all that can block for (final Card blocker : ComputerUtilBlock.getBlockersLeft()) { if (CombatUtil.mustBlockAnAttacker(blocker, combat)) { @@ -895,7 +895,7 @@ public class ComputerUtilBlock { } } if (!chumpBlockers.isEmpty()) { - CardListUtil.shuffle(ComputerUtilBlock.getAttackers()); + CardLists.shuffle(ComputerUtilBlock.getAttackers()); for (final Card attacker : ComputerUtilBlock.getAttackers()) { blockers = ComputerUtilBlock.getPossibleBlockers(attacker, chumpBlockers, combat); for (final Card blocker : blockers) { @@ -915,8 +915,8 @@ public class ComputerUtilBlock { public static List orderBlockers(Card attacker, List blockers) { // very very simple ordering of blockers, sort by evaluate, then sort by attack //final int damage = attacker.getNetCombatDamage(); - CardListUtil.sortByEvaluateCreature(blockers); - CardListUtil.sortAttack(blockers); + CardLists.sortByEvaluateCreature(blockers); + CardLists.sortAttack(blockers); // TODO: Take total damage, and attempt to maximize killing the greatest evaluation of creatures // It's probably generally better to kill the largest creature, but sometimes its better to kill a few smaller ones @@ -928,8 +928,8 @@ public class ComputerUtilBlock { // This shouldn't really take trample into account, but otherwise should be pretty similar to orderBlockers // very very simple ordering of attackers, sort by evaluate, then sort by attack //final int damage = attacker.getNetCombatDamage(); - CardListUtil.sortByEvaluateCreature(blockers); - CardListUtil.sortAttack(blockers); + CardLists.sortByEvaluateCreature(blockers); + CardLists.sortAttack(blockers); // TODO: Take total damage, and attempt to maximize killing the greatest evaluation of creatures // It's probably generally better to kill the largest creature, but sometimes its better to kill a few smaller ones diff --git a/src/main/java/forge/game/player/Player.java b/src/main/java/forge/game/player/Player.java index 955ffa0565d..6ecbac0adc6 100644 --- a/src/main/java/forge/game/player/Player.java +++ b/src/main/java/forge/game/player/Player.java @@ -35,7 +35,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates; import forge.CardUtil; import forge.Constant; @@ -1417,7 +1417,7 @@ public abstract class Player extends GameEntity implements Comparable { * @return a List with all the cards currently in that player's library */ public final List getCardsIn(final ZoneType zone, final String cardName) { - return CardListUtil.filter(this.getCardsIn(zone), CardPredicates.nameEquals(cardName)); + return CardLists.filter(this.getCardsIn(zone), CardPredicates.nameEquals(cardName)); } /** @@ -1539,7 +1539,7 @@ public abstract class Player extends GameEntity implements Comparable { */ public final List discard(final Card c, final SpellAbility sa) { this.doDiscard(c, sa); - return CardListUtil.createCardList(c); + return CardLists.createCardList(c); } /** @@ -1644,7 +1644,7 @@ public abstract class Player extends GameEntity implements Comparable { final List discarded = new ArrayList(); for (int i = 0; i < num; i++) { List list = this.getCardsIn(ZoneType.Hand); - list = CardListUtil.getValidCards(list, valid, sa.getSourceCard().getController(), sa.getSourceCard()); + list = CardLists.getValidCards(list, valid, sa.getSourceCard().getController(), sa.getSourceCard()); if (list.size() != 0) { final Card disc = CardUtil.getRandom(list); discarded.add(disc); @@ -1886,7 +1886,7 @@ public abstract class Player extends GameEntity implements Comparable { * @return a {@link forge.Card} object. */ public final Card getPlaneswalker() { - final List c = CardListUtil.filter(this.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.PLANEWALKERS); + final List c = CardLists.filter(this.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.PLANEWALKERS); if ((null != c) && (c.size() > 0)) { return c.get(0); } else { @@ -2284,7 +2284,7 @@ public abstract class Player extends GameEntity implements Comparable { * @return a boolean. */ public final boolean hasMetalcraft() { - final List list = CardListUtil.filter(this.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.ARTIFACTS); + final List list = CardLists.filter(this.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.ARTIFACTS); return list.size() >= 3; } diff --git a/src/main/java/forge/game/player/PlayerUtil.java b/src/main/java/forge/game/player/PlayerUtil.java index 9f07a770428..cd5a615a859 100644 --- a/src/main/java/forge/game/player/PlayerUtil.java +++ b/src/main/java/forge/game/player/PlayerUtil.java @@ -24,7 +24,7 @@ import com.google.common.base.Predicate; import forge.AllZone; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.Singletons; import forge.card.spellability.SpellAbility; import forge.control.input.Input; @@ -60,8 +60,8 @@ public final class PlayerUtil { public static boolean worshipFlag(final Player player) { // Instead of hardcoded Ali from Cairo like cards, it is now a Keyword List list = player.getCardsIn(ZoneType.Battlefield); - list = CardListUtil.getKeyword(list, "Damage that would reduce your life total to less than 1 reduces it to 1 instead."); - list = CardListUtil.filter(list, new Predicate() { + list = CardLists.getKeyword(list, "Damage that would reduce your life total to less than 1 reduces it to 1 instead."); + list = CardLists.filter(list, new Predicate() { @Override public boolean apply(final Card c) { return !c.isFaceDown(); @@ -263,7 +263,7 @@ public final class PlayerUtil { public static Input inputSacrificePermanents(final int nCards, final String type) { List list = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield); - list = CardListUtil.getType(list, type); + list = CardLists.getType(list, type); return PlayerUtil.inputSacrificePermanentsFromList(nCards, list, "Select a " + type + " to sacrifice"); } // input_sacrificePermanents() diff --git a/src/main/java/forge/game/zone/MagicStack.java b/src/main/java/forge/game/zone/MagicStack.java index d4b9ea0da83..9be94f9c246 100644 --- a/src/main/java/forge/game/zone/MagicStack.java +++ b/src/main/java/forge/game/zone/MagicStack.java @@ -28,7 +28,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates.Presets; import forge.Command; import forge.GameActionUtil; @@ -767,7 +767,7 @@ public class MagicStack extends MyObservable { if (sp.isSpell() && AllZoneUtil.isCardInPlay("Bazaar of Wonders")) { boolean found = false; List all = AllZoneUtil.getCardsIn(ZoneType.Battlefield); - all = CardListUtil.filter(all, Presets.NON_TOKEN); + all = CardLists.filter(all, Presets.NON_TOKEN); final List graves = AllZoneUtil.getCardsIn(ZoneType.Graveyard); all.addAll(graves); @@ -946,7 +946,7 @@ public class MagicStack extends MyObservable { AllZone.getInputControl().setInput(target); } else { // AI choosing what to haunt - final List oppCreats = CardListUtil.filterControlledBy(creats, AllZone.getHumanPlayer()); + final List oppCreats = CardLists.filterControlledBy(creats, AllZone.getHumanPlayer()); if (oppCreats.size() != 0) { haunterDiesWork.setTargetCard(CardFactoryUtil.getWorstCreatureAI(oppCreats)); } else { diff --git a/src/main/java/forge/game/zone/PlayerZoneComesIntoPlay.java b/src/main/java/forge/game/zone/PlayerZoneComesIntoPlay.java index 31411f40f26..915f6c1700c 100644 --- a/src/main/java/forge/game/zone/PlayerZoneComesIntoPlay.java +++ b/src/main/java/forge/game/zone/PlayerZoneComesIntoPlay.java @@ -24,7 +24,7 @@ import forge.AllZone; import forge.AllZoneUtil; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates.Presets; import forge.Command; import forge.GameActionUtil; @@ -127,7 +127,7 @@ public class PlayerZoneComesIntoPlay extends DefaultPlayerZone { @Override public void resolve() { List lands = tisLand.getController().getCardsIn(ZoneType.Battlefield); - lands = CardListUtil.filter(lands, Presets.LANDS); + lands = CardLists.filter(lands, Presets.LANDS); for (final Card land : lands) { land.tap(); } diff --git a/src/main/java/forge/gui/match/controllers/CDock.java b/src/main/java/forge/gui/match/controllers/CDock.java index 1fba32c8fdd..d1d71c89916 100644 --- a/src/main/java/forge/gui/match/controllers/CDock.java +++ b/src/main/java/forge/gui/match/controllers/CDock.java @@ -30,7 +30,7 @@ import javax.swing.SwingWorker; import forge.AllZone; import forge.Card; -import forge.CardListUtil; +import forge.CardLists; import forge.CardPredicates.Presets; import forge.Command; import forge.Singletons; @@ -147,7 +147,7 @@ public enum CDock implements ICDoc { final Player human = Singletons.getControl().getPlayer(); if (ph.is(PhaseType.COMBAT_DECLARE_ATTACKERS, human)) { - for (Card c : CardListUtil.filter(human.getCardsIn(ZoneType.Battlefield), Presets.CREATURES)) { + for (Card c : CardLists.filter(human.getCardsIn(ZoneType.Battlefield), Presets.CREATURES)) { if (!c.isAttacking() && CombatUtil.canAttack(c, AllZone.getCombat())) { AllZone.getCombat().addAttacker(c); }