mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
- More getCards read-only list errors.
This commit is contained in:
@@ -1244,7 +1244,6 @@ public final class AbilityFactoryChangeZone {
|
||||
|
||||
// Does AI need a land?
|
||||
List<Card> hand = ai.getCardsIn(ZoneType.Hand);
|
||||
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) {
|
||||
@@ -1388,7 +1387,7 @@ public final class AbilityFactoryChangeZone {
|
||||
private static Card basicManaFixing(final Player ai, final List<Card> list) { // Search for a
|
||||
// Basic Land
|
||||
|
||||
final List<Card> combined = ai.getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> combined = new ArrayList<Card>(ai.getCardsIn(ZoneType.Battlefield));
|
||||
combined.addAll(ai.getCardsIn(ZoneType.Hand));
|
||||
|
||||
final ArrayList<String> basics = new ArrayList<String>();
|
||||
@@ -1586,7 +1585,7 @@ public final class AbilityFactoryChangeZone {
|
||||
}
|
||||
// don't return something to your hand if your hand is full of good stuff
|
||||
if (destination.equals(ZoneType.Hand) && origin.equals(ZoneType.Graveyard)) {
|
||||
int handSize = ai.getCardsIn(ZoneType.Hand).size();
|
||||
final int handSize = ai.getCardsIn(ZoneType.Hand).size();
|
||||
if (Singletons.getModel().getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN1)) {
|
||||
return false;
|
||||
}
|
||||
@@ -2596,8 +2595,7 @@ public final class AbilityFactoryChangeZone {
|
||||
// ex. "Return all blocking/blocked by target creature"
|
||||
|
||||
final Player opp = ai.getOpponent();
|
||||
List<Card> humanType = opp.getCardsIn(origin);
|
||||
humanType = AbilityFactory.filterListByType(humanType, params.get("ChangeType"), sa);
|
||||
final List<Card> humanType = AbilityFactory.filterListByType(opp.getCardsIn(origin), params.get("ChangeType"), sa);
|
||||
List<Card> computerType = ai.getCardsIn(origin);
|
||||
computerType = AbilityFactory.filterListByType(computerType, params.get("ChangeType"), sa);
|
||||
final Target tgt = sa.getTarget();
|
||||
@@ -2762,8 +2760,7 @@ public final class AbilityFactoryChangeZone {
|
||||
final ZoneType origin = ZoneType.smartValueOf(params.get("Origin"));
|
||||
|
||||
final Player opp = ai.getOpponent();
|
||||
List<Card> humanType = opp.getCardsIn(origin);
|
||||
humanType = AbilityFactory.filterListByType(humanType, params.get("ChangeType"), sa);
|
||||
final List<Card> humanType = AbilityFactory.filterListByType(opp.getCardsIn(origin), params.get("ChangeType"), sa);
|
||||
List<Card> computerType = ai.getCardsIn(origin);
|
||||
computerType = AbilityFactory.filterListByType(computerType, params.get("ChangeType"), sa);
|
||||
|
||||
|
||||
@@ -527,8 +527,7 @@ public class AbilityFactoryDealDamage {
|
||||
final Target tgt = saMe.getTarget();
|
||||
final Card source = saMe.getSourceCard();
|
||||
final HashMap<String, String> params = this.abilityFactory.getMapParams();
|
||||
List<Card> hPlay = pl.getCardsIn(ZoneType.Battlefield);
|
||||
hPlay = CardLists.getValidCards(hPlay, tgt.getValidTgts(), ai, source);
|
||||
List<Card> hPlay = CardLists.getValidCards(pl.getCardsIn(ZoneType.Battlefield), tgt.getValidTgts(), ai, source);
|
||||
|
||||
final ArrayList<Object> objects = tgt.getTargets();
|
||||
if (params.containsKey("TargetUnique")) {
|
||||
@@ -1254,8 +1253,8 @@ public class AbilityFactoryDealDamage {
|
||||
}
|
||||
|
||||
// TODO: X may be something different than X paid
|
||||
List<Card> list = player.getCardsIn(ZoneType.Battlefield);
|
||||
list = CardLists.getValidCards(list, validC.split(","), source.getController(), source);
|
||||
List<Card> list =
|
||||
CardLists.getValidCards(player.getCardsIn(ZoneType.Battlefield), validC.split(","), source.getController(), source);
|
||||
|
||||
final Predicate<Card> filterKillable = new Predicate<Card>() {
|
||||
@Override
|
||||
|
||||
@@ -811,10 +811,8 @@ public final class AbilityFactoryDebuff {
|
||||
valid = params.get("ValidCards");
|
||||
}
|
||||
|
||||
List<Card> comp = ai.getCardsIn(ZoneType.Battlefield);
|
||||
comp = CardLists.getValidCards(comp, valid, hostCard.getController(), hostCard);
|
||||
List<Card> human = opp.getCardsIn(ZoneType.Battlefield);
|
||||
human = CardLists.getValidCards(human, valid, hostCard.getController(), hostCard);
|
||||
List<Card> comp = CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), valid, hostCard.getController(), hostCard);
|
||||
List<Card> human = CardLists.getValidCards(opp.getCardsIn(ZoneType.Battlefield), valid, hostCard.getController(), hostCard);
|
||||
|
||||
// TODO - add blocking situations here also
|
||||
|
||||
|
||||
@@ -246,8 +246,7 @@ public class AbilityFactoryDestroy {
|
||||
// Targeting
|
||||
if (abTgt != null) {
|
||||
abTgt.resetTargets();
|
||||
list = ai.getOpponent().getCardsIn(ZoneType.Battlefield);
|
||||
list = CardLists.getTargetableCards(list, sa);
|
||||
list = CardLists.getTargetableCards(ai.getOpponent().getCardsIn(ZoneType.Battlefield), sa);
|
||||
list = CardLists.getValidCards(list, abTgt.getValidTgts(), source.getController(), source);
|
||||
if (params.containsKey("AITgts")) {
|
||||
list = CardLists.getValidCards(list, params.get("AITgts"), sa.getActivatingPlayer(), source);
|
||||
@@ -846,21 +845,22 @@ public class AbilityFactoryDestroy {
|
||||
final HashMap<String, String> params = af.getMapParams();
|
||||
final Target tgt = sa.getTarget();
|
||||
String valid = "";
|
||||
if (mandatory) {
|
||||
return true;
|
||||
}
|
||||
if (params.containsKey("ValidCards")) {
|
||||
valid = params.get("ValidCards");
|
||||
}
|
||||
List<Card> humanlist = ai.getOpponent().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> computerlist = ai.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> humanlist =
|
||||
CardLists.getValidCards(ai.getOpponent().getCardsIn(ZoneType.Battlefield), valid.split(","), source.getController(), source);
|
||||
List<Card> computerlist =
|
||||
CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), valid.split(","), source.getController(), source);
|
||||
if (sa.getTarget() != null) {
|
||||
tgt.resetTargets();
|
||||
sa.getTarget().addTarget(ai.getOpponent());
|
||||
computerlist.clear();
|
||||
}
|
||||
if (mandatory) {
|
||||
return true;
|
||||
}
|
||||
humanlist = CardLists.getValidCards(humanlist, valid.split(","), source.getController(), source);
|
||||
computerlist = CardLists.getValidCards(computerlist, valid.split(","), source.getController(), source);
|
||||
|
||||
humanlist = CardLists.filter(humanlist, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
@@ -930,20 +930,18 @@ public class AbilityFactoryDestroy {
|
||||
valid = valid.replace("X", Integer.toString(xPay));
|
||||
}
|
||||
|
||||
List<Card> humanlist = ai.getOpponent().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> computerlist = ai.getCardsIn(ZoneType.Battlefield);
|
||||
|
||||
final Target tgt = sa.getTarget();
|
||||
|
||||
List<Card> humanlist =
|
||||
CardLists.getValidCards(ai.getOpponent().getCardsIn(ZoneType.Battlefield), valid.split(","), source.getController(), source);
|
||||
List<Card> computerlist =
|
||||
CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), valid.split(","), source.getController(), source);
|
||||
if (sa.getTarget() != null) {
|
||||
tgt.resetTargets();
|
||||
sa.getTarget().addTarget(ai.getOpponent());
|
||||
computerlist.clear();
|
||||
}
|
||||
|
||||
humanlist = CardLists.getValidCards(humanlist, valid.split(","), source.getController(), source);
|
||||
computerlist = CardLists.getValidCards(computerlist, valid.split(","), source.getController(), source);
|
||||
|
||||
humanlist = CardLists.filter(humanlist, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
|
||||
@@ -334,8 +334,8 @@ public class AbilityFactoryGainControl {
|
||||
}
|
||||
}
|
||||
|
||||
List<Card> list = opp.getCardsIn(ZoneType.Battlefield);
|
||||
list = CardLists.getValidCards(list, tgt.getValidTgts(), sa.getSourceCard().getController(), sa.getSourceCard());
|
||||
List<Card> list =
|
||||
CardLists.getValidCards(opp.getCardsIn(ZoneType.Battlefield), tgt.getValidTgts(), sa.getActivatingPlayer(), sa.getSourceCard());
|
||||
// AI won't try to grab cards that are filtered out of AI decks on
|
||||
// purpose
|
||||
list = CardLists.filter(list, new Predicate<Card>() {
|
||||
@@ -854,8 +854,8 @@ public class AbilityFactoryGainControl {
|
||||
final Target tgt = sa.getTarget();
|
||||
tgt.resetTargets();
|
||||
|
||||
List<Card> list = ai.getOpponent().getCardsIn(ZoneType.Battlefield);
|
||||
list = CardLists.getValidCards(list, tgt.getValidTgts(), ai, sa.getSourceCard());
|
||||
List<Card> list =
|
||||
CardLists.getValidCards(ai.getOpponent().getCardsIn(ZoneType.Battlefield), tgt.getValidTgts(), ai, sa.getSourceCard());
|
||||
// AI won't try to grab cards that are filtered out of AI decks on
|
||||
// purpose
|
||||
list = CardLists.filter(list, new Predicate<Card>() {
|
||||
|
||||
@@ -1328,8 +1328,8 @@ public class AbilityFactoryZoneAffecting {
|
||||
}
|
||||
|
||||
if (mode.equals("NotRemembered")) {
|
||||
List<Card> dPHand = p.getCardsIn(ZoneType.Hand);
|
||||
dPHand = CardLists.getValidCards(dPHand, "Card.IsNotRemembered", source.getController(), source);
|
||||
final List<Card> dPHand =
|
||||
CardLists.getValidCards(p.getCardsIn(ZoneType.Hand), "Card.IsNotRemembered", source.getController(), source);
|
||||
for (final Card c : dPHand) {
|
||||
p.discard(c, sa);
|
||||
discarded.add(c);
|
||||
@@ -1395,7 +1395,7 @@ public class AbilityFactoryZoneAffecting {
|
||||
} else if (mode.equals("RevealYouChoose") || mode.equals("RevealOppChoose") || mode.equals("TgtChoose")) {
|
||||
// Is Reveal you choose right? I think the wrong player is
|
||||
// being used?
|
||||
List<Card> dPHand = p.getCardsIn(ZoneType.Hand);
|
||||
List<Card> dPHand = new ArrayList<Card>(p.getCardsIn(ZoneType.Hand));
|
||||
if (dPHand.size() != 0) {
|
||||
if (params.containsKey("RevealNumber")) {
|
||||
String amountString = params.get("RevealNumber");
|
||||
@@ -1717,7 +1717,7 @@ public class AbilityFactoryZoneAffecting {
|
||||
private static boolean discardTargetAI(final Player ai, final AbilityFactory af, final SpellAbility sa) {
|
||||
final Target tgt = sa.getTarget();
|
||||
Player opp = ai.getOpponent();
|
||||
if (opp.getCardsIn(ZoneType.Hand).size() < 1) {
|
||||
if (opp.getCardsIn(ZoneType.Hand).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
if (tgt != null) {
|
||||
|
||||
@@ -118,7 +118,7 @@ public class CardFactoryCreatures {
|
||||
|
||||
@Override
|
||||
public boolean canPlayAI() {
|
||||
List<Card> perms = getActivatingPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> perms = new ArrayList<Card>(getActivatingPlayer().getCardsIn(ZoneType.Battlefield));
|
||||
perms = CardLists.filter(CardLists.getTargetableCards(perms, this), new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
@@ -155,7 +155,8 @@ public class CardFactoryCreatures {
|
||||
@Override
|
||||
public void execute() {
|
||||
|
||||
final List<Card> artifacts = CardLists.filter(card.getController().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.ARTIFACTS);
|
||||
final List<Card> artifacts =
|
||||
CardLists.filter(card.getController().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.ARTIFACTS);
|
||||
if (card.getController().isHuman()) {
|
||||
|
||||
|
||||
@@ -419,7 +420,7 @@ public class CardFactoryCreatures {
|
||||
return false;
|
||||
}
|
||||
|
||||
List<Card> targetables = getActivatingPlayer().getOpponent().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> targetables = new ArrayList<Card>(getActivatingPlayer().getOpponent().getCardsIn(ZoneType.Battlefield));
|
||||
|
||||
targetables = CardLists.filter(CardLists.getTargetableCards(targetables, this), new Predicate<Card>() {
|
||||
@Override
|
||||
@@ -587,15 +588,15 @@ public class CardFactoryCreatures {
|
||||
} // resolve()
|
||||
|
||||
public int countKithkin() {
|
||||
List<Card> kithkin = card.getController().getCardsIn(ZoneType.Battlefield);
|
||||
kithkin = CardLists.filter(kithkin, new Predicate<Card>() {
|
||||
final List<Card> kithkin =
|
||||
CardLists.filter(card.getController().getCardsIn(ZoneType.Battlefield), new Predicate<Card>() {
|
||||
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
return (c.isType("Kithkin")) && !c.equals(card);
|
||||
}
|
||||
|
||||
});
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
return (c.isType("Kithkin")) && !c.equals(card);
|
||||
}
|
||||
|
||||
});
|
||||
return kithkin.size();
|
||||
|
||||
}
|
||||
@@ -713,7 +714,7 @@ public class CardFactoryCreatures {
|
||||
}
|
||||
|
||||
// Get rid of Planeswalkers:
|
||||
list = ai.getOpponent().getCardsIn(ZoneType.Battlefield);
|
||||
list = new ArrayList<Card>(ai.getOpponent().getCardsIn(ZoneType.Battlefield));
|
||||
list = CardLists.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card crd) {
|
||||
@@ -757,8 +758,8 @@ public class CardFactoryCreatures {
|
||||
int intermSumPower = 0;
|
||||
int intermSumToughness = 0;
|
||||
// intermSumPower = intermSumToughness = 0;
|
||||
List<Card> creats = card.getController().getCardsIn(ZoneType.Graveyard);
|
||||
creats = CardLists.filter(creats, new Predicate<Card>() {
|
||||
List<Card> creats =
|
||||
CardLists.filter(card.getController().getCardsIn(ZoneType.Graveyard), new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
return c.isCreature() && !c.equals(card);
|
||||
|
||||
@@ -164,7 +164,7 @@ public class CardFactoryInstants {
|
||||
}
|
||||
|
||||
public void computerResolve() {
|
||||
final List<Card> list = card.getController().getCardsIn(ZoneType.Library);
|
||||
final List<Card> list = new ArrayList<Card>(card.getController().getCardsIn(ZoneType.Library));
|
||||
final List<Card> selectedCards = new ArrayList<Card>();
|
||||
|
||||
// pick best creature
|
||||
|
||||
@@ -279,8 +279,7 @@ class CardFactoryLands {
|
||||
}
|
||||
|
||||
public void computerExecute() {
|
||||
List<Card> hand = card.getController().getCardsIn(ZoneType.Hand);
|
||||
hand = CardLists.getType(hand, type);
|
||||
List<Card> hand = CardLists.getType(card.getController().getCardsIn(ZoneType.Hand), type);
|
||||
if (hand.size() > 0) {
|
||||
this.revealCard(hand.get(0));
|
||||
} else {
|
||||
|
||||
@@ -4732,8 +4732,8 @@ public class CardFactoryUtil {
|
||||
public void execute() {
|
||||
// Target as Modular is Destroyed
|
||||
if (card.getController().isComputer()) {
|
||||
List<Card> choices = card.getController().getCardsIn(ZoneType.Battlefield);
|
||||
choices = CardLists.filter(choices, new Predicate<Card>() {
|
||||
List<Card> choices =
|
||||
CardLists.filter(card.getController().getCardsIn(ZoneType.Battlefield), new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
return c.isCreature() && c.isArtifact();
|
||||
|
||||
@@ -157,7 +157,7 @@ public class CostExile extends CostPartWithList {
|
||||
typeList.add(Singletons.getModel().getGame().getStack().peekAbility(i).getSourceCard());
|
||||
}
|
||||
} else {
|
||||
typeList = activator.getCardsIn(this.getFrom());
|
||||
typeList = new ArrayList<Card>(activator.getCardsIn(this.getFrom()));
|
||||
}
|
||||
if (!this.getThis()) {
|
||||
typeList = CardLists.getValidCards(typeList, this.getType().split(";"), activator, source);
|
||||
|
||||
@@ -217,7 +217,8 @@ public class CostPutCounter extends CostPartWithList {
|
||||
c = AbilityFactory.calculateAmount(source, this.getAmount(), ability);
|
||||
}
|
||||
|
||||
final List<Card> typeList = CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), this.getType().split(";"), ai, source);
|
||||
final List<Card> typeList =
|
||||
CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), this.getType().split(";"), ai, source);
|
||||
|
||||
Card card = null;
|
||||
if (this.getType().equals("Creature.YouCtrl")) {
|
||||
|
||||
@@ -289,7 +289,8 @@ public class CostRemoveCounter extends CostPartWithList {
|
||||
|
||||
if (!this.getThis()) {
|
||||
this.getList().clear();
|
||||
final List<Card> typeList = CardLists.getValidCards(ai.getCardsIn(this.getZone()), this.getType().split(";"), ai, source);
|
||||
final List<Card> typeList =
|
||||
CardLists.getValidCards(ai.getCardsIn(this.getZone()), this.getType().split(";"), ai, source);
|
||||
for (Card card : typeList) {
|
||||
if (card.getCounters(this.getCounter()) >= c) {
|
||||
this.addToList(card);
|
||||
|
||||
@@ -64,7 +64,7 @@ public class CostReveal extends CostPartWithList {
|
||||
*/
|
||||
@Override
|
||||
public final boolean canPay(final SpellAbility ability, final Card source, final Player activator, final Cost cost) {
|
||||
List<Card> handList = activator.getCardsIn(ZoneType.Hand);
|
||||
List<Card> handList = new ArrayList<Card>(activator.getCardsIn(ZoneType.Hand));
|
||||
final String type = this.getType();
|
||||
final Integer amount = this.convertAmount();
|
||||
|
||||
@@ -109,7 +109,7 @@ public class CostReveal extends CostPartWithList {
|
||||
|
||||
this.getList().add(source);
|
||||
} else if (this.getType().equals("Hand")) {
|
||||
this.setList(ai.getCardsIn(ZoneType.Hand));
|
||||
this.setList(new ArrayList<Card>(ai.getCardsIn(ZoneType.Hand)));
|
||||
return true;
|
||||
} else {
|
||||
hand = CardLists.getValidCards(hand, type.split(";"), ai, source);
|
||||
|
||||
@@ -191,8 +191,8 @@ public class CostTapType extends CostPartWithList {
|
||||
if (c == null) {
|
||||
final String sVar = ability.getSVar(amount);
|
||||
if (sVar.equals("XChoice")) {
|
||||
List<Card> typeList = ai.getCardsIn(ZoneType.Battlefield);
|
||||
typeList = CardLists.getValidCards(typeList, this.getType().split(";"), ability.getActivatingPlayer(), ability.getSourceCard());
|
||||
List<Card> typeList =
|
||||
CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), this.getType().split(";"), ability.getActivatingPlayer(), ability.getSourceCard());
|
||||
typeList = CardLists.filter(typeList, Presets.UNTAPPED);
|
||||
c = typeList.size();
|
||||
source.setSVar("ChosenX", "Number$" + Integer.toString(c));
|
||||
|
||||
@@ -83,8 +83,8 @@ public class CostUtil {
|
||||
continue;
|
||||
}
|
||||
|
||||
List<Card> typeList = ai.getCardsIn(ZoneType.Battlefield);
|
||||
typeList = CardLists.getValidCards(typeList, type.split(","), source.getController(), source);
|
||||
final List<Card> typeList =
|
||||
CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), type.split(","), source.getController(), source);
|
||||
if (ComputerUtil.getCardPreference(ai, source, "SacCost", typeList) == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -118,8 +118,7 @@ public class CostUtil {
|
||||
continue;
|
||||
}
|
||||
|
||||
List<Card> typeList = ai.getCardsIn(ZoneType.Battlefield);
|
||||
typeList = CardLists.getValidCards(typeList, type.split(","), source.getController(), source);
|
||||
final List<Card> typeList = CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), type.split(","), source.getController(), source);
|
||||
if (ComputerUtil.getCardPreference(ai, source, "SacCost", typeList) == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -212,11 +211,10 @@ public class CostUtil {
|
||||
final CostDiscard disc = (CostDiscard) part;
|
||||
|
||||
final String type = disc.getType();
|
||||
List<Card> typeList = ai.getCardsIn(ZoneType.Hand);
|
||||
final List<Card> typeList = CardLists.getValidCards(ai.getCardsIn(ZoneType.Hand), type.split(","), source.getController(), source);
|
||||
if (typeList.size() > ai.getMaxHandSize()) {
|
||||
continue;
|
||||
}
|
||||
typeList = CardLists.getValidCards(typeList, type.split(","), source.getController(), source);
|
||||
if (ComputerUtil.getCardPreference(ai, source, "DiscardCost", typeList) == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -120,8 +120,8 @@ public class Combat {
|
||||
private void fillDefenderMaps(final Player defender) {
|
||||
this.defenders.add(defender);
|
||||
this.defenderMap.put(defender, new ArrayList<Card>());
|
||||
List<Card> planeswalkers = defender.getCardsIn(ZoneType.Battlefield);
|
||||
planeswalkers = CardLists.filter(planeswalkers, CardPredicates.Presets.PLANEWALKERS);
|
||||
List<Card> planeswalkers =
|
||||
CardLists.filter(defender.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.PLANEWALKERS);
|
||||
for (final Card pw : planeswalkers) {
|
||||
this.defenders.add(pw);
|
||||
this.defenderMap.put(pw, new ArrayList<Card>());
|
||||
|
||||
@@ -229,7 +229,7 @@ public class EndOfTurn extends Phase implements java.io.Serializable {
|
||||
private static void endOfTurnLighthouseChronologist() {
|
||||
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
|
||||
final Player opponent = player.getOpponent();
|
||||
List<Card> list = opponent.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = new ArrayList<Card>(opponent.getCardsIn(ZoneType.Battlefield));
|
||||
|
||||
list = CardLists.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
|
||||
@@ -111,7 +111,7 @@ public class Untap extends Phase implements java.io.Serializable {
|
||||
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
|
||||
final Predicate<Card> tappedCanUntap = Predicates.and(Presets.TAPPED, Presets.CANUNTAP);
|
||||
|
||||
List<Card> list = player.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = new ArrayList<Card>(player.getCardsIn(ZoneType.Battlefield));
|
||||
|
||||
for (final Card c : list) {
|
||||
if (c.getBounceAtUntap() && c.getName().contains("Undiscovered Paradise")) {
|
||||
@@ -185,7 +185,7 @@ public class Untap extends Phase implements java.io.Serializable {
|
||||
}
|
||||
|
||||
// opponent untapping during your untap phase
|
||||
final List<Card> opp = player.getOpponent().getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> opp = new ArrayList<Card>(player.getOpponent().getCardsIn(ZoneType.Battlefield));
|
||||
for (final Card oppCard : opp) {
|
||||
if (oppCard.hasKeyword("CARDNAME untaps during each other player's untap step.")) {
|
||||
oppCard.untap();
|
||||
@@ -235,7 +235,7 @@ public class Untap extends Phase implements java.io.Serializable {
|
||||
if (Singletons.getModel().getGame().isCardInPlay("Damping Field") || Singletons.getModel().getGame().isCardInPlay("Imi Statue")) {
|
||||
final Player turnOwner = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
|
||||
if (turnOwner.isComputer()) {
|
||||
List<Card> artList = turnOwner.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> artList = new ArrayList<Card>(turnOwner.getCardsIn(ZoneType.Battlefield));
|
||||
artList = CardLists.filter(artList, Presets.ARTIFACTS);
|
||||
artList = CardLists.filter(artList, tappedCanUntap);
|
||||
if (artList.size() > 0) {
|
||||
@@ -265,7 +265,7 @@ public class Untap extends Phase implements java.io.Serializable {
|
||||
}
|
||||
} // selectCard()
|
||||
}; // Input
|
||||
List<Card> artList = turnOwner.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> artList = new ArrayList<Card>(turnOwner.getCardsIn(ZoneType.Battlefield));
|
||||
artList = CardLists.filter(artList, Presets.ARTIFACTS);
|
||||
artList = CardLists.filter(artList, tappedCanUntap);
|
||||
if (artList.size() > 0) {
|
||||
@@ -304,8 +304,7 @@ public class Untap extends Phase implements java.io.Serializable {
|
||||
}
|
||||
} // selectCard()
|
||||
}; // Input
|
||||
List<Card> creatures = player.getCreaturesInPlay();
|
||||
creatures = CardLists.filter(creatures, tappedCanUntap);
|
||||
final List<Card> creatures = CardLists.filter(player.getCreaturesInPlay(), tappedCanUntap);
|
||||
if (creatures.size() > 0) {
|
||||
Singletons.getModel().getMatch().getInput().setInput(target);
|
||||
}
|
||||
|
||||
@@ -1460,8 +1460,8 @@ public class ComputerUtil {
|
||||
*/
|
||||
public static List<Card> chooseSacrificeType(final Player ai, final String type, final Card activate, final Card target,
|
||||
final int amount) {
|
||||
List<Card> typeList = ai.getCardsIn(ZoneType.Battlefield);
|
||||
typeList = CardLists.getValidCards(typeList, type.split(";"), activate.getController(), activate);
|
||||
List<Card> typeList =
|
||||
CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), type.split(";"), activate.getController(), activate);
|
||||
if (ai.hasKeyword("You can't sacrifice creatures to cast spells or activate abilities.")) {
|
||||
typeList = CardLists.getNotType(typeList, "Creature");
|
||||
}
|
||||
@@ -1559,7 +1559,7 @@ public class ComputerUtil {
|
||||
if (hand.size() <= 0) {
|
||||
continue;
|
||||
}
|
||||
List<Card> aiCards = ai.getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> aiCards = ai.getCardsIn(ZoneType.Battlefield);
|
||||
final int numLandsInPlay = Iterables.size(Iterables.filter(aiCards, CardPredicates.Presets.LANDS));
|
||||
final List<Card> landsInHand = CardLists.filter(hand, CardPredicates.Presets.LANDS);
|
||||
final int numLandsInHand = landsInHand.size();
|
||||
@@ -1619,8 +1619,7 @@ public class ComputerUtil {
|
||||
typeList = CardLists.getValidCards(typeList, type.split(","), activate.getController(), activate);
|
||||
}
|
||||
} else {
|
||||
typeList = ai.getCardsIn(zone);
|
||||
typeList = CardLists.getValidCards(typeList, type.split(","), activate.getController(), activate);
|
||||
typeList = CardLists.getValidCards(ai.getCardsIn(zone), 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
|
||||
@@ -1655,8 +1654,8 @@ public class ComputerUtil {
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public static List<Card> chooseTapType(final Player ai, final String type, final Card activate, final boolean tap, final int amount) {
|
||||
List<Card> typeList = ai.getCardsIn(ZoneType.Battlefield);
|
||||
typeList = CardLists.getValidCards(typeList, type.split(","), activate.getController(), activate);
|
||||
List<Card> typeList =
|
||||
CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), type.split(","), activate.getController(), activate);
|
||||
|
||||
// is this needed?
|
||||
typeList = CardLists.filter(typeList, Presets.UNTAPPED);
|
||||
@@ -1695,8 +1694,8 @@ public class ComputerUtil {
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public static List<Card> chooseUntapType(final Player ai, final String type, final Card activate, final boolean untap, final int amount) {
|
||||
List<Card> typeList = ai.getCardsIn(ZoneType.Battlefield);
|
||||
typeList = CardLists.getValidCards(typeList, type.split(","), activate.getController(), activate);
|
||||
List<Card> typeList =
|
||||
CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), type.split(","), activate.getController(), activate);
|
||||
|
||||
// is this needed?
|
||||
typeList = CardLists.filter(typeList, Presets.TAPPED);
|
||||
@@ -1735,14 +1734,10 @@ public class ComputerUtil {
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public static List<Card> chooseReturnType(final Player ai, final String type, final Card activate, final Card target, final int amount) {
|
||||
List<Card> typeList = ai.getCardsIn(ZoneType.Battlefield);
|
||||
typeList = CardLists.getValidCards(typeList, type.split(","), activate.getController(), activate);
|
||||
final List<Card> typeList =
|
||||
CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), type.split(","), activate.getController(), activate);
|
||||
if ((target != null) && target.getController().isComputer() && typeList.contains(target)) {
|
||||
// bounce
|
||||
// the
|
||||
// card
|
||||
// we're
|
||||
// pumping
|
||||
// don't bounce the card we're pumping
|
||||
typeList.remove(target);
|
||||
}
|
||||
|
||||
|
||||
@@ -831,15 +831,12 @@ public class ComputerUtilAttack {
|
||||
* @return a int.
|
||||
*/
|
||||
public final int countExaltedBonus(final Player player) {
|
||||
List<Card> list = player.getCardsIn(ZoneType.Battlefield);
|
||||
list = CardLists.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
return c.hasKeyword("Exalted");
|
||||
}
|
||||
});
|
||||
int bonus = 0;
|
||||
for (Card c : player.getCardsIn(ZoneType.Battlefield)) {
|
||||
bonus += c.getKeywordAmount("Exalted");
|
||||
}
|
||||
|
||||
return list.size();
|
||||
return bonus;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1599,7 +1599,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
* @return the card list
|
||||
*/
|
||||
public final List<Card> discardHand(final SpellAbility sa) {
|
||||
final List<Card> list = this.getCardsIn(ZoneType.Hand);
|
||||
final List<Card> list = new ArrayList<Card>(this.getCardsIn(ZoneType.Hand));
|
||||
this.discardRandom(list.size(), sa);
|
||||
return list;
|
||||
}
|
||||
@@ -1648,8 +1648,8 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
public final List<Card> discardRandom(final int num, final SpellAbility sa, final String valid) {
|
||||
final List<Card> discarded = new ArrayList<Card>();
|
||||
for (int i = 0; i < num; i++) {
|
||||
List<Card> list = this.getCardsIn(ZoneType.Hand);
|
||||
list = CardLists.getValidCards(list, valid, sa.getSourceCard().getController(), sa.getSourceCard());
|
||||
final List<Card> list =
|
||||
CardLists.getValidCards(this.getCardsIn(ZoneType.Hand), valid, sa.getSourceCard().getController(), sa.getSourceCard());
|
||||
if (list.size() != 0) {
|
||||
final Card disc = CardUtil.getRandom(list);
|
||||
discarded.add(disc);
|
||||
|
||||
@@ -126,7 +126,7 @@ public class ControlWinLose {
|
||||
continue; // not a loser
|
||||
}
|
||||
|
||||
List<Card> compAntes = loser.getCardsIn(ZoneType.Ante);
|
||||
List<Card> compAntes = new ArrayList<Card>(loser.getCardsIn(ZoneType.Ante));
|
||||
Deck cDeck = match.getPlayersDeck(loser.getLobbyPlayer());
|
||||
|
||||
for (Card c : compAntes) {
|
||||
|
||||
Reference in New Issue
Block a user