mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
replacing CardList calls with iterables where possible
This commit is contained in:
@@ -32,6 +32,7 @@ import java.util.Set;
|
|||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import com.esotericsoftware.minlog.Log;
|
import com.esotericsoftware.minlog.Log;
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
|
||||||
import forge.card.CardCharacteristics;
|
import forge.card.CardCharacteristics;
|
||||||
import forge.card.CardManaCost;
|
import forge.card.CardManaCost;
|
||||||
@@ -8275,7 +8276,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
|
|
||||||
final CardList auras = new CardList(this.getEnchantedBy());
|
final CardList auras = new CardList(this.getEnchantedBy());
|
||||||
|
|
||||||
if (auras.containsName("Treacherous Link")) {
|
if (Iterables.any(auras, CardPredicates.nameEquals("Treacherous Link"))) {
|
||||||
this.getController().addDamage(damageIn, source);
|
this.getController().addDamage(damageIn, source);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,15 +59,6 @@ public class CardList extends ArrayList<Card> {
|
|||||||
return new CardList(Iterables.filter(this, filt));
|
return new CardList(Iterables.filter(this, filt));
|
||||||
}
|
}
|
||||||
|
|
||||||
public final boolean containsName(final String name) {
|
|
||||||
return Iterables.any(this, CardPredicates.nameEquals(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
public final CardList getController(final Player player) {
|
|
||||||
return this.filter(CardPredicates.isController(player));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// cardType is like "Land" or "Goblin", returns a new CardList that is a
|
// cardType is like "Land" or "Goblin", returns a new CardList that is a
|
||||||
// subset of current CardList
|
// subset of current CardList
|
||||||
public final CardList getType(final String cardType) {
|
public final CardList getType(final String cardType) {
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import java.util.List;
|
|||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
|
|
||||||
import forge.card.cardfactory.CardFactoryUtil;
|
import forge.card.cardfactory.CardFactoryUtil;
|
||||||
|
import forge.game.player.Player;
|
||||||
import forge.util.Aggregates;
|
import forge.util.Aggregates;
|
||||||
import forge.util.MyRandom;
|
import forge.util.MyRandom;
|
||||||
|
|
||||||
@@ -295,4 +296,8 @@ public class CardListUtil {
|
|||||||
Collections.shuffle(list, MyRandom.getRandom());
|
Collections.shuffle(list, MyRandom.getRandom());
|
||||||
Collections.shuffle(list, MyRandom.getRandom());
|
Collections.shuffle(list, MyRandom.getRandom());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static CardList filterControlledBy(CardList cardList, Player player) {
|
||||||
|
return cardList.filter(CardPredicates.isController(player));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,10 +23,13 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
|
||||||
import forge.AllZone;
|
import forge.AllZone;
|
||||||
import forge.AllZoneUtil;
|
import forge.AllZoneUtil;
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
import forge.CardList;
|
import forge.CardList;
|
||||||
|
import forge.CardPredicates;
|
||||||
import forge.CardUtil;
|
import forge.CardUtil;
|
||||||
import forge.Command;
|
import forge.Command;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
@@ -368,7 +371,7 @@ public final class AbilityFactoryAnimate {
|
|||||||
// don't animate if the AI won't attack anyway
|
// don't animate if the AI won't attack anyway
|
||||||
if (Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(AllZone.getComputerPlayer())
|
if (Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(AllZone.getComputerPlayer())
|
||||||
&& AllZone.getComputerPlayer().getLife() < 6 && AllZone.getHumanPlayer().getLife() > 6
|
&& AllZone.getComputerPlayer().getLife() < 6 && AllZone.getHumanPlayer().getLife() > 6
|
||||||
&& !AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield).getType("Creature").isEmpty()) {
|
&& Iterables.any(AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -399,7 +399,7 @@ public class AbilityFactoryAttach {
|
|||||||
}
|
}
|
||||||
// Some ChangeType cards are beneficial, and PrefPlayer should be
|
// Some ChangeType cards are beneficial, and PrefPlayer should be
|
||||||
// changed to represent that
|
// changed to represent that
|
||||||
final CardList prefList = list.getController(prefPlayer);
|
final CardList prefList = CardListUtil.filterControlledBy(list, prefPlayer);
|
||||||
|
|
||||||
// If there are no preferred cards, and not mandatory bail out
|
// If there are no preferred cards, and not mandatory bail out
|
||||||
if (prefList.size() == 0) {
|
if (prefList.size() == 0) {
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import forge.CardListUtil;
|
|||||||
import forge.CardPredicates;
|
import forge.CardPredicates;
|
||||||
import forge.CardPredicates.Presets;
|
import forge.CardPredicates.Presets;
|
||||||
import forge.CardUtil;
|
import forge.CardUtil;
|
||||||
|
import forge.Constant;
|
||||||
import forge.GameActionUtil;
|
import forge.GameActionUtil;
|
||||||
import forge.GameEntity;
|
import forge.GameEntity;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
@@ -1356,34 +1357,15 @@ public final class AbilityFactoryChangeZone {
|
|||||||
*/
|
*/
|
||||||
private static Card basicManaFixing(final CardList list) { // Search for a
|
private static Card basicManaFixing(final CardList list) { // Search for a
|
||||||
// Basic Land
|
// Basic Land
|
||||||
return AbilityFactoryChangeZone.basicManaFixing(list, "Plains, Island, Swamp, Mountain, Forest");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* basicManaFixing.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param list
|
|
||||||
* a {@link forge.CardList} object.
|
|
||||||
* @param type
|
|
||||||
* a {@link java.lang.String} object.
|
|
||||||
* @return a {@link forge.Card} object.
|
|
||||||
*/
|
|
||||||
private static Card basicManaFixing(CardList list, final String type) { // type
|
|
||||||
// =
|
|
||||||
// basic
|
|
||||||
// land
|
|
||||||
// types
|
|
||||||
final CardList combined = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
final CardList combined = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||||
combined.addAll(AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand));
|
combined.addAll(AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand));
|
||||||
|
|
||||||
final String[] names = type.split(",");
|
|
||||||
final ArrayList<String> basics = new ArrayList<String>();
|
final ArrayList<String> basics = new ArrayList<String>();
|
||||||
|
|
||||||
// what types can I go get?
|
// what types can I go get?
|
||||||
for (final String name : names) {
|
for (final String name : Constant.Color.BASIC_LANDS) {
|
||||||
if (list.getType(name).size() != 0) {
|
if (!list.getType(name).isEmpty()) {
|
||||||
basics.add(name);
|
basics.add(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1402,11 +1384,12 @@ public final class AbilityFactoryChangeZone {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<Card> result = list;
|
||||||
if (minType != null) {
|
if (minType != null) {
|
||||||
list = list.getType(minType);
|
result = list.getType(minType);
|
||||||
}
|
}
|
||||||
|
|
||||||
return list.get(0);
|
return result.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1665,7 +1648,7 @@ public final class AbilityFactoryChangeZone {
|
|||||||
if (origin.equals(ZoneType.Battlefield)) {
|
if (origin.equals(ZoneType.Battlefield)) {
|
||||||
// filter out untargetables
|
// filter out untargetables
|
||||||
list = list.getTargetableCards(sa);
|
list = list.getTargetableCards(sa);
|
||||||
CardList aiPermanents = list.getController(AllZone.getComputerPlayer());
|
CardList aiPermanents = CardListUtil.filterControlledBy(list, AllZone.getComputerPlayer());
|
||||||
|
|
||||||
// Don't blink cards that will die.
|
// Don't blink cards that will die.
|
||||||
aiPermanents = aiPermanents.filter(new Predicate<Card>() {
|
aiPermanents = aiPermanents.filter(new Predicate<Card>() {
|
||||||
@@ -1736,7 +1719,7 @@ public final class AbilityFactoryChangeZone {
|
|||||||
} else if (origin.equals(ZoneType.Graveyard)) {
|
} else if (origin.equals(ZoneType.Graveyard)) {
|
||||||
if (destination.equals(ZoneType.Hand)) {
|
if (destination.equals(ZoneType.Hand)) {
|
||||||
// only retrieve cards from computer graveyard
|
// only retrieve cards from computer graveyard
|
||||||
list = list.getController(AllZone.getComputerPlayer());
|
list = CardListUtil.filterControlledBy(list, AllZone.getComputerPlayer());
|
||||||
System.out.println("changeZone:" + list);
|
System.out.println("changeZone:" + list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1761,7 +1744,7 @@ public final class AbilityFactoryChangeZone {
|
|||||||
&& AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer()).isEmpty()) {
|
&& AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer()).isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
list = list.getController(AllZone.getHumanPlayer());
|
list = CardListUtil.filterControlledBy(list, AllZone.getHumanPlayer());
|
||||||
list = list.filter(new Predicate<Card>() {
|
list = list.filter(new Predicate<Card>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(final Card c) {
|
public boolean apply(final Card c) {
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import forge.AllZone;
|
|||||||
import forge.AllZoneUtil;
|
import forge.AllZoneUtil;
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
import forge.CardList;
|
import forge.CardList;
|
||||||
|
import forge.CardListUtil;
|
||||||
import forge.CardPredicates;
|
import forge.CardPredicates;
|
||||||
import forge.CardPredicates.Presets;
|
import forge.CardPredicates.Presets;
|
||||||
import forge.CardUtil;
|
import forge.CardUtil;
|
||||||
@@ -389,13 +390,11 @@ public final class AbilityFactoryChoose {
|
|||||||
chosen = CardFactoryUtil.getMostProminentCreatureType(AllZone.getHumanPlayer()
|
chosen = CardFactoryUtil.getMostProminentCreatureType(AllZone.getHumanPlayer()
|
||||||
.getCardsIn(ZoneType.Battlefield));
|
.getCardsIn(ZoneType.Battlefield));
|
||||||
if (!CardUtil.isACreatureType(chosen) || invalidTypes.contains(chosen)) {
|
if (!CardUtil.isACreatureType(chosen) || invalidTypes.contains(chosen)) {
|
||||||
chosen = CardFactoryUtil.getMostProminentCreatureType(AllZoneUtil.getCardsInGame()
|
chosen = CardFactoryUtil.getMostProminentCreatureType(CardListUtil.filterControlledBy(AllZoneUtil.getCardsInGame(), AllZone.getHumanPlayer()));
|
||||||
.getController(AllZone.getHumanPlayer()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (logic.equals("MostProminentInComputerDeck")) {
|
if (logic.equals("MostProminentInComputerDeck")) {
|
||||||
chosen = CardFactoryUtil.getMostProminentCreatureType(AllZoneUtil.getCardsInGame()
|
chosen = CardFactoryUtil.getMostProminentCreatureType(CardListUtil.filterControlledBy(AllZoneUtil.getCardsInGame(), AllZone.getComputerPlayer()));
|
||||||
.getController(AllZone.getComputerPlayer()));
|
|
||||||
}
|
}
|
||||||
if (logic.equals("MostProminentInComputerGraveyard")) {
|
if (logic.equals("MostProminentInComputerGraveyard")) {
|
||||||
chosen = CardFactoryUtil.getMostProminentCreatureType(AllZone.getComputerPlayer()
|
chosen = CardFactoryUtil.getMostProminentCreatureType(AllZone.getComputerPlayer()
|
||||||
@@ -726,11 +725,9 @@ public final class AbilityFactoryChoose {
|
|||||||
if (params.containsKey("AILogic")) {
|
if (params.containsKey("AILogic")) {
|
||||||
final String logic = params.get("AILogic");
|
final String logic = params.get("AILogic");
|
||||||
if (logic.equals("MostProminentInHumanDeck")) {
|
if (logic.equals("MostProminentInHumanDeck")) {
|
||||||
chosen = CardFactoryUtil.getMostProminentColor(AllZoneUtil.getCardsInGame().getController(
|
chosen = CardFactoryUtil.getMostProminentColor(CardListUtil.filterControlledBy(AllZoneUtil.getCardsInGame(), AllZone.getHumanPlayer()));
|
||||||
AllZone.getHumanPlayer()));
|
|
||||||
} else if (logic.equals("MostProminentInComputerDeck")) {
|
} else if (logic.equals("MostProminentInComputerDeck")) {
|
||||||
chosen = CardFactoryUtil.getMostProminentColor(AllZoneUtil.getCardsInGame().getController(
|
chosen = CardFactoryUtil.getMostProminentColor(CardListUtil.filterControlledBy(AllZoneUtil.getCardsInGame(), AllZone.getComputerPlayer()));
|
||||||
AllZone.getComputerPlayer()));
|
|
||||||
}
|
}
|
||||||
else if (logic.equals("MostProminentInGame")) {
|
else if (logic.equals("MostProminentInGame")) {
|
||||||
chosen = CardFactoryUtil.getMostProminentColor(AllZoneUtil.getCardsInGame());
|
chosen = CardFactoryUtil.getMostProminentColor(AllZoneUtil.getCardsInGame());
|
||||||
@@ -738,7 +735,7 @@ public final class AbilityFactoryChoose {
|
|||||||
else if (logic.equals("MostProminentHumanCreatures")) {
|
else if (logic.equals("MostProminentHumanCreatures")) {
|
||||||
CardList list = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
CardList list = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
list = AllZoneUtil.getCardsInGame().getController(AllZone.getHumanPlayer())
|
list = CardListUtil.filterControlledBy(AllZoneUtil.getCardsInGame(), AllZone.getHumanPlayer())
|
||||||
.filter(CardPredicates.Presets.CREATURES);
|
.filter(CardPredicates.Presets.CREATURES);
|
||||||
}
|
}
|
||||||
chosen = CardFactoryUtil.getMostProminentColor(list);
|
chosen = CardFactoryUtil.getMostProminentColor(list);
|
||||||
@@ -1644,7 +1641,7 @@ public final class AbilityFactoryChoose {
|
|||||||
.getCardsIn(ZoneType.Library));
|
.getCardsIn(ZoneType.Library));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CardList list = AllZoneUtil.getCardsInGame().getController(AllZone.getHumanPlayer());
|
CardList list = CardListUtil.filterControlledBy(AllZoneUtil.getCardsInGame(), AllZone.getHumanPlayer());
|
||||||
list = list.filter(Predicates.not(Presets.LANDS));
|
list = list.filter(Predicates.not(Presets.LANDS));
|
||||||
if (!list.isEmpty()) {
|
if (!list.isEmpty()) {
|
||||||
chosen = list.get(0).getName();
|
chosen = list.get(0).getName();
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import forge.AllZone;
|
|||||||
import forge.AllZoneUtil;
|
import forge.AllZoneUtil;
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
import forge.CardList;
|
import forge.CardList;
|
||||||
|
import forge.CardListUtil;
|
||||||
import forge.Counters;
|
import forge.Counters;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.card.cardfactory.CardFactoryUtil;
|
import forge.card.cardfactory.CardFactoryUtil;
|
||||||
@@ -1898,8 +1899,8 @@ public class AbilityFactoryCounters {
|
|||||||
|
|
||||||
tgt.addTarget(pl);
|
tgt.addTarget(pl);
|
||||||
|
|
||||||
hList = hList.getController(pl);
|
hList = CardListUtil.filterControlledBy(hList, pl);
|
||||||
cList = cList.getController(pl);
|
cList = CardListUtil.filterControlledBy(cList, pl);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO improve X value to don't overpay when extra mana won't do
|
// TODO improve X value to don't overpay when extra mana won't do
|
||||||
@@ -2011,7 +2012,7 @@ public class AbilityFactoryCounters {
|
|||||||
final Target tgt = sa.getTarget();
|
final Target tgt = sa.getTarget();
|
||||||
if (tgt != null) {
|
if (tgt != null) {
|
||||||
final Player pl = sa.getTargetPlayer();
|
final Player pl = sa.getTargetPlayer();
|
||||||
cards = cards.getController(pl);
|
cards = CardListUtil.filterControlledBy(cards, pl);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final Card tgtCard : cards) {
|
for (final Card tgtCard : cards) {
|
||||||
@@ -2266,7 +2267,7 @@ public class AbilityFactoryCounters {
|
|||||||
final Target tgt = sa.getTarget();
|
final Target tgt = sa.getTarget();
|
||||||
if (tgt != null) {
|
if (tgt != null) {
|
||||||
final Player pl = sa.getTargetPlayer();
|
final Player pl = sa.getTargetPlayer();
|
||||||
cards = cards.getController(pl);
|
cards = CardListUtil.filterControlledBy(cards, pl);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final Card tgtCard : cards) {
|
for (final Card tgtCard : cards) {
|
||||||
|
|||||||
@@ -22,11 +22,14 @@ import java.util.HashMap;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
|
||||||
import forge.AllZone;
|
import forge.AllZone;
|
||||||
import forge.AllZoneUtil;
|
import forge.AllZoneUtil;
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
import forge.CardList;
|
import forge.CardList;
|
||||||
|
import forge.CardListUtil;
|
||||||
|
import forge.CardPredicates;
|
||||||
import forge.CardUtil;
|
import forge.CardUtil;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.card.cardfactory.CardFactoryUtil;
|
import forge.card.cardfactory.CardFactoryUtil;
|
||||||
@@ -462,7 +465,7 @@ public class AbilityFactoryDealDamage {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// burn Planeswalkers
|
// burn Planeswalkers
|
||||||
if (!human.getCardsIn(ZoneType.Battlefield).getType("Planeswalker").isEmpty()) {
|
if (Iterables.any(human.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.PLANEWALKERS)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1360,7 +1363,7 @@ public class AbilityFactoryDealDamage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (targetPlayer != null) {
|
if (targetPlayer != null) {
|
||||||
list = list.getController(targetPlayer);
|
list = CardListUtil.filterControlledBy(list, targetPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
list = AbilityFactory.filterListByType(list, params.get("ValidCards"), sa);
|
list = AbilityFactory.filterListByType(list, params.get("ValidCards"), sa);
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import forge.AllZone;
|
|||||||
import forge.AllZoneUtil;
|
import forge.AllZoneUtil;
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
import forge.CardList;
|
import forge.CardList;
|
||||||
|
import forge.CardListUtil;
|
||||||
import forge.Command;
|
import forge.Command;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.card.cardfactory.CardFactoryUtil;
|
import forge.card.cardfactory.CardFactoryUtil;
|
||||||
@@ -490,8 +491,8 @@ public final class AbilityFactoryDebuff {
|
|||||||
list.remove(c);
|
list.remove(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
final CardList pref = list.getController(AllZone.getHumanPlayer());
|
final CardList pref = CardListUtil.filterControlledBy(list, AllZone.getHumanPlayer());
|
||||||
final CardList forced = list.getController(AllZone.getComputerPlayer());
|
final CardList forced = CardListUtil.filterControlledBy(list, AllZone.getComputerPlayer());
|
||||||
final Card source = sa.getSourceCard();
|
final Card source = sa.getSourceCard();
|
||||||
|
|
||||||
while (tgt.getNumTargeted() < tgt.getMaxTargets(source, sa)) {
|
while (tgt.getNumTargeted() < tgt.getMaxTargets(source, sa)) {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import forge.AllZone;
|
|||||||
import forge.AllZoneUtil;
|
import forge.AllZoneUtil;
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
import forge.CardList;
|
import forge.CardList;
|
||||||
|
import forge.CardListUtil;
|
||||||
import forge.CardUtil;
|
import forge.CardUtil;
|
||||||
import forge.Counters;
|
import forge.Counters;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
@@ -318,7 +319,7 @@ public class AbilityFactoryDestroy {
|
|||||||
if (params.containsKey("Defined")) {
|
if (params.containsKey("Defined")) {
|
||||||
list = new CardList(AbilityFactory.getDefinedCards(af.getHostCard(), params.get("Defined"), sa));
|
list = new CardList(AbilityFactory.getDefinedCards(af.getHostCard(), params.get("Defined"), sa));
|
||||||
if (list.isEmpty()
|
if (list.isEmpty()
|
||||||
|| !list.getController(AllZone.getComputerPlayer()).isEmpty()
|
|| !CardListUtil.filterControlledBy(list, AllZone.getComputerPlayer()).isEmpty()
|
||||||
|| list.getNotKeyword("Indestructible").isEmpty()) {
|
|| list.getNotKeyword("Indestructible").isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -387,7 +388,7 @@ public class AbilityFactoryDestroy {
|
|||||||
tgt.resetTargets();
|
tgt.resetTargets();
|
||||||
|
|
||||||
CardList preferred = list.getNotKeyword("Indestructible");
|
CardList preferred = list.getNotKeyword("Indestructible");
|
||||||
preferred = preferred.getController(AllZone.getHumanPlayer());
|
preferred = CardListUtil.filterControlledBy(preferred, AllZone.getHumanPlayer());
|
||||||
|
|
||||||
// If NoRegen is not set, filter out creatures that have a
|
// If NoRegen is not set, filter out creatures that have a
|
||||||
// regeneration shield
|
// regeneration shield
|
||||||
@@ -1040,7 +1041,7 @@ public class AbilityFactoryDestroy {
|
|||||||
CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||||
|
|
||||||
if (targetPlayer != null) {
|
if (targetPlayer != null) {
|
||||||
list = list.getController(targetPlayer);
|
list = CardListUtil.filterControlledBy(list, targetPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
list = AbilityFactory.filterListByType(list, valid, sa);
|
list = AbilityFactory.filterListByType(list, valid, sa);
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import forge.AllZone;
|
|||||||
import forge.AllZoneUtil;
|
import forge.AllZoneUtil;
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
import forge.CardList;
|
import forge.CardList;
|
||||||
|
import forge.CardListUtil;
|
||||||
import forge.Command;
|
import forge.Command;
|
||||||
import forge.GameEntity;
|
import forge.GameEntity;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
@@ -559,8 +560,7 @@ public class AbilityFactoryGainControl {
|
|||||||
private boolean gainControlDrawbackAI(final SpellAbility sa) {
|
private boolean gainControlDrawbackAI(final SpellAbility sa) {
|
||||||
if ((sa.getTarget() == null) || !sa.getTarget().doesTarget()) {
|
if ((sa.getTarget() == null) || !sa.getTarget().doesTarget()) {
|
||||||
if (this.params.containsKey("AllValid")) {
|
if (this.params.containsKey("AllValid")) {
|
||||||
CardList tgtCards = AllZoneUtil.getCardsIn(ZoneType.Battlefield)
|
CardList tgtCards = CardListUtil.filterControlledBy(AllZoneUtil.getCardsIn(ZoneType.Battlefield), AllZone.getHumanPlayer());
|
||||||
.getController(AllZone.getHumanPlayer());
|
|
||||||
tgtCards = AbilityFactory.filterListByType(tgtCards, this.params.get("AllValid"), sa);
|
tgtCards = AbilityFactory.filterListByType(tgtCards, this.params.get("AllValid"), sa);
|
||||||
if (tgtCards.isEmpty()) {
|
if (tgtCards.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -22,10 +22,15 @@ import java.util.HashMap;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import com.google.common.base.Predicate;
|
||||||
|
import com.google.common.base.Predicates;
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
|
||||||
import forge.AllZone;
|
import forge.AllZone;
|
||||||
import forge.AllZoneUtil;
|
import forge.AllZoneUtil;
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
import forge.CardList;
|
import forge.CardList;
|
||||||
|
import forge.CardPredicates;
|
||||||
import forge.Constant;
|
import forge.Constant;
|
||||||
import forge.Counters;
|
import forge.Counters;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
@@ -995,9 +1000,9 @@ public class AbilityFactoryMana {
|
|||||||
*/
|
*/
|
||||||
private static boolean hasUrzaLands(final Player p) {
|
private static boolean hasUrzaLands(final Player p) {
|
||||||
final CardList landsControlled = p.getCardsIn(ZoneType.Battlefield);
|
final CardList landsControlled = p.getCardsIn(ZoneType.Battlefield);
|
||||||
|
return Iterables.any(landsControlled, CardPredicates.nameEquals("Urza's Mine")) &&
|
||||||
return (landsControlled.containsName("Urza's Mine") && landsControlled.containsName("Urza's Tower") && landsControlled
|
Iterables.any(landsControlled, CardPredicates.nameEquals("Urza's Tower")) &&
|
||||||
.containsName("Urza's Power Plant"));
|
Iterables.any(landsControlled, CardPredicates.nameEquals("Urza's Power Plant"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ****************************************
|
// ****************************************
|
||||||
|
|||||||
@@ -459,7 +459,7 @@ public class AbilityFactoryPreventDamage {
|
|||||||
// filter AIs battlefield by what I can target
|
// filter AIs battlefield by what I can target
|
||||||
CardList targetables = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
CardList targetables = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||||
targetables = targetables.getValidCards(tgt.getValidTgts(), AllZone.getComputerPlayer(), hostCard);
|
targetables = targetables.getValidCards(tgt.getValidTgts(), AllZone.getComputerPlayer(), hostCard);
|
||||||
final CardList compTargetables = targetables.getController(AllZone.getComputerPlayer());
|
final CardList compTargetables = CardListUtil.filterControlledBy(targetables, AllZone.getComputerPlayer());
|
||||||
|
|
||||||
if (targetables.size() == 0) {
|
if (targetables.size() == 0) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import forge.AllZone;
|
|||||||
import forge.AllZoneUtil;
|
import forge.AllZoneUtil;
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
import forge.CardList;
|
import forge.CardList;
|
||||||
|
import forge.CardListUtil;
|
||||||
import forge.CardUtil;
|
import forge.CardUtil;
|
||||||
import forge.Command;
|
import forge.Command;
|
||||||
import forge.Constant;
|
import forge.Constant;
|
||||||
@@ -482,7 +483,7 @@ public final class AbilityFactoryProtection {
|
|||||||
list.remove(c);
|
list.remove(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
CardList pref = list.getController(AllZone.getComputerPlayer());
|
CardList pref = CardListUtil.filterControlledBy(list, AllZone.getComputerPlayer());
|
||||||
pref = pref.filter(new Predicate<Card>() {
|
pref = pref.filter(new Predicate<Card>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(final Card c) {
|
public boolean apply(final Card c) {
|
||||||
@@ -490,7 +491,7 @@ public final class AbilityFactoryProtection {
|
|||||||
AbilityFactoryProtection.getProtectionList(host, params));
|
AbilityFactoryProtection.getProtectionList(host, params));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
final CardList pref2 = list.getController(AllZone.getComputerPlayer());
|
final CardList pref2 = CardListUtil.filterControlledBy(list, AllZone.getComputerPlayer());
|
||||||
pref = pref.filter(new Predicate<Card>() {
|
pref = pref.filter(new Predicate<Card>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(final Card c) {
|
public boolean apply(final Card c) {
|
||||||
@@ -498,7 +499,7 @@ public final class AbilityFactoryProtection {
|
|||||||
AbilityFactoryProtection.getProtectionList(host, params));
|
AbilityFactoryProtection.getProtectionList(host, params));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
final CardList forced = list.getController(AllZone.getHumanPlayer());
|
final CardList forced = CardListUtil.filterControlledBy(list, AllZone.getHumanPlayer());
|
||||||
final Card source = sa.getSourceCard();
|
final Card source = sa.getSourceCard();
|
||||||
|
|
||||||
while (tgt.getNumTargeted() < tgt.getMaxTargets(source, sa)) {
|
while (tgt.getNumTargeted() < tgt.getMaxTargets(source, sa)) {
|
||||||
@@ -743,7 +744,7 @@ public final class AbilityFactoryProtection {
|
|||||||
if (logic.equals("MostProminentHumanCreatures")) {
|
if (logic.equals("MostProminentHumanCreatures")) {
|
||||||
CardList list = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
CardList list = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
list = AllZoneUtil.getCardsInGame().getController(AllZone.getHumanPlayer());
|
list = CardListUtil.filterControlledBy(AllZoneUtil.getCardsInGame(), AllZone.getHumanPlayer());
|
||||||
}
|
}
|
||||||
if (!list.isEmpty()) {
|
if (!list.isEmpty()) {
|
||||||
choice = CardFactoryUtil.getMostProminentColor(list);
|
choice = CardFactoryUtil.getMostProminentColor(list);
|
||||||
|
|||||||
@@ -1075,11 +1075,11 @@ public class AbilityFactoryPump {
|
|||||||
final Card source = sa.getSourceCard();
|
final Card source = sa.getSourceCard();
|
||||||
|
|
||||||
if (af.isCurse()) {
|
if (af.isCurse()) {
|
||||||
pref = list.getController(AllZone.getHumanPlayer());
|
pref = CardListUtil.filterControlledBy(list, AllZone.getHumanPlayer());
|
||||||
forced = list.getController(AllZone.getComputerPlayer());
|
forced = CardListUtil.filterControlledBy(list, AllZone.getComputerPlayer());
|
||||||
} else {
|
} else {
|
||||||
pref = list.getController(AllZone.getComputerPlayer());
|
pref = CardListUtil.filterControlledBy(list, AllZone.getComputerPlayer());
|
||||||
forced = list.getController(AllZone.getHumanPlayer());
|
forced = CardListUtil.filterControlledBy(list, AllZone.getHumanPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
while (tgt.getNumTargeted() < tgt.getMaxTargets(source, sa)) {
|
while (tgt.getNumTargeted() < tgt.getMaxTargets(source, sa)) {
|
||||||
|
|||||||
@@ -419,7 +419,7 @@ public class AbilityFactoryRegenerate {
|
|||||||
// filter AIs battlefield by what I can target
|
// filter AIs battlefield by what I can target
|
||||||
CardList targetables = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
CardList targetables = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||||
targetables = targetables.getValidCards(tgt.getValidTgts(), AllZone.getComputerPlayer(), hostCard);
|
targetables = targetables.getValidCards(tgt.getValidTgts(), AllZone.getComputerPlayer(), hostCard);
|
||||||
final CardList compTargetables = targetables.getController(AllZone.getComputerPlayer());
|
final CardList compTargetables = CardListUtil.filterControlledBy(targetables, AllZone.getComputerPlayer());
|
||||||
|
|
||||||
if (targetables.size() == 0) {
|
if (targetables.size() == 0) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import forge.AllZoneUtil;
|
|||||||
import forge.Card;
|
import forge.Card;
|
||||||
import forge.CardCharacteristicName;
|
import forge.CardCharacteristicName;
|
||||||
import forge.CardList;
|
import forge.CardList;
|
||||||
|
import forge.CardListUtil;
|
||||||
import forge.card.spellability.AbilityActivated;
|
import forge.card.spellability.AbilityActivated;
|
||||||
import forge.card.spellability.AbilitySub;
|
import forge.card.spellability.AbilitySub;
|
||||||
import forge.card.spellability.Spell;
|
import forge.card.spellability.Spell;
|
||||||
@@ -472,7 +473,7 @@ public class AbilityFactorySetState {
|
|||||||
CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||||
|
|
||||||
if (targetPlayer != null) {
|
if (targetPlayer != null) {
|
||||||
list = list.getController(targetPlayer);
|
list = CardListUtil.filterControlledBy(list, targetPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
list = AbilityFactory.filterListByType(list, valid, sa);
|
list = AbilityFactory.filterListByType(list, valid, sa);
|
||||||
|
|||||||
@@ -1021,8 +1021,7 @@ public class CardFactorySorceries {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Actually put everything on the battlefield
|
// Actually put everything on the battlefield
|
||||||
CardList bidded = AllZoneUtil.getCardsIn(ZoneType.Graveyard);
|
CardList bidded = AllZoneUtil.getCardsIn(ZoneType.Graveyard).filter(CardPredicates.Presets.CREATURES);
|
||||||
bidded = bidded.getType("Creature");
|
|
||||||
for (final Card c : bidded) {
|
for (final Card c : bidded) {
|
||||||
if (c.isType(input[1]) || (!input[0].equals("") && c.isType(input[0]))) {
|
if (c.isType(input[1]) || (!input[0].equals("") && c.isType(input[0]))) {
|
||||||
Singletons.getModel().getGameAction().moveToPlay(c);
|
Singletons.getModel().getGameAction().moveToPlay(c);
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ public class CardFactoryUtil {
|
|||||||
|
|
||||||
// Add all cost of all auras with the same controller
|
// Add all cost of all auras with the same controller
|
||||||
final CardList auras = new CardList(card.getEnchantedBy());
|
final CardList auras = new CardList(card.getEnchantedBy());
|
||||||
auras.getController(card.getController());
|
CardListUtil.filterControlledBy(auras, card.getController());
|
||||||
curCMC += CardListUtil.sumCMC(auras) + auras.size();
|
curCMC += CardListUtil.sumCMC(auras) + auras.size();
|
||||||
|
|
||||||
if (curCMC >= bigCMC) {
|
if (curCMC >= bigCMC) {
|
||||||
@@ -4151,7 +4151,7 @@ public class CardFactoryUtil {
|
|||||||
AllZone.getInputControl().setInput(target);
|
AllZone.getInputControl().setInput(target);
|
||||||
} else {
|
} else {
|
||||||
// AI choosing what to haunt
|
// AI choosing what to haunt
|
||||||
final CardList oppCreats = creats.getController(AllZone.getHumanPlayer());
|
final CardList oppCreats = CardListUtil.filterControlledBy(creats, AllZone.getHumanPlayer());
|
||||||
if (oppCreats.size() != 0) {
|
if (oppCreats.size() != 0) {
|
||||||
haunterDiesWork.setTargetCard(CardFactoryUtil.getWorstCreatureAI(oppCreats));
|
haunterDiesWork.setTargetCard(CardFactoryUtil.getWorstCreatureAI(oppCreats));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import java.util.Random;
|
|||||||
import forge.AllZone;
|
import forge.AllZone;
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
import forge.CardList;
|
import forge.CardList;
|
||||||
|
import forge.CardListUtil;
|
||||||
import forge.Counters;
|
import forge.Counters;
|
||||||
import forge.card.abilityfactory.AbilityFactory;
|
import forge.card.abilityfactory.AbilityFactory;
|
||||||
import forge.card.mana.ManaCost;
|
import forge.card.mana.ManaCost;
|
||||||
@@ -77,7 +78,7 @@ public class CostUtil {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
CardList auras = new CardList(source.getEnchantedBy());
|
CardList auras = new CardList(source.getEnchantedBy());
|
||||||
if (!auras.getController(source.getController()).isEmpty()) {
|
if (!CardListUtil.filterControlledBy(auras, source.getController()).isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import forge.AllZone;
|
|||||||
import forge.AllZoneUtil;
|
import forge.AllZoneUtil;
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
import forge.CardList;
|
import forge.CardList;
|
||||||
|
import forge.CardListUtil;
|
||||||
import forge.card.abilityfactory.AbilityFactory;
|
import forge.card.abilityfactory.AbilityFactory;
|
||||||
import forge.control.input.Input;
|
import forge.control.input.Input;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
@@ -293,11 +294,11 @@ public class TargetSelection {
|
|||||||
|
|
||||||
// If all cards must be from the same zone
|
// If all cards must be from the same zone
|
||||||
if (tgt.isSingleZone() && !targeted.isEmpty()) {
|
if (tgt.isSingleZone() && !targeted.isEmpty()) {
|
||||||
choices = choices.getController(targeted.get(0).getController());
|
choices = CardListUtil.filterControlledBy(choices, targeted.get(0).getController());
|
||||||
}
|
}
|
||||||
// If all cards must be from different zones
|
// If all cards must be from different zones
|
||||||
if (tgt.isDifferentZone() && !targeted.isEmpty()) {
|
if (tgt.isDifferentZone() && !targeted.isEmpty()) {
|
||||||
choices = choices.getController(targeted.get(0).getController().getOpponent());
|
choices = CardListUtil.filterControlledBy(choices, targeted.get(0).getController().getOpponent());
|
||||||
}
|
}
|
||||||
// If the cards can't share a creature type
|
// If the cards can't share a creature type
|
||||||
if (tgt.isWithoutSameCreatureType() && !targeted.isEmpty()) {
|
if (tgt.isWithoutSameCreatureType() && !targeted.isEmpty()) {
|
||||||
@@ -314,7 +315,7 @@ public class TargetSelection {
|
|||||||
ArrayList<Player> pl = AbilityFactory.getDefinedPlayers(card, tgt.getDefinedController(), this.ability);
|
ArrayList<Player> pl = AbilityFactory.getDefinedPlayers(card, tgt.getDefinedController(), this.ability);
|
||||||
if (pl != null && !pl.isEmpty()) {
|
if (pl != null && !pl.isEmpty()) {
|
||||||
Player controller = pl.get(0);
|
Player controller = pl.get(0);
|
||||||
choices = choices.getController(controller);
|
choices = CardListUtil.filterControlledBy(choices, controller);
|
||||||
} else {
|
} else {
|
||||||
choices.clear();
|
choices.clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import forge.AllZone;
|
|||||||
import forge.AllZoneUtil;
|
import forge.AllZoneUtil;
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
import forge.CardList;
|
import forge.CardList;
|
||||||
|
import forge.CardListUtil;
|
||||||
import forge.Command;
|
import forge.Command;
|
||||||
import forge.CommandArgs;
|
import forge.CommandArgs;
|
||||||
import forge.GameActionUtil;
|
import forge.GameActionUtil;
|
||||||
@@ -315,7 +316,7 @@ public class TriggerHandler {
|
|||||||
|
|
||||||
// AP
|
// AP
|
||||||
allCards = playerAP.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES);
|
allCards = playerAP.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES);
|
||||||
allCards.addAll(AllZoneUtil.getCardsIn(ZoneType.Stack).getController(playerAP));
|
allCards.addAll(CardListUtil.filterControlledBy(AllZoneUtil.getCardsIn(ZoneType.Stack), playerAP));
|
||||||
// add cards that move to hidden zones
|
// add cards that move to hidden zones
|
||||||
if (runParams.containsKey("Destination") && runParams.containsKey("Card")) {
|
if (runParams.containsKey("Destination") && runParams.containsKey("Card")) {
|
||||||
Card card = (Card) runParams.get("Card");
|
Card card = (Card) runParams.get("Card");
|
||||||
@@ -341,7 +342,7 @@ public class TriggerHandler {
|
|||||||
|
|
||||||
// NAP
|
// NAP
|
||||||
allCards = playerAP.getOpponent().getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES);
|
allCards = playerAP.getOpponent().getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES);
|
||||||
allCards.addAll(AllZoneUtil.getCardsIn(ZoneType.Stack).getController(playerAP.getOpponent()));
|
allCards.addAll(CardListUtil.filterControlledBy(AllZoneUtil.getCardsIn(ZoneType.Stack), playerAP.getOpponent()));
|
||||||
// add cards that move to hidden zones
|
// add cards that move to hidden zones
|
||||||
if (runParams.containsKey("Destination") && runParams.containsKey("Card")) {
|
if (runParams.containsKey("Destination") && runParams.containsKey("Card")) {
|
||||||
Card card = (Card) runParams.get("Card");
|
Card card = (Card) runParams.get("Card");
|
||||||
|
|||||||
@@ -2026,7 +2026,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
|||||||
final Ability ability = new Ability(oathList.get(0), "0") {
|
final Ability ability = new Ability(oathList.get(0), "0") {
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
final CardList graveyardCreatures = player.getCardsIn(ZoneType.Graveyard).getType("Creature");
|
final CardList graveyardCreatures = player.getCardsIn(ZoneType.Graveyard).filter(CardPredicates.Presets.CREATURES);
|
||||||
|
|
||||||
if (AllZoneUtil.compareTypeAmountInGraveyard(player, "Creature") > 0) {
|
if (AllZoneUtil.compareTypeAmountInGraveyard(player, "Creature") > 0) {
|
||||||
if (player.isHuman()) {
|
if (player.isHuman()) {
|
||||||
|
|||||||
@@ -1354,7 +1354,7 @@ public class ComputerUtil {
|
|||||||
}
|
}
|
||||||
if (c.isType("Legendary") && !c.getName().equals("Flagstones of Trokair")) {
|
if (c.isType("Legendary") && !c.getName().equals("Flagstones of Trokair")) {
|
||||||
final CardList list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
final CardList list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||||
if (list.containsName(c.getName())) {
|
if (Iterables.any(list, CardPredicates.nameEquals(c.getName()))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1366,7 +1366,7 @@ public class ComputerUtil {
|
|||||||
final CardList hand = AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand);
|
final CardList hand = AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand);
|
||||||
CardList lands = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
CardList lands = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||||
lands.addAll(hand);
|
lands.addAll(hand);
|
||||||
lands = lands.getType("Land");
|
lands = lands.filter(CardPredicates.Presets.LANDS);
|
||||||
int maxCmcInHand = Aggregates.max(hand, CardPredicates.Accessors.fnGetCmc);
|
int maxCmcInHand = Aggregates.max(hand, CardPredicates.Accessors.fnGetCmc);
|
||||||
for (final SpellAbility sa : spellAbilities) {
|
for (final SpellAbility sa : spellAbilities) {
|
||||||
if (sa.isCycling()) {
|
if (sa.isCycling()) {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import forge.AllZone;
|
|||||||
import forge.AllZoneUtil;
|
import forge.AllZoneUtil;
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
import forge.CardList;
|
import forge.CardList;
|
||||||
|
import forge.CardListUtil;
|
||||||
import forge.CardPredicates.Presets;
|
import forge.CardPredicates.Presets;
|
||||||
import forge.Command;
|
import forge.Command;
|
||||||
import forge.GameActionUtil;
|
import forge.GameActionUtil;
|
||||||
@@ -941,7 +942,7 @@ public class MagicStack extends MyObservable {
|
|||||||
AllZone.getInputControl().setInput(target);
|
AllZone.getInputControl().setInput(target);
|
||||||
} else {
|
} else {
|
||||||
// AI choosing what to haunt
|
// AI choosing what to haunt
|
||||||
final CardList oppCreats = creats.getController(AllZone.getHumanPlayer());
|
final CardList oppCreats = CardListUtil.filterControlledBy(creats, AllZone.getHumanPlayer());
|
||||||
if (oppCreats.size() != 0) {
|
if (oppCreats.size() != 0) {
|
||||||
haunterDiesWork.setTargetCard(CardFactoryUtil.getWorstCreatureAI(oppCreats));
|
haunterDiesWork.setTargetCard(CardFactoryUtil.getWorstCreatureAI(oppCreats));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user