mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
CardList class replaced by java.util.(Array)List<Card>
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -12339,7 +12339,6 @@ 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/CardList.java svneol=native#text/plain
|
||||
src/main/java/forge/CardListUtil.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
|
||||
|
||||
@@ -44,15 +44,15 @@ public abstract class AllZoneUtil {
|
||||
*
|
||||
* @param zone
|
||||
* Constant.Zone
|
||||
* @return a CardList with all cards currently in a graveyard
|
||||
* @return a List<Card> with all cards currently in a graveyard
|
||||
*/
|
||||
public static CardList getCardsIn(final ZoneType zone) {
|
||||
final CardList cards = new CardList();
|
||||
public static List<Card> getCardsIn(final ZoneType zone) {
|
||||
final List<Card> cards = new ArrayList<Card>();
|
||||
getCardsIn(zone, cards);
|
||||
return cards;
|
||||
}
|
||||
|
||||
private static void getCardsIn(final ZoneType zone, final CardList cards) {
|
||||
private static void getCardsIn(final ZoneType zone, final List<Card> cards) {
|
||||
if (zone == ZoneType.Stack) {
|
||||
cards.addAll(AllZone.getStackZone().getCards());
|
||||
} else {
|
||||
@@ -62,16 +62,16 @@ public abstract class AllZoneUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static CardList getCardsIn(final Iterable<ZoneType> zones) {
|
||||
final CardList cards = new CardList();
|
||||
public static List<Card> getCardsIn(final Iterable<ZoneType> zones) {
|
||||
final List<Card> cards = new ArrayList<Card>();
|
||||
for (final ZoneType z : zones) {
|
||||
getCardsIn(z, cards);
|
||||
}
|
||||
return cards;
|
||||
}
|
||||
|
||||
public static CardList getCardsIn(final ZoneType[] zones) {
|
||||
final CardList cards = new CardList();
|
||||
public static List<Card> getCardsIn(final ZoneType[] zones) {
|
||||
final List<Card> cards = new ArrayList<Card>();
|
||||
for (final ZoneType z : zones) {
|
||||
getCardsIn(z, cards);
|
||||
}
|
||||
@@ -86,22 +86,22 @@ public abstract class AllZoneUtil {
|
||||
* a Constant.Zone
|
||||
* @param cardName
|
||||
* a String
|
||||
* @return a CardList with all cards currently in a graveyard
|
||||
* @return a List<Card> with all cards currently in a graveyard
|
||||
*/
|
||||
public static CardList getCardsIn(final ZoneType zone, final String cardName) {
|
||||
public static List<Card> getCardsIn(final ZoneType zone, final String cardName) {
|
||||
return CardListUtil.filter(AllZoneUtil.getCardsIn(zone), CardPredicates.nameEquals(cardName));
|
||||
}
|
||||
|
||||
// ////////// Creatures
|
||||
|
||||
/**
|
||||
* use to get a CardList of all creatures on the battlefield for both.
|
||||
* use to get a List<Card> of all creatures on the battlefield for both.
|
||||
* players
|
||||
*
|
||||
* @return a CardList of all creatures on the battlefield on both sides
|
||||
* @return a List<Card> of all creatures on the battlefield on both sides
|
||||
*/
|
||||
public static CardList getCreaturesInPlay() {
|
||||
final CardList creats = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
public static List<Card> getCreaturesInPlay() {
|
||||
final List<Card> creats = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
return CardListUtil.filter(creats, Presets.CREATURES);
|
||||
}
|
||||
|
||||
@@ -110,10 +110,10 @@ public abstract class AllZoneUtil {
|
||||
*
|
||||
* @param player
|
||||
* the player to get creatures for
|
||||
* @return a CardList containing all creatures a given player has in play
|
||||
* @return a List<Card> containing all creatures a given player has in play
|
||||
*/
|
||||
public static CardList getCreaturesInPlay(final Player player) {
|
||||
final CardList creats = player.getCardsIn(ZoneType.Battlefield);
|
||||
public static List<Card> getCreaturesInPlay(final Player player) {
|
||||
final List<Card> creats = player.getCardsIn(ZoneType.Battlefield);
|
||||
return CardListUtil.filter(creats, Presets.CREATURES);
|
||||
}
|
||||
|
||||
@@ -124,18 +124,18 @@ public abstract class AllZoneUtil {
|
||||
*
|
||||
* @param player
|
||||
* the player whose lands we want to get
|
||||
* @return a CardList containing all lands the given player has in play
|
||||
* @return a List<Card> containing all lands the given player has in play
|
||||
*/
|
||||
public static CardList getPlayerLandsInPlay(final Player player) {
|
||||
public static List<Card> getPlayerLandsInPlay(final Player player) {
|
||||
return CardListUtil.filter(player.getCardsIn(ZoneType.Battlefield), Presets.LANDS);
|
||||
}
|
||||
|
||||
/**
|
||||
* gets a list of all lands in play.
|
||||
*
|
||||
* @return a CardList of all lands on the battlefield
|
||||
* @return a List<Card> of all lands on the battlefield
|
||||
*/
|
||||
public static CardList getLandsInPlay() {
|
||||
public static List<Card> getLandsInPlay() {
|
||||
return CardListUtil.filter(AllZoneUtil.getCardsIn(ZoneType.Battlefield), Presets.LANDS);
|
||||
}
|
||||
|
||||
@@ -215,10 +215,10 @@ public abstract class AllZoneUtil {
|
||||
*
|
||||
* @param color
|
||||
* the color of cards to get
|
||||
* @return a CardList of all cards in play of a given color
|
||||
* @return a List<Card> of all cards in play of a given color
|
||||
*/
|
||||
public static CardList getColorInPlay(final String color) {
|
||||
final CardList cards = AllZoneUtil.getPlayerColorInPlay(AllZone.getComputerPlayer(), color);
|
||||
public static List<Card> getColorInPlay(final String color) {
|
||||
final List<Card> cards = AllZoneUtil.getPlayerColorInPlay(AllZone.getComputerPlayer(), color);
|
||||
cards.addAll(AllZoneUtil.getPlayerColorInPlay(AllZone.getHumanPlayer(), color));
|
||||
return cards;
|
||||
}
|
||||
@@ -231,10 +231,10 @@ public abstract class AllZoneUtil {
|
||||
* the player's cards to get
|
||||
* @param color
|
||||
* the color of cards to get
|
||||
* @return a CardList of all cards in play of a given color
|
||||
* @return a List<Card> of all cards in play of a given color
|
||||
*/
|
||||
public static CardList getPlayerColorInPlay(final Player player, final String color) {
|
||||
CardList cards = player.getCardsIn(ZoneType.Battlefield);
|
||||
public static List<Card> getPlayerColorInPlay(final Player player, final String color) {
|
||||
List<Card> cards = player.getCardsIn(ZoneType.Battlefield);
|
||||
cards = CardListUtil.filter(cards, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card 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 CardList playerList = CardListUtil.getType(player.getCardsIn(ZoneType.Battlefield), type);
|
||||
final CardList opponentList = CardListUtil.getType(opponent.getCardsIn(ZoneType.Battlefield), type);
|
||||
final List<Card> playerList = CardListUtil.getType(player.getCardsIn(ZoneType.Battlefield), type);
|
||||
final List<Card> opponentList = CardListUtil.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 CardList playerList = CardListUtil.getType(player.getCardsIn(ZoneType.Graveyard), type);
|
||||
final CardList opponentList = CardListUtil.getType(opponent.getCardsIn(ZoneType.Graveyard), type);
|
||||
final List<Card> playerList = CardListUtil.getType(player.getCardsIn(ZoneType.Graveyard), type);
|
||||
final List<Card> opponentList = CardListUtil.getType(opponent.getCardsIn(ZoneType.Graveyard), type);
|
||||
return (playerList.size() - opponentList.size());
|
||||
}
|
||||
|
||||
@@ -309,8 +309,8 @@ public abstract class AllZoneUtil {
|
||||
* @return a {@link forge.CardList} with all cards in all Battlefields,
|
||||
* Hands, Graveyards, Libraries, and Exiles.
|
||||
*/
|
||||
public static CardList getCardsInGame() {
|
||||
final CardList all = new CardList();
|
||||
public static List<Card> getCardsInGame() {
|
||||
final List<Card> all = new ArrayList<Card>();
|
||||
for (final Player player : AllZone.getPlayersInGame()) {
|
||||
all.addAll(player.getZone(ZoneType.Graveyard).getCards());
|
||||
all.addAll(player.getZone(ZoneType.Hand).getCards());
|
||||
|
||||
@@ -113,14 +113,14 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
private final ArrayList<Object> rememberedObjects = new ArrayList<Object>();
|
||||
private final ArrayList<Card> imprintedCards = new ArrayList<Card>();
|
||||
private Card championedCard = null;
|
||||
private final CardList devouredCards = new CardList();
|
||||
private final List<Card> devouredCards = new ArrayList<Card>();
|
||||
|
||||
private Map<Card, Integer> receivedDamageFromThisTurn = new TreeMap<Card, Integer>();
|
||||
private Map<Card, Integer> dealtDamageToThisTurn = new TreeMap<Card, Integer>();
|
||||
private Map<String, Integer> dealtDamageToPlayerThisTurn = new TreeMap<String, Integer>();
|
||||
private final Map<Card, Integer> assignedDamageMap = new TreeMap<Card, Integer>();
|
||||
private CardList blockedThisTurn = null;
|
||||
private CardList blockedByThisTurn = null;
|
||||
private List<Card> blockedThisTurn = null;
|
||||
private List<Card> blockedByThisTurn = null;
|
||||
|
||||
private boolean startsGameInPlay = false;
|
||||
private boolean drawnThisTurn = false;
|
||||
@@ -575,9 +575,9 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
*
|
||||
* TODO Write javadoc for this method.
|
||||
*
|
||||
* @return a CardList object
|
||||
* @return a List<Card> object
|
||||
*/
|
||||
public final CardList getDevoured() {
|
||||
public final List<Card> getDevoured() {
|
||||
return this.devouredCards;
|
||||
}
|
||||
|
||||
@@ -941,7 +941,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
/**
|
||||
* @return the blockedThisTurn
|
||||
*/
|
||||
public CardList getBlockedThisTurn() {
|
||||
public List<Card> getBlockedThisTurn() {
|
||||
return blockedThisTurn;
|
||||
}
|
||||
|
||||
@@ -950,7 +950,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
*/
|
||||
public void addBlockedThisTurn(Card attacker) {
|
||||
if (this.blockedThisTurn == null) {
|
||||
this.blockedThisTurn = new CardList();
|
||||
this.blockedThisTurn = new ArrayList<Card>();
|
||||
}
|
||||
this.blockedThisTurn.add(attacker);
|
||||
}
|
||||
@@ -967,7 +967,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
/**
|
||||
* @return the blockedByThisTurn
|
||||
*/
|
||||
public CardList getBlockedByThisTurn() {
|
||||
public List<Card> getBlockedByThisTurn() {
|
||||
return blockedByThisTurn;
|
||||
}
|
||||
|
||||
@@ -976,7 +976,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
*/
|
||||
public void addBlockedByThisTurn(Card blocker) {
|
||||
if (this.blockedByThisTurn == null) {
|
||||
this.blockedByThisTurn = new CardList();
|
||||
this.blockedByThisTurn = new ArrayList<Card>();
|
||||
}
|
||||
this.blockedByThisTurn.add(blocker);
|
||||
}
|
||||
@@ -6546,7 +6546,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
}
|
||||
} else if (property.startsWith("ControllerControls")) {
|
||||
final String type = property.substring(18);
|
||||
final CardList list = this.getController().getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> list = this.getController().getCardsIn(ZoneType.Battlefield);
|
||||
if (CardListUtil.getType(list, type).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
@@ -6639,13 +6639,13 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
}
|
||||
}
|
||||
} else if (property.startsWith("Above")) { // "Are Above" Source
|
||||
final CardList list = this.getOwner().getCardsIn(ZoneType.Graveyard);
|
||||
final List<Card> list = this.getOwner().getCardsIn(ZoneType.Graveyard);
|
||||
if (list.indexOf(source) >= list.indexOf(this)) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("DirectlyAbove")) { // "Are Directly Above"
|
||||
// Source
|
||||
final CardList list = this.getOwner().getCardsIn(ZoneType.Graveyard);
|
||||
final List<Card> list = this.getOwner().getCardsIn(ZoneType.Graveyard);
|
||||
if (list.indexOf(this) - list.indexOf(source) != 1) {
|
||||
return false;
|
||||
}
|
||||
@@ -6656,18 +6656,18 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("TopGraveyard")) {
|
||||
final CardList list = this.getOwner().getCardsIn(ZoneType.Graveyard);
|
||||
final List<Card> list = this.getOwner().getCardsIn(ZoneType.Graveyard);
|
||||
Collections.reverse(list);
|
||||
if (list.isEmpty() || !this.equals(list.get(0))) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("BottomGraveyard")) {
|
||||
final CardList list = this.getOwner().getCardsIn(ZoneType.Graveyard);
|
||||
final List<Card> list = this.getOwner().getCardsIn(ZoneType.Graveyard);
|
||||
if (list.isEmpty() || !this.equals(list.get(0))) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("TopLibrary")) {
|
||||
final CardList list = this.getOwner().getCardsIn(ZoneType.Library);
|
||||
final List<Card> list = this.getOwner().getCardsIn(ZoneType.Library);
|
||||
if (list.isEmpty() || !this.equals(list.get(0))) {
|
||||
return false;
|
||||
}
|
||||
@@ -6691,7 +6691,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
} else {
|
||||
final String restriction = property.split("SharesColorWith ")[1];
|
||||
if (restriction.equals("TopCardOfLibrary")) {
|
||||
final CardList list = sourceController.getCardsIn(ZoneType.Library);
|
||||
final List<Card> list = sourceController.getCardsIn(ZoneType.Library);
|
||||
if (list.isEmpty() || !this.sharesColorWith(list.get(0))) {
|
||||
return false;
|
||||
}
|
||||
@@ -6721,7 +6721,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
} else {
|
||||
final String restriction = property.split("sharesCreatureTypeWith ")[1];
|
||||
if (restriction.equals("TopCardOfLibrary")) {
|
||||
final CardList list = sourceController.getCardsIn(ZoneType.Library);
|
||||
final List<Card> list = sourceController.getCardsIn(ZoneType.Library);
|
||||
if (list.isEmpty() || !this.sharesCreatureTypeWith(list.get(0))) {
|
||||
return false;
|
||||
}
|
||||
@@ -6771,7 +6771,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
} else {
|
||||
final String restriction = property.split("sharesNameWith ")[1];
|
||||
if (restriction.equals("YourGraveyard")) {
|
||||
final CardList list = sourceController.getCardsIn(ZoneType.Graveyard);
|
||||
final List<Card> list = sourceController.getCardsIn(ZoneType.Graveyard);
|
||||
if (list.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
@@ -6785,7 +6785,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
return false;
|
||||
}
|
||||
} else if (restriction.equals(ZoneType.Battlefield.toString())) {
|
||||
final CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
if (list.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
@@ -6799,7 +6799,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
return false;
|
||||
}
|
||||
} else if (restriction.equals("ThisTurnCast")) {
|
||||
final CardList list = CardUtil.getThisTurnCast("Card", source);
|
||||
final List<Card> list = CardUtil.getThisTurnCast("Card", source);
|
||||
if (list.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
@@ -6830,7 +6830,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
}
|
||||
|
||||
} else if (property.startsWith("SecondSpellCastThisTurn")) {
|
||||
final CardList list = CardUtil.getThisTurnCast("Card", source);
|
||||
final List<Card> list = CardUtil.getThisTurnCast("Card", source);
|
||||
if (list.size() < 2) {
|
||||
return false;
|
||||
}
|
||||
@@ -6969,28 +6969,28 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("greatestPower")) {
|
||||
final CardList list = AllZoneUtil.getCreaturesInPlay();
|
||||
final List<Card> list = AllZoneUtil.getCreaturesInPlay();
|
||||
for (final Card crd : list) {
|
||||
if (crd.getNetAttack() > this.getNetAttack()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if (property.startsWith("leastPower")) {
|
||||
final CardList list = AllZoneUtil.getCreaturesInPlay();
|
||||
final List<Card> list = AllZoneUtil.getCreaturesInPlay();
|
||||
for (final Card crd : list) {
|
||||
if (crd.getNetAttack() < this.getNetAttack()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if (property.startsWith("greatestCMC")) {
|
||||
final CardList list = AllZoneUtil.getCreaturesInPlay();
|
||||
final List<Card> list = AllZoneUtil.getCreaturesInPlay();
|
||||
for (final Card crd : list) {
|
||||
if (crd.getCMC() > this.getCMC()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if (property.startsWith("lowestCMC")) {
|
||||
final CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
for (final Card crd : list) {
|
||||
if (!crd.isLand() && !crd.isImmutable() && (crd.getCMC() < this.getCMC())) {
|
||||
return false;
|
||||
@@ -7256,7 +7256,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("OnBattlefield")) {
|
||||
final CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
if (!list.contains(this)) {
|
||||
return false;
|
||||
}
|
||||
@@ -7523,7 +7523,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
* @return a boolean.
|
||||
*/
|
||||
public final boolean isBlocking() {
|
||||
final CardList blockers = AllZone.getCombat().getAllBlockers();
|
||||
final List<Card> blockers = AllZone.getCombat().getAllBlockers();
|
||||
return blockers.contains(this);
|
||||
}
|
||||
|
||||
@@ -7922,7 +7922,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
* a {@link java.util.Map} object.
|
||||
*/
|
||||
public final void addCombatDamage(final Map<Card, Integer> map) {
|
||||
final CardList list = new CardList();
|
||||
final List<Card> list = new ArrayList<Card>();
|
||||
|
||||
for (final Entry<Card, Integer> entry : map.entrySet()) {
|
||||
final Card source = entry.getKey();
|
||||
@@ -8081,7 +8081,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
}
|
||||
|
||||
// Prevent Damage static abilities
|
||||
final CardList allp = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> allp = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
for (final Card ca : allp) {
|
||||
final ArrayList<StaticAbility> staticAbilities = ca.getStaticAbilities();
|
||||
for (final StaticAbility stAb : staticAbilities) {
|
||||
@@ -8274,7 +8274,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
return 0;
|
||||
}
|
||||
|
||||
final CardList auras = new CardList(this.getEnchantedBy());
|
||||
final List<Card> auras = new ArrayList<Card>(this.getEnchantedBy());
|
||||
|
||||
if (Iterables.any(auras, CardPredicates.nameEquals("Treacherous Link"))) {
|
||||
this.getController().addDamage(damageIn, source);
|
||||
@@ -8870,7 +8870,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
}
|
||||
|
||||
// CantTarget static abilities
|
||||
final CardList allp = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> allp = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
for (final Card ca : allp) {
|
||||
final ArrayList<StaticAbility> staticAbilities = ca.getStaticAbilities();
|
||||
for (final StaticAbility stAb : staticAbilities) {
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Forge: Play Magic: the Gathering.
|
||||
* Copyright (C) 2011 Forge Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package forge;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* CardList class.
|
||||
* </p>
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id$
|
||||
*/
|
||||
public class CardList extends ArrayList<Card> {
|
||||
|
||||
private static final long serialVersionUID = 7912620750458976012L;
|
||||
|
||||
public CardList() {}
|
||||
public CardList(final Card c) { this.add(c); }
|
||||
public CardList(final Iterable<Card> al) { for(Card c : al) this.add(c); }
|
||||
|
||||
} // end class CardList
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package forge;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
@@ -24,6 +25,7 @@ import java.util.List;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import forge.card.cardfactory.CardFactoryUtil;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
@@ -52,7 +54,7 @@ public class CardListUtil {
|
||||
* a int.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public static CardList filterToughness(final CardList in, final int atLeastToughness) {
|
||||
public static List<Card> filterToughness(final List<Card> in, final int atLeastToughness) {
|
||||
return CardListUtil.filter(in, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(Card c) {
|
||||
@@ -116,32 +118,32 @@ public class CardListUtil {
|
||||
* @param list
|
||||
* a {@link forge.CardList} object.
|
||||
*/
|
||||
public static void sortAttack(final CardList list) {
|
||||
public static void sortAttack(final List<Card> list) {
|
||||
Collections.sort(list, AttackComparator);
|
||||
} // sortAttack()
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Sorts a CardList by "best" using the EvaluateCreature function.
|
||||
* Sorts a List<Card> by "best" using the EvaluateCreature function.
|
||||
* the best creatures will be first in the list.
|
||||
* </p>
|
||||
*
|
||||
* @param list
|
||||
* a {@link forge.CardList} object.
|
||||
*/
|
||||
public static void sortByEvaluateCreature(final CardList list) {
|
||||
public static void sortByEvaluateCreature(final List<Card> list) {
|
||||
Collections.sort(list, EvaluateCreatureComparator);
|
||||
} // sortByEvaluateCreature()
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Sorts a CardList by converted mana cost, putting highest first.
|
||||
* Sorts a List<Card> by converted mana cost, putting highest first.
|
||||
* </p>
|
||||
*
|
||||
* @param list
|
||||
* a {@link forge.CardList} object.
|
||||
*/
|
||||
public static void sortByMostExpensive(final CardList list) {
|
||||
public static void sortByMostExpensive(final List<Card> list) {
|
||||
Collections.sort(list, CmcComparator);
|
||||
} // sortByMostExpensive()
|
||||
|
||||
@@ -154,7 +156,7 @@ public class CardListUtil {
|
||||
* @param list
|
||||
* a {@link forge.CardList} object.
|
||||
*/
|
||||
public static void sortAttackLowFirst(final CardList list) {
|
||||
public static void sortAttackLowFirst(final List<Card> list) {
|
||||
Collections.sort(list, Collections.reverseOrder(AttackComparator));
|
||||
} // sortAttackLowFirst()
|
||||
|
||||
@@ -166,7 +168,7 @@ public class CardListUtil {
|
||||
* @param list
|
||||
* a {@link forge.CardList} object.
|
||||
*/
|
||||
public static void sortNonFlyingFirst(final CardList list) {
|
||||
public static void sortNonFlyingFirst(final List<Card> list) {
|
||||
CardListUtil.sortFlying(list);
|
||||
Collections.reverse(list);
|
||||
} // sortNonFlyingFirst
|
||||
@@ -179,19 +181,19 @@ public class CardListUtil {
|
||||
* @param list
|
||||
* a {@link forge.CardList} object.
|
||||
*/
|
||||
public static void sortFlying(final CardList list) {
|
||||
public static void sortFlying(final List<Card> list) {
|
||||
Collections.sort(list, getKeywordComparator("Flying"));
|
||||
} // sortFlying()
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Sorts a CardList from highest converted mana cost to lowest.
|
||||
* Sorts a List<Card> from highest converted mana cost to lowest.
|
||||
* </p>
|
||||
*
|
||||
* @param list
|
||||
* a {@link forge.CardList} object.
|
||||
*/
|
||||
public static void sortCMC(final CardList list) {
|
||||
public static void sortCMC(final List<Card> list) {
|
||||
Collections.sort( list, CmcComparator );
|
||||
} // sortCMC
|
||||
|
||||
@@ -206,7 +208,7 @@ public class CardListUtil {
|
||||
* a {@link java.lang.String} object.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public static CardList getColor(final CardList list, final String color) {
|
||||
public static List<Card> getColor(final List<Card> list, final String color) {
|
||||
return CardListUtil.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
@@ -224,7 +226,7 @@ public class CardListUtil {
|
||||
* a {@link forge.CardList} object.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public static CardList getGoldCards(final CardList list) {
|
||||
public static List<Card> getGoldCards(final List<Card> list) {
|
||||
return CardListUtil.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
@@ -243,7 +245,7 @@ public class CardListUtil {
|
||||
* a {@link forge.CardList} object.
|
||||
* @return a int.
|
||||
*/
|
||||
public static int sumCMC(final CardList c) {
|
||||
public static int sumCMC(final List<Card> c) {
|
||||
return Aggregates.sum(c, CardPredicates.Accessors.fnGetCmc);
|
||||
} // sumCMC
|
||||
|
||||
@@ -256,7 +258,7 @@ public class CardListUtil {
|
||||
* a {@link forge.CardList} object.
|
||||
* @return a float.
|
||||
*/
|
||||
public static float getAverageCMC(final CardList c) {
|
||||
public static float getAverageCMC(final List<Card> c) {
|
||||
|
||||
return sumCMC(c) / c.size();
|
||||
|
||||
@@ -264,7 +266,7 @@ public class CardListUtil {
|
||||
|
||||
/**
|
||||
*
|
||||
* Given a CardList c, return a CardList that contains a random amount of cards from c.
|
||||
* Given a List<Card> c, return a List<Card> that contains a random amount of cards from c.
|
||||
*
|
||||
* @param c
|
||||
* CardList
|
||||
@@ -272,12 +274,12 @@ public class CardListUtil {
|
||||
* int
|
||||
* @return CardList
|
||||
*/
|
||||
public static CardList getRandomSubList(final CardList c, final int amount) {
|
||||
public static List<Card> getRandomSubList(final List<Card> c, final int amount) {
|
||||
if (c.size() < amount) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final CardList subList = new CardList();
|
||||
final List<Card> subList = new ArrayList<Card>();
|
||||
while (subList.size() < amount) {
|
||||
CardListUtil.shuffle(c);
|
||||
subList.add(c.get(0));
|
||||
@@ -298,38 +300,38 @@ public class CardListUtil {
|
||||
Collections.shuffle(list, MyRandom.getRandom());
|
||||
}
|
||||
|
||||
public static CardList filterControlledBy(List<Card> cardList, Player player) {
|
||||
public static List<Card> filterControlledBy(List<Card> cardList, Player player) {
|
||||
return CardListUtil.filter(cardList, CardPredicates.isController(player));
|
||||
}
|
||||
|
||||
|
||||
public static CardList getValidCards(List<Card> cardList, String[] restrictions, Player sourceController, Card source) {
|
||||
public static List<Card> getValidCards(List<Card> cardList, String[] restrictions, Player sourceController, Card source) {
|
||||
return CardListUtil.filter(cardList, CardPredicates.restriction(restrictions, sourceController, source));
|
||||
}
|
||||
|
||||
public static CardList getValidCards(List<Card> cardList, String restriction, Player sourceController, Card source) {
|
||||
public static List<Card> getValidCards(List<Card> cardList, String restriction, Player sourceController, Card source) {
|
||||
return CardListUtil.filter(cardList, CardPredicates.restriction(restriction.split(","), sourceController, source));
|
||||
}
|
||||
|
||||
public static CardList getTargetableCards(List<Card> cardList, SpellAbility source) {
|
||||
public static List<Card> getTargetableCards(List<Card> cardList, SpellAbility source) {
|
||||
return CardListUtil.filter(cardList, CardPredicates.isTargetableBy(source));
|
||||
}
|
||||
|
||||
public static CardList getKeyword(List<Card> cardList, String keyword) {
|
||||
public static List<Card> getKeyword(List<Card> cardList, String keyword) {
|
||||
return CardListUtil.filter(cardList, CardPredicates.hasKeyword(keyword));
|
||||
}
|
||||
|
||||
public static CardList getNotKeyword(List<Card> cardList, String keyword) {
|
||||
public static List<Card> getNotKeyword(List<Card> cardList, String keyword) {
|
||||
return CardListUtil.filter(cardList, Predicates.not(CardPredicates.hasKeyword(keyword)));
|
||||
}
|
||||
|
||||
// cardType is like "Land" or "Goblin", returns a new CardList that is a
|
||||
// cardType is like "Land" or "Goblin", returns a new ArrayList<Card> that is a
|
||||
// subset of current CardList
|
||||
public static CardList getNotType(List<Card> cardList, String cardType) {
|
||||
public static List<Card> getNotType(List<Card> cardList, String cardType) {
|
||||
return CardListUtil.filter(cardList, Predicates.not(CardPredicates.isType(cardType)));
|
||||
}
|
||||
|
||||
public static CardList getType(List<Card> cardList, String cardType) {
|
||||
public static List<Card> getType(List<Card> cardList, String cardType) {
|
||||
return CardListUtil.filter(cardList, CardPredicates.isType(cardType));
|
||||
}
|
||||
|
||||
@@ -339,10 +341,16 @@ public class CardListUtil {
|
||||
* @param filt
|
||||
* determines which cards are present in the resulting list
|
||||
*
|
||||
* @return a subset of this CardList whose items meet the filtering
|
||||
* @return a subset of this List<Card> whose items meet the filtering
|
||||
* criteria; may be empty, but never null.
|
||||
*/
|
||||
public static CardList filter(List<Card> cardList, Predicate<Card> filt) {
|
||||
return new CardList(Iterables.filter(cardList, filt));
|
||||
public static List<Card> filter(List<Card> cardList, Predicate<Card> filt) {
|
||||
return Lists.newArrayList(Iterables.filter(cardList, filt));
|
||||
}
|
||||
|
||||
public static List<Card> createCardList(Card c) {
|
||||
List<Card> res = new ArrayList<Card>();
|
||||
res.add(c);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ public final class CardUtil {
|
||||
* a {@link forge.CardList} object.
|
||||
* @return a int.
|
||||
*/
|
||||
public static int getRandomIndex(final CardList c) {
|
||||
public static int getRandomIndex(final List<Card> c) {
|
||||
return CardUtil.RANDOM.nextInt(c.size());
|
||||
}
|
||||
|
||||
@@ -621,11 +621,11 @@ public final class CardUtil {
|
||||
* a isValid expression
|
||||
* @param src
|
||||
* a Card object
|
||||
* @return a CardList that matches the given criteria
|
||||
* @return a List<Card> that matches the given criteria
|
||||
*/
|
||||
public static CardList getThisTurnEntered(final ZoneType to, final ZoneType from, final String valid,
|
||||
public static List<Card> getThisTurnEntered(final ZoneType to, final ZoneType from, final String valid,
|
||||
final Card src) {
|
||||
CardList res = new CardList();
|
||||
List<Card> res = new ArrayList<Card>();
|
||||
if (to != ZoneType.Stack) {
|
||||
res.addAll(((DefaultPlayerZone) AllZone.getComputerPlayer().getZone(to)).getCardsAddedThisTurn(from));
|
||||
res.addAll(((DefaultPlayerZone) AllZone.getHumanPlayer().getZone(to)).getCardsAddedThisTurn(from));
|
||||
@@ -645,10 +645,10 @@ public final class CardUtil {
|
||||
* a String object
|
||||
* @param src
|
||||
* a Card object
|
||||
* @return a CardList that matches the given criteria
|
||||
* @return a List<Card> that matches the given criteria
|
||||
*/
|
||||
public static CardList getThisTurnCast(final String valid, final Card src) {
|
||||
CardList res = new CardList();
|
||||
public static List<Card> getThisTurnCast(final String valid, final Card src) {
|
||||
List<Card> res = new ArrayList<Card>();
|
||||
|
||||
res.addAll(AllZone.getStack().getCardsCastThisTurn());
|
||||
|
||||
@@ -664,10 +664,10 @@ public final class CardUtil {
|
||||
* a String object
|
||||
* @param src
|
||||
* a Card object
|
||||
* @return a CardList that matches the given criteria
|
||||
* @return a List<Card> that matches the given criteria
|
||||
*/
|
||||
public static CardList getLastTurnCast(final String valid, final Card src) {
|
||||
CardList res = new CardList();
|
||||
public static List<Card> getLastTurnCast(final String valid, final Card src) {
|
||||
List<Card> res = new ArrayList<Card>();
|
||||
|
||||
res.addAll(AllZone.getStack().getCardsCastLastTurn());
|
||||
|
||||
@@ -820,8 +820,8 @@ public final class CardUtil {
|
||||
* the valid
|
||||
* @return the radiance
|
||||
*/
|
||||
public static CardList getRadiance(final Card source, final Card origin, final String[] valid) {
|
||||
final CardList res = new CardList();
|
||||
public static List<Card> getRadiance(final Card source, final Card origin, final String[] valid) {
|
||||
final List<Card> res = new ArrayList<Card>();
|
||||
|
||||
for (final CardColor col : origin.getColor()) {
|
||||
for (final String strCol : col.toStringList()) {
|
||||
|
||||
@@ -22,6 +22,7 @@ import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
|
||||
@@ -75,7 +76,7 @@ public class GameAction {
|
||||
* </p>
|
||||
*/
|
||||
public final void resetActivationsPerTurn() {
|
||||
final CardList all = AllZoneUtil.getCardsInGame();
|
||||
final List<Card> all = AllZoneUtil.getCardsInGame();
|
||||
|
||||
// Reset Activations per Turn
|
||||
for (final Card card : all) {
|
||||
@@ -246,7 +247,7 @@ public class GameAction {
|
||||
}
|
||||
// Handle unequipping creatures
|
||||
if (copied.isEquipped()) {
|
||||
final CardList equipments = new CardList(copied.getEquippedBy());
|
||||
final List<Card> equipments = new ArrayList<Card>(copied.getEquippedBy());
|
||||
for (final Card equipment : equipments) {
|
||||
if (AllZoneUtil.isCardInPlay(equipment)) {
|
||||
equipment.unEquipCard(copied);
|
||||
@@ -255,7 +256,7 @@ public class GameAction {
|
||||
}
|
||||
// Handle unequipping creatures
|
||||
if (copied.isEquipped()) {
|
||||
final CardList equipments = new CardList(copied.getEquippedBy());
|
||||
final List<Card> equipments = new ArrayList<Card>(copied.getEquippedBy());
|
||||
for (final Card equipment : equipments) {
|
||||
if (AllZoneUtil.isCardInPlay(equipment)) {
|
||||
equipment.unEquipCard(copied);
|
||||
@@ -271,7 +272,7 @@ public class GameAction {
|
||||
}
|
||||
// remove enchantments from creatures
|
||||
if (copied.isEnchanted()) {
|
||||
final CardList auras = new CardList(copied.getEnchantedBy());
|
||||
final List<Card> auras = new ArrayList<Card>(copied.getEnchantedBy());
|
||||
for (final Card aura : auras) {
|
||||
aura.unEnchantEntity(copied);
|
||||
}
|
||||
@@ -455,8 +456,8 @@ public class GameAction {
|
||||
final Player owner = c.getOwner();
|
||||
final PlayerZone grave = owner.getZone(ZoneType.Graveyard);
|
||||
final PlayerZone exile = owner.getZone(ZoneType.Exile);
|
||||
final CardList ownerBoard = owner.getCardsIn(ZoneType.Battlefield);
|
||||
final CardList opponentsBoard = owner.getOpponent().getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> ownerBoard = owner.getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> opponentsBoard = owner.getOpponent().getCardsIn(ZoneType.Battlefield);
|
||||
|
||||
if (c.getName().equals("Nissa's Chosen") && origZone.is(ZoneType.Battlefield)) {
|
||||
return this.moveToLibrary(c, -1);
|
||||
@@ -949,7 +950,7 @@ public class GameAction {
|
||||
AllZone.getStaticEffects().clearStaticEffects();
|
||||
|
||||
// search for cards with static abilities
|
||||
final CardList allCards = AllZoneUtil.getCardsInGame();
|
||||
final List<Card> allCards = AllZoneUtil.getCardsInGame();
|
||||
final ArrayList<StaticAbility> staticAbilities = new ArrayList<StaticAbility>();
|
||||
for (final Card card : allCards) {
|
||||
for (StaticAbility sa : card.getStaticAbilities()) {
|
||||
@@ -1036,7 +1037,7 @@ public class GameAction {
|
||||
final HashMap<String, Object> runParams = new HashMap<String, Object>();
|
||||
AllZone.getTriggerHandler().runTrigger(TriggerType.Always, runParams);
|
||||
|
||||
final CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
Card c;
|
||||
|
||||
final Iterator<Card> it = list.iterator();
|
||||
@@ -1045,7 +1046,7 @@ public class GameAction {
|
||||
c = it.next();
|
||||
|
||||
if (c.isEquipped()) {
|
||||
final CardList equipments = new CardList(c.getEquippedBy());
|
||||
final List<Card> equipments = new ArrayList<Card>(c.getEquippedBy());
|
||||
for (final Card equipment : equipments) {
|
||||
if (!AllZoneUtil.isCardInPlay(equipment)) {
|
||||
equipment.unEquipCard(c);
|
||||
@@ -1169,13 +1170,13 @@ public class GameAction {
|
||||
} // for q=0;q<2
|
||||
/*
|
||||
//Experiment Kraj experiment
|
||||
CardList krajs = AllZoneUtil.getCardsIn(ZoneType.Battlefield).filter(new Predicate<Card>() {
|
||||
List<Card> krajs = AllZoneUtil.getCardsIn(ZoneType.Battlefield).filter(new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean addCard(Card c) {
|
||||
return c.getName().equals("Experiment Kraj");
|
||||
}
|
||||
});
|
||||
CardList P1P1s = AllZoneUtil.getCardsIn(ZoneType.Battlefield).filter(new Predicate<Card>() {
|
||||
List<Card> P1P1s = AllZoneUtil.getCardsIn(ZoneType.Battlefield).filter(new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean addCard(Card c) {
|
||||
return c.getCounters(Counters.P1P1) > 0;
|
||||
@@ -1217,7 +1218,7 @@ public class GameAction {
|
||||
*/
|
||||
private void destroyPlaneswalkers() {
|
||||
// get all Planeswalkers
|
||||
final CardList list = CardListUtil.filter(AllZoneUtil.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.PLANEWALKERS);
|
||||
final List<Card> list = CardListUtil.filter(AllZoneUtil.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.PLANEWALKERS);
|
||||
|
||||
Card c;
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
@@ -1233,7 +1234,7 @@ public class GameAction {
|
||||
continue;
|
||||
}
|
||||
|
||||
final CardList cl = CardListUtil.getType(list, type);
|
||||
final List<Card> cl = CardListUtil.getType(list, type);
|
||||
|
||||
if (cl.size() > 1) {
|
||||
for (final Card crd : cl) {
|
||||
@@ -1250,13 +1251,13 @@ public class GameAction {
|
||||
* </p>
|
||||
*/
|
||||
private void destroyLegendaryCreatures() {
|
||||
final CardList a = CardListUtil.getType(AllZoneUtil.getCardsIn(ZoneType.Battlefield), "Legendary");
|
||||
final List<Card> a = CardListUtil.getType(AllZoneUtil.getCardsIn(ZoneType.Battlefield), "Legendary");
|
||||
if (a.isEmpty() || AllZoneUtil.isCardInPlay("Mirror Gallery")) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (!a.isEmpty()) {
|
||||
CardList b = AllZoneUtil.getCardsIn(ZoneType.Battlefield, a.get(0).getName());
|
||||
List<Card> b = AllZoneUtil.getCardsIn(ZoneType.Battlefield, a.get(0).getName());
|
||||
b = CardListUtil.getType(b, "Legendary");
|
||||
b = CardListUtil.filter(b, new Predicate<Card>() {
|
||||
@Override
|
||||
@@ -1319,7 +1320,7 @@ public class GameAction {
|
||||
}
|
||||
|
||||
if (c.isEnchanted()) {
|
||||
CardList list = new CardList(c.getEnchantedBy());
|
||||
List<Card> list = new ArrayList<Card>(c.getEnchantedBy());
|
||||
list = CardListUtil.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card crd) {
|
||||
@@ -1502,7 +1503,7 @@ public class GameAction {
|
||||
}
|
||||
|
||||
if (c.isEnchanted()) {
|
||||
CardList list = new CardList(c.getEnchantedBy());
|
||||
List<Card> list = new ArrayList<Card>(c.getEnchantedBy());
|
||||
list = CardListUtil.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card crd) {
|
||||
@@ -1710,8 +1711,8 @@ public class GameAction {
|
||||
|
||||
final Integer chosenAmount = (Integer) GuiChoose.one("Exile how many cards?", cntChoice);
|
||||
System.out.println("Delve for " + chosenAmount);
|
||||
final CardList choices = AllZone.getHumanPlayer().getCardsIn(ZoneType.Graveyard);
|
||||
final CardList chosen = new CardList();
|
||||
final List<Card> choices = AllZone.getHumanPlayer().getCardsIn(ZoneType.Graveyard);
|
||||
final List<Card> chosen = new ArrayList<Card>();
|
||||
for (int i = 0; i < chosenAmount; i++) {
|
||||
final Card nowChosen = GuiChoose.oneOrNone("Exile which card?", choices);
|
||||
|
||||
@@ -1743,7 +1744,7 @@ public class GameAction {
|
||||
}
|
||||
|
||||
for (int i = 0; i < numToExile; i++) {
|
||||
final CardList grave = new CardList(AllZone.getComputerPlayer().getZone(ZoneType.Graveyard)
|
||||
final List<Card> grave = new ArrayList<Card>(AllZone.getComputerPlayer().getZone(ZoneType.Graveyard)
|
||||
.getCards());
|
||||
Card chosen = null;
|
||||
for (final Card c : grave) { // Exile noncreatures first
|
||||
@@ -1772,7 +1773,7 @@ public class GameAction {
|
||||
manaCost.decreaseColorlessMana(numToExile);
|
||||
}
|
||||
} else if (spell.getSourceCard().hasKeyword("Convoke")) {
|
||||
CardList untappedCreats = CardListUtil.filter(spell.getActivatingPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES);
|
||||
List<Card> untappedCreats = CardListUtil.filter(spell.getActivatingPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES);
|
||||
untappedCreats = CardListUtil.filter(untappedCreats, CardPredicates.Presets.UNTAPPED);
|
||||
|
||||
if (untappedCreats.size() != 0) {
|
||||
@@ -1859,7 +1860,7 @@ public class GameAction {
|
||||
}
|
||||
} // isSpell
|
||||
|
||||
CardList cardsOnBattlefield = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> cardsOnBattlefield = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
cardsOnBattlefield.add(originalCard);
|
||||
final ArrayList<StaticAbility> raiseAbilities = new ArrayList<StaticAbility>();
|
||||
final ArrayList<StaticAbility> reduceAbilities = new ArrayList<StaticAbility>();
|
||||
|
||||
@@ -104,12 +104,12 @@ public final class GameActionUtil {
|
||||
public void execute() {
|
||||
|
||||
if (!c.isCopiedSpell()) {
|
||||
final CardList humanNexus = AllZone.getHumanPlayer()
|
||||
final List<Card> humanNexus = AllZone.getHumanPlayer()
|
||||
.getCardsIn(ZoneType.Battlefield, "Maelstrom Nexus");
|
||||
final CardList computerNexus = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield,
|
||||
final List<Card> computerNexus = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield,
|
||||
"Maelstrom Nexus");
|
||||
|
||||
final CardList maelstromNexii = new CardList();
|
||||
final List<Card> maelstromNexii = new ArrayList<Card>();
|
||||
maelstromNexii.addAll(humanNexus);
|
||||
maelstromNexii.addAll(computerNexus);
|
||||
|
||||
@@ -133,8 +133,8 @@ public final class GameActionUtil {
|
||||
final Ability ability = new Ability(c, "0") {
|
||||
@Override
|
||||
public void resolve() {
|
||||
final CardList topOfLibrary = controller.getCardsIn(ZoneType.Library);
|
||||
final CardList revealed = new CardList();
|
||||
final List<Card> topOfLibrary = controller.getCardsIn(ZoneType.Library);
|
||||
final List<Card> revealed = new ArrayList<Card>();
|
||||
|
||||
if (topOfLibrary.size() == 0) {
|
||||
return;
|
||||
@@ -229,9 +229,9 @@ public final class GameActionUtil {
|
||||
@Override
|
||||
public void execute() {
|
||||
|
||||
final CardList humanThrummingStone = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield,
|
||||
final List<Card> humanThrummingStone = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield,
|
||||
"Thrumming Stone");
|
||||
final CardList computerThrummingStone = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield,
|
||||
final List<Card> computerThrummingStone = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield,
|
||||
"Thrumming Stone");
|
||||
|
||||
for (int i = 0; i < humanThrummingStone.size(); i++) {
|
||||
@@ -264,8 +264,8 @@ public final class GameActionUtil {
|
||||
final Ability ability = new Ability(c, "0") {
|
||||
@Override
|
||||
public void resolve() {
|
||||
final CardList topOfLibrary = controller.getCardsIn(ZoneType.Library);
|
||||
final CardList revealed = new CardList();
|
||||
final List<Card> topOfLibrary = controller.getCardsIn(ZoneType.Library);
|
||||
final List<Card> revealed = new ArrayList<Card>();
|
||||
int rippleNumber = rippleCount;
|
||||
if (topOfLibrary.size() == 0) {
|
||||
return;
|
||||
@@ -856,14 +856,14 @@ public final class GameActionUtil {
|
||||
return;
|
||||
}
|
||||
|
||||
final CardList playerLiches = player.getCardsIn(ZoneType.Battlefield, "Lich");
|
||||
final List<Card> playerLiches = player.getCardsIn(ZoneType.Battlefield, "Lich");
|
||||
|
||||
for (final Card lich : playerLiches) {
|
||||
final SpellAbility ability = new Ability(lich, "0") {
|
||||
@Override
|
||||
public void resolve() {
|
||||
for (int i = 0; i < damage; i++) {
|
||||
CardList nonTokens = player.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> nonTokens = player.getCardsIn(ZoneType.Battlefield);
|
||||
nonTokens = CardListUtil.filter(nonTokens, Presets.NON_TOKEN);
|
||||
if (nonTokens.size() == 0) {
|
||||
player.loseConditionMet(GameLossReason.SpellEffect, lich.getName());
|
||||
@@ -916,7 +916,7 @@ public final class GameActionUtil {
|
||||
}
|
||||
|
||||
if (c.isCreature() && AllZoneUtil.isCardInPlay("Contested War Zone", player)) {
|
||||
final CardList zones = player.getCardsIn(ZoneType.Battlefield, "Contested War Zone");
|
||||
final List<Card> zones = player.getCardsIn(ZoneType.Battlefield, "Contested War Zone");
|
||||
for (final Card zone : zones) {
|
||||
final Ability ability = new Ability(zone, "0") {
|
||||
@Override
|
||||
@@ -1069,7 +1069,7 @@ public final class GameActionUtil {
|
||||
@Override
|
||||
public void resolve() {
|
||||
|
||||
final CardList libList = opponent.getCardsIn(ZoneType.Library);
|
||||
final List<Card> libList = opponent.getCardsIn(ZoneType.Library);
|
||||
int count = 0;
|
||||
int broken = 0;
|
||||
for (int i = 0; i < libList.size(); i = i + 4) {
|
||||
@@ -1158,7 +1158,7 @@ public final class GameActionUtil {
|
||||
produces.put("Plains", "W");
|
||||
produces.put("Swamp", "B");
|
||||
|
||||
CardList lands = AllZoneUtil.getCardsInGame();
|
||||
List<Card> lands = AllZoneUtil.getCardsInGame();
|
||||
lands = CardListUtil.filter(lands, Presets.LANDS);
|
||||
|
||||
// remove all abilities granted by this Command
|
||||
@@ -1217,11 +1217,11 @@ public final class GameActionUtil {
|
||||
private static Command coatOfArms = new Command() {
|
||||
private static final long serialVersionUID = 583505612126735693L;
|
||||
|
||||
private final CardList gloriousAnthemList = new CardList();
|
||||
private final List<Card> gloriousAnthemList = new ArrayList<Card>();
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
final CardList list = this.gloriousAnthemList;
|
||||
final List<Card> list = this.gloriousAnthemList;
|
||||
// reset all cards in list - aka "old" cards
|
||||
for (int i2 = 0; i2 < list.size(); i2++) {
|
||||
list.get(i2).addSemiPermanentAttackBoost(-1);
|
||||
@@ -1249,14 +1249,14 @@ public final class GameActionUtil {
|
||||
private static Command alphaStatus = new Command() {
|
||||
private static final long serialVersionUID = -3213793711304934358L;
|
||||
|
||||
private final CardList previouslyPumped = new CardList();
|
||||
private final List<Card> previouslyPumped = new ArrayList<Card>();
|
||||
private final ArrayList<Integer> previouslyPumpedValue = new ArrayList<Integer>();
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
final CardList alphaStatuses = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Alpha Status");
|
||||
final List<Card> alphaStatuses = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Alpha Status");
|
||||
|
||||
final CardList allCreatures = AllZoneUtil.getCreaturesInPlay();
|
||||
final List<Card> allCreatures = AllZoneUtil.getCreaturesInPlay();
|
||||
|
||||
for (int i = 0; i < this.previouslyPumped.size(); i++) {
|
||||
this.previouslyPumped.get(i).addSemiPermanentAttackBoost(0 - this.previouslyPumpedValue.get(i));
|
||||
@@ -1291,10 +1291,10 @@ public final class GameActionUtil {
|
||||
@Override
|
||||
public void execute() {
|
||||
// get all creatures
|
||||
final CardList cards = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Umbra Stalker");
|
||||
final List<Card> cards = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Umbra Stalker");
|
||||
for (final Card c : cards) {
|
||||
final Player player = c.getController();
|
||||
final CardList grave = player.getCardsIn(ZoneType.Graveyard);
|
||||
final List<Card> grave = player.getCardsIn(ZoneType.Graveyard);
|
||||
final int pt = CardFactoryUtil.getNumberOfManaSymbolsByColor("B", grave);
|
||||
c.setBaseAttack(pt);
|
||||
c.setBaseDefense(pt);
|
||||
@@ -1308,7 +1308,7 @@ public final class GameActionUtil {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
|
||||
list = CardListUtil.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
@@ -1331,7 +1331,7 @@ public final class GameActionUtil {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
final CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Old Man of the Sea");
|
||||
final List<Card> list = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Old Man of the Sea");
|
||||
for (final Card oldman : list) {
|
||||
if (!oldman.getGainControlTargets().isEmpty()) {
|
||||
if (oldman.getNetAttack() < oldman.getGainControlTargets().get(0).getNetAttack()) {
|
||||
@@ -1352,7 +1352,7 @@ public final class GameActionUtil {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
final CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Liu Bei, Lord of Shu");
|
||||
final List<Card> list = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Liu Bei, Lord of Shu");
|
||||
|
||||
if (list.size() > 0) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
@@ -1371,7 +1371,7 @@ public final class GameActionUtil {
|
||||
} // execute()
|
||||
|
||||
private boolean getsBonus(final Card c) {
|
||||
CardList list = c.getController().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = c.getController().getCardsIn(ZoneType.Battlefield);
|
||||
list = CardListUtil.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
@@ -1391,7 +1391,7 @@ public final class GameActionUtil {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
list = CardListUtil.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
@@ -1409,7 +1409,7 @@ public final class GameActionUtil {
|
||||
}
|
||||
|
||||
private int countSoundTheCalls() {
|
||||
CardList list = AllZoneUtil.getCardsIn(ZoneType.Graveyard, "Sound the Call");
|
||||
List<Card> list = AllZoneUtil.getCardsIn(ZoneType.Graveyard, "Sound the Call");
|
||||
return list.size();
|
||||
}
|
||||
|
||||
@@ -1422,7 +1422,7 @@ public final class GameActionUtil {
|
||||
@Override
|
||||
public void execute() {
|
||||
// get all creatures
|
||||
final CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Tarmogoyf");
|
||||
final List<Card> list = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Tarmogoyf");
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
final Card c = list.get(i);
|
||||
@@ -1433,7 +1433,7 @@ public final class GameActionUtil {
|
||||
} // execute()
|
||||
|
||||
private int countDiffTypes() {
|
||||
final CardList list = AllZoneUtil.getCardsIn(ZoneType.Graveyard);
|
||||
final List<Card> list = AllZoneUtil.getCardsIn(ZoneType.Graveyard);
|
||||
|
||||
int count = 0;
|
||||
for (int q = 0; q < list.size(); q++) {
|
||||
@@ -1521,7 +1521,7 @@ public final class GameActionUtil {
|
||||
*/
|
||||
public static void doPowerSink(final Player p) {
|
||||
// get all lands with mana abilities
|
||||
CardList lands = AllZoneUtil.getPlayerLandsInPlay(p);
|
||||
List<Card> lands = AllZoneUtil.getPlayerLandsInPlay(p);
|
||||
lands = CardListUtil.filter(lands, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
|
||||
@@ -19,6 +19,8 @@ package forge;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.StringTokenizer;
|
||||
@@ -154,9 +156,9 @@ public class NameChanger {
|
||||
* @return either list itself or a new list (possibly wasteful) containing
|
||||
* the side effected cards
|
||||
*/
|
||||
public final CardList changeCardsIfNeeded(CardList list) {
|
||||
public final List<Card> changeCardsIfNeeded(List<Card> list) {
|
||||
if (this.shouldChangeCardName()) {
|
||||
list = new CardList( Lists.transform(list, fnTransformCard) );
|
||||
list = new ArrayList<Card>( Lists.transform(list, fnTransformCard) );
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ package forge;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import forge.card.spellability.SpellAbility;
|
||||
import forge.game.player.Player;
|
||||
@@ -34,7 +35,7 @@ import forge.game.player.Player;
|
||||
public class StaticEffect {
|
||||
private Card source = new Card();
|
||||
private int keywordNumber = 0;
|
||||
private CardList affectedCards = new CardList();
|
||||
private List<Card> affectedCards = new ArrayList<Card>();
|
||||
private ArrayList<Player> affectedPlayers = new ArrayList<Player>();
|
||||
private int xValue = 0;
|
||||
private int yValue = 0;
|
||||
@@ -739,7 +740,7 @@ public class StaticEffect {
|
||||
*
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public final CardList getAffectedCards() {
|
||||
public final List<Card> getAffectedCards() {
|
||||
return this.affectedCards;
|
||||
}
|
||||
|
||||
@@ -751,7 +752,7 @@ public class StaticEffect {
|
||||
* @param list
|
||||
* a {@link forge.CardList} object.
|
||||
*/
|
||||
public final void setAffectedCards(final CardList list) {
|
||||
public final void setAffectedCards(final List<Card> list) {
|
||||
this.affectedCards = list;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ package forge;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.esotericsoftware.minlog.Log;
|
||||
|
||||
@@ -75,7 +76,7 @@ public class StaticEffects {
|
||||
* a StaticEffect
|
||||
*/
|
||||
final void removeStaticEffect(final StaticEffect se) {
|
||||
final CardList affectedCards = se.getAffectedCards();
|
||||
final List<Card> affectedCards = se.getAffectedCards();
|
||||
final ArrayList<Player> affectedPlayers = se.getAffectedPlayers();
|
||||
final HashMap<String, String> params = se.getParams();
|
||||
|
||||
@@ -317,7 +318,7 @@ public class StaticEffects {
|
||||
public final void rePopulateStateBasedList() {
|
||||
this.reset();
|
||||
|
||||
final CardList cards = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> cards = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
|
||||
Log.debug("== Start add state effects ==");
|
||||
for (int i = 0; i < cards.size(); i++) {
|
||||
|
||||
@@ -63,12 +63,12 @@ public class DeckHints {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of Cards from the given CardList that match this
|
||||
* Returns a list of Cards from the given List<Card> that match this
|
||||
* DeckHints. I.e., other cards that this Card needs in its deck.
|
||||
*
|
||||
* @param cardList
|
||||
* list of cards to be filtered
|
||||
* @return CardList of Cards that match this DeckHints.
|
||||
* @return List<Card> of Cards that match this DeckHints.
|
||||
*/
|
||||
public List<CardPrinted> filter(Iterable<CardPrinted> cardList) {
|
||||
List<CardPrinted> ret;
|
||||
|
||||
@@ -19,11 +19,12 @@ package forge.card.abilityfactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardUtil;
|
||||
import forge.Command;
|
||||
@@ -1627,7 +1628,7 @@ public class AbilityFactory {
|
||||
* multiplier;
|
||||
} else if (calcX[0].startsWith("Remembered")) {
|
||||
// Add whole Remembered list to handlePaid
|
||||
final CardList list = new CardList();
|
||||
final List<Card> list = new ArrayList<Card>();
|
||||
if (card.getRemembered().isEmpty()) {
|
||||
final Card newCard = AllZoneUtil.getCardState(card);
|
||||
for (final Object o : newCard.getRemembered()) {
|
||||
@@ -1654,7 +1655,7 @@ public class AbilityFactory {
|
||||
return CardFactoryUtil.handlePaid(list, calcX[1], card) * multiplier;
|
||||
} else if (calcX[0].startsWith("Imprinted")) {
|
||||
// Add whole Imprinted list to handlePaid
|
||||
final CardList list = new CardList();
|
||||
final List<Card> list = new ArrayList<Card>();
|
||||
for (final Card c : card.getImprinted()) {
|
||||
list.add(AllZoneUtil.getCardState(c));
|
||||
}
|
||||
@@ -1662,7 +1663,7 @@ public class AbilityFactory {
|
||||
return CardFactoryUtil.handlePaid(list, calcX[1], card) * multiplier;
|
||||
} else if (calcX[0].matches("Enchanted")) {
|
||||
// Add whole Enchanted list to handlePaid
|
||||
final CardList list = new CardList();
|
||||
final List<Card> list = new ArrayList<Card>();
|
||||
if (card.isEnchanting()) {
|
||||
Object o = card.getEnchanting();
|
||||
if (o instanceof Card) {
|
||||
@@ -1722,7 +1723,7 @@ public class AbilityFactory {
|
||||
}
|
||||
*/
|
||||
|
||||
CardList list = new CardList();
|
||||
List<Card> list = new ArrayList<Card>();
|
||||
if (calcX[0].startsWith("Sacrificed")) {
|
||||
list = AbilityFactory.findRootAbility(ability).getPaidList("Sacrificed");
|
||||
} else if (calcX[0].startsWith("Discarded")) {
|
||||
@@ -1743,14 +1744,14 @@ public class AbilityFactory {
|
||||
final ArrayList<Object> all = t.getTargets();
|
||||
if (!all.isEmpty() && (all.get(0) instanceof SpellAbility)) {
|
||||
final SpellAbility saTargeting = AbilityFactory.findParentsTargetedSpellAbility(ability);
|
||||
list = new CardList();
|
||||
list = new ArrayList<Card>();
|
||||
final ArrayList<SpellAbility> sas = saTargeting.getTarget().getTargetSAs();
|
||||
for (final SpellAbility sa : sas) {
|
||||
list.add(sa.getSourceCard());
|
||||
}
|
||||
} else {
|
||||
final SpellAbility saTargeting = AbilityFactory.findParentsTargetedCard(ability);
|
||||
list = new CardList(saTargeting.getTarget().getTargetCards());
|
||||
list = new ArrayList<Card>(saTargeting.getTarget().getTargetCards());
|
||||
}
|
||||
} else {
|
||||
final SpellAbility parent = AbilityFactory.findParentsTargetedCard(ability);
|
||||
@@ -1758,20 +1759,20 @@ public class AbilityFactory {
|
||||
if (parent != null) {
|
||||
final ArrayList<Object> all = parent.getTarget().getTargets();
|
||||
if (!all.isEmpty() && (all.get(0) instanceof SpellAbility)) {
|
||||
list = new CardList();
|
||||
list = new ArrayList<Card>();
|
||||
final ArrayList<SpellAbility> sas = parent.getTarget().getTargetSAs();
|
||||
for (final SpellAbility sa : sas) {
|
||||
list.add(sa.getSourceCard());
|
||||
}
|
||||
} else {
|
||||
final SpellAbility saTargeting = AbilityFactory.findParentsTargetedCard(ability);
|
||||
list = new CardList(saTargeting.getTarget().getTargetCards());
|
||||
list = new ArrayList<Card>(saTargeting.getTarget().getTargetCards());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (calcX[0].startsWith("Triggered")) {
|
||||
final SpellAbility root = ability.getRootSpellAbility();
|
||||
list = new CardList();
|
||||
list = new ArrayList<Card>();
|
||||
list.add((Card) root.getTriggeringObject(calcX[0].substring(9)));
|
||||
} else if (calcX[0].startsWith("TriggerCount")) {
|
||||
// TriggerCount is similar to a regular Count, but just
|
||||
@@ -1784,7 +1785,7 @@ public class AbilityFactory {
|
||||
return CardFactoryUtil.doXMath(count, m, card) * multiplier;
|
||||
} else if (calcX[0].startsWith("Replaced")) {
|
||||
final SpellAbility root = ability.getRootSpellAbility();
|
||||
list = new CardList();
|
||||
list = new ArrayList<Card>();
|
||||
list.add((Card) root.getReplacingObject(calcX[0].substring(8)));
|
||||
} else if (calcX[0].startsWith("ReplaceCount")) {
|
||||
// ReplaceCount is similar to a regular Count, but just
|
||||
@@ -1852,6 +1853,7 @@ public class AbilityFactory {
|
||||
* a {@link forge.card.spellability.SpellAbility} object.
|
||||
* @return a {@link java.util.ArrayList} object.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static ArrayList<Card> getDefinedCards(final Card hostCard, final String def, final SpellAbility sa) {
|
||||
final ArrayList<Card> cards = new ArrayList<Card>();
|
||||
final String defined = (def == null) ? "Self" : def; // default to Self
|
||||
@@ -1886,7 +1888,7 @@ public class AbilityFactory {
|
||||
}
|
||||
|
||||
else if (defined.equals("TopOfLibrary")) {
|
||||
final CardList lib = hostCard.getController().getCardsIn(ZoneType.Library);
|
||||
final List<Card> lib = hostCard.getController().getCardsIn(ZoneType.Library);
|
||||
if (lib.size() > 0) {
|
||||
c = lib.get(0);
|
||||
} else {
|
||||
@@ -1915,8 +1917,8 @@ public class AbilityFactory {
|
||||
if (crd instanceof Card) {
|
||||
c = AllZoneUtil.getCardState((Card) crd);
|
||||
c = (Card) crd;
|
||||
} else if (crd instanceof CardList) {
|
||||
for (final Card cardItem : (CardList) crd) {
|
||||
} else if (crd instanceof List<?>) {
|
||||
for (final Card cardItem : (List<Card>) crd) {
|
||||
cards.add(cardItem);
|
||||
}
|
||||
}
|
||||
@@ -1926,8 +1928,8 @@ public class AbilityFactory {
|
||||
final Object crd = root.getReplacingObject(defined.substring(8));
|
||||
if (crd instanceof Card) {
|
||||
c = AllZoneUtil.getCardState((Card) crd);
|
||||
} else if (crd instanceof CardList) {
|
||||
for (final Card cardItem : (CardList) crd) {
|
||||
} else if (crd instanceof List<?>) {
|
||||
for (final Card cardItem : (List<Card>) crd) {
|
||||
cards.add(cardItem);
|
||||
}
|
||||
}
|
||||
@@ -1971,7 +1973,7 @@ public class AbilityFactory {
|
||||
cards.add(cl);
|
||||
}
|
||||
} else {
|
||||
CardList list = null;
|
||||
List<Card> list = null;
|
||||
if (defined.startsWith("Sacrificed")) {
|
||||
list = AbilityFactory.findRootAbility(sa).getPaidList("Sacrificed");
|
||||
}
|
||||
@@ -2472,7 +2474,7 @@ public class AbilityFactory {
|
||||
if (threatParams.containsKey("Defined")) {
|
||||
objects = AbilityFactory.getDefinedObjects(source, threatParams.get("Defined"), topStack);
|
||||
} else if (threatParams.containsKey("ValidCards")) {
|
||||
CardList cards = CardListUtil.getValidCards(AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield), threatParams.get("ValidCards").split(","), source.getController(), source);
|
||||
List<Card> cards = CardListUtil.getValidCards(AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield), threatParams.get("ValidCards").split(","), source.getController(), source);
|
||||
for (Card card : cards) {
|
||||
objects.add(card);
|
||||
}
|
||||
@@ -2644,7 +2646,7 @@ public class AbilityFactory {
|
||||
|
||||
if (params.containsKey("RememberCostCards")) {
|
||||
if (params.get("Cost").contains("Exile")) {
|
||||
final CardList paidListExiled = sa.getPaidList("Exiled");
|
||||
final List<Card> paidListExiled = sa.getPaidList("Exiled");
|
||||
for (final Card exiledAsCost : paidListExiled) {
|
||||
host.addRemembered(exiledAsCost);
|
||||
}
|
||||
@@ -2663,7 +2665,7 @@ public class AbilityFactory {
|
||||
* a SpellAbility
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public static CardList filterListByType(final CardList list, String type, final SpellAbility sa) {
|
||||
public static List<Card> filterListByType(final List<Card> list, String type, final SpellAbility sa) {
|
||||
if (type == null) {
|
||||
return list;
|
||||
}
|
||||
@@ -2685,7 +2687,7 @@ public class AbilityFactory {
|
||||
}
|
||||
|
||||
if (!(o instanceof Card)) {
|
||||
return new CardList();
|
||||
return new ArrayList<Card>();
|
||||
}
|
||||
|
||||
if (type.equals("Triggered") || (type.equals("TriggeredCard")) || (type.equals("TriggeredAttacker")) || (type.equals("TriggeredBlocker"))) {
|
||||
@@ -2716,7 +2718,7 @@ public class AbilityFactory {
|
||||
}
|
||||
}
|
||||
if (source == null) {
|
||||
return new CardList();
|
||||
return new ArrayList<Card>();
|
||||
}
|
||||
|
||||
if (type.startsWith("TargetedCard")) {
|
||||
@@ -2737,7 +2739,7 @@ public class AbilityFactory {
|
||||
}
|
||||
|
||||
if (!hasRememberedCard) {
|
||||
return new CardList();
|
||||
return new ArrayList<Card>();
|
||||
}
|
||||
} else if (type.equals("Card.AttachedBy")) {
|
||||
source = source.getEnchantingCard();
|
||||
|
||||
@@ -28,7 +28,7 @@ import com.google.common.collect.Iterables;
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates;
|
||||
import forge.CardUtil;
|
||||
@@ -1282,7 +1282,7 @@ public final class AbilityFactoryAnimate {
|
||||
valid = params.get("ValidCards");
|
||||
}
|
||||
|
||||
CardList list;
|
||||
List<Card> list;
|
||||
ArrayList<Player> tgtPlayers = null;
|
||||
|
||||
final Target tgt = sa.getTarget();
|
||||
|
||||
@@ -20,6 +20,7 @@ package forge.card.abilityfactory;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
@@ -29,7 +30,7 @@ import com.google.common.base.Predicates;
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates;
|
||||
import forge.CardPredicates.Presets;
|
||||
@@ -347,7 +348,7 @@ public class AbilityFactoryAttach {
|
||||
return null;
|
||||
}
|
||||
|
||||
CardList list = AllZoneUtil.getCardsIn(tgt.getZone());
|
||||
List<Card> list = AllZoneUtil.getCardsIn(tgt.getZone());
|
||||
list = CardListUtil.getValidCards(list, tgt.getValidTgts(), sa.getActivatingPlayer(), attachSource);
|
||||
if (params.containsKey("AITgts")) {
|
||||
list = CardListUtil.getValidCards(list, params.get("AITgts"), sa.getActivatingPlayer(), attachSource);
|
||||
@@ -392,7 +393,7 @@ public class AbilityFactoryAttach {
|
||||
* the logic
|
||||
* @return the card
|
||||
*/
|
||||
public static Card attachGeneralAI(final SpellAbility sa, final CardList list, final boolean mandatory,
|
||||
public static Card attachGeneralAI(final SpellAbility sa, final List<Card> list, final boolean mandatory,
|
||||
final Card attachSource, final String logic) {
|
||||
Player prefPlayer = AllZone.getHumanPlayer();
|
||||
if ("Pump".equals(logic) || "Animate".equals(logic) ) {
|
||||
@@ -400,7 +401,7 @@ public class AbilityFactoryAttach {
|
||||
}
|
||||
// Some ChangeType cards are beneficial, and PrefPlayer should be
|
||||
// changed to represent that
|
||||
final CardList prefList = CardListUtil.filterControlledBy(list, prefPlayer);
|
||||
final List<Card> prefList = CardListUtil.filterControlledBy(list, prefPlayer);
|
||||
|
||||
// If there are no preferred cards, and not mandatory bail out
|
||||
if (prefList.size() == 0) {
|
||||
@@ -436,7 +437,7 @@ public class AbilityFactoryAttach {
|
||||
* the list
|
||||
* @return the card
|
||||
*/
|
||||
public static Card chooseUnpreferred(final boolean mandatory, final CardList list) {
|
||||
public static Card chooseUnpreferred(final boolean mandatory, final List<Card> list) {
|
||||
if (!mandatory) {
|
||||
return null;
|
||||
}
|
||||
@@ -453,7 +454,7 @@ public class AbilityFactoryAttach {
|
||||
* the list
|
||||
* @return the card
|
||||
*/
|
||||
public static Card chooseLessPreferred(final boolean mandatory, final CardList list) {
|
||||
public static Card chooseLessPreferred(final boolean mandatory, final List<Card> list) {
|
||||
if (!mandatory) {
|
||||
return null;
|
||||
}
|
||||
@@ -499,10 +500,10 @@ public class AbilityFactoryAttach {
|
||||
* the attach source
|
||||
* @return the card
|
||||
*/
|
||||
public static Card attachAIAnimatePreference(final SpellAbility sa, final CardList list, final boolean mandatory,
|
||||
public static Card attachAIAnimatePreference(final SpellAbility sa, final List<Card> list, final boolean mandatory,
|
||||
final Card attachSource) {
|
||||
// AI For choosing a Card to Animate.
|
||||
CardList betterList = CardListUtil.getNotType(list, "Creature");
|
||||
List<Card> betterList = CardListUtil.getNotType(list, "Creature");
|
||||
if (sa.getSourceCard().getName().equals("Animate Artifact")) {
|
||||
betterList = CardListUtil.filter(betterList, new Predicate<Card>() {
|
||||
@Override
|
||||
@@ -537,7 +538,7 @@ public class AbilityFactoryAttach {
|
||||
* the attach source
|
||||
* @return the card
|
||||
*/
|
||||
public static Card attachAIControlPreference(final SpellAbility sa, final CardList list, final boolean mandatory,
|
||||
public static Card attachAIControlPreference(final SpellAbility sa, final List<Card> list, final boolean mandatory,
|
||||
final Card attachSource) {
|
||||
// AI For choosing a Card to Gain Control of.
|
||||
|
||||
@@ -688,11 +689,11 @@ public class AbilityFactoryAttach {
|
||||
* the attach source
|
||||
* @return the card
|
||||
*/
|
||||
public static Card attachAIPumpPreference(final SpellAbility sa, final CardList list, final boolean mandatory,
|
||||
public static Card attachAIPumpPreference(final SpellAbility sa, final List<Card> list, final boolean mandatory,
|
||||
final Card attachSource) {
|
||||
// AI For choosing a Card to Pump
|
||||
Card c = null;
|
||||
CardList magnetList = null;
|
||||
List<Card> magnetList = null;
|
||||
String stCheck = null;
|
||||
if (attachSource.isAura()) {
|
||||
stCheck = "EnchantedBy";
|
||||
@@ -769,7 +770,7 @@ public class AbilityFactoryAttach {
|
||||
}
|
||||
}
|
||||
|
||||
CardList prefList = new CardList(list);
|
||||
List<Card> prefList = new ArrayList<Card>(list);
|
||||
if (totToughness < 0) {
|
||||
// Don't kill my own stuff with Negative toughness Auras
|
||||
final int tgh = totToughness;
|
||||
@@ -841,7 +842,7 @@ public class AbilityFactoryAttach {
|
||||
* the attach source
|
||||
* @return the card
|
||||
*/
|
||||
public static Card attachAICursePreference(final SpellAbility sa, final CardList list, final boolean mandatory,
|
||||
public static Card attachAICursePreference(final SpellAbility sa, final List<Card> list, final boolean mandatory,
|
||||
final Card attachSource) {
|
||||
// AI For choosing a Card to Curse of.
|
||||
|
||||
@@ -887,7 +888,7 @@ public class AbilityFactoryAttach {
|
||||
}
|
||||
}
|
||||
|
||||
CardList prefList = null;
|
||||
List<Card> prefList = null;
|
||||
if (totToughness < 0) {
|
||||
// Kill a creature if we can
|
||||
final int tgh = totToughness;
|
||||
@@ -904,7 +905,7 @@ public class AbilityFactoryAttach {
|
||||
}
|
||||
Card c = null;
|
||||
if ((prefList == null) || (prefList.size() == 0)) {
|
||||
prefList = new CardList(list);
|
||||
prefList = new ArrayList<Card>(list);
|
||||
} else {
|
||||
c = CardFactoryUtil.getBestAI(prefList);
|
||||
if (c != null) {
|
||||
@@ -948,7 +949,7 @@ public class AbilityFactoryAttach {
|
||||
* the attach source
|
||||
* @return the card
|
||||
*/
|
||||
public static Card attachAIChangeTypePreference(final SpellAbility sa, CardList list, final boolean mandatory,
|
||||
public static Card attachAIChangeTypePreference(final SpellAbility sa, List<Card> list, final boolean mandatory,
|
||||
final Card attachSource) {
|
||||
// AI For Cards like Evil Presence or Spreading Seas
|
||||
|
||||
@@ -992,10 +993,10 @@ public class AbilityFactoryAttach {
|
||||
* the attach source
|
||||
* @return the card
|
||||
*/
|
||||
public static Card attachAIKeepTappedPreference(final SpellAbility sa, final CardList list,
|
||||
public static Card attachAIKeepTappedPreference(final SpellAbility sa, final List<Card> list,
|
||||
final boolean mandatory, final Card attachSource) {
|
||||
// AI For Cards like Paralyzing Grasp and Glimmerdust Nap
|
||||
final CardList prefList = CardListUtil.filter(list, new Predicate<Card>() {
|
||||
final List<Card> prefList = CardListUtil.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
// Don't do Untapped Vigilance cards
|
||||
@@ -1417,7 +1418,7 @@ public class AbilityFactoryAttach {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
CardList list = AllZoneUtil.getCardsIn(tgt.getZone());
|
||||
List<Card> list = AllZoneUtil.getCardsIn(tgt.getZone());
|
||||
list = CardListUtil.getValidCards(list, tgt.getValidTgts(), aura.getActivatingPlayer(), source);
|
||||
|
||||
final Object o = GuiChoose.one(source + " - Select a card to attach to.", list);
|
||||
@@ -1710,7 +1711,7 @@ public class AbilityFactoryAttach {
|
||||
// If Cast Targets will be checked on the Stack
|
||||
for (final Object o : targets) {
|
||||
String valid = params.get("UnattachValid");
|
||||
CardList unattachList = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> unattachList = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
unattachList = CardListUtil.getValidCards(unattachList, valid.split(","), source.getController(), source);
|
||||
for (final Card c : unattachList) {
|
||||
AbilityFactoryAttach.handleUnattachment(o, c, af);
|
||||
|
||||
@@ -19,9 +19,11 @@ package forge.card.abilityfactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.card.spellability.AbilityActivated;
|
||||
import forge.card.spellability.AbilitySub;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
@@ -322,7 +324,7 @@ public final class AbilityFactoryBond {
|
||||
}
|
||||
|
||||
// find list of valid cards to pair with
|
||||
CardList cards = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> cards = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
cards = AbilityFactory.filterListByType(cards, params.get("ValidCards"), sa);
|
||||
if (cards.isEmpty()) {
|
||||
return;
|
||||
|
||||
@@ -30,7 +30,7 @@ import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardCharacteristicName;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates;
|
||||
import forge.CardPredicates.Presets;
|
||||
@@ -499,7 +499,7 @@ public final class AbilityFactoryChangeZone {
|
||||
//Ninjutsu
|
||||
if (params.containsKey("Ninjutsu")) {
|
||||
if (source.isType("Legendary") && !AllZoneUtil.isCardInPlay("Mirror Gallery")) {
|
||||
final CardList list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
if (Iterables.any(list, CardPredicates.nameEquals(source.getName()))) {
|
||||
return false;
|
||||
}
|
||||
@@ -507,7 +507,7 @@ public final class AbilityFactoryChangeZone {
|
||||
if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isAfter(PhaseType.COMBAT_DAMAGE)) {
|
||||
return false;
|
||||
}
|
||||
CardList attackers = new CardList();
|
||||
List<Card> attackers = new ArrayList<Card>();
|
||||
attackers.addAll(AllZone.getCombat().getUnblockedAttackers());
|
||||
boolean lowerCMC = false;
|
||||
for (Card attacker : attackers) {
|
||||
@@ -566,7 +566,7 @@ public final class AbilityFactoryChangeZone {
|
||||
}
|
||||
|
||||
for (final Player p : pDefined) {
|
||||
CardList list = p.getCardsIn(origin);
|
||||
List<Card> list = p.getCardsIn(origin);
|
||||
|
||||
if ((type != null) && p.isComputer()) {
|
||||
// AI only "knows" about his information
|
||||
@@ -696,7 +696,7 @@ public final class AbilityFactoryChangeZone {
|
||||
}
|
||||
|
||||
for (final Player p : pDefined) {
|
||||
CardList list = p.getCardsIn(origin);
|
||||
List<Card> list = p.getCardsIn(origin);
|
||||
|
||||
// Computer should "know" his deck
|
||||
if (p.isComputer()) {
|
||||
@@ -899,7 +899,7 @@ public final class AbilityFactoryChangeZone {
|
||||
private static void changeHiddenOriginResolveHuman(final AbilityFactory af, final SpellAbility sa, Player player) {
|
||||
final HashMap<String, String> params = af.getMapParams();
|
||||
final Card card = sa.getSourceCard();
|
||||
final CardList reveal = new CardList();
|
||||
final List<Card> reveal = new ArrayList<Card>();
|
||||
final boolean defined = params.containsKey("Defined");
|
||||
|
||||
final Target tgt = sa.getTarget();
|
||||
@@ -923,7 +923,7 @@ public final class AbilityFactoryChangeZone {
|
||||
// Currently only used for Mishra, but may be used by other things
|
||||
// Improve how this message reacts for other cards
|
||||
final List<ZoneType> alt = ZoneType.listValueOf(params.get("OriginAlternative"));
|
||||
CardList altFetchList = player.getCardsIn(alt);
|
||||
List<Card> altFetchList = player.getCardsIn(alt);
|
||||
altFetchList = AbilityFactory.filterListByType(altFetchList, params.get("ChangeType"), sa);
|
||||
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
@@ -950,9 +950,9 @@ public final class AbilityFactoryChangeZone {
|
||||
int changeNum = params.containsKey("ChangeNum") ? AbilityFactory.calculateAmount(card, params.get("ChangeNum"),
|
||||
sa) : 1;
|
||||
|
||||
CardList fetchList;
|
||||
List<Card> fetchList;
|
||||
if (defined) {
|
||||
fetchList = new CardList(AbilityFactory.getDefinedCards(card, params.get("Defined"), sa));
|
||||
fetchList = new ArrayList<Card>(AbilityFactory.getDefinedCards(card, params.get("Defined"), sa));
|
||||
if (!params.containsKey("ChangeNum")) {
|
||||
changeNum = fetchList.size();
|
||||
}
|
||||
@@ -1133,9 +1133,9 @@ public final class AbilityFactoryChangeZone {
|
||||
int changeNum = params.containsKey("ChangeNum") ? AbilityFactory.calculateAmount(card, params.get("ChangeNum"),
|
||||
sa) : 1;
|
||||
|
||||
CardList fetchList;
|
||||
List<Card> fetchList;
|
||||
if (defined) {
|
||||
fetchList = new CardList(AbilityFactory.getDefinedCards(card, params.get("Defined"), sa));
|
||||
fetchList = new ArrayList<Card>(AbilityFactory.getDefinedCards(card, params.get("Defined"), sa));
|
||||
if (!params.containsKey("ChangeNum")) {
|
||||
changeNum = fetchList.size();
|
||||
}
|
||||
@@ -1149,7 +1149,7 @@ public final class AbilityFactoryChangeZone {
|
||||
}
|
||||
|
||||
final ZoneType destination = ZoneType.smartValueOf(params.get("Destination"));
|
||||
final CardList fetched = new CardList();
|
||||
final List<Card> fetched = new ArrayList<Card>();
|
||||
final String remember = params.get("RememberChanged");
|
||||
final String forget = params.get("ForgetChanged");
|
||||
final String imprint = params.get("Imprint");
|
||||
@@ -1213,13 +1213,13 @@ public final class AbilityFactoryChangeZone {
|
||||
c = CardFactoryUtil.getBestAI(fetchList);
|
||||
} else {
|
||||
// Don't fetch another tutor with the same name
|
||||
CardList sameNamed = CardListUtil.filter(fetchList, Predicates.not(CardPredicates.nameEquals(card.getName())));
|
||||
List<Card> sameNamed = CardListUtil.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?
|
||||
CardList hand = ai.getCardsIn(ZoneType.Hand);
|
||||
List<Card> 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) {
|
||||
boolean canCastSomething = false;
|
||||
@@ -1355,10 +1355,10 @@ public final class AbilityFactoryChangeZone {
|
||||
* a {@link forge.CardList} object.
|
||||
* @return a {@link forge.Card} object.
|
||||
*/
|
||||
private static Card basicManaFixing(final CardList list) { // Search for a
|
||||
private static Card basicManaFixing(final List<Card> list) { // Search for a
|
||||
// Basic Land
|
||||
|
||||
final CardList combined = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> combined = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
combined.addAll(AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand));
|
||||
|
||||
final ArrayList<String> basics = new ArrayList<String>();
|
||||
@@ -1426,11 +1426,11 @@ public final class AbilityFactoryChangeZone {
|
||||
* @param list
|
||||
* @return Card
|
||||
*/
|
||||
private static Card chooseCreature(CardList list) {
|
||||
private static Card chooseCreature(List<Card> list) {
|
||||
Card card = null;
|
||||
Combat combat = new Combat();
|
||||
combat.initiatePossibleDefenders(AllZone.getComputerPlayer());
|
||||
CardList attackers = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
List<Card> attackers = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
for (Card att : attackers) {
|
||||
combat.addAttacker(att);
|
||||
}
|
||||
@@ -1510,7 +1510,7 @@ public final class AbilityFactoryChangeZone {
|
||||
}
|
||||
} else {
|
||||
// non-targeted retrieval
|
||||
final CardList retrieval = AbilityFactoryChangeZone
|
||||
final List<Card> retrieval = AbilityFactoryChangeZone
|
||||
.knownDetermineDefined(sa, params.get("Defined"), origin);
|
||||
|
||||
if ((retrieval == null) || retrieval.isEmpty()) {
|
||||
@@ -1634,7 +1634,7 @@ public final class AbilityFactoryChangeZone {
|
||||
tgt.resetTargets();
|
||||
}
|
||||
|
||||
CardList list = AllZoneUtil.getCardsIn(origin);
|
||||
List<Card> list = AllZoneUtil.getCardsIn(origin);
|
||||
list = CardListUtil.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.
|
||||
@@ -1648,7 +1648,7 @@ public final class AbilityFactoryChangeZone {
|
||||
if (origin.equals(ZoneType.Battlefield)) {
|
||||
// filter out untargetables
|
||||
list = CardListUtil.getTargetableCards(list, sa);
|
||||
CardList aiPermanents = CardListUtil.filterControlledBy(list, AllZone.getComputerPlayer());
|
||||
List<Card> aiPermanents = CardListUtil.filterControlledBy(list, AllZone.getComputerPlayer());
|
||||
|
||||
// Don't blink cards that will die.
|
||||
aiPermanents = CardListUtil.filter(aiPermanents, new Predicate<Card>() {
|
||||
@@ -1668,7 +1668,7 @@ public final class AbilityFactoryChangeZone {
|
||||
if (AllZone.getStack().size() > 0) {
|
||||
final ArrayList<Object> objects = AbilityFactory.predictThreatenedObjects(af);
|
||||
|
||||
final CardList threatenedTargets = new CardList();
|
||||
final List<Card> threatenedTargets = new ArrayList<Card>();
|
||||
|
||||
for (final Card c : aiPermanents) {
|
||||
if (objects.contains(c)) {
|
||||
@@ -1684,7 +1684,7 @@ public final class AbilityFactoryChangeZone {
|
||||
}
|
||||
// Save combatants
|
||||
else if (Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
|
||||
final CardList combatants = CardListUtil.filter(aiPermanents, CardPredicates.Presets.CREATURES);
|
||||
final List<Card> combatants = CardListUtil.filter(aiPermanents, CardPredicates.Presets.CREATURES);
|
||||
CardListUtil.sortByEvaluateCreature(combatants);
|
||||
|
||||
for (final Card c : combatants) {
|
||||
@@ -1791,7 +1791,7 @@ public final class AbilityFactoryChangeZone {
|
||||
choice = mostExpensive;
|
||||
}
|
||||
} else if (destination.equals(ZoneType.Hand) || destination.equals(ZoneType.Library)) {
|
||||
CardList nonLands = CardListUtil.getNotType(list, "Land");
|
||||
List<Card> nonLands = CardListUtil.getNotType(list, "Land");
|
||||
// Prefer to pull a creature, generally more useful for AI.
|
||||
choice = chooseCreature(CardListUtil.filter(nonLands, CardPredicates.Presets.CREATURES));
|
||||
if (choice == null) { // Could not find a creature.
|
||||
@@ -1866,7 +1866,7 @@ public final class AbilityFactoryChangeZone {
|
||||
final ZoneType destination = ZoneType.smartValueOf(params.get("Destination"));
|
||||
final Target tgt = sa.getTarget();
|
||||
|
||||
CardList list = AllZoneUtil.getCardsIn(origin);
|
||||
List<Card> list = AllZoneUtil.getCardsIn(origin);
|
||||
list = CardListUtil.getValidCards(list, tgt.getValidTgts(), AllZone.getComputerPlayer(), source);
|
||||
|
||||
// Narrow down the list:
|
||||
@@ -1904,7 +1904,7 @@ 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)) {
|
||||
CardList nonLands = CardListUtil.getNotType(list, "Land");
|
||||
List<Card> nonLands = CardListUtil.getNotType(list, "Land");
|
||||
// Prefer to pull a creature, generally more useful for AI.
|
||||
choice = chooseCreature(CardListUtil.filter(nonLands, CardPredicates.Presets.CREATURES));
|
||||
if (choice == null) { // Could not find a creature.
|
||||
@@ -2312,8 +2312,8 @@ public final class AbilityFactoryChangeZone {
|
||||
* a {@link java.lang.String} object.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
private static CardList knownDetermineDefined(final SpellAbility sa, final String defined, final ZoneType origin) {
|
||||
final CardList ret = new CardList();
|
||||
private static List<Card> knownDetermineDefined(final SpellAbility sa, final String defined, final ZoneType origin) {
|
||||
final List<Card> ret = new ArrayList<Card>();
|
||||
final ArrayList<Card> list = AbilityFactory.getDefinedCards(sa.getSourceCard(), defined, sa);
|
||||
|
||||
for (final Card c : list) {
|
||||
@@ -2574,9 +2574,9 @@ public final class AbilityFactoryChangeZone {
|
||||
// ex. "Return all Auras attached to target"
|
||||
// ex. "Return all blocking/blocked by target creature"
|
||||
|
||||
CardList humanType = AllZone.getHumanPlayer().getCardsIn(origin);
|
||||
List<Card> humanType = AllZone.getHumanPlayer().getCardsIn(origin);
|
||||
humanType = AbilityFactory.filterListByType(humanType, params.get("ChangeType"), sa);
|
||||
CardList computerType = AllZone.getComputerPlayer().getCardsIn(origin);
|
||||
List<Card> computerType = AllZone.getComputerPlayer().getCardsIn(origin);
|
||||
computerType = AbilityFactory.filterListByType(computerType, params.get("ChangeType"), sa);
|
||||
final Target tgt = sa.getTarget();
|
||||
|
||||
@@ -2739,9 +2739,9 @@ public final class AbilityFactoryChangeZone {
|
||||
final ZoneType destination = ZoneType.smartValueOf(params.get("Destination"));
|
||||
final ZoneType origin = ZoneType.smartValueOf(params.get("Origin"));
|
||||
|
||||
CardList humanType = AllZone.getHumanPlayer().getCardsIn(origin);
|
||||
List<Card> humanType = AllZone.getHumanPlayer().getCardsIn(origin);
|
||||
humanType = AbilityFactory.filterListByType(humanType, params.get("ChangeType"), sa);
|
||||
CardList computerType = AllZone.getComputerPlayer().getCardsIn(origin);
|
||||
List<Card> computerType = AllZone.getComputerPlayer().getCardsIn(origin);
|
||||
computerType = AbilityFactory.filterListByType(computerType, params.get("ChangeType"), sa);
|
||||
|
||||
// TODO improve restrictions on when the AI would want to use this
|
||||
@@ -2885,7 +2885,7 @@ public final class AbilityFactoryChangeZone {
|
||||
final ZoneType destination = ZoneType.smartValueOf(params.get("Destination"));
|
||||
final List<ZoneType> origin = ZoneType.listValueOf(params.get("Origin"));
|
||||
|
||||
CardList cards = null;
|
||||
List<Card> cards = null;
|
||||
|
||||
ArrayList<Player> tgtPlayers = null;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ import com.google.common.collect.HashBiMap;
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates;
|
||||
import forge.CardPredicates.Presets;
|
||||
@@ -733,7 +733,7 @@ public final class AbilityFactoryChoose {
|
||||
chosen = CardFactoryUtil.getMostProminentColor(AllZoneUtil.getCardsInGame());
|
||||
}
|
||||
else if (logic.equals("MostProminentHumanCreatures")) {
|
||||
CardList list = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
List<Card> list = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
if (list.isEmpty()) {
|
||||
list = CardListUtil.filter(CardListUtil.filterControlledBy(AllZoneUtil.getCardsInGame(), AllZone.getHumanPlayer()), CardPredicates.Presets.CREATURES);
|
||||
}
|
||||
@@ -744,7 +744,7 @@ public final class AbilityFactoryChoose {
|
||||
ZoneType.Battlefield));
|
||||
}
|
||||
else if (logic.equals("MostProminentPermanent")) {
|
||||
final CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
chosen = CardFactoryUtil.getMostProminentColor(list);
|
||||
}
|
||||
else if (logic.equals("MostProminentAttackers")) {
|
||||
@@ -1640,7 +1640,7 @@ public final class AbilityFactoryChoose {
|
||||
.getCardsIn(ZoneType.Library));
|
||||
}
|
||||
} else {
|
||||
CardList list = CardListUtil.filterControlledBy(AllZoneUtil.getCardsInGame(), AllZone.getHumanPlayer());
|
||||
List<Card> list = CardListUtil.filterControlledBy(AllZoneUtil.getCardsInGame(), AllZone.getHumanPlayer());
|
||||
list = CardListUtil.filter(list, Predicates.not(Presets.LANDS));
|
||||
if (!list.isEmpty()) {
|
||||
chosen = list.get(0).getName();
|
||||
@@ -1866,7 +1866,7 @@ public final class AbilityFactoryChoose {
|
||||
if (params.containsKey("ChoiceZone")) {
|
||||
choiceZone = ZoneType.smartValueOf(params.get("ChoiceZone"));
|
||||
}
|
||||
CardList choices = AllZoneUtil.getCardsIn(choiceZone);
|
||||
List<Card> choices = AllZoneUtil.getCardsIn(choiceZone);
|
||||
if (params.containsKey("Choices")) {
|
||||
choices = CardListUtil.getValidCards(choices, params.get("Choices"), host.getController(), host);
|
||||
}
|
||||
@@ -1932,7 +1932,7 @@ public final class AbilityFactoryChoose {
|
||||
if (params.containsKey("ChoiceZone")) {
|
||||
choiceZone = ZoneType.smartValueOf(params.get("ChoiceZone"));
|
||||
}
|
||||
CardList choices = AllZoneUtil.getCardsIn(choiceZone);
|
||||
List<Card> choices = AllZoneUtil.getCardsIn(choiceZone);
|
||||
if (params.containsKey("Choices")) {
|
||||
choices = CardListUtil.getValidCards(choices, params.get("Choices"), host.getController(), host);
|
||||
}
|
||||
@@ -1942,11 +1942,11 @@ public final class AbilityFactoryChoose {
|
||||
? CardFactoryUtil.xCount(host, host.getSVar(params.get("Amount"))) : Integer.parseInt(numericAmount);
|
||||
|
||||
if (params.containsKey("SunderingTitan")) {
|
||||
final CardList land = AllZoneUtil.getLandsInPlay();
|
||||
final List<Card> land = AllZoneUtil.getLandsInPlay();
|
||||
final ArrayList<String> basic = CardUtil.getBasicTypes();
|
||||
|
||||
for (final String type : basic) {
|
||||
final CardList cl = CardListUtil.getType(land, type);
|
||||
final List<Card> cl = CardListUtil.getType(land, type);
|
||||
if (cl.size() > 0) {
|
||||
final String prompt = "Choose a" + (type.equals("Island") ? "n " : " ") + type;
|
||||
final Object o = GuiChoose.one(prompt, cl);
|
||||
|
||||
@@ -25,7 +25,7 @@ import javax.swing.JOptionPane;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.GameActionUtil;
|
||||
import forge.card.cardfactory.CardFactoryUtil;
|
||||
@@ -703,9 +703,9 @@ public final class AbilityFactoryClash {
|
||||
}
|
||||
|
||||
final Player p = tgtPlayers.get(0);
|
||||
CardList pool = new CardList();
|
||||
List<Card> pool = new ArrayList<Card>();
|
||||
if (params.containsKey("DefinedCards")) {
|
||||
pool = new CardList(AbilityFactory.getDefinedCards(sa.getSourceCard(), params.get("DefinedCards"), sa));
|
||||
pool = new ArrayList<Card>(AbilityFactory.getDefinedCards(sa.getSourceCard(), params.get("DefinedCards"), sa));
|
||||
} else {
|
||||
pool = p.getCardsIn(zone);
|
||||
}
|
||||
@@ -756,9 +756,9 @@ public final class AbilityFactoryClash {
|
||||
if ((tgt == null) || p.canBeTargetedBy(sa)) {
|
||||
final ArrayList<Card> pile1 = new ArrayList<Card>();
|
||||
final ArrayList<Card> pile2 = new ArrayList<Card>();
|
||||
CardList pool = new CardList();
|
||||
List<Card> pool = new ArrayList<Card>();
|
||||
if (params.containsKey("DefinedCards")) {
|
||||
pool = new CardList(AbilityFactory.getDefinedCards(sa.getSourceCard(), params.get("DefinedCards"), sa));
|
||||
pool = new ArrayList<Card>(AbilityFactory.getDefinedCards(sa.getSourceCard(), params.get("DefinedCards"), sa));
|
||||
} else {
|
||||
pool = p.getCardsIn(zone);
|
||||
}
|
||||
@@ -845,7 +845,7 @@ public final class AbilityFactoryClash {
|
||||
} // end twoPiles resolve
|
||||
|
||||
private static boolean selectPiles(final HashMap<String, String> params, final SpellAbility sa, ArrayList<Card> pile1, ArrayList<Card> pile2,
|
||||
Player chooser, Card card, CardList pool) {
|
||||
Player chooser, Card card, List<Card> pool) {
|
||||
boolean pile1WasChosen = true;
|
||||
// then, the chooser picks a pile
|
||||
|
||||
@@ -899,11 +899,11 @@ public final class AbilityFactoryClash {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
int cmc1 = CardFactoryUtil.evaluatePermanentList(new CardList(pile1));
|
||||
int cmc2 = CardFactoryUtil.evaluatePermanentList(new CardList(pile2));
|
||||
int cmc1 = CardFactoryUtil.evaluatePermanentList(new ArrayList<Card>(pile1));
|
||||
int cmc2 = CardFactoryUtil.evaluatePermanentList(new ArrayList<Card>(pile2));
|
||||
if (CardListUtil.getNotType(pool, "Creature").isEmpty()) {
|
||||
cmc1 = CardFactoryUtil.evaluateCreatureList(new CardList(pile1));
|
||||
cmc2 = CardFactoryUtil.evaluateCreatureList(new CardList(pile2));
|
||||
cmc1 = CardFactoryUtil.evaluateCreatureList(new ArrayList<Card>(pile1));
|
||||
cmc2 = CardFactoryUtil.evaluateCreatureList(new ArrayList<Card>(pile2));
|
||||
System.out.println("value:" + cmc1 + " " + cmc2);
|
||||
}
|
||||
|
||||
|
||||
@@ -257,7 +257,7 @@ public final class AbilityFactoryClone {
|
||||
boolean useAbility = true;
|
||||
|
||||
// if (card.getController().isComputer()) {
|
||||
// final CardList creatures = AllZoneUtil.getCreaturesInPlay();
|
||||
// final List<Card> creatures = AllZoneUtil.getCreaturesInPlay();
|
||||
// if (!creatures.isEmpty()) {
|
||||
// cardToCopy = CardFactoryUtil.getBestCreatureAI(creatures);
|
||||
// }
|
||||
|
||||
@@ -19,12 +19,13 @@ package forge.card.abilityfactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates;
|
||||
import forge.Singletons;
|
||||
@@ -1061,7 +1062,7 @@ public final class AbilityFactoryCombat {
|
||||
boolean chance = false;
|
||||
|
||||
if (abTgt != null) {
|
||||
CardList list = CardListUtil.filter(AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES);
|
||||
List<Card> 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<Card>() {
|
||||
|
||||
@@ -21,13 +21,14 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardCharacteristicName;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates.Presets;
|
||||
import forge.Command;
|
||||
@@ -306,7 +307,7 @@ public final class AbilityFactoryCopy {
|
||||
final Target abTgt = sa.getTarget();
|
||||
|
||||
if (abTgt != null) {
|
||||
CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
list = CardListUtil.getValidCards(list, abTgt.getValidTgts(), source.getController(), source);
|
||||
list = CardListUtil.getTargetableCards(list, sa);
|
||||
abTgt.resetTargets();
|
||||
|
||||
@@ -29,7 +29,7 @@ import com.google.common.base.Predicate;
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.Counters;
|
||||
import forge.Singletons;
|
||||
@@ -305,7 +305,7 @@ public class AbilityFactoryCounters {
|
||||
final Cost abCost = sa.getPayCosts();
|
||||
final Target abTgt = sa.getTarget();
|
||||
final Card source = sa.getSourceCard();
|
||||
CardList list;
|
||||
List<Card> list;
|
||||
Card choice = null;
|
||||
final String type = params.get("CounterType");
|
||||
final String amountStr = params.get("CounterNum");
|
||||
@@ -457,7 +457,7 @@ public class AbilityFactoryCounters {
|
||||
boolean chance = true;
|
||||
final Target abTgt = sa.getTarget();
|
||||
final Card source = sa.getSourceCard();
|
||||
CardList list;
|
||||
List<Card> list;
|
||||
Card choice = null;
|
||||
final String type = params.get("CounterType");
|
||||
final String amountStr = params.get("CounterNum");
|
||||
@@ -562,7 +562,7 @@ public class AbilityFactoryCounters {
|
||||
final Card source = sa.getSourceCard();
|
||||
// boolean chance = true;
|
||||
boolean preferred = true;
|
||||
CardList list;
|
||||
List<Card> list;
|
||||
final Player player = af.isCurse() ? AllZone.getHumanPlayer() : AllZone.getComputerPlayer();
|
||||
final String type = params.get("CounterType");
|
||||
final String amountStr = params.get("CounterNum");
|
||||
@@ -570,7 +570,7 @@ public class AbilityFactoryCounters {
|
||||
|
||||
if (abTgt == null) {
|
||||
// No target. So must be defined
|
||||
list = new CardList(AbilityFactory.getDefinedCards(source, params.get("Defined"), sa));
|
||||
list = new ArrayList<Card>(AbilityFactory.getDefinedCards(source, params.get("Defined"), sa));
|
||||
|
||||
if (!mandatory) {
|
||||
// TODO - If Trigger isn't mandatory, when wouldn't we want to
|
||||
@@ -655,11 +655,11 @@ public class AbilityFactoryCounters {
|
||||
* a int.
|
||||
* @return a {@link forge.Card} object.
|
||||
*/
|
||||
private static Card chooseCursedTarget(final CardList list, final String type, final int amount) {
|
||||
private static Card chooseCursedTarget(final List<Card> list, final String type, final int amount) {
|
||||
Card choice;
|
||||
if (type.equals("M1M1")) {
|
||||
// try to kill the best killable creature, or reduce the best one
|
||||
final CardList killable = CardListUtil.filter(list, new Predicate<Card>() {
|
||||
final List<Card> killable = CardListUtil.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
return c.getNetDefense() <= amount;
|
||||
@@ -688,12 +688,12 @@ public class AbilityFactoryCounters {
|
||||
* a {@link java.lang.String} object.
|
||||
* @return a {@link forge.Card} object.
|
||||
*/
|
||||
private static Card chooseBoonTarget(final CardList list, final String type) {
|
||||
private static Card chooseBoonTarget(final List<Card> list, final String type) {
|
||||
Card choice;
|
||||
if (type.equals("P1P1")) {
|
||||
choice = CardFactoryUtil.getBestCreatureAI(list);
|
||||
} else if (type.equals("DIVINITY")) {
|
||||
final CardList boon = CardListUtil.filter(list, new Predicate<Card>() {
|
||||
final List<Card> boon = CardListUtil.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
return c.getCounters(Counters.DIVINITY) == 0;
|
||||
@@ -995,7 +995,7 @@ public class AbilityFactoryCounters {
|
||||
final Cost abCost = sa.getPayCosts();
|
||||
Target abTgt = sa.getTarget();
|
||||
final Card source = sa.getSourceCard();
|
||||
// CardList list;
|
||||
// List<Card> list;
|
||||
// Card choice = null;
|
||||
final HashMap<String, String> params = af.getMapParams();
|
||||
|
||||
@@ -1075,7 +1075,7 @@ public class AbilityFactoryCounters {
|
||||
// the expected targets could be
|
||||
// Target abTgt = sa.getTarget();
|
||||
// final Card source = sa.getSourceCard();
|
||||
// CardList list;
|
||||
// List<Card> list;
|
||||
// Card choice = null;
|
||||
// HashMap<String,String> params = af.getMapParams();
|
||||
|
||||
@@ -1446,8 +1446,8 @@ public class AbilityFactoryCounters {
|
||||
if (subAb != null && !subAb.chkAIDrawback()) {
|
||||
return false;
|
||||
}
|
||||
CardList hperms = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
CardList cperms = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> hperms = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> cperms = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
cperms = CardListUtil.filter(cperms, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card crd) {
|
||||
@@ -1512,12 +1512,12 @@ public class AbilityFactoryCounters {
|
||||
* a {@link forge.card.spellability.SpellAbility} object.
|
||||
*/
|
||||
private static void proliferateResolve(final AbilityFactory af, final SpellAbility sa) {
|
||||
CardList hperms = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
CardList cperms = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> hperms = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> cperms = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
|
||||
if (sa.getSourceCard().getController().isHuman()) {
|
||||
cperms.addAll(hperms);
|
||||
final CardList unchosen = cperms;
|
||||
final List<Card> unchosen = cperms;
|
||||
AllZone.getInputControl().setInput(new Input() {
|
||||
private static final long serialVersionUID = -1779224307654698954L;
|
||||
|
||||
@@ -1860,8 +1860,8 @@ public class AbilityFactoryCounters {
|
||||
final HashMap<String, String> params = af.getMapParams();
|
||||
final Cost abCost = sa.getPayCosts();
|
||||
final Card source = sa.getSourceCard();
|
||||
CardList hList;
|
||||
CardList cList;
|
||||
List<Card> hList;
|
||||
List<Card> cList;
|
||||
final String type = params.get("CounterType");
|
||||
final String amountStr = params.get("CounterNum");
|
||||
final String valid = params.get("ValidCards");
|
||||
@@ -1919,7 +1919,7 @@ public class AbilityFactoryCounters {
|
||||
|
||||
if (curse) {
|
||||
if (type.equals("M1M1")) {
|
||||
final CardList killable = CardListUtil.filter(hList, new Predicate<Card>() {
|
||||
final List<Card> killable = CardListUtil.filter(hList, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
return c.getNetDefense() <= amount;
|
||||
@@ -2006,7 +2006,7 @@ public class AbilityFactoryCounters {
|
||||
final String valid = params.get("ValidCards");
|
||||
final ZoneType zone = params.containsKey("ValidZone") ? ZoneType.smartValueOf(params.get("ValidZone")) : ZoneType.Battlefield;
|
||||
|
||||
CardList cards = AllZoneUtil.getCardsIn(zone);
|
||||
List<Card> cards = AllZoneUtil.getCardsIn(zone);
|
||||
cards = CardListUtil.getValidCards(cards, valid, sa.getSourceCard().getController(), sa.getSourceCard());
|
||||
|
||||
final Target tgt = sa.getTarget();
|
||||
@@ -2261,7 +2261,7 @@ public class AbilityFactoryCounters {
|
||||
final String valid = params.get("ValidCards");
|
||||
final ZoneType zone = params.containsKey("ValidZone") ? ZoneType.smartValueOf(params.get("ValidZone")) : ZoneType.Battlefield;
|
||||
|
||||
CardList cards = AllZoneUtil.getCardsIn(zone);
|
||||
List<Card> cards = AllZoneUtil.getCardsIn(zone);
|
||||
cards = CardListUtil.getValidCards(cards, valid, sa.getSourceCard().getController(), sa.getSourceCard());
|
||||
|
||||
final Target tgt = sa.getTarget();
|
||||
@@ -2584,7 +2584,7 @@ public class AbilityFactoryCounters {
|
||||
}
|
||||
} else { // targeted
|
||||
final Player player = af.isCurse() ? AllZone.getHumanPlayer() : AllZone.getComputerPlayer();
|
||||
CardList list = player.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = player.getCardsIn(ZoneType.Battlefield);
|
||||
list = CardListUtil.getTargetableCards(list, sa);
|
||||
list = CardListUtil.getValidCards(list, abTgt.getValidTgts(), host.getController(), host);
|
||||
if (list.isEmpty() && mandatory) {
|
||||
|
||||
@@ -19,6 +19,7 @@ package forge.card.abilityfactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
@@ -27,7 +28,7 @@ import com.google.common.collect.Iterables;
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates;
|
||||
import forge.CardUtil;
|
||||
@@ -487,7 +488,7 @@ public class AbilityFactoryDealDamage {
|
||||
return false;
|
||||
}
|
||||
|
||||
final CardList hand = comp.getCardsIn(ZoneType.Hand);
|
||||
final List<Card> hand = comp.getCardsIn(ZoneType.Hand);
|
||||
|
||||
if (this.abilityFactory.isSpell()) {
|
||||
// If this is a spell, cast it instead of discarding
|
||||
@@ -526,7 +527,7 @@ public class AbilityFactoryDealDamage {
|
||||
final Target tgt = saMe.getTarget();
|
||||
final Card source = saMe.getSourceCard();
|
||||
final HashMap<String, String> params = this.abilityFactory.getMapParams();
|
||||
CardList hPlay = pl.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> hPlay = pl.getCardsIn(ZoneType.Battlefield);
|
||||
hPlay = CardListUtil.getValidCards(hPlay, tgt.getValidTgts(), AllZone.getComputerPlayer(), source);
|
||||
|
||||
final ArrayList<Object> objects = tgt.getTargets();
|
||||
@@ -543,7 +544,7 @@ public class AbilityFactoryDealDamage {
|
||||
}
|
||||
hPlay = CardListUtil.getTargetableCards(hPlay, saMe);
|
||||
|
||||
final CardList killables = CardListUtil.filter(hPlay, new Predicate<Card>() {
|
||||
final List<Card> killables = CardListUtil.filter(hPlay, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
return (c.getEnoughDamageToKill(d, source, false, noPrevention) <= d) && !ComputerUtil.canRegenerate(c)
|
||||
@@ -1164,14 +1165,14 @@ public class AbilityFactoryDealDamage {
|
||||
validP = params.get("ValidPlayers");
|
||||
}
|
||||
|
||||
final CardList humanList = this.getKillableCreatures(af, sa, AllZone.getHumanPlayer(), dmg);
|
||||
CardList computerList = this.getKillableCreatures(af, sa, AllZone.getComputerPlayer(), dmg);
|
||||
final List<Card> humanList = this.getKillableCreatures(af, sa, AllZone.getHumanPlayer(), dmg);
|
||||
List<Card> computerList = this.getKillableCreatures(af, sa, AllZone.getComputerPlayer(), dmg);
|
||||
|
||||
final Target tgt = sa.getTarget();
|
||||
if (tgt != null && sa.canTarget(AllZone.getHumanPlayer())) {
|
||||
tgt.resetTargets();
|
||||
sa.getTarget().addTarget(AllZone.getHumanPlayer());
|
||||
computerList = new CardList();
|
||||
computerList = new ArrayList<Card>();
|
||||
}
|
||||
|
||||
// abCost stuff that should probably be centralized...
|
||||
@@ -1234,7 +1235,7 @@ public class AbilityFactoryDealDamage {
|
||||
* a int.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
private CardList getKillableCreatures(final AbilityFactory af, final SpellAbility sa, final Player player,
|
||||
private List<Card> getKillableCreatures(final AbilityFactory af, final SpellAbility sa, final Player player,
|
||||
final int dmg) {
|
||||
final HashMap<String, String> params = af.getMapParams();
|
||||
final Card source = af.getHostCard();
|
||||
@@ -1245,7 +1246,7 @@ public class AbilityFactoryDealDamage {
|
||||
}
|
||||
|
||||
// TODO: X may be something different than X paid
|
||||
CardList list = player.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = player.getCardsIn(ZoneType.Battlefield);
|
||||
list = CardListUtil.getValidCards(list, validC.split(","), source.getController(), source);
|
||||
|
||||
final Predicate<Card> filterKillable = new Predicate<Card>() {
|
||||
@@ -1319,8 +1320,8 @@ public class AbilityFactoryDealDamage {
|
||||
}
|
||||
|
||||
// Evaluate creatures getting killed
|
||||
final CardList humanList = this.getKillableCreatures(af, sa, AllZone.getHumanPlayer(), dmg);
|
||||
final CardList computerList = this.getKillableCreatures(af, sa, AllZone.getComputerPlayer(), dmg);
|
||||
final List<Card> humanList = this.getKillableCreatures(af, sa, AllZone.getHumanPlayer(), dmg);
|
||||
final List<Card> computerList = this.getKillableCreatures(af, sa, AllZone.getComputerPlayer(), dmg);
|
||||
if ((CardFactoryUtil.evaluateCreatureList(computerList) + 50) >= CardFactoryUtil
|
||||
.evaluateCreatureList(humanList)) {
|
||||
return false;
|
||||
@@ -1364,7 +1365,7 @@ public class AbilityFactoryDealDamage {
|
||||
}
|
||||
|
||||
String players = "";
|
||||
CardList list = new CardList();
|
||||
List<Card> list = new ArrayList<Card>();
|
||||
|
||||
if (params.containsKey("ValidPlayers")) {
|
||||
players = params.get("ValidPlayers");
|
||||
@@ -1635,7 +1636,7 @@ public class AbilityFactoryDealDamage {
|
||||
final HashMap<String, String> params = af.getMapParams();
|
||||
final Card card = sa.getSourceCard();
|
||||
|
||||
CardList sources = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> sources = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
if (params.containsKey("ValidCards")) {
|
||||
sources = CardListUtil.getValidCards(sources, params.get("ValidCards"), card.getController(), card);
|
||||
}
|
||||
@@ -1878,7 +1879,7 @@ public class AbilityFactoryDealDamage {
|
||||
Target tgt = sa.getTarget();
|
||||
tgt.resetTargets();
|
||||
|
||||
CardList aiCreatures = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
||||
List<Card> aiCreatures = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
||||
aiCreatures = CardListUtil.getTargetableCards(aiCreatures, sa);
|
||||
aiCreatures = CardListUtil.filter(aiCreatures, new Predicate<Card>() {
|
||||
@Override
|
||||
@@ -1887,7 +1888,7 @@ public class AbilityFactoryDealDamage {
|
||||
}
|
||||
});
|
||||
|
||||
CardList humCreatures = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
List<Card> humCreatures = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
humCreatures = CardListUtil.getTargetableCards(humCreatures, sa);
|
||||
|
||||
final Random r = MyRandom.getRandom();
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
@@ -28,7 +29,7 @@ import com.google.common.base.Predicate;
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.Command;
|
||||
import forge.Singletons;
|
||||
@@ -392,7 +393,7 @@ public final class AbilityFactoryDebuff {
|
||||
|
||||
final Target tgt = sa.getTarget();
|
||||
tgt.resetTargets();
|
||||
CardList list = AbilityFactoryDebuff.getCurseCreatures(af, sa, kws);
|
||||
List<Card> list = AbilityFactoryDebuff.getCurseCreatures(af, sa, kws);
|
||||
list = CardListUtil.getValidCards(list, tgt.getValidTgts(), sa.getActivatingPlayer(), sa.getSourceCard());
|
||||
|
||||
// several uses here:
|
||||
@@ -445,9 +446,9 @@ public final class AbilityFactoryDebuff {
|
||||
* a {@link java.util.ArrayList} object.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
private static CardList getCurseCreatures(final AbilityFactory af, final SpellAbility sa,
|
||||
private static List<Card> getCurseCreatures(final AbilityFactory af, final SpellAbility sa,
|
||||
final ArrayList<String> kws) {
|
||||
CardList list = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
List<Card> list = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
list = CardListUtil.getTargetableCards(list, sa);
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
@@ -477,7 +478,7 @@ public final class AbilityFactoryDebuff {
|
||||
* @return a boolean.
|
||||
*/
|
||||
private static boolean debuffMandatoryTarget(final AbilityFactory af, final SpellAbility sa, final boolean mandatory) {
|
||||
CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
final Target tgt = sa.getTarget();
|
||||
list = CardListUtil.getValidCards(list, tgt.getValidTgts(), sa.getActivatingPlayer(), sa.getSourceCard());
|
||||
|
||||
@@ -491,8 +492,8 @@ public final class AbilityFactoryDebuff {
|
||||
list.remove(c);
|
||||
}
|
||||
|
||||
final CardList pref = CardListUtil.filterControlledBy(list, AllZone.getHumanPlayer());
|
||||
final CardList forced = CardListUtil.filterControlledBy(list, AllZone.getComputerPlayer());
|
||||
final List<Card> pref = CardListUtil.filterControlledBy(list, AllZone.getHumanPlayer());
|
||||
final List<Card> forced = CardListUtil.filterControlledBy(list, AllZone.getComputerPlayer());
|
||||
final Card source = sa.getSourceCard();
|
||||
|
||||
while (tgt.getNumTargeted() < tgt.getMaxTargets(source, sa)) {
|
||||
@@ -792,9 +793,9 @@ public final class AbilityFactoryDebuff {
|
||||
valid = params.get("ValidCards");
|
||||
}
|
||||
|
||||
CardList comp = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> comp = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
comp = CardListUtil.getValidCards(comp, valid, hostCard.getController(), hostCard);
|
||||
CardList human = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> human = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
human = CardListUtil.getValidCards(human, valid, hostCard.getController(), hostCard);
|
||||
|
||||
// TODO - add blocking situations here also
|
||||
@@ -839,7 +840,7 @@ public final class AbilityFactoryDebuff {
|
||||
valid = params.get("ValidCards");
|
||||
}
|
||||
|
||||
CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
list = CardListUtil.getValidCards(list, valid.split(","), hostCard.getController(), hostCard);
|
||||
|
||||
for (final Card tgtC : list) {
|
||||
|
||||
@@ -20,6 +20,7 @@ package forge.card.abilityfactory;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
@@ -27,7 +28,7 @@ import com.google.common.base.Predicate;
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardUtil;
|
||||
import forge.Counters;
|
||||
@@ -225,7 +226,7 @@ public class AbilityFactoryDestroy {
|
||||
final Card source = sa.getSourceCard();
|
||||
final HashMap<String, String> params = af.getMapParams();
|
||||
final boolean noRegen = params.containsKey("NoRegen");
|
||||
CardList list;
|
||||
List<Card> list;
|
||||
|
||||
if (abCost != null) {
|
||||
if (!CostUtil.checkSacrificeCost(abCost, source)) {
|
||||
@@ -317,7 +318,7 @@ public class AbilityFactoryDestroy {
|
||||
}
|
||||
} else {
|
||||
if (params.containsKey("Defined")) {
|
||||
list = new CardList(AbilityFactory.getDefinedCards(af.getHostCard(), params.get("Defined"), sa));
|
||||
list = new ArrayList<Card>(AbilityFactory.getDefinedCards(af.getHostCard(), params.get("Defined"), sa));
|
||||
if (list.isEmpty()
|
||||
|| !CardListUtil.filterControlledBy(list, AllZone.getComputerPlayer()).isEmpty()
|
||||
|| CardListUtil.getNotKeyword(list, "Indestructible").isEmpty()) {
|
||||
@@ -376,7 +377,7 @@ public class AbilityFactoryDestroy {
|
||||
final boolean noRegen = params.containsKey("NoRegen");
|
||||
|
||||
if (tgt != null) {
|
||||
CardList list;
|
||||
List<Card> list;
|
||||
list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
list = CardListUtil.getTargetableCards(list, sa);
|
||||
list = CardListUtil.getValidCards(list, tgt.getValidTgts(), source.getController(), source);
|
||||
@@ -387,7 +388,7 @@ public class AbilityFactoryDestroy {
|
||||
|
||||
tgt.resetTargets();
|
||||
|
||||
CardList preferred = CardListUtil.getNotKeyword(list, "Indestructible");
|
||||
List<Card> preferred = CardListUtil.getNotKeyword(list, "Indestructible");
|
||||
preferred = CardListUtil.filterControlledBy(preferred, AllZone.getHumanPlayer());
|
||||
|
||||
// If NoRegen is not set, filter out creatures that have a
|
||||
@@ -851,8 +852,8 @@ public class AbilityFactoryDestroy {
|
||||
if (params.containsKey("ValidCards")) {
|
||||
valid = params.get("ValidCards");
|
||||
}
|
||||
CardList humanlist = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
CardList computerlist = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> humanlist = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> computerlist = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
if (sa.getTarget() != null) {
|
||||
tgt.resetTargets();
|
||||
sa.getTarget().addTarget(AllZone.getHumanPlayer());
|
||||
@@ -932,8 +933,8 @@ public class AbilityFactoryDestroy {
|
||||
valid = valid.replace("X", Integer.toString(xPay));
|
||||
}
|
||||
|
||||
CardList humanlist = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
CardList computerlist = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> humanlist = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> computerlist = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
|
||||
final Target tgt = sa.getTarget();
|
||||
|
||||
@@ -1038,7 +1039,7 @@ public class AbilityFactoryDestroy {
|
||||
valid = valid.replace("X", Integer.toString(AbilityFactory.calculateAmount(card, "X", sa)));
|
||||
}
|
||||
|
||||
CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
|
||||
if (targetPlayer != null) {
|
||||
list = CardListUtil.filterControlledBy(list, targetPlayer);
|
||||
|
||||
@@ -19,6 +19,7 @@ package forge.card.abilityfactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
@@ -26,7 +27,7 @@ import com.google.common.base.Predicate;
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates;
|
||||
import forge.Command;
|
||||
@@ -286,7 +287,7 @@ public class AbilityFactoryEffect {
|
||||
final Target tgt = sa.getTarget();
|
||||
if (tgt != null) {
|
||||
tgt.resetTargets();
|
||||
CardList list = AllZone.getCombat().getAttackerList();
|
||||
List<Card> list = AllZone.getCombat().getAttackerList();
|
||||
list = CardListUtil.getValidCards(list, tgt.getValidTgts(), sa.getActivatingPlayer(), sa.getSourceCard());
|
||||
list = CardListUtil.getTargetableCards(list, sa);
|
||||
Card target = CardFactoryUtil.getBestCreatureAI(list);
|
||||
@@ -299,8 +300,8 @@ public class AbilityFactoryEffect {
|
||||
} else if (logic.equals("Always")) {
|
||||
randomReturn = true;
|
||||
} else if (logic.equals("Evasion")) {
|
||||
CardList comp = CardListUtil.filter(AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES);
|
||||
CardList human = CardListUtil.filter(AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES);
|
||||
List<Card> comp = CardListUtil.filter(AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES);
|
||||
List<Card> human = CardListUtil.filter(AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES);
|
||||
|
||||
// only count creatures that can attack or block
|
||||
comp = CardListUtil.filter(comp, new Predicate<Card>() {
|
||||
@@ -330,7 +331,7 @@ public class AbilityFactoryEffect {
|
||||
if (name == null) {
|
||||
name = sa.getSourceCard().getName() + "'s Effect";
|
||||
}
|
||||
final CardList list = sa.getActivatingPlayer().getCardsIn(ZoneType.Battlefield, name);
|
||||
final List<Card> list = sa.getActivatingPlayer().getCardsIn(ZoneType.Battlefield, name);
|
||||
if (list.size() != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ package forge.card.abilityfactory;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
@@ -27,7 +28,7 @@ import com.google.common.base.Predicate;
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.Command;
|
||||
import forge.GameEntity;
|
||||
@@ -334,7 +335,7 @@ public class AbilityFactoryGainControl {
|
||||
}
|
||||
}
|
||||
|
||||
CardList list = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
list = CardListUtil.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
|
||||
@@ -418,7 +419,7 @@ public class AbilityFactoryGainControl {
|
||||
* a {@link forge.card.spellability.SpellAbility} object.
|
||||
*/
|
||||
private void gainControlResolve(final SpellAbility sa) {
|
||||
CardList tgtCards = new CardList();
|
||||
List<Card> tgtCards = new ArrayList<Card>();
|
||||
Card source = sa.getSourceCard();
|
||||
|
||||
final Target tgt = sa.getTarget();
|
||||
@@ -472,7 +473,7 @@ public class AbilityFactoryGainControl {
|
||||
if (!tgtC.equals(newController)) {
|
||||
tgtC.addController(newController);
|
||||
}
|
||||
// Singletons.getModel().getGameAction().changeController(new CardList(tgtC),
|
||||
// Singletons.getModel().getGameAction().changeController(new ArrayList<Card>(tgtC),
|
||||
// tgtC.getController(), newController.get(0));
|
||||
|
||||
if (this.bUntap) {
|
||||
@@ -560,7 +561,7 @@ public class AbilityFactoryGainControl {
|
||||
private boolean gainControlDrawbackAI(final SpellAbility sa) {
|
||||
if ((sa.getTarget() == null) || !sa.getTarget().doesTarget()) {
|
||||
if (this.params.containsKey("AllValid")) {
|
||||
CardList tgtCards = CardListUtil.filterControlledBy(AllZoneUtil.getCardsIn(ZoneType.Battlefield), AllZone.getHumanPlayer());
|
||||
List<Card> tgtCards = CardListUtil.filterControlledBy(AllZoneUtil.getCardsIn(ZoneType.Battlefield), AllZone.getHumanPlayer());
|
||||
tgtCards = AbilityFactory.filterListByType(tgtCards, this.params.get("AllValid"), sa);
|
||||
if (tgtCards.isEmpty()) {
|
||||
return false;
|
||||
@@ -651,7 +652,7 @@ public class AbilityFactoryGainControl {
|
||||
}
|
||||
if (AllZoneUtil.isCardInPlay(c)) {
|
||||
c.removeController(newController);
|
||||
// Singletons.getModel().getGameAction().changeController(new CardList(c),
|
||||
// Singletons.getModel().getGameAction().changeController(new ArrayList<Card>(c),
|
||||
// c.getController(), originalController);
|
||||
|
||||
if (tapOnLose) {
|
||||
@@ -854,7 +855,7 @@ public class AbilityFactoryGainControl {
|
||||
final Target tgt = sa.getTarget();
|
||||
tgt.resetTargets();
|
||||
|
||||
CardList list = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
list = CardListUtil.getValidCards(list, tgt.getValidTgts(), AllZone.getComputerPlayer(), sa.getSourceCard());
|
||||
// AI won't try to grab cards that are filtered out of AI decks on
|
||||
// purpose
|
||||
@@ -869,7 +870,7 @@ public class AbilityFactoryGainControl {
|
||||
if (params.containsKey("Defined")) {
|
||||
object2 = AbilityFactory.getDefinedCards(sa.getSourceCard(), params.get("Defined"), sa).get(0);
|
||||
} else if (tgt.getMinTargets(sa.getSourceCard(), sa) > 1) {
|
||||
CardList list2 = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list2 = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
list2 = CardListUtil.getValidCards(list2, tgt.getValidTgts(), AllZone.getComputerPlayer(), sa.getSourceCard());
|
||||
object2 = CardFactoryUtil.getWorstAI(list2);
|
||||
tgt.addTarget(object2);
|
||||
|
||||
@@ -20,6 +20,7 @@ package forge.card.abilityfactory;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
@@ -27,7 +28,7 @@ import com.google.common.collect.Iterables;
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates;
|
||||
import forge.Constant;
|
||||
@@ -762,11 +763,11 @@ public class AbilityFactoryMana {
|
||||
maxChoices++;
|
||||
}
|
||||
|
||||
CardList cards = null;
|
||||
List<Card> cards = null;
|
||||
|
||||
// Reuse AF_Defined in a slightly different way
|
||||
if (validCard.startsWith("Defined.")) {
|
||||
cards = new CardList();
|
||||
cards = new ArrayList<Card>();
|
||||
for (final Card c : AbilityFactory.getDefinedCards(card, validCard.replace("Defined.", ""), abMana)) {
|
||||
cards.add(c);
|
||||
}
|
||||
@@ -852,7 +853,7 @@ public class AbilityFactoryMana {
|
||||
* a {@link java.util.ArrayList} object.
|
||||
* @return a {@link java.util.ArrayList} object.
|
||||
*/
|
||||
private static ArrayList<String> hasProperty(final int maxChoices, final CardList cards,
|
||||
private static ArrayList<String> hasProperty(final int maxChoices, final List<Card> cards,
|
||||
final ArrayList<String> colors) {
|
||||
for (final Card c : cards) {
|
||||
// For each card, go through all the colors and if the card is that
|
||||
@@ -997,7 +998,7 @@ public class AbilityFactoryMana {
|
||||
* @return a boolean.
|
||||
*/
|
||||
private static boolean hasUrzaLands(final Player p) {
|
||||
final CardList landsControlled = p.getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> landsControlled = p.getCardsIn(ZoneType.Battlefield);
|
||||
return Iterables.any(landsControlled, CardPredicates.nameEquals("Urza's Mine")) &&
|
||||
Iterables.any(landsControlled, CardPredicates.nameEquals("Urza's Tower")) &&
|
||||
Iterables.any(landsControlled, CardPredicates.nameEquals("Urza's Power Plant"));
|
||||
|
||||
@@ -20,6 +20,7 @@ package forge.card.abilityfactory;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
@@ -28,7 +29,7 @@ import com.google.common.collect.Iterables;
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates;
|
||||
import forge.CardPredicates.Presets;
|
||||
@@ -404,7 +405,7 @@ public class AbilityFactoryPermanentState {
|
||||
targetController = AllZone.getHumanPlayer();
|
||||
}
|
||||
|
||||
CardList untapList = targetController.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> untapList = targetController.getCardsIn(ZoneType.Battlefield);
|
||||
untapList = CardListUtil.getTargetableCards(untapList, sa);
|
||||
untapList = CardListUtil.getValidCards(untapList, tgt.getValidTgts(), source.getController(), source);
|
||||
|
||||
@@ -476,7 +477,7 @@ public class AbilityFactoryPermanentState {
|
||||
final Card source = sa.getSourceCard();
|
||||
final Target tgt = sa.getTarget();
|
||||
|
||||
CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
|
||||
list = CardListUtil.getValidCards(list, tgt.getValidTgts(), source.getController(), source);
|
||||
list = CardListUtil.getTargetableCards(list, sa);
|
||||
@@ -484,7 +485,7 @@ public class AbilityFactoryPermanentState {
|
||||
// filter by enchantments and planeswalkers, their tapped state doesn't
|
||||
// matter.
|
||||
final String[] tappablePermanents = { "Enchantment", "Planeswalker" };
|
||||
CardList tapList = CardListUtil.getValidCards(list, tappablePermanents, source.getController(), source);
|
||||
List<Card> tapList = CardListUtil.getValidCards(list, tappablePermanents, source.getController(), source);
|
||||
|
||||
if (AbilityFactoryPermanentState.untapTargetList(source, tgt, af, sa, mandatory, tapList)) {
|
||||
return true;
|
||||
@@ -527,7 +528,7 @@ public class AbilityFactoryPermanentState {
|
||||
* @return a boolean.
|
||||
*/
|
||||
private static boolean untapTargetList(final Card source, final Target tgt, final AbilityFactory af,
|
||||
final SpellAbility sa, final boolean mandatory, final CardList tapList) {
|
||||
final SpellAbility sa, final boolean mandatory, final List<Card> tapList) {
|
||||
for (final Card c : tgt.getTargetCards()) {
|
||||
tapList.remove(c);
|
||||
}
|
||||
@@ -637,7 +638,7 @@ public class AbilityFactoryPermanentState {
|
||||
if (p.isHuman()) {
|
||||
AllZone.getInputControl().setInput(CardFactoryUtil.inputUntapUpToNType(num, valid));
|
||||
} else {
|
||||
CardList list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
list = CardListUtil.getType(list, valid);
|
||||
list = CardListUtil.filter(list, Presets.TAPPED);
|
||||
|
||||
@@ -1000,7 +1001,7 @@ public class AbilityFactoryPermanentState {
|
||||
*/
|
||||
private static boolean tapPrefTargeting(final Card source, final Target tgt, final AbilityFactory af,
|
||||
final SpellAbility sa, final boolean mandatory) {
|
||||
CardList tapList = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> tapList = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
tapList = CardListUtil.filter(tapList, Presets.UNTAPPED);
|
||||
tapList = CardListUtil.getValidCards(tapList, tgt.getValidTgts(), source.getController(), source);
|
||||
// filter out enchantments and planeswalkers, their tapped state doesn't matter.
|
||||
@@ -1036,8 +1037,8 @@ public class AbilityFactoryPermanentState {
|
||||
|
||||
if (phase.getPhase().isAfter(PhaseType.COMBAT_DECLARE_ATTACKERS)) {
|
||||
//Combat has already started
|
||||
final CardList attackers = AllZone.getCombat().getAttackerList();
|
||||
CardList creatureList = CardListUtil.filter(tapList, new Predicate<Card>() {
|
||||
final List<Card> attackers = AllZone.getCombat().getAttackerList();
|
||||
List<Card> creatureList = CardListUtil.filter(tapList, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
if (c.isCreature()) {
|
||||
@@ -1050,9 +1051,9 @@ public class AbilityFactoryPermanentState {
|
||||
choice = CardFactoryUtil.getBestCreatureAI(creatureList);
|
||||
}
|
||||
} else {
|
||||
final CardList attackers = ComputerUtil.getPossibleAttackers();
|
||||
final List<Card> attackers = ComputerUtil.getPossibleAttackers();
|
||||
attackers.remove(sa.getSourceCard());
|
||||
CardList creatureList = CardListUtil.filter(tapList, new Predicate<Card>() {
|
||||
List<Card> creatureList = CardListUtil.filter(tapList, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
if (c.isCreature()) {
|
||||
@@ -1069,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)) {
|
||||
CardList creatureList = CardListUtil.filter(tapList, CardPredicates.Presets.CREATURES_CAN_ATTACK);
|
||||
List<Card> creatureList = CardListUtil.filter(tapList, CardPredicates.Presets.CREATURES_CAN_ATTACK);
|
||||
choice = CardFactoryUtil.getBestCreatureAI(creatureList);
|
||||
} else { // no creatures available
|
||||
choice = CardFactoryUtil.getMostExpensivePermanentAI(tapList, sa, false);
|
||||
@@ -1117,13 +1118,13 @@ public class AbilityFactoryPermanentState {
|
||||
final Card source = sa.getSourceCard();
|
||||
final Target tgt = sa.getTarget();
|
||||
|
||||
CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
list = CardListUtil.getValidCards(list, tgt.getValidTgts(), source.getController(), source);
|
||||
list = CardListUtil.getTargetableCards(list, sa);
|
||||
|
||||
// filter by enchantments and planeswalkers, their tapped state doesn't matter.
|
||||
final String[] tappablePermanents = { "Enchantment", "Planeswalker" };
|
||||
CardList tapList = CardListUtil.getValidCards(list, tappablePermanents, source.getController(), source);
|
||||
List<Card> tapList = CardListUtil.getValidCards(list, tappablePermanents, source.getController(), source);
|
||||
|
||||
if (AbilityFactoryPermanentState.tapTargetList(af, sa, tapList, mandatory)) {
|
||||
return true;
|
||||
@@ -1161,7 +1162,7 @@ public class AbilityFactoryPermanentState {
|
||||
* a boolean.
|
||||
* @return a boolean.
|
||||
*/
|
||||
private static boolean tapTargetList(final AbilityFactory af, final SpellAbility sa, final CardList tapList,
|
||||
private static boolean tapTargetList(final AbilityFactory af, final SpellAbility sa, final List<Card> tapList,
|
||||
final boolean mandatory) {
|
||||
final Card source = sa.getSourceCard();
|
||||
final Target tgt = sa.getTarget();
|
||||
@@ -1420,7 +1421,7 @@ public class AbilityFactoryPermanentState {
|
||||
final Card card = sa.getSourceCard();
|
||||
|
||||
String valid = "";
|
||||
CardList list = null;
|
||||
List<Card> list = null;
|
||||
|
||||
ArrayList<Player> tgtPlayers = null;
|
||||
|
||||
@@ -1682,7 +1683,7 @@ public class AbilityFactoryPermanentState {
|
||||
card.clearRemembered();
|
||||
}
|
||||
|
||||
CardList cards = null;
|
||||
List<Card> cards = null;
|
||||
|
||||
ArrayList<Player> tgtPlayers = null;
|
||||
|
||||
@@ -1738,7 +1739,7 @@ public class AbilityFactoryPermanentState {
|
||||
valid = params.get("ValidCards");
|
||||
}
|
||||
|
||||
CardList validTappables = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> validTappables = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
|
||||
final Target tgt = sa.getTarget();
|
||||
|
||||
@@ -1758,13 +1759,13 @@ public class AbilityFactoryPermanentState {
|
||||
}
|
||||
|
||||
if (validTappables.size() > 0) {
|
||||
final CardList human = CardListUtil.filter(validTappables, new Predicate<Card>() {
|
||||
final List<Card> human = CardListUtil.filter(validTappables, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
return c.getController().isHuman();
|
||||
}
|
||||
});
|
||||
final CardList compy = CardListUtil.filter(validTappables, new Predicate<Card>() {
|
||||
final List<Card> compy = CardListUtil.filter(validTappables, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
return c.getController().isComputer();
|
||||
@@ -1788,8 +1789,8 @@ public class AbilityFactoryPermanentState {
|
||||
* a {@link forge.Card} object.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
private static CardList getTapAllTargets(final String valid, final Card source) {
|
||||
CardList tmpList = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
private static List<Card> getTapAllTargets(final String valid, final Card source) {
|
||||
List<Card> tmpList = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
tmpList = CardListUtil.getValidCards(tmpList, valid, source.getController(), source);
|
||||
tmpList = CardListUtil.filter(tmpList, Presets.UNTAPPED);
|
||||
return tmpList;
|
||||
@@ -1852,7 +1853,7 @@ public class AbilityFactoryPermanentState {
|
||||
valid = params.get("ValidCards");
|
||||
}
|
||||
|
||||
CardList validTappables = AbilityFactoryPermanentState.getTapAllTargets(valid, source);
|
||||
List<Card> validTappables = AbilityFactoryPermanentState.getTapAllTargets(valid, source);
|
||||
|
||||
final Target tgt = sa.getTarget();
|
||||
|
||||
@@ -1873,13 +1874,13 @@ public class AbilityFactoryPermanentState {
|
||||
}
|
||||
|
||||
if (validTappables.size() > 0) {
|
||||
final CardList human = CardListUtil.filter(validTappables, new Predicate<Card>() {
|
||||
final List<Card> human = CardListUtil.filter(validTappables, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
return c.getController().isHuman();
|
||||
}
|
||||
});
|
||||
final CardList compy = CardListUtil.filter(validTappables, new Predicate<Card>() {
|
||||
final List<Card> compy = CardListUtil.filter(validTappables, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
return c.getController().isComputer();
|
||||
@@ -2581,17 +2582,17 @@ public class AbilityFactoryPermanentState {
|
||||
final boolean mandatory) {
|
||||
// Card source = sa.getSourceCard();
|
||||
|
||||
// CardList phaseList =
|
||||
// List<Card> phaseList =
|
||||
// AllZoneUtil.getCardsIn(Zone.Battlefield).getTargetableCards(source)
|
||||
// .getValidCards(tgt.getValidTgts(), source.getController(), source);
|
||||
|
||||
// CardList aiPhaseList =
|
||||
// List<Card> aiPhaseList =
|
||||
// phaseList.getController(AllZone.getComputerPlayer());
|
||||
|
||||
// If Something in the Phase List might die from a bad combat, or a
|
||||
// spell on the stack save it
|
||||
|
||||
// CardList humanPhaseList =
|
||||
// List<Card> humanPhaseList =
|
||||
// phaseList.getController(AllZone.getHumanPlayer());
|
||||
|
||||
// If something in the Human List is causing issues, phase it out
|
||||
@@ -2617,7 +2618,7 @@ public class AbilityFactoryPermanentState {
|
||||
final Card source = sa.getSourceCard();
|
||||
final Target tgt = sa.getTarget();
|
||||
|
||||
CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
list = CardListUtil.getTargetableCards(CardListUtil.getValidCards(list, tgt.getValidTgts(), source.getController(), source), sa);
|
||||
|
||||
return false;
|
||||
|
||||
@@ -20,6 +20,7 @@ package forge.card.abilityfactory;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
@@ -28,7 +29,7 @@ import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardCharacteristicName;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.GameActionUtil;
|
||||
import forge.Singletons;
|
||||
@@ -298,7 +299,7 @@ public final class AbilityFactoryPlay {
|
||||
// prevent run-away activations - first time will always return true
|
||||
boolean chance = r.nextFloat() <= Math.pow(.6667, sa.getRestrictions().getNumberTurnActivations());
|
||||
|
||||
CardList cards;
|
||||
List<Card> cards;
|
||||
final Target tgt = sa.getTarget();
|
||||
if (tgt != null) {
|
||||
ZoneType zone = tgt.getZone().get(0);
|
||||
@@ -309,7 +310,7 @@ public final class AbilityFactoryPlay {
|
||||
}
|
||||
tgt.addTarget(CardFactoryUtil.getBestAI(cards));
|
||||
} else if (!params.containsKey("Valid")) {
|
||||
cards = new CardList(AbilityFactory.getDefinedCards(sa.getSourceCard(), params.get("Defined"), sa));
|
||||
cards = new ArrayList<Card>(AbilityFactory.getDefinedCards(sa.getSourceCard(), params.get("Defined"), sa));
|
||||
if (cards.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
@@ -366,7 +367,7 @@ public final class AbilityFactoryPlay {
|
||||
}
|
||||
|
||||
final Player controller = activator;
|
||||
CardList tgtCards = new CardList();
|
||||
List<Card> tgtCards = new ArrayList<Card>();
|
||||
|
||||
final Target tgt = sa.getTarget();
|
||||
if (params.containsKey("Valid")) {
|
||||
@@ -377,9 +378,9 @@ public final class AbilityFactoryPlay {
|
||||
tgtCards = AllZoneUtil.getCardsIn(zone);
|
||||
tgtCards = AbilityFactory.filterListByType(tgtCards, params.get("Valid"), sa);
|
||||
} else if (params.containsKey("Defined")) {
|
||||
tgtCards = new CardList(AbilityFactory.getDefinedCards(sa.getSourceCard(), params.get("Defined"), sa));
|
||||
tgtCards = new ArrayList<Card>(AbilityFactory.getDefinedCards(sa.getSourceCard(), params.get("Defined"), sa));
|
||||
} else if (tgt != null) {
|
||||
tgtCards = new CardList(tgt.getTargetCards());
|
||||
tgtCards = new ArrayList<Card>(tgt.getTargetCards());
|
||||
}
|
||||
|
||||
if (tgtCards.isEmpty()) {
|
||||
|
||||
@@ -19,11 +19,12 @@ package forge.card.abilityfactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates;
|
||||
import forge.CardUtil;
|
||||
@@ -348,9 +349,9 @@ public class AbilityFactoryPreventDamage {
|
||||
tgt.addTarget(AllZone.getComputerPlayer());
|
||||
}
|
||||
|
||||
final CardList threatenedTargets = new CardList();
|
||||
final List<Card> threatenedTargets = new ArrayList<Card>();
|
||||
// filter AIs battlefield by what I can target
|
||||
CardList targetables = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> targetables = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
targetables = CardListUtil.getValidCards(targetables, tgt.getValidTgts(), AllZone.getComputerPlayer(), hostCard);
|
||||
|
||||
for (final Card c : targetables) {
|
||||
@@ -374,13 +375,13 @@ public class AbilityFactoryPreventDamage {
|
||||
chance = true;
|
||||
} else {
|
||||
// filter AIs battlefield by what I can target
|
||||
CardList targetables = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> targetables = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
targetables = CardListUtil.getValidCards(targetables, tgt.getValidTgts(), AllZone.getComputerPlayer(), hostCard);
|
||||
|
||||
if (targetables.size() == 0) {
|
||||
return false;
|
||||
}
|
||||
final CardList combatants = CardListUtil.filter(targetables, CardPredicates.Presets.CREATURES);
|
||||
final List<Card> combatants = CardListUtil.filter(targetables, CardPredicates.Presets.CREATURES);
|
||||
CardListUtil.sortByEvaluateCreature(combatants);
|
||||
|
||||
for (final Card c : combatants) {
|
||||
@@ -457,9 +458,9 @@ public class AbilityFactoryPreventDamage {
|
||||
final Target tgt = sa.getTarget();
|
||||
tgt.resetTargets();
|
||||
// filter AIs battlefield by what I can target
|
||||
CardList targetables = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> targetables = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
targetables = CardListUtil.getValidCards(targetables, tgt.getValidTgts(), AllZone.getComputerPlayer(), hostCard);
|
||||
final CardList compTargetables = CardListUtil.filterControlledBy(targetables, AllZone.getComputerPlayer());
|
||||
final List<Card> compTargetables = CardListUtil.filterControlledBy(targetables, AllZone.getComputerPlayer());
|
||||
|
||||
if (targetables.size() == 0) {
|
||||
return false;
|
||||
@@ -470,7 +471,7 @@ public class AbilityFactoryPreventDamage {
|
||||
}
|
||||
|
||||
if (compTargetables.size() > 0) {
|
||||
final CardList combatants = CardListUtil.filter(compTargetables, CardPredicates.Presets.CREATURES);
|
||||
final List<Card> combatants = CardListUtil.filter(compTargetables, CardPredicates.Presets.CREATURES);
|
||||
CardListUtil.sortByEvaluateCreature(combatants);
|
||||
if (Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
|
||||
for (final Card c : combatants) {
|
||||
@@ -780,7 +781,7 @@ public class AbilityFactoryPreventDamage {
|
||||
final int numDam = AbilityFactory.calculateAmount(af.getHostCard(), params.get("Amount"), sa);
|
||||
|
||||
String players = "";
|
||||
CardList list = new CardList();
|
||||
List<Card> list = new ArrayList<Card>();
|
||||
|
||||
if (params.containsKey("ValidPlayers")) {
|
||||
players = params.get("ValidPlayers");
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
@@ -29,7 +30,7 @@ import com.google.common.base.Predicate;
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardUtil;
|
||||
import forge.Command;
|
||||
@@ -244,11 +245,11 @@ public final class AbilityFactoryProtection {
|
||||
* a {@link forge.card.abilityfactory.AbilityFactory} object.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
private static CardList getProtectCreatures(final AbilityFactory af, final SpellAbility sa) {
|
||||
private static List<Card> getProtectCreatures(final AbilityFactory af, final SpellAbility sa) {
|
||||
final Card hostCard = af.getHostCard();
|
||||
final ArrayList<String> gains = AbilityFactoryProtection.getProtectionList(hostCard, af.getMapParams());
|
||||
|
||||
CardList list = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
||||
List<Card> list = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
||||
list = CardListUtil.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
@@ -382,7 +383,7 @@ public final class AbilityFactoryProtection {
|
||||
|
||||
final Target tgt = sa.getTarget();
|
||||
tgt.resetTargets();
|
||||
CardList list = AbilityFactoryProtection.getProtectCreatures(af, sa);
|
||||
List<Card> list = AbilityFactoryProtection.getProtectCreatures(af, sa);
|
||||
|
||||
list = CardListUtil.getValidCards(list, tgt.getValidTgts(), sa.getActivatingPlayer(), sa.getSourceCard());
|
||||
|
||||
@@ -469,7 +470,7 @@ public final class AbilityFactoryProtection {
|
||||
final HashMap<String, String> params = af.getMapParams();
|
||||
final Card host = af.getHostCard();
|
||||
|
||||
CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
final Target tgt = sa.getTarget();
|
||||
list = CardListUtil.getValidCards(list, tgt.getValidTgts(), sa.getActivatingPlayer(), sa.getSourceCard());
|
||||
|
||||
@@ -483,7 +484,7 @@ public final class AbilityFactoryProtection {
|
||||
list.remove(c);
|
||||
}
|
||||
|
||||
CardList pref = CardListUtil.filterControlledBy(list, AllZone.getComputerPlayer());
|
||||
List<Card> pref = CardListUtil.filterControlledBy(list, AllZone.getComputerPlayer());
|
||||
pref = CardListUtil.filter(pref, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
@@ -491,7 +492,7 @@ public final class AbilityFactoryProtection {
|
||||
AbilityFactoryProtection.getProtectionList(host, params));
|
||||
}
|
||||
});
|
||||
final CardList pref2 = CardListUtil.filterControlledBy(list, AllZone.getComputerPlayer());
|
||||
final List<Card> pref2 = CardListUtil.filterControlledBy(list, AllZone.getComputerPlayer());
|
||||
pref = CardListUtil.filter(pref, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
@@ -499,7 +500,7 @@ public final class AbilityFactoryProtection {
|
||||
AbilityFactoryProtection.getProtectionList(host, params));
|
||||
}
|
||||
});
|
||||
final CardList forced = CardListUtil.filterControlledBy(list, AllZone.getHumanPlayer());
|
||||
final List<Card> forced = CardListUtil.filterControlledBy(list, AllZone.getHumanPlayer());
|
||||
final Card source = sa.getSourceCard();
|
||||
|
||||
while (tgt.getNumTargeted() < tgt.getMaxTargets(source, sa)) {
|
||||
@@ -742,7 +743,7 @@ public final class AbilityFactoryProtection {
|
||||
if (params.containsKey("AILogic")) {
|
||||
final String logic = params.get("AILogic");
|
||||
if (logic.equals("MostProminentHumanCreatures")) {
|
||||
CardList list = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
List<Card> list = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
if (list.isEmpty()) {
|
||||
list = CardListUtil.filterControlledBy(AllZoneUtil.getCardsInGame(), AllZone.getHumanPlayer());
|
||||
}
|
||||
@@ -1189,7 +1190,7 @@ public final class AbilityFactoryProtection {
|
||||
valid = params.get("ValidCards");
|
||||
}
|
||||
if (!valid.equals("")) {
|
||||
CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
list = CardListUtil.getValidCards(list, valid, sa.getActivatingPlayer(), host);
|
||||
|
||||
for (final Card tgtC : list) {
|
||||
|
||||
@@ -29,7 +29,7 @@ import com.google.common.collect.Iterables;
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates;
|
||||
import forge.CardUtil;
|
||||
@@ -334,7 +334,7 @@ public class AbilityFactoryPump {
|
||||
return false;
|
||||
}
|
||||
|
||||
CardList attackers = CardListUtil.filter(AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.possibleAttackers);
|
||||
List<Card> attackers = CardListUtil.filter(AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.possibleAttackers);
|
||||
if(!CombatUtil.canBlockAtLeastOne(card, attackers)) {
|
||||
return false;
|
||||
}
|
||||
@@ -390,7 +390,7 @@ public class AbilityFactoryPump {
|
||||
}
|
||||
|
||||
Predicate<Card> opBlockers = CardPredicates.possibleBlockers(card);
|
||||
CardList cardsCanBlock = CardListUtil.filter(AllZoneUtil.getCreaturesInPlay(human), opBlockers);
|
||||
List<Card> cardsCanBlock = CardListUtil.filter(AllZoneUtil.getCreaturesInPlay(human), opBlockers);
|
||||
|
||||
final boolean evasive = (keyword.endsWith("Unblockable") || keyword.endsWith("Fear")
|
||||
|| keyword.endsWith("Intimidate") || keyword.endsWith("Shadow"));
|
||||
@@ -455,7 +455,7 @@ public class AbilityFactoryPump {
|
||||
}
|
||||
} else if (ph.isPlayerTurn(computer) && ph.getPhase().isBefore(PhaseType.COMBAT_DECLARE_ATTACKERS)
|
||||
&& CombatUtil.canAttack(card)) {
|
||||
CardList blockers = AllZoneUtil.getCreaturesInPlay(human);
|
||||
List<Card> blockers = AllZoneUtil.getCreaturesInPlay(human);
|
||||
for (Card blocker : blockers) {
|
||||
if (CombatUtil.canBlock(card, blocker, combat)
|
||||
&& !CombatUtil.canDestroyBlocker(blocker, card, combat, false)) {
|
||||
@@ -630,7 +630,7 @@ public class AbilityFactoryPump {
|
||||
if (defense > 0 && CombatUtil.blockerWouldBeDestroyed(c)) {
|
||||
return true;
|
||||
}
|
||||
CardList blockedBy = AllZone.getCombat().getAttackersBlockedBy(c);
|
||||
List<Card> blockedBy = AllZone.getCombat().getAttackersBlockedBy(c);
|
||||
// For now, Only care the first creature blocked by a card.
|
||||
// TODO Add in better BlockAdditional support
|
||||
if (!blockedBy.isEmpty() && attack > 0 && !CombatUtil.attackerWouldBeDestroyed(blockedBy.get(0))) {
|
||||
@@ -654,7 +654,7 @@ public class AbilityFactoryPump {
|
||||
}
|
||||
|
||||
// if the life of the computer is in danger, try to pump blockers blocking Tramplers
|
||||
CardList blockedBy = AllZone.getCombat().getAttackersBlockedBy(c);
|
||||
List<Card> blockedBy = AllZone.getCombat().getAttackersBlockedBy(c);
|
||||
boolean attackerHasTrample = false;
|
||||
for (Card b : blockedBy) {
|
||||
attackerHasTrample |= b.hasKeyword("Trample");
|
||||
@@ -679,9 +679,9 @@ public class AbilityFactoryPump {
|
||||
*
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
private CardList getPumpCreatures(final SpellAbility sa) {
|
||||
private List<Card> getPumpCreatures(final SpellAbility sa) {
|
||||
|
||||
CardList list = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
||||
List<Card> list = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
||||
list = CardListUtil.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
@@ -704,8 +704,8 @@ public class AbilityFactoryPump {
|
||||
* a int.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
private CardList getCurseCreatures(final SpellAbility sa, final int defense, final int attack) {
|
||||
CardList list = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
private List<Card> getCurseCreatures(final SpellAbility sa, final int defense, final int attack) {
|
||||
List<Card> list = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
list = CardListUtil.getTargetableCards(list, sa);
|
||||
if ((defense < 0) && !list.isEmpty()) { // with spells that give -X/-X,
|
||||
// compi will try to destroy a
|
||||
@@ -727,9 +727,9 @@ public class AbilityFactoryPump {
|
||||
if (activePlayer.isComputer()) {
|
||||
if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_BEGIN)) {
|
||||
// TODO: Curse creatures that will block AI's creatures, if AI is going to attack.
|
||||
list = new CardList();
|
||||
list = new ArrayList<Card>();
|
||||
} else {
|
||||
list = new CardList();
|
||||
list = new ArrayList<Card>();
|
||||
}
|
||||
} else {
|
||||
// Human active, only curse attacking creatures
|
||||
@@ -751,7 +751,7 @@ public class AbilityFactoryPump {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
list = new CardList();
|
||||
list = new ArrayList<Card>();
|
||||
}
|
||||
}
|
||||
Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_BEGIN);
|
||||
@@ -768,7 +768,7 @@ public class AbilityFactoryPump {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
list = new CardList();
|
||||
list = new ArrayList<Card>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -955,7 +955,7 @@ public class AbilityFactoryPump {
|
||||
|
||||
final Target tgt = sa.getTarget();
|
||||
tgt.resetTargets();
|
||||
CardList list = new CardList();
|
||||
List<Card> list = new ArrayList<Card>();
|
||||
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());
|
||||
@@ -1057,7 +1057,7 @@ public class AbilityFactoryPump {
|
||||
* @return a boolean.
|
||||
*/
|
||||
private boolean pumpMandatoryTarget(final AbilityFactory af, final SpellAbility sa, final boolean mandatory) {
|
||||
CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> 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);
|
||||
@@ -1072,8 +1072,8 @@ public class AbilityFactoryPump {
|
||||
list.remove(c);
|
||||
}
|
||||
|
||||
CardList pref;
|
||||
CardList forced;
|
||||
List<Card> pref;
|
||||
List<Card> forced;
|
||||
final Card source = sa.getSourceCard();
|
||||
|
||||
if (af.isCurse()) {
|
||||
@@ -1702,16 +1702,16 @@ public class AbilityFactoryPump {
|
||||
valid = this.params.get("ValidCards");
|
||||
}
|
||||
|
||||
CardList comp = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> comp = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
comp = CardListUtil.getValidCards(comp, valid, source.getController(), source);
|
||||
CardList human = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> human = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
human = CardListUtil.getValidCards(human, valid, source.getController(), source);
|
||||
|
||||
final Target tgt = sa.getTarget();
|
||||
if (tgt != null && sa.canTarget(AllZone.getHumanPlayer()) && params.containsKey("IsCurse")) {
|
||||
tgt.resetTargets();
|
||||
sa.getTarget().addTarget(AllZone.getHumanPlayer());
|
||||
comp = new CardList();
|
||||
comp = new ArrayList<Card>();
|
||||
}
|
||||
|
||||
if (this.abilityFactory.isCurse()) {
|
||||
@@ -1782,7 +1782,7 @@ public class AbilityFactoryPump {
|
||||
* a {@link forge.card.spellability.SpellAbility} object.
|
||||
*/
|
||||
private void pumpAllResolve(final SpellAbility sa) {
|
||||
CardList list;
|
||||
List<Card> list;
|
||||
ArrayList<Player> tgtPlayers = null;
|
||||
final ArrayList<ZoneType> affectedZones = new ArrayList<ZoneType>();
|
||||
|
||||
@@ -1802,7 +1802,7 @@ public class AbilityFactoryPump {
|
||||
affectedZones.add(ZoneType.Battlefield);
|
||||
}
|
||||
|
||||
list = new CardList();
|
||||
list = new ArrayList<Card>();
|
||||
if ((tgtPlayers == null) || tgtPlayers.isEmpty()) {
|
||||
for (final ZoneType zone : affectedZones) {
|
||||
list.addAll(AllZoneUtil.getCardsIn(zone));
|
||||
|
||||
@@ -20,11 +20,12 @@ package forge.card.abilityfactory;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates;
|
||||
import forge.Command;
|
||||
@@ -314,7 +315,7 @@ public class AbilityFactoryRegenerate {
|
||||
} else {
|
||||
tgt.resetTargets();
|
||||
// filter AIs battlefield by what I can target
|
||||
CardList targetables = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> targetables = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
targetables = CardListUtil.getValidCards(targetables, tgt.getValidTgts(), AllZone.getComputerPlayer(), hostCard);
|
||||
|
||||
if (targetables.size() == 0) {
|
||||
@@ -326,7 +327,7 @@ public class AbilityFactoryRegenerate {
|
||||
// control
|
||||
final ArrayList<Object> objects = AbilityFactory.predictThreatenedObjects(af);
|
||||
|
||||
final CardList threatenedTargets = new CardList();
|
||||
final List<Card> threatenedTargets = new ArrayList<Card>();
|
||||
|
||||
for (final Card c : targetables) {
|
||||
if (objects.contains(c) && (c.getShield() == 0)) {
|
||||
@@ -341,7 +342,7 @@ public class AbilityFactoryRegenerate {
|
||||
}
|
||||
} else {
|
||||
if (Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
|
||||
final CardList combatants = CardListUtil.filter(targetables, CardPredicates.Presets.CREATURES);
|
||||
final List<Card> combatants = CardListUtil.filter(targetables, CardPredicates.Presets.CREATURES);
|
||||
CardListUtil.sortByEvaluateCreature(combatants);
|
||||
|
||||
for (final Card c : combatants) {
|
||||
@@ -417,9 +418,9 @@ public class AbilityFactoryRegenerate {
|
||||
final Target tgt = sa.getTarget();
|
||||
tgt.resetTargets();
|
||||
// filter AIs battlefield by what I can target
|
||||
CardList targetables = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> targetables = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
targetables = CardListUtil.getValidCards(targetables, tgt.getValidTgts(), AllZone.getComputerPlayer(), hostCard);
|
||||
final CardList compTargetables = CardListUtil.filterControlledBy(targetables, AllZone.getComputerPlayer());
|
||||
final List<Card> compTargetables = CardListUtil.filterControlledBy(targetables, AllZone.getComputerPlayer());
|
||||
|
||||
if (targetables.size() == 0) {
|
||||
return false;
|
||||
@@ -430,7 +431,7 @@ public class AbilityFactoryRegenerate {
|
||||
}
|
||||
|
||||
if (compTargetables.size() > 0) {
|
||||
final CardList combatants = CardListUtil.filter(compTargetables, CardPredicates.Presets.CREATURES);
|
||||
final List<Card> combatants = CardListUtil.filter(compTargetables, CardPredicates.Presets.CREATURES);
|
||||
CardListUtil.sortByEvaluateCreature(combatants);
|
||||
if (Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
|
||||
for (final Card c : combatants) {
|
||||
@@ -726,7 +727,7 @@ public class AbilityFactoryRegenerate {
|
||||
valid = params.get("ValidCards");
|
||||
}
|
||||
|
||||
CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
list = CardListUtil.getValidCards(list, valid.split(","), hostCard.getController(), hostCard);
|
||||
|
||||
if (list.size() == 0) {
|
||||
@@ -740,7 +741,7 @@ public class AbilityFactoryRegenerate {
|
||||
} else {
|
||||
|
||||
if (Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
|
||||
final CardList combatants = CardListUtil.filter(list, CardPredicates.Presets.CREATURES);
|
||||
final List<Card> combatants = CardListUtil.filter(list, CardPredicates.Presets.CREATURES);
|
||||
|
||||
for (final Card c : combatants) {
|
||||
if ((c.getShield() == 0) && CombatUtil.combatantWouldBeDestroyed(c)) {
|
||||
@@ -810,7 +811,7 @@ public class AbilityFactoryRegenerate {
|
||||
valid = params.get("ValidCards");
|
||||
}
|
||||
|
||||
CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
list = CardListUtil.getValidCards(list, valid.split(","), hostCard.getController(), hostCard);
|
||||
|
||||
for (final Card c : list) {
|
||||
|
||||
@@ -17,14 +17,16 @@
|
||||
*/
|
||||
package forge.card.abilityfactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardListUtil;
|
||||
import forge.card.cost.Cost;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.GameActionUtil;
|
||||
import forge.card.cardfactory.CardFactoryUtil;
|
||||
import forge.card.spellability.AbilityActivated;
|
||||
@@ -265,7 +267,7 @@ public final class AbilityFactoryRepeat {
|
||||
|
||||
if (params.containsKey("RepeatPresent")) {
|
||||
final String repeatPresent = params.get("RepeatPresent");
|
||||
CardList list = new CardList();
|
||||
List<Card> list = new ArrayList<Card>();
|
||||
|
||||
String repeatCompare = "GE1";
|
||||
if (params.containsKey("RepeatCompare")) {
|
||||
|
||||
@@ -31,7 +31,7 @@ import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardCharacteristicName;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardUtil;
|
||||
import forge.GameActionUtil;
|
||||
@@ -423,9 +423,9 @@ public final class AbilityFactoryReveal {
|
||||
if (tgt != null && !p.canBeTargetedBy(sa)) {
|
||||
continue;
|
||||
}
|
||||
final CardList top = new CardList();
|
||||
CardList valid = new CardList();
|
||||
final CardList rest = new CardList();
|
||||
final List<Card> top = new ArrayList<Card>();
|
||||
List<Card> valid = new ArrayList<Card>();
|
||||
final List<Card> rest = new ArrayList<Card>();
|
||||
final PlayerZone library = p.getZone(ZoneType.Library);
|
||||
|
||||
numToDig = Math.min(numToDig, library.size());
|
||||
@@ -458,7 +458,7 @@ public final class AbilityFactoryReveal {
|
||||
}
|
||||
} else if (params.containsKey("RevealValid")) {
|
||||
final String revealValid = params.get("RevealValid");
|
||||
final CardList toReveal = CardListUtil.getValidCards(top, revealValid, host.getController(), host);
|
||||
final List<Card> toReveal = CardListUtil.getValidCards(top, revealValid, host.getController(), host);
|
||||
if (!toReveal.isEmpty()) {
|
||||
GuiChoose.one("Revealing cards from library", toReveal);
|
||||
if (params.containsKey("RememberRevealed")) {
|
||||
@@ -482,8 +482,8 @@ public final class AbilityFactoryReveal {
|
||||
}
|
||||
|
||||
if (!noMove) {
|
||||
List<Card> movedCards = new CardList();
|
||||
CardList andOrCards = new CardList();
|
||||
List<Card> movedCards = new ArrayList<Card>();
|
||||
List<Card> andOrCards = new ArrayList<Card>();
|
||||
for (final Card c : top) {
|
||||
rest.add(c);
|
||||
}
|
||||
@@ -540,7 +540,7 @@ public final class AbilityFactoryReveal {
|
||||
if (!andOrValid.equals("")) {
|
||||
andOrCards.remove(chosen);
|
||||
if (!chosen.isValid(andOrValid.split(","), host.getController(), host)) {
|
||||
valid = new CardList(andOrCards);
|
||||
valid = new ArrayList<Card>(andOrCards);
|
||||
} else if (!chosen.isValid(changeValid.split(","), host.getController(), host)) {
|
||||
valid.removeAll(andOrCards);
|
||||
}
|
||||
@@ -661,7 +661,7 @@ public final class AbilityFactoryReveal {
|
||||
} // end foreach player
|
||||
} // end resolve
|
||||
|
||||
// returns a CardList that is a subset of list with cards that share a name
|
||||
// returns a List<Card> that is a subset of list with cards that share a name
|
||||
// with a permanent on the battlefield
|
||||
/**
|
||||
* <p>
|
||||
@@ -672,9 +672,9 @@ public final class AbilityFactoryReveal {
|
||||
* a {@link forge.CardList} object.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
private static CardList sharesNameWithCardOnBattlefield(final CardList list) {
|
||||
final CardList toReturn = new CardList();
|
||||
final CardList play = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
private static List<Card> sharesNameWithCardOnBattlefield(final List<Card> list) {
|
||||
final List<Card> toReturn = new ArrayList<Card>();
|
||||
final List<Card> play = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
for (final Card c : list) {
|
||||
for (final Card p : play) {
|
||||
if (p.getName().equals(c.getName()) && !toReturn.contains(c)) {
|
||||
@@ -1029,8 +1029,8 @@ public final class AbilityFactoryReveal {
|
||||
|
||||
for (final Player p : tgtPlayers) {
|
||||
if ((tgt == null) || p.canBeTargetedBy(sa)) {
|
||||
final CardList found = new CardList();
|
||||
final CardList revealed = new CardList();
|
||||
final List<Card> found = new ArrayList<Card>();
|
||||
final List<Card> revealed = new ArrayList<Card>();
|
||||
|
||||
final PlayerZone library = p.getZone(ZoneType.Library);
|
||||
|
||||
@@ -1426,7 +1426,7 @@ public final class AbilityFactoryReveal {
|
||||
|
||||
for (final Player p : tgtPlayers) {
|
||||
if ((tgt == null) || p.canBeTargetedBy(sa)) {
|
||||
final CardList hand = p.getCardsIn(ZoneType.Hand);
|
||||
final List<Card> hand = p.getCardsIn(ZoneType.Hand);
|
||||
if (sa.getActivatingPlayer().isHuman()) {
|
||||
if (hand.size() > 0) {
|
||||
GuiChoose.one(p + "'s hand", hand);
|
||||
@@ -2049,7 +2049,7 @@ public final class AbilityFactoryReveal {
|
||||
if (maxCards == 0) {
|
||||
return;
|
||||
}
|
||||
final CardList topCards = new CardList();
|
||||
final List<Card> topCards = new ArrayList<Card>();
|
||||
// show top n cards:
|
||||
for (int j = 0; j < maxCards; j++) {
|
||||
topCards.add(lib.get(j));
|
||||
@@ -2373,14 +2373,14 @@ public final class AbilityFactoryReveal {
|
||||
|
||||
for (final Player p : tgtPlayers) {
|
||||
if ((tgt == null) || p.canBeTargetedBy(sa)) {
|
||||
final CardList handChoices = p.getCardsIn(ZoneType.Hand);
|
||||
final List<Card> handChoices = p.getCardsIn(ZoneType.Hand);
|
||||
if (handChoices.size() > 0) {
|
||||
final CardList revealed = new CardList();
|
||||
final List<Card> revealed = new ArrayList<Card>();
|
||||
if (params.containsKey("Random")) {
|
||||
revealed.add(CardUtil.getRandom(handChoices));
|
||||
GuiChoose.oneOrNone("Revealed card(s)", revealed);
|
||||
} else {
|
||||
CardList valid = new CardList(handChoices);
|
||||
List<Card> valid = new ArrayList<Card>(handChoices);
|
||||
int max = 1;
|
||||
if (params.containsKey("RevealValid")) {
|
||||
valid = CardListUtil.getValidCards(valid, params.get("RevealValid"), p, host);
|
||||
@@ -2414,8 +2414,8 @@ public final class AbilityFactoryReveal {
|
||||
* @param anyNumber a boolean
|
||||
* @return the revealed list
|
||||
*/
|
||||
public static CardList getRevealedList(final Player player, final CardList valid, final int max, boolean anyNumber) {
|
||||
final CardList chosen = new CardList();
|
||||
public static List<Card> getRevealedList(final Player player, final List<Card> valid, final int max, boolean anyNumber) {
|
||||
final List<Card> chosen = new ArrayList<Card>();
|
||||
final int validamount = Math.min(valid.size(), max);
|
||||
|
||||
if (anyNumber && player.isHuman() && validamount > 0) {
|
||||
|
||||
@@ -19,12 +19,13 @@ package forge.card.abilityfactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardUtil;
|
||||
import forge.Singletons;
|
||||
@@ -285,7 +286,7 @@ public class AbilityFactorySacrifice {
|
||||
num = (num == null) ? "1" : num;
|
||||
final int amount = AbilityFactory.calculateAmount(sa.getSourceCard(), num, sa);
|
||||
|
||||
CardList list = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
list = CardListUtil.getValidCards(list, valid.split(","), sa.getActivatingPlayer(), sa.getSourceCard());
|
||||
|
||||
if (list.size() == 0) {
|
||||
@@ -425,11 +426,11 @@ public class AbilityFactorySacrifice {
|
||||
amount = Math.min(ComputerUtil.determineLeftoverMana(sa), amount);
|
||||
}
|
||||
|
||||
CardList humanList = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> humanList = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
humanList = CardListUtil.getValidCards(humanList, valid.split(","), sa.getActivatingPlayer(), sa.getSourceCard());
|
||||
CardList computerList = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> computerList = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
if (defined.equals("Opponent")) {
|
||||
computerList = new CardList();
|
||||
computerList = new ArrayList<Card>();
|
||||
}
|
||||
computerList = CardListUtil.getValidCards(computerList, valid.split(","), sa.getActivatingPlayer(), sa.getSourceCard());
|
||||
|
||||
@@ -492,7 +493,7 @@ public class AbilityFactorySacrifice {
|
||||
}
|
||||
}
|
||||
else {
|
||||
CardList sacList = null;
|
||||
List<Card> sacList = null;
|
||||
for (final Player p : tgts) {
|
||||
if (params.containsKey("Random")) {
|
||||
sacList = AbilityFactorySacrifice.sacrificeRandom(p, amount, valid, sa, destroy);
|
||||
@@ -529,10 +530,10 @@ public class AbilityFactorySacrifice {
|
||||
* @param sa
|
||||
* a {@link forge.card.spellability.SpellAbility} object.
|
||||
*/
|
||||
private static CardList sacrificeAI(final Player p, final int amount, final String valid, final SpellAbility sa,
|
||||
private static List<Card> sacrificeAI(final Player p, final int amount, final String valid, final SpellAbility sa,
|
||||
final boolean destroy) {
|
||||
CardList battlefield = p.getCardsIn(ZoneType.Battlefield);
|
||||
CardList sacList = AbilityFactory.filterListByType(battlefield, valid, sa);
|
||||
List<Card> battlefield = p.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> sacList = AbilityFactory.filterListByType(battlefield, valid, sa);
|
||||
sacList = ComputerUtil.sacrificePermanents(amount, sacList, destroy, sa);
|
||||
|
||||
return sacList;
|
||||
@@ -554,11 +555,11 @@ public class AbilityFactorySacrifice {
|
||||
* @param message
|
||||
* a {@link java.lang.String} object.
|
||||
*/
|
||||
public static CardList sacrificeHuman(final Player p, final int amount, final String valid, final SpellAbility sa,
|
||||
public static List<Card> sacrificeHuman(final Player p, final int amount, final String valid, final SpellAbility sa,
|
||||
final boolean destroy, final boolean optional) {
|
||||
CardList battlefield = p.getCardsIn(ZoneType.Battlefield);
|
||||
CardList list = AbilityFactory.filterListByType(battlefield, valid, sa);
|
||||
CardList sacList = new CardList();
|
||||
List<Card> battlefield = p.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = AbilityFactory.filterListByType(battlefield, valid, sa);
|
||||
List<Card> sacList = new ArrayList<Card>();
|
||||
|
||||
for (int i = 0; i < amount; i++) {
|
||||
if (list.isEmpty()) {
|
||||
@@ -606,12 +607,12 @@ public class AbilityFactorySacrifice {
|
||||
* @param sa
|
||||
* a {@link forge.card.spellability.SpellAbility} object.
|
||||
*/
|
||||
private static CardList sacrificeRandom(final Player p, final int amount, final String valid, final SpellAbility sa,
|
||||
private static List<Card> sacrificeRandom(final Player p, final int amount, final String valid, final SpellAbility sa,
|
||||
final boolean destroy) {
|
||||
CardList sacList = new CardList();
|
||||
List<Card> sacList = new ArrayList<Card>();
|
||||
for (int i = 0; i < amount; i++) {
|
||||
CardList battlefield = p.getCardsIn(ZoneType.Battlefield);
|
||||
CardList list = AbilityFactory.filterListByType(battlefield, valid, sa);
|
||||
List<Card> battlefield = p.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = AbilityFactory.filterListByType(battlefield, valid, sa);
|
||||
if (list.size() != 0) {
|
||||
final Card sac = CardUtil.getRandom(list);
|
||||
if (destroy) {
|
||||
@@ -847,8 +848,8 @@ public class AbilityFactorySacrifice {
|
||||
valid = valid.replace("X", Integer.toString(xPay));
|
||||
}
|
||||
|
||||
CardList humanlist = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
CardList computerlist = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> humanlist = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> computerlist = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
|
||||
humanlist = CardListUtil.getValidCards(humanlist, valid.split(","), source.getController(), source);
|
||||
computerlist = CardListUtil.getValidCards(computerlist, valid.split(","), source.getController(), source);
|
||||
@@ -920,9 +921,9 @@ public class AbilityFactorySacrifice {
|
||||
valid = valid.replace("X", Integer.toString(AbilityFactory.calculateAmount(card, "X", sa)));
|
||||
}
|
||||
|
||||
CardList list;
|
||||
List<Card> list;
|
||||
if (params.containsKey("Defined")) {
|
||||
list = new CardList(AbilityFactory.getDefinedCards(af.getHostCard(), params.get("Defined"), sa));
|
||||
list = new ArrayList<Card>(AbilityFactory.getDefinedCards(af.getHostCard(), params.get("Defined"), sa));
|
||||
} else {
|
||||
list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
}
|
||||
|
||||
@@ -20,12 +20,13 @@ package forge.card.abilityfactory;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardCharacteristicName;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.card.spellability.AbilityActivated;
|
||||
import forge.card.spellability.AbilitySub;
|
||||
@@ -470,7 +471,7 @@ public class AbilityFactorySetState {
|
||||
valid = valid.replace("X", Integer.toString(AbilityFactory.calculateAmount(card, "X", sa)));
|
||||
}
|
||||
|
||||
CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
|
||||
if (targetPlayer != null) {
|
||||
list = CardListUtil.filterControlledBy(list, targetPlayer);
|
||||
|
||||
@@ -19,12 +19,13 @@ package forge.card.abilityfactory;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.card.cardfactory.CardFactoryUtil;
|
||||
import forge.card.cost.Cost;
|
||||
@@ -571,7 +572,7 @@ public class AbilityFactoryToken extends AbilityFactory {
|
||||
|
||||
final String remember = this.abilityFactory.getMapParams().get("RememberTokens");
|
||||
for (int i = 0; i < finalAmount; i++) {
|
||||
final CardList tokens = CardFactoryUtil.makeToken(substitutedName, imageName, controller, cost,
|
||||
final List<Card> tokens = CardFactoryUtil.makeToken(substitutedName, imageName, controller, cost,
|
||||
substitutedTypes, finalPower, finalToughness, this.tokenKeywords);
|
||||
|
||||
// Grant abilities
|
||||
|
||||
@@ -22,11 +22,12 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardUtil;
|
||||
import forge.GameActionUtil;
|
||||
@@ -312,7 +313,7 @@ public class AbilityFactoryZoneAffecting {
|
||||
if (part instanceof CostDiscard) {
|
||||
CostDiscard cd = (CostDiscard) part;
|
||||
cd.decideAIPayment(sa, sa.getSourceCard(), null);
|
||||
CardList discards = cd.getList();
|
||||
List<Card> discards = cd.getList();
|
||||
for (Card discard : discards) {
|
||||
if (!ComputerUtil.isWorseThanDraw(discard)) {
|
||||
return false;
|
||||
@@ -621,7 +622,7 @@ public class AbilityFactoryZoneAffecting {
|
||||
p.addSlowtripList(source);
|
||||
}
|
||||
} else {
|
||||
final CardList drawn = p.drawCards(numCards);
|
||||
final List<Card> drawn = p.drawCards(numCards);
|
||||
if (params.containsKey("Reveal")) {
|
||||
GuiChoose.one("Revealing drawn cards", drawn);
|
||||
}
|
||||
@@ -965,7 +966,7 @@ public class AbilityFactoryZoneAffecting {
|
||||
|
||||
final int numCards = AbilityFactory.calculateAmount(sa.getSourceCard(), params.get("NumCards"), sa);
|
||||
|
||||
final CardList pLibrary = AllZone.getHumanPlayer().getCardsIn(ZoneType.Library);
|
||||
final List<Card> pLibrary = AllZone.getHumanPlayer().getCardsIn(ZoneType.Library);
|
||||
|
||||
if (pLibrary.size() == 0) { // deck already empty, no need to mill
|
||||
if (!mandatory) {
|
||||
@@ -1085,7 +1086,7 @@ public class AbilityFactoryZoneAffecting {
|
||||
|
||||
for (final Player p : tgtPlayers) {
|
||||
if ((tgt == null) || p.canBeTargetedBy(sa)) {
|
||||
final CardList milled = p.mill(numCards, destination, bottom);
|
||||
final List<Card> milled = p.mill(numCards, destination, bottom);
|
||||
if (params.containsKey("RememberMilled")) {
|
||||
for (final Card c : milled) {
|
||||
source.addRemembered(c);
|
||||
@@ -1295,7 +1296,7 @@ public class AbilityFactoryZoneAffecting {
|
||||
tgtPlayers = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("Defined"), sa);
|
||||
}
|
||||
|
||||
final CardList discarded = new CardList();
|
||||
final List<Card> discarded = new ArrayList<Card>();
|
||||
|
||||
for (final Player p : tgtPlayers) {
|
||||
if ((tgt == null) || p.canBeTargetedBy(sa)) {
|
||||
@@ -1314,7 +1315,7 @@ public class AbilityFactoryZoneAffecting {
|
||||
}
|
||||
|
||||
if (mode.equals("Hand")) {
|
||||
final CardList list = p.discardHand(sa);
|
||||
final List<Card> list = p.discardHand(sa);
|
||||
if (params.containsKey("RememberDiscarded")) {
|
||||
for (final Card c : list) {
|
||||
source.addRemembered(c);
|
||||
@@ -1340,7 +1341,7 @@ public class AbilityFactoryZoneAffecting {
|
||||
p.discardUnless(numCards, params.get("UnlessType"), sa);
|
||||
} else if (mode.equals("RevealDiscardAll")) {
|
||||
// Reveal
|
||||
final CardList dPHand = p.getCardsIn(ZoneType.Hand);
|
||||
final List<Card> dPHand = p.getCardsIn(ZoneType.Hand);
|
||||
|
||||
if (p.isHuman()) {
|
||||
// "reveal to computer" for information gathering
|
||||
@@ -1357,7 +1358,7 @@ public class AbilityFactoryZoneAffecting {
|
||||
valid = valid.replace("X", Integer.toString(AbilityFactory.calculateAmount(source, "X", sa)));
|
||||
}
|
||||
|
||||
final CardList dPChHand = CardListUtil.getValidCards(dPHand, valid.split(","), source.getController(), source);
|
||||
final List<Card> dPChHand = CardListUtil.getValidCards(dPHand, valid.split(","), source.getController(), source);
|
||||
// Reveal cards that will be discarded?
|
||||
for (final Card c : dPChHand) {
|
||||
p.discard(c, sa);
|
||||
@@ -1366,7 +1367,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?
|
||||
CardList dPHand = p.getCardsIn(ZoneType.Hand);
|
||||
List<Card> dPHand = p.getCardsIn(ZoneType.Hand);
|
||||
if (dPHand.size() != 0) {
|
||||
if (params.containsKey("RevealNumber")) {
|
||||
String amountString = params.get("RevealNumber");
|
||||
@@ -1374,7 +1375,7 @@ public class AbilityFactoryZoneAffecting {
|
||||
: CardFactoryUtil.xCount(source, source.getSVar(amountString));
|
||||
dPHand = AbilityFactoryReveal.getRevealedList(p, dPHand, amount, false);
|
||||
}
|
||||
CardList dPChHand = new CardList(dPHand);
|
||||
List<Card> dPChHand = new ArrayList<Card>(dPHand);
|
||||
String[] dValid = null;
|
||||
if (params.containsKey("DiscardValid")) { // Restrict card choices
|
||||
dValid = params.get("DiscardValid").split(",");
|
||||
@@ -1392,7 +1393,7 @@ public class AbilityFactoryZoneAffecting {
|
||||
if (p.isComputer()) { // discard AI cards
|
||||
int max = chooser.getCardsIn(ZoneType.Hand).size();
|
||||
max = Math.min(max, numCards);
|
||||
CardList list = ComputerUtil.discardNumTypeAI(max, dValid, sa);
|
||||
List<Card> list = ComputerUtil.discardNumTypeAI(max, dValid, sa);
|
||||
if (mode.startsWith("Reveal")) {
|
||||
GuiChoose.oneOrNone("Computer has chosen", list);
|
||||
}
|
||||
@@ -1405,7 +1406,7 @@ public class AbilityFactoryZoneAffecting {
|
||||
// discard human cards
|
||||
for (int i = 0; i < numCards; i++) {
|
||||
if (dPChHand.size() > 0) {
|
||||
final CardList dChoices = new CardList();
|
||||
final List<Card> dChoices = new ArrayList<Card>();
|
||||
if (params.containsKey("DiscardValid")) {
|
||||
final String validString = params.get("DiscardValid");
|
||||
if (validString.contains("Creature") && !validString.contains("nonCreature")) {
|
||||
@@ -1425,7 +1426,7 @@ public class AbilityFactoryZoneAffecting {
|
||||
dPChHand.remove(dC);
|
||||
|
||||
if (mode.startsWith("Reveal")) {
|
||||
final CardList dCs = new CardList();
|
||||
final List<Card> dCs = new ArrayList<Card>();
|
||||
dCs.add(dC);
|
||||
GuiChoose.oneOrNone("Computer has chosen", dCs);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package forge.card.cardfactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates;
|
||||
import forge.CardPredicates.Presets;
|
||||
@@ -184,7 +187,7 @@ class CardFactoryArtifacts {
|
||||
AllZone.getInputControl().setInput(discard);
|
||||
}
|
||||
} else {
|
||||
CardList list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand);
|
||||
List<Card> list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand);
|
||||
list = CardListUtil.filter(list, CardPredicates.Presets.LANDS);
|
||||
AllZone.getComputerPlayer().discard(list.get(0), this);
|
||||
} // else
|
||||
@@ -216,7 +219,7 @@ class CardFactoryArtifacts {
|
||||
|
||||
@Override
|
||||
public boolean canPlay() {
|
||||
CardList list = card.getController().getCardsIn(ZoneType.Hand);
|
||||
List<Card> list = card.getController().getCardsIn(ZoneType.Hand);
|
||||
list.remove(card);
|
||||
list = CardListUtil.filter(list, CardPredicates.Presets.LANDS);
|
||||
return (list.size() != 0) && super.canPlay();
|
||||
@@ -247,8 +250,8 @@ class CardFactoryArtifacts {
|
||||
|
||||
@Override
|
||||
public void resolve() {
|
||||
final CardList topOfLibrary = card.getController().getCardsIn(ZoneType.Library);
|
||||
final CardList revealed = new CardList();
|
||||
final List<Card> topOfLibrary = card.getController().getCardsIn(ZoneType.Library);
|
||||
final List<Card> revealed = new ArrayList<Card>();
|
||||
|
||||
if (topOfLibrary.size() == 0) {
|
||||
return;
|
||||
@@ -343,7 +346,7 @@ class CardFactoryArtifacts {
|
||||
final int limit = 4; // at most, this can target 4 cards
|
||||
final Player player = this.getTargetPlayer();
|
||||
|
||||
CardList lands = player.getCardsIn(ZoneType.Graveyard);
|
||||
List<Card> lands = player.getCardsIn(ZoneType.Graveyard);
|
||||
lands = CardListUtil.filter(lands, Presets.BASIC_LANDS);
|
||||
if (card.getController().isHuman()) {
|
||||
// now, select up to four lands
|
||||
@@ -373,7 +376,7 @@ class CardFactoryArtifacts {
|
||||
} else { // Computer
|
||||
// based on current AI, computer should always target
|
||||
// himself.
|
||||
final CardList list = this.getComputerLands();
|
||||
final List<Card> list = this.getComputerLands();
|
||||
int max = list.size();
|
||||
if (max > limit) {
|
||||
max = limit;
|
||||
@@ -387,8 +390,8 @@ class CardFactoryArtifacts {
|
||||
player.addSlowtripList(card);
|
||||
}
|
||||
|
||||
private CardList getComputerLands() {
|
||||
final CardList list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Graveyard);
|
||||
private List<Card> getComputerLands() {
|
||||
final List<Card> list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Graveyard);
|
||||
return CardListUtil.filter(list, CardPredicates.Presets.BASIC_LANDS);
|
||||
}
|
||||
}
|
||||
@@ -426,8 +429,8 @@ class CardFactoryArtifacts {
|
||||
|
||||
@Override
|
||||
public boolean canPlayAI() {
|
||||
final CardList libList = AllZone.getHumanPlayer().getCardsIn(ZoneType.Library);
|
||||
// CardList list =
|
||||
final List<Card> libList = AllZone.getHumanPlayer().getCardsIn(ZoneType.Library);
|
||||
// List<Card> list =
|
||||
// AllZoneUtil.getCardsInPlay("Painter's Servant");
|
||||
return libList.size() > 0; // && list.size() > 0;
|
||||
}
|
||||
@@ -435,10 +438,10 @@ class CardFactoryArtifacts {
|
||||
@Override
|
||||
public void resolve() {
|
||||
final Player target = this.getTargetPlayer();
|
||||
final CardList library = this.getTargetPlayer().getCardsIn(ZoneType.Library);
|
||||
final List<Card> library = this.getTargetPlayer().getCardsIn(ZoneType.Library);
|
||||
|
||||
boolean loop = true;
|
||||
final CardList grinding = new CardList();
|
||||
final List<Card> grinding = new ArrayList<Card>();
|
||||
do {
|
||||
grinding.clear();
|
||||
|
||||
@@ -544,7 +547,7 @@ class CardFactoryArtifacts {
|
||||
if (card.getController().isHuman()) {
|
||||
AllZone.getInputControl().setInput(new Input() {
|
||||
private static final long serialVersionUID = -2305549394512889450L;
|
||||
private final CardList exiled = new CardList();
|
||||
private final List<Card> exiled = new ArrayList<Card>();
|
||||
|
||||
@Override
|
||||
public void showMessage() {
|
||||
|
||||
@@ -19,6 +19,7 @@ package forge.card.cardfactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.esotericsoftware.minlog.Log;
|
||||
import com.google.common.base.Predicate;
|
||||
@@ -27,7 +28,7 @@ import com.google.common.collect.Iterables;
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates.Presets;
|
||||
import forge.CardUtil;
|
||||
@@ -84,7 +85,7 @@ class CardFactoryAuras {
|
||||
}
|
||||
final String[] landTypes = new String[] { "Plains", "Island", "Swamp", "Mountain", "Forest" };
|
||||
final HashMap<String, Integer> humanLandCount = new HashMap<String, Integer>();
|
||||
final CardList humanlands = AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer());
|
||||
final List<Card> humanlands = AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer());
|
||||
|
||||
for (final String landType : landTypes) {
|
||||
humanLandCount.put(landType, 0);
|
||||
@@ -112,7 +113,7 @@ class CardFactoryAuras {
|
||||
}
|
||||
|
||||
newType[0] = landTypes[minAt];
|
||||
CardList list = AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer());
|
||||
List<Card> list = AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer());
|
||||
list = CardListUtil.getNotType(list, newType[0]); // Don't enchant lands
|
||||
// that already have the
|
||||
// type
|
||||
@@ -247,7 +248,7 @@ class CardFactoryAuras {
|
||||
|
||||
@Override
|
||||
public void showMessage() {
|
||||
final CardList land = AllZoneUtil.getLandsInPlay();
|
||||
final List<Card> land = AllZoneUtil.getLandsInPlay();
|
||||
this.stopSetNext(CardFactoryUtil
|
||||
.inputTargetSpecific(spell, land, "Select target land", true, false));
|
||||
}
|
||||
@@ -265,7 +266,7 @@ class CardFactoryAuras {
|
||||
|
||||
@Override
|
||||
public boolean canPlayAI() {
|
||||
CardList list = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
List<Card> list = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
list = CardListUtil.getKeyword(list, "Flying");
|
||||
if (list.isEmpty()) {
|
||||
return false;
|
||||
@@ -369,13 +370,13 @@ class CardFactoryAuras {
|
||||
@Override
|
||||
public boolean canPlayAI() {
|
||||
|
||||
final CardList stuffy = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield, "Stuffy Doll");
|
||||
final List<Card> stuffy = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield, "Stuffy Doll");
|
||||
|
||||
if (stuffy.size() > 0) {
|
||||
this.setTargetCard(stuffy.get(0));
|
||||
return true;
|
||||
} else {
|
||||
final CardList list = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
final List<Card> list = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
|
||||
if (list.isEmpty()) {
|
||||
return false;
|
||||
@@ -420,7 +421,7 @@ class CardFactoryAuras {
|
||||
final SpellPermanent animate = new SpellPermanent(card) {
|
||||
private static final long serialVersionUID = 7126615291288065344L;
|
||||
|
||||
public CardList getCreturesInGrave() {
|
||||
public List<Card> getCreturesInGrave() {
|
||||
// This includes creatures Animate Dead can't enchant once
|
||||
// in play.
|
||||
// The human may try to Animate them, the AI will not.
|
||||
@@ -434,7 +435,7 @@ class CardFactoryAuras {
|
||||
|
||||
@Override
|
||||
public boolean canPlayAI() {
|
||||
CardList cList = this.getCreturesInGrave();
|
||||
List<Card> cList = this.getCreturesInGrave();
|
||||
// AI will only target something that will stick in play.
|
||||
cList = CardListUtil.getTargetableCards(cList, this);
|
||||
if (cList.size() == 0) {
|
||||
|
||||
@@ -31,7 +31,7 @@ import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardCharacteristicName;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates;
|
||||
import forge.CardPredicates.Presets;
|
||||
@@ -77,7 +77,7 @@ public class CardFactoryCreatures {
|
||||
|
||||
@Override
|
||||
public boolean canPlayAI() {
|
||||
final CardList list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
return Iterables.any(list, Predicates.or(CardPredicates.nameEquals("Glorious Anthem"), CardPredicates.nameEquals("Gaea's Anthem")));
|
||||
}
|
||||
};
|
||||
@@ -120,7 +120,7 @@ public class CardFactoryCreatures {
|
||||
|
||||
@Override
|
||||
public void chooseTargetAI() {
|
||||
CardList perms = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> perms = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
perms = CardListUtil.filter(CardListUtil.getTargetableCards(perms, this), new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
@@ -133,7 +133,7 @@ public class CardFactoryCreatures {
|
||||
|
||||
@Override
|
||||
public boolean canPlayAI() {
|
||||
CardList perms = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> perms = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
perms = CardListUtil.filter(CardListUtil.getTargetableCards(perms, this), new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
@@ -178,7 +178,7 @@ public class CardFactoryCreatures {
|
||||
final SpellAbility ability = new Ability(card, "0") {
|
||||
@Override
|
||||
public void resolve() {
|
||||
final CardList hand = card.getController().getCardsIn(ZoneType.Hand);
|
||||
final List<Card> hand = card.getController().getCardsIn(ZoneType.Hand);
|
||||
if (hand.size() == 0) {
|
||||
Singletons.getModel().getGameAction().sacrifice(card, null);
|
||||
} else {
|
||||
@@ -215,7 +215,7 @@ public class CardFactoryCreatures {
|
||||
public void execute() {
|
||||
|
||||
if (card.getController().isHuman()) {
|
||||
final CardList artifacts = CardListUtil.filter(AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.ARTIFACTS);
|
||||
final List<Card> artifacts = CardListUtil.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);
|
||||
@@ -225,10 +225,10 @@ public class CardFactoryCreatures {
|
||||
}
|
||||
|
||||
} else { // computer
|
||||
CardList art = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> art = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
art = CardListUtil.filter(art, Presets.ARTIFACTS);
|
||||
|
||||
CardList list = new CardList(art);
|
||||
List<Card> list = new ArrayList<Card>(art);
|
||||
list = CardListUtil.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
@@ -272,7 +272,7 @@ public class CardFactoryCreatures {
|
||||
// TODO - this needs to be targeted
|
||||
final Player opp = card.getController().getOpponent();
|
||||
|
||||
CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
list = list.getValidCards("Card.Other+YouCtrl".split(","), card.getController(), card);
|
||||
|
||||
for (final Card c : list) {
|
||||
@@ -315,7 +315,7 @@ public class CardFactoryCreatures {
|
||||
} else {
|
||||
// AI chooses the color that appears in the keywords of
|
||||
// the most cards in its deck, hand and on battlefield
|
||||
final CardList list = new CardList();
|
||||
final List<Card> list = new ArrayList<Card>();
|
||||
list.addAll(AllZone.getComputerPlayer().getCardsIn(ZoneType.Library));
|
||||
list.addAll(AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand));
|
||||
list.addAll(AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield));
|
||||
@@ -360,7 +360,7 @@ public class CardFactoryCreatures {
|
||||
final Ability ability = new Ability(card, "0") {
|
||||
@Override
|
||||
public void resolve() {
|
||||
final CardList cl = CardFactoryUtil.makeToken("Stangg Twin", "RG 3 4 Stangg Twin",
|
||||
final List<Card> cl = CardFactoryUtil.makeToken("Stangg Twin", "RG 3 4 Stangg Twin",
|
||||
card.getController(), "R G", new String[] { "Legendary", "Creature", "Human", "Warrior" },
|
||||
3, 4, new String[] { "" });
|
||||
|
||||
@@ -397,7 +397,7 @@ public class CardFactoryCreatures {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
final CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Stangg Twin");
|
||||
final List<Card> list = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Stangg Twin");
|
||||
|
||||
if (list.size() == 1) {
|
||||
Singletons.getModel().getGameAction().exile(list.get(0));
|
||||
@@ -423,7 +423,7 @@ public class CardFactoryCreatures {
|
||||
|
||||
@Override
|
||||
public void resolve() {
|
||||
CardList allTokens = AllZoneUtil.getCreaturesInPlay(card.getController());
|
||||
List<Card> allTokens = AllZoneUtil.getCreaturesInPlay(card.getController());
|
||||
allTokens = CardListUtil.filter(allTokens, Presets.TOKEN);
|
||||
|
||||
CardFactoryUtil.copyTokens(allTokens);
|
||||
@@ -431,7 +431,7 @@ public class CardFactoryCreatures {
|
||||
|
||||
@Override
|
||||
public boolean canPlayAI() {
|
||||
CardList allTokens = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
||||
List<Card> allTokens = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
||||
allTokens = CardListUtil.filter(allTokens, Presets.TOKEN);
|
||||
|
||||
return allTokens.size() >= 2;
|
||||
@@ -470,7 +470,7 @@ public class CardFactoryCreatures {
|
||||
lifeGain = CardFactoryUtil.getNumberOfPermanentsByColor((String) o);
|
||||
|
||||
} else {
|
||||
final CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
final String color = CardFactoryUtil.getMostProminentColor(list);
|
||||
lifeGain = CardFactoryUtil.getNumberOfPermanentsByColor(color);
|
||||
}
|
||||
@@ -506,7 +506,7 @@ public class CardFactoryCreatures {
|
||||
return;
|
||||
}
|
||||
|
||||
final CardList cl = new CardList();
|
||||
final List<Card> cl = new ArrayList<Card>();
|
||||
cl.add(lib.get(0));
|
||||
|
||||
GuiChoose.oneOrNone("Top card", cl);
|
||||
@@ -553,7 +553,7 @@ public class CardFactoryCreatures {
|
||||
return false;
|
||||
}
|
||||
|
||||
CardList targetables = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> targetables = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
|
||||
targetables = CardListUtil.filter(CardListUtil.getTargetableCards(targetables, this), new Predicate<Card>() {
|
||||
@Override
|
||||
@@ -574,7 +574,7 @@ public class CardFactoryCreatures {
|
||||
|
||||
@Override
|
||||
public void resolve() {
|
||||
CardList wolves = CardListUtil.getType(card.getController().getCardsIn(ZoneType.Battlefield), "Wolf");
|
||||
List<Card> wolves = CardListUtil.getType(card.getController().getCardsIn(ZoneType.Battlefield), "Wolf");
|
||||
wolves = CardListUtil.filter(wolves, untappedCreature);
|
||||
|
||||
final Card target = this.getTargetCard();
|
||||
@@ -607,7 +607,7 @@ public class CardFactoryCreatures {
|
||||
}));
|
||||
}
|
||||
} else { // AI Choose spread Damage
|
||||
final CardList damageableWolves = CardListUtil.filter(wolves, new Predicate<Card>() {
|
||||
final List<Card> damageableWolves = CardListUtil.filter(wolves, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
return (c.predictDamage(target.getNetAttack(), target, false) > 0);
|
||||
@@ -620,7 +620,7 @@ public class CardFactoryCreatures {
|
||||
return;
|
||||
}
|
||||
|
||||
CardList wolvesLeft = CardListUtil.filter(damageableWolves, new Predicate<Card>() {
|
||||
List<Card> wolvesLeft = CardListUtil.filter(damageableWolves, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
return !c.hasKeyword("Indestructible");
|
||||
@@ -647,7 +647,7 @@ public class CardFactoryCreatures {
|
||||
} else {
|
||||
// Add -1/-1s to Random Indestructibles
|
||||
if (target.hasKeyword("Infect") || target.hasKeyword("Wither")) {
|
||||
final CardList indestructibles = CardListUtil.filter(damageableWolves, new Predicate<Card>() {
|
||||
final List<Card> indestructibles = CardListUtil.filter(damageableWolves, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
return c.hasKeyword("Indestructible");
|
||||
@@ -742,14 +742,14 @@ public class CardFactoryCreatures {
|
||||
if (AllZone.getHumanPlayer().getLife() < card.getCounters(Counters.P1P1)) {
|
||||
this.setTargetPlayer(AllZone.getHumanPlayer());
|
||||
} else {
|
||||
final CardList list = this.getCreature();
|
||||
final List<Card> list = this.getCreature();
|
||||
CardListUtil.shuffle(list);
|
||||
this.setTargetCard(list.get(0));
|
||||
}
|
||||
} // chooseTargetAI()
|
||||
|
||||
CardList getCreature() {
|
||||
CardList list = CardFactoryUtil.getHumanCreatureAI(this, true);
|
||||
List<Card> getCreature() {
|
||||
List<Card> list = CardFactoryUtil.getHumanCreatureAI(this, true);
|
||||
list = CardListUtil.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
@@ -804,7 +804,7 @@ public class CardFactoryCreatures {
|
||||
} // resolve()
|
||||
|
||||
public int countKithkin() {
|
||||
CardList kithkin = card.getController().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> kithkin = card.getController().getCardsIn(ZoneType.Battlefield);
|
||||
kithkin = CardListUtil.filter(kithkin, new Predicate<Card>() {
|
||||
|
||||
@Override
|
||||
@@ -915,7 +915,7 @@ public class CardFactoryCreatures {
|
||||
public boolean canPlayAI() {
|
||||
|
||||
// Dark Depths:
|
||||
CardList list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield, "Dark Depths");
|
||||
List<Card> list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield, "Dark Depths");
|
||||
list = CardListUtil.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card crd) {
|
||||
@@ -973,7 +973,7 @@ public class CardFactoryCreatures {
|
||||
int intermSumPower = 0;
|
||||
int intermSumToughness = 0;
|
||||
// intermSumPower = intermSumToughness = 0;
|
||||
CardList creats = card.getController().getCardsIn(ZoneType.Graveyard);
|
||||
List<Card> creats = card.getController().getCardsIn(ZoneType.Graveyard);
|
||||
creats = CardListUtil.filter(creats, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
@@ -1025,7 +1025,7 @@ public class CardFactoryCreatures {
|
||||
@Override
|
||||
public boolean canPlayAI() {
|
||||
// get all creatures
|
||||
CardList list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Graveyard);
|
||||
List<Card> list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Graveyard);
|
||||
list = CardListUtil.filter(list, Presets.CREATURES);
|
||||
return 0 < list.size();
|
||||
}
|
||||
@@ -1047,12 +1047,12 @@ public class CardFactoryCreatures {
|
||||
final Player player = card.getController();
|
||||
final Player opp = player.getOpponent();
|
||||
int max = 0;
|
||||
CardList play = opp.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> play = opp.getCardsIn(ZoneType.Battlefield);
|
||||
play = CardListUtil.filter(play, Presets.NON_TOKEN);
|
||||
play = CardListUtil.filter(play, Presets.WHITE);
|
||||
max += play.size();
|
||||
|
||||
CardList grave = opp.getCardsIn(ZoneType.Graveyard);
|
||||
List<Card> grave = opp.getCardsIn(ZoneType.Graveyard);
|
||||
grave = CardListUtil.filter(grave, Presets.WHITE);
|
||||
max += grave.size();
|
||||
|
||||
@@ -1099,7 +1099,7 @@ public class CardFactoryCreatures {
|
||||
}
|
||||
|
||||
private static void getCard_YoseiTheMorningStar(final Card card, final String cardName) {
|
||||
final CardList targetPerms = new CardList();
|
||||
final List<Card> targetPerms = new ArrayList<Card>();
|
||||
final SpellAbility ability = new Ability(card, "0") {
|
||||
@Override
|
||||
public void resolve() {
|
||||
@@ -1193,7 +1193,7 @@ public class CardFactoryCreatures {
|
||||
@Override
|
||||
public void execute() {
|
||||
final Player player = card.getController();
|
||||
final CardList list = CardFactoryUtil.getHumanCreatureAI(ability, true);
|
||||
final List<Card> list = CardFactoryUtil.getHumanCreatureAI(ability, true);
|
||||
|
||||
if (player.isHuman()) {
|
||||
AllZone.getInputControl().setInput(playerInput);
|
||||
@@ -1210,7 +1210,7 @@ public class CardFactoryCreatures {
|
||||
|
||||
private static void getCard_PhyrexianDreadnought(final Card card, final String cardName) {
|
||||
final Player player = card.getController();
|
||||
final CardList toSac = new CardList();
|
||||
final List<Card> toSac = new ArrayList<Card>();
|
||||
|
||||
final Ability sacOrSac = new Ability(card, "") {
|
||||
@Override
|
||||
@@ -1321,11 +1321,11 @@ public class CardFactoryCreatures {
|
||||
// name a card
|
||||
final String choice = JOptionPane.showInputDialog(null, "Name a card", cardName,
|
||||
JOptionPane.QUESTION_MESSAGE);
|
||||
final CardList hand = this.getTargetPlayer().getCardsIn(ZoneType.Hand);
|
||||
final List<Card> hand = this.getTargetPlayer().getCardsIn(ZoneType.Hand);
|
||||
int numCards = card.getXManaCostPaid();
|
||||
numCards = Math.min(hand.size(), numCards);
|
||||
|
||||
final CardList revealed = new CardList();
|
||||
final List<Card> revealed = new ArrayList<Card>();
|
||||
for (int i = 0; i < numCards; i++) {
|
||||
final Card random = CardUtil.getRandom(hand);
|
||||
revealed.add(random);
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package forge.card.cardfactory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.Command;
|
||||
import forge.GameActionUtil;
|
||||
@@ -68,8 +70,8 @@ class CardFactoryEnchantments {
|
||||
|
||||
@Override
|
||||
public boolean canPlay() {
|
||||
final CardList grave = AllZone.getHumanPlayer().getCardsIn(ZoneType.Graveyard);
|
||||
final CardList aiGrave = AllZone.getComputerPlayer().getCardsIn(ZoneType.Graveyard);
|
||||
final List<Card> grave = AllZone.getHumanPlayer().getCardsIn(ZoneType.Graveyard);
|
||||
final List<Card> aiGrave = AllZone.getComputerPlayer().getCardsIn(ZoneType.Graveyard);
|
||||
return ((CardListUtil.getType(grave, "Creature").size() > 1) || (CardListUtil.getType(aiGrave, "Creature").size() > 1))
|
||||
&& super.canPlay();
|
||||
}
|
||||
@@ -81,8 +83,8 @@ class CardFactoryEnchantments {
|
||||
|
||||
@Override
|
||||
public void showMessage() {
|
||||
CardList grave = AllZone.getHumanPlayer().getCardsIn(ZoneType.Graveyard);
|
||||
CardList aiGrave = AllZone.getComputerPlayer().getCardsIn(ZoneType.Graveyard);
|
||||
List<Card> grave = AllZone.getHumanPlayer().getCardsIn(ZoneType.Graveyard);
|
||||
List<Card> aiGrave = AllZone.getComputerPlayer().getCardsIn(ZoneType.Graveyard);
|
||||
grave = CardListUtil.filter(grave, CardPredicates.Presets.CREATURES);
|
||||
aiGrave = CardListUtil.filter(aiGrave, CardPredicates.Presets.CREATURES);
|
||||
|
||||
@@ -90,7 +92,7 @@ class CardFactoryEnchantments {
|
||||
this.once = false;
|
||||
this.stop();
|
||||
} else {
|
||||
CardList chooseGrave;
|
||||
List<Card> chooseGrave;
|
||||
if (grave.size() < 2) {
|
||||
chooseGrave = aiGrave;
|
||||
} else if (aiGrave.size() < 2) {
|
||||
@@ -102,7 +104,7 @@ class CardFactoryEnchantments {
|
||||
|
||||
final Card c = GuiChoose.one("Choose first creature to exile", chooseGrave);
|
||||
if (c != null) {
|
||||
CardList newGrave = CardListUtil.filter(c.getOwner().getCardsIn(ZoneType.Graveyard), CardPredicates.Presets.CREATURES);
|
||||
List<Card> newGrave = CardListUtil.filter(c.getOwner().getCardsIn(ZoneType.Graveyard), CardPredicates.Presets.CREATURES);
|
||||
newGrave.remove(c);
|
||||
|
||||
final Object o2 = GuiChoose.one("Choose second creature to exile", newGrave);
|
||||
@@ -148,8 +150,8 @@ class CardFactoryEnchantments {
|
||||
|
||||
@Override
|
||||
public boolean canPlayAI() {
|
||||
final CardList compCreats = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
||||
final CardList humCreats = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
final List<Card> compCreats = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
||||
final List<Card> humCreats = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
|
||||
// only play standstill if comp controls more creatures than
|
||||
// human
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package forge.card.cardfactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
@@ -25,7 +26,7 @@ import com.google.common.collect.Iterables;
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates;
|
||||
import forge.CardPredicates.Presets;
|
||||
@@ -94,7 +95,7 @@ public class CardFactoryInstants {
|
||||
@Override
|
||||
public void resolve() {
|
||||
Player player = getTargetPlayer();
|
||||
CardList artifacts = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> artifacts = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
artifacts = CardListUtil.filter(artifacts, CardPredicates.Presets.ARTIFACTS);
|
||||
|
||||
for (int i = 0; i < artifacts.size(); i++) {
|
||||
@@ -128,8 +129,8 @@ public class CardFactoryInstants {
|
||||
}
|
||||
|
||||
public void humanResolve() {
|
||||
final CardList libraryList = AllZone.getHumanPlayer().getCardsIn(ZoneType.Library);
|
||||
final CardList selectedCards = new CardList();
|
||||
final List<Card> libraryList = AllZone.getHumanPlayer().getCardsIn(ZoneType.Library);
|
||||
final List<Card> selectedCards = new ArrayList<Card>();
|
||||
|
||||
Object o = GuiChoose.oneOrNone("Select first card", libraryList);
|
||||
if (o != null) {
|
||||
@@ -168,8 +169,8 @@ public class CardFactoryInstants {
|
||||
}
|
||||
|
||||
public void computerResolve() {
|
||||
final CardList list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Library);
|
||||
final CardList selectedCards = new CardList();
|
||||
final List<Card> list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Library);
|
||||
final List<Card> selectedCards = new ArrayList<Card>();
|
||||
|
||||
// pick best creature
|
||||
Card c = CardFactoryUtil.getBestCreatureAI(list);
|
||||
@@ -207,7 +208,7 @@ public class CardFactoryInstants {
|
||||
|
||||
@Override
|
||||
public boolean canPlay() {
|
||||
final CardList library = card.getController().getCardsIn(ZoneType.Library);
|
||||
final List<Card> library = card.getController().getCardsIn(ZoneType.Library);
|
||||
return library.size() >= 3 && super.canPlay();
|
||||
}
|
||||
|
||||
@@ -234,7 +235,7 @@ public class CardFactoryInstants {
|
||||
final Player player = card.getController();
|
||||
final int max = card.getXManaCostPaid();
|
||||
|
||||
final CardList graveList = tPlayer.getCardsIn(ZoneType.Graveyard);
|
||||
final List<Card> graveList = tPlayer.getCardsIn(ZoneType.Graveyard);
|
||||
final int x = Math.min(max, graveList.size());
|
||||
|
||||
if (player.isHuman()) {
|
||||
@@ -268,7 +269,7 @@ public class CardFactoryInstants {
|
||||
|
||||
@Override
|
||||
public boolean canPlayAI() {
|
||||
final CardList graveList = AllZone.getHumanPlayer().getCardsIn(ZoneType.Graveyard);
|
||||
final List<Card> graveList = AllZone.getHumanPlayer().getCardsIn(ZoneType.Graveyard);
|
||||
|
||||
final int maxX = ComputerUtil.getAvailableMana(true).size() - 1;
|
||||
return (maxX >= 3) && (graveList.size() > 0);
|
||||
@@ -309,7 +310,7 @@ public class CardFactoryInstants {
|
||||
// the siren flag
|
||||
final Player player = card.getController();
|
||||
final Player opponent = player.getOpponent();
|
||||
final CardList creatures = AllZoneUtil.getCreaturesInPlay(opponent);
|
||||
final List<Card> creatures = AllZoneUtil.getCreaturesInPlay(opponent);
|
||||
for (final Card creature : creatures) {
|
||||
// skip walls, skip creatures with summoning sickness
|
||||
// also skip creatures with haste if they came onto the
|
||||
@@ -325,7 +326,7 @@ public class CardFactoryInstants {
|
||||
public void resolve() {
|
||||
final Player player = card.getController();
|
||||
final Player opponent = player.getOpponent();
|
||||
final CardList creatures = AllZoneUtil.getCreaturesInPlay(opponent);
|
||||
final List<Card> creatures = AllZoneUtil.getCreaturesInPlay(opponent);
|
||||
|
||||
for (final Card creature : creatures) {
|
||||
// System.out.println("Siren's Call - EOT - "+creature.getName()
|
||||
@@ -385,7 +386,7 @@ public class CardFactoryInstants {
|
||||
@Override
|
||||
public void resolve() {
|
||||
final PlayerZone lib = card.getController().getZone(ZoneType.Library);
|
||||
final CardList choices = new CardList();
|
||||
final List<Card> choices = new ArrayList<Card>();
|
||||
for (int i = 0; (i < 3) && (lib.size() > 0); i++) {
|
||||
choices.add(lib.get(i));
|
||||
}
|
||||
@@ -422,8 +423,8 @@ public class CardFactoryInstants {
|
||||
@Override
|
||||
public void resolve() {
|
||||
final Player you = card.getController();
|
||||
final CardList ens = CardListUtil.filter(AllZoneUtil.getCardsIn(ZoneType.Battlefield), Presets.ENCHANTMENTS);
|
||||
final CardList toReturn = CardListUtil.filter(ens, new Predicate<Card>() {
|
||||
final List<Card> ens = CardListUtil.filter(AllZoneUtil.getCardsIn(ZoneType.Battlefield), Presets.ENCHANTMENTS);
|
||||
final List<Card> toReturn = CardListUtil.filter(ens, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
final Card enchanting = c.getEnchantingCard();
|
||||
@@ -480,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 CardList list = CardListUtil.getType(this.getTargetPlayer().getCardsIn(ZoneType.Battlefield), cardType);
|
||||
final List<Card> list = CardListUtil.getType(this.getTargetPlayer().getCardsIn(ZoneType.Battlefield), cardType);
|
||||
|
||||
final String[] tapOrUntap = new String[] { "Tap", "Untap" };
|
||||
final Object z = GuiChoose.one("Tap or Untap?", tapOrUntap);
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
*/
|
||||
package forge.card.cardfactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
@@ -24,7 +27,7 @@ import com.google.common.base.Predicate;
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates;
|
||||
import forge.CardPredicates.Presets;
|
||||
@@ -162,7 +165,7 @@ class CardFactoryLands {
|
||||
|
||||
private static final long serialVersionUID = 1416258136308898492L;
|
||||
|
||||
private final CardList inPlay = new CardList();
|
||||
private final List<Card> inPlay = new ArrayList<Card>();
|
||||
|
||||
@Override
|
||||
public boolean canPlayAI() {
|
||||
@@ -292,11 +295,11 @@ class CardFactoryLands {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
final CardList land = CardListUtil.getValidCards(this.player.getCardsIn(ZoneType.Battlefield), type[0], this.player, card);
|
||||
final List<Card> land = CardListUtil.getValidCards(this.player.getCardsIn(ZoneType.Battlefield), type[0], this.player, card);
|
||||
|
||||
if (this.player.isComputer()) {
|
||||
if (land.size() > 0) {
|
||||
CardList tappedLand = new CardList(land);
|
||||
List<Card> tappedLand = new ArrayList<Card>(land);
|
||||
tappedLand = CardListUtil.filter(tappedLand, Presets.TAPPED);
|
||||
// if any are tapped, sacrifice it
|
||||
// else sacrifice random
|
||||
@@ -355,7 +358,7 @@ class CardFactoryLands {
|
||||
@Override
|
||||
public void execute() {
|
||||
final Player player = card.getController();
|
||||
final CardList land = player.getCardsIn(ZoneType.Battlefield, "Sheltered Valley");
|
||||
final List<Card> land = player.getCardsIn(ZoneType.Battlefield, "Sheltered Valley");
|
||||
land.remove(card);
|
||||
|
||||
if (land.size() > 0) {
|
||||
@@ -377,12 +380,12 @@ class CardFactoryLands {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
CardList plains = AllZoneUtil.getPlayerLandsInPlay(card.getController());
|
||||
List<Card> plains = AllZoneUtil.getPlayerLandsInPlay(card.getController());
|
||||
plains = CardListUtil.filter(plains, Presets.UNTAPPED);
|
||||
|
||||
if (this.player.isComputer()) {
|
||||
if (plains.size() > 1) {
|
||||
CardList tappedPlains = CardListUtil.filter(plains, CardPredicates.Presets.BASIC_LANDS);
|
||||
List<Card> tappedPlains = CardListUtil.filter(plains, CardPredicates.Presets.BASIC_LANDS);
|
||||
for (final Card c : tappedPlains) {
|
||||
Singletons.getModel().getGameAction().sacrifice(c, null);
|
||||
}
|
||||
@@ -487,7 +490,7 @@ class CardFactoryLands {
|
||||
}
|
||||
|
||||
public void computerExecute() {
|
||||
CardList hand = AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand);
|
||||
List<Card> hand = AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand);
|
||||
hand = CardListUtil.getType(hand, type);
|
||||
if (hand.size() > 0) {
|
||||
this.revealCard(hand.get(0));
|
||||
@@ -671,12 +674,12 @@ class CardFactoryLands {
|
||||
@Override
|
||||
public void execute() {
|
||||
final Player player = card.getController();
|
||||
CardList land = AllZoneUtil.getPlayerLandsInPlay(player);
|
||||
List<Card> land = AllZoneUtil.getPlayerLandsInPlay(player);
|
||||
land = land.getNotType("Lair");
|
||||
|
||||
if (player.isComputer()) {
|
||||
if (land.size() > 0) {
|
||||
CardList tappedLand = new CardList(land);
|
||||
List<Card> tappedLand = new ArrayList<Card>(land);
|
||||
tappedLand = tappedLand.filter(CardListFilter.TAPPED);
|
||||
if (tappedLand.size() > 0) {
|
||||
Singletons.getModel().getGameAction().moveToHand(CardFactoryUtil.getWorstLand(tappedLand));
|
||||
@@ -745,7 +748,7 @@ class CardFactoryLands {
|
||||
final Player player = card.getController();
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append(type[0]).append(".untapped");
|
||||
final CardList land = player.getCardsIn(ZoneType.Battlefield)
|
||||
final List<Card> land = player.getCardsIn(ZoneType.Battlefield)
|
||||
.getValidCards(sb.toString(), player, card);
|
||||
|
||||
if (player.isComputer()) {
|
||||
|
||||
@@ -33,7 +33,7 @@ import com.google.common.collect.Iterables;
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates;
|
||||
import forge.CardPredicates.Presets;
|
||||
@@ -80,9 +80,9 @@ public class CardFactorySorceries {
|
||||
Card choice = null;
|
||||
|
||||
// check for no cards in hand on resolve
|
||||
final CardList lib = card.getController().getCardsIn(ZoneType.Library);
|
||||
final CardList cards = new CardList();
|
||||
final CardList exiled = new CardList();
|
||||
final List<Card> lib = card.getController().getCardsIn(ZoneType.Library);
|
||||
final List<Card> cards = new ArrayList<Card>();
|
||||
final List<Card> exiled = new ArrayList<Card>();
|
||||
if (lib.size() == 0) {
|
||||
JOptionPane.showMessageDialog(null, "No more cards in library.", "",
|
||||
JOptionPane.INFORMATION_MESSAGE);
|
||||
@@ -99,8 +99,8 @@ public class CardFactorySorceries {
|
||||
exiled.add(lib.get(i));
|
||||
Singletons.getModel().getGameAction().exile(lib.get(i));
|
||||
}
|
||||
final CardList pile1 = new CardList();
|
||||
final CardList pile2 = new CardList();
|
||||
final List<Card> pile1 = new ArrayList<Card>();
|
||||
final List<Card> pile2 = new ArrayList<Card>();
|
||||
boolean stop = false;
|
||||
int pile1CMC = 0;
|
||||
int pile2CMC = 0;
|
||||
@@ -212,7 +212,7 @@ public class CardFactorySorceries {
|
||||
JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, possibleValues,
|
||||
possibleValues[0]);
|
||||
|
||||
CardList chosen;
|
||||
List<Card> chosen;
|
||||
if (q.equals(0)) {
|
||||
chosen = pile1;
|
||||
} else {
|
||||
@@ -247,7 +247,7 @@ public class CardFactorySorceries {
|
||||
|
||||
@Override
|
||||
public boolean canPlayAI() {
|
||||
final CardList cards = AllZone.getComputerPlayer().getCardsIn(ZoneType.Library);
|
||||
final List<Card> cards = AllZone.getComputerPlayer().getCardsIn(ZoneType.Library);
|
||||
return cards.size() >= 8;
|
||||
}
|
||||
}; // SpellAbility
|
||||
@@ -262,7 +262,7 @@ public class CardFactorySorceries {
|
||||
|
||||
@Override
|
||||
public void resolve() {
|
||||
final CardList all = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> all = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
final int soldiers = card.getXManaCostPaid();
|
||||
for (int i = 0; i < soldiers; i++) {
|
||||
CardFactoryUtil.makeToken("Soldier", "W 1 1 Soldier", card.getController(), "W", new String[] {
|
||||
@@ -280,8 +280,8 @@ public class CardFactorySorceries {
|
||||
|
||||
@Override
|
||||
public boolean canPlayAI() {
|
||||
final CardList human = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
final CardList computer = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
||||
final List<Card> human = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
final List<Card> computer = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
||||
|
||||
// the computer will at least destroy 2 more human creatures
|
||||
return ((computer.size() < (human.size() - 1)) || ((AllZone.getComputerPlayer().getLife() < 7) && !human
|
||||
@@ -297,15 +297,15 @@ public class CardFactorySorceries {
|
||||
|
||||
@Override
|
||||
public boolean canPlayAI() {
|
||||
CardList humTokenCreats = CardListUtil.filter(AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer()), Presets.TOKEN);
|
||||
CardList compTokenCreats = CardListUtil.filter(AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer()), Presets.TOKEN);
|
||||
List<Card> humTokenCreats = CardListUtil.filter(AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer()), Presets.TOKEN);
|
||||
List<Card> compTokenCreats = CardListUtil.filter(AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer()), Presets.TOKEN);
|
||||
|
||||
return compTokenCreats.size() > humTokenCreats.size();
|
||||
} // canPlayAI()
|
||||
|
||||
@Override
|
||||
public void resolve() {
|
||||
CardList tokens = AllZoneUtil.getCreaturesInPlay();
|
||||
List<Card> tokens = AllZoneUtil.getCreaturesInPlay();
|
||||
tokens = CardListUtil.filter(tokens, Presets.TOKEN);
|
||||
|
||||
CardFactoryUtil.copyTokens(tokens);
|
||||
@@ -327,8 +327,8 @@ public class CardFactorySorceries {
|
||||
}
|
||||
|
||||
private final static SpellAbility getGlobalRuin( final Card card ) {
|
||||
final CardList target = new CardList();
|
||||
final CardList saveList = new CardList();
|
||||
final List<Card> target = new ArrayList<Card>();
|
||||
final List<Card> saveList = new ArrayList<Card>();
|
||||
// need to use arrays so we can declare them final and still set the
|
||||
// values in the input and runtime classes. This is a hack.
|
||||
final int[] index = new int[1];
|
||||
@@ -353,10 +353,10 @@ public class CardFactorySorceries {
|
||||
// Vector<?> computerBasic = new Vector();
|
||||
|
||||
// figure out which basic land types the computer has
|
||||
CardList land = AllZoneUtil.getPlayerLandsInPlay(AllZone.getComputerPlayer());
|
||||
List<Card> land = AllZoneUtil.getPlayerLandsInPlay(AllZone.getComputerPlayer());
|
||||
|
||||
for (final String element : Constant.Color.BASIC_LANDS) {
|
||||
final CardList cl = CardListUtil.getType(land, element);
|
||||
final List<Card> cl = CardListUtil.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
|
||||
@@ -437,8 +437,8 @@ public class CardFactorySorceries {
|
||||
/* && !saveList.contains(c) */) {
|
||||
// get all other basic[count] lands human player
|
||||
// controls and add them to target
|
||||
CardList land = AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer());
|
||||
CardList cl = CardListUtil.getType(land, humanBasic.get(this.count));
|
||||
List<Card> land = AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer());
|
||||
List<Card> cl = CardListUtil.getType(land, humanBasic.get(this.count));
|
||||
cl = CardListUtil.filter(cl, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card crd) {
|
||||
@@ -485,10 +485,10 @@ public class CardFactorySorceries {
|
||||
countBase[0] = 0;
|
||||
// figure out which basic land types the human has
|
||||
// put those in an set to use later
|
||||
final CardList land = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> land = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
|
||||
for (final String element : Constant.Color.BASIC_LANDS) {
|
||||
final CardList c = CardListUtil.getType(land, element);
|
||||
final List<Card> c = CardListUtil.getType(land, element);
|
||||
if (!c.isEmpty()) {
|
||||
humanBasic.add(element);
|
||||
countBase[0]++;
|
||||
@@ -531,7 +531,7 @@ public class CardFactorySorceries {
|
||||
@Override
|
||||
public void resolve() {
|
||||
final Player player = this.getTargetPlayer();
|
||||
final CardList lib = player.getCardsIn(ZoneType.Library);
|
||||
final List<Card> lib = player.getCardsIn(ZoneType.Library);
|
||||
|
||||
for (final Card c : Iterables.filter(player.getCardsIn(ZoneType.Graveyard), nonBasicLands)) {
|
||||
for (final Card rem : Iterables.filter(lib, CardPredicates.nameEquals(c.getName()))) {
|
||||
@@ -611,8 +611,8 @@ public class CardFactorySorceries {
|
||||
@Override
|
||||
public void resolve() {
|
||||
// Lands:
|
||||
final CardList humLand = AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer());
|
||||
final CardList compLand = AllZoneUtil.getPlayerLandsInPlay(AllZone.getComputerPlayer());
|
||||
final List<Card> humLand = AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer());
|
||||
final List<Card> compLand = AllZoneUtil.getPlayerLandsInPlay(AllZone.getComputerPlayer());
|
||||
|
||||
if (compLand.size() > humLand.size()) {
|
||||
CardListUtil.shuffle(compLand);
|
||||
@@ -625,8 +625,8 @@ public class CardFactorySorceries {
|
||||
}
|
||||
|
||||
// Hand
|
||||
final CardList humHand = AllZone.getHumanPlayer().getCardsIn(ZoneType.Hand);
|
||||
final CardList compHand = AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand);
|
||||
final List<Card> humHand = AllZone.getHumanPlayer().getCardsIn(ZoneType.Hand);
|
||||
final List<Card> compHand = AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand);
|
||||
final int handDiff = Math.abs(humHand.size() - compHand.size());
|
||||
|
||||
if (compHand.size() > humHand.size()) {
|
||||
@@ -636,8 +636,8 @@ public class CardFactorySorceries {
|
||||
}
|
||||
|
||||
// Creatures:
|
||||
final CardList humCreats = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
final CardList compCreats = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
||||
final List<Card> humCreats = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
final List<Card> compCreats = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
||||
|
||||
if (compCreats.size() > humCreats.size()) {
|
||||
CardListUtil.sortAttackLowFirst(compCreats);
|
||||
@@ -655,17 +655,17 @@ public class CardFactorySorceries {
|
||||
@Override
|
||||
public boolean canPlayAI() {
|
||||
int diff = 0;
|
||||
final CardList humLand = AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer());
|
||||
final CardList compLand = AllZoneUtil.getPlayerLandsInPlay(AllZone.getComputerPlayer());
|
||||
final List<Card> humLand = AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer());
|
||||
final List<Card> compLand = AllZoneUtil.getPlayerLandsInPlay(AllZone.getComputerPlayer());
|
||||
diff += humLand.size() - compLand.size();
|
||||
|
||||
final CardList humCreats = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
CardList compCreats = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
||||
final List<Card> humCreats = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
List<Card> compCreats = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
||||
compCreats = CardListUtil.filter(compCreats, CardPredicates.Presets.CREATURES);
|
||||
diff += 1.5 * (humCreats.size() - compCreats.size());
|
||||
|
||||
final CardList humHand = AllZone.getHumanPlayer().getCardsIn(ZoneType.Hand);
|
||||
final CardList compHand = AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand);
|
||||
final List<Card> humHand = AllZone.getHumanPlayer().getCardsIn(ZoneType.Hand);
|
||||
final List<Card> compHand = AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand);
|
||||
diff += 0.5 * (humHand.size() - compHand.size());
|
||||
|
||||
return diff > 2;
|
||||
@@ -752,15 +752,15 @@ public class CardFactorySorceries {
|
||||
/*
|
||||
* We want compy to have less cards in hand than the human
|
||||
*/
|
||||
final CardList humanHand = AllZone.getHumanPlayer().getCardsIn(ZoneType.Hand);
|
||||
final CardList computerHand = AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand);
|
||||
final List<Card> humanHand = AllZone.getHumanPlayer().getCardsIn(ZoneType.Hand);
|
||||
final List<Card> computerHand = AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand);
|
||||
return computerHand.size() < humanHand.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resolve() {
|
||||
final CardList humanHand = AllZone.getHumanPlayer().getCardsIn(ZoneType.Hand);
|
||||
final CardList computerHand = AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand);
|
||||
final List<Card> humanHand = AllZone.getHumanPlayer().getCardsIn(ZoneType.Hand);
|
||||
final List<Card> computerHand = AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand);
|
||||
|
||||
final int num = Math.max(humanHand.size(), computerHand.size());
|
||||
|
||||
@@ -808,7 +808,7 @@ public class CardFactorySorceries {
|
||||
}
|
||||
|
||||
final HashMap<String, Integer> countInGraveyard = new HashMap<String, Integer>();
|
||||
final CardList allGrave = AllZone.getComputerPlayer().getCardsIn(ZoneType.Graveyard);
|
||||
final List<Card> allGrave = AllZone.getComputerPlayer().getCardsIn(ZoneType.Graveyard);
|
||||
for (final Card c : Iterables.filter(allGrave, CardPredicates.Presets.CREATURES)) {
|
||||
for (final String type : c.getType()) {
|
||||
if (CardUtil.isACreatureType(type)) {
|
||||
@@ -835,7 +835,7 @@ public class CardFactorySorceries {
|
||||
}
|
||||
|
||||
// Actually put everything on the battlefield
|
||||
CardList bidded = CardListUtil.filter(AllZoneUtil.getCardsIn(ZoneType.Graveyard), CardPredicates.Presets.CREATURES);
|
||||
List<Card> bidded = CardListUtil.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);
|
||||
@@ -909,7 +909,7 @@ public class CardFactorySorceries {
|
||||
if (maxCards == 0) {
|
||||
return;
|
||||
}
|
||||
final CardList topCards = new CardList();
|
||||
final List<Card> topCards = new ArrayList<Card>();
|
||||
// show top n cards:
|
||||
for (int j = 0; j < maxCards; j++) {
|
||||
topCards.add(lib.get(j));
|
||||
@@ -1158,7 +1158,7 @@ public class CardFactorySorceries {
|
||||
|
||||
@Override
|
||||
public void showMessage() {
|
||||
CardList grave = card.getController().getCardsIn(ZoneType.Graveyard);
|
||||
List<Card> grave = card.getController().getCardsIn(ZoneType.Graveyard);
|
||||
grave = CardListUtil.filter(grave, Presets.CREATURES);
|
||||
grave = CardListUtil.filter(grave, new Predicate<Card>() {
|
||||
@Override
|
||||
@@ -1306,8 +1306,8 @@ public class CardFactorySorceries {
|
||||
final ArrayList<String> display = new ArrayList<String>();
|
||||
|
||||
// get all
|
||||
final CardList creatures = AllZoneUtil.getCreaturesInPlay();
|
||||
CardList grave = card.getController().getCardsIn(ZoneType.Graveyard);
|
||||
final List<Card> creatures = AllZoneUtil.getCreaturesInPlay();
|
||||
List<Card> grave = card.getController().getCardsIn(ZoneType.Graveyard);
|
||||
grave = CardListUtil.filter(grave, Presets.CREATURES);
|
||||
|
||||
if (AllZone.getHumanPlayer().canBeTargetedBy(spell)
|
||||
@@ -1387,7 +1387,7 @@ public class CardFactorySorceries {
|
||||
final Card[] newArtifact = new Card[1];
|
||||
|
||||
// Sacrifice an artifact
|
||||
CardList arts = p.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> arts = p.getCardsIn(ZoneType.Battlefield);
|
||||
arts = CardListUtil.filter(arts, Presets.ARTIFACTS);
|
||||
final Object toSac = GuiChoose.oneOrNone("Sacrifice an artifact", arts);
|
||||
if (toSac != null) {
|
||||
@@ -1399,9 +1399,9 @@ public class CardFactorySorceries {
|
||||
}
|
||||
|
||||
// Search your library for an artifact
|
||||
final CardList lib = p.getCardsIn(ZoneType.Library);
|
||||
final List<Card> lib = p.getCardsIn(ZoneType.Library);
|
||||
GuiChoose.oneOrNone("Looking at Library", lib);
|
||||
final CardList libArts = CardListUtil.filter(lib, Presets.ARTIFACTS);
|
||||
final List<Card> libArts = CardListUtil.filter(lib, Presets.ARTIFACTS);
|
||||
final Object o = GuiChoose.oneOrNone("Search for artifact", libArts);
|
||||
if (o != null) {
|
||||
newArtifact[0] = (Card) o;
|
||||
|
||||
@@ -34,7 +34,7 @@ import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardCharacteristicName;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates;
|
||||
import forge.CardPredicates.Presets;
|
||||
@@ -106,8 +106,8 @@ public class CardFactoryUtil {
|
||||
* a boolean.
|
||||
* @return a {@link forge.Card} object.
|
||||
*/
|
||||
public static Card getMostExpensivePermanentAI(final CardList list, final SpellAbility spell, final boolean targeted) {
|
||||
CardList all = list;
|
||||
public static Card getMostExpensivePermanentAI(final List<Card> list, final SpellAbility spell, final boolean targeted) {
|
||||
List<Card> all = list;
|
||||
if (targeted) {
|
||||
all = CardListUtil.filter(all, new Predicate<Card>() {
|
||||
@Override
|
||||
@@ -127,7 +127,7 @@ public class CardFactoryUtil {
|
||||
* the all
|
||||
* @return the card
|
||||
*/
|
||||
public static Card getMostExpensivePermanentAI(final CardList all) {
|
||||
public static Card getMostExpensivePermanentAI(final List<Card> all) {
|
||||
if (all.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
@@ -140,7 +140,7 @@ public class CardFactoryUtil {
|
||||
int curCMC = card.getCMC();
|
||||
|
||||
// Add all cost of all auras with the same controller
|
||||
final CardList auras = new CardList(card.getEnchantedBy());
|
||||
final List<Card> auras = new ArrayList<Card>(card.getEnchantedBy());
|
||||
CardListUtil.filterControlledBy(auras, card.getController());
|
||||
curCMC += CardListUtil.sumCMC(auras) + auras.size();
|
||||
|
||||
@@ -167,7 +167,7 @@ public class CardFactoryUtil {
|
||||
* a boolean.
|
||||
* @return a {@link forge.Card} object.
|
||||
*/
|
||||
public static Card getCheapestCreatureAI(CardList list, final SpellAbility spell, final boolean targeted) {
|
||||
public static Card getCheapestCreatureAI(List<Card> list, final SpellAbility spell, final boolean targeted) {
|
||||
list = CardListUtil.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
@@ -190,8 +190,8 @@ public class CardFactoryUtil {
|
||||
* a boolean.
|
||||
* @return a {@link forge.Card} object.
|
||||
*/
|
||||
public static Card getCheapestPermanentAI(final CardList list, final SpellAbility spell, final boolean targeted) {
|
||||
CardList all = list;
|
||||
public static Card getCheapestPermanentAI(final List<Card> list, final SpellAbility spell, final boolean targeted) {
|
||||
List<Card> all = list;
|
||||
if (targeted) {
|
||||
all = CardListUtil.filter(all, new Predicate<Card>() {
|
||||
@Override
|
||||
@@ -227,14 +227,14 @@ public class CardFactoryUtil {
|
||||
* a {@link forge.CardList} object.
|
||||
* @return a {@link forge.Card} object.
|
||||
*/
|
||||
public static Card getBestLandAI(final CardList list) {
|
||||
final CardList land = CardListUtil.filter(list, CardPredicates.Presets.LANDS);
|
||||
public static Card getBestLandAI(final List<Card> list) {
|
||||
final List<Card> land = CardListUtil.filter(list, CardPredicates.Presets.LANDS);
|
||||
if (!(land.size() > 0)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// prefer to target non basic lands
|
||||
final CardList nbLand = CardListUtil.filter(land, Predicates.not(CardPredicates.Presets.BASIC_LANDS));
|
||||
final List<Card> nbLand = CardListUtil.filter(land, Predicates.not(CardPredicates.Presets.BASIC_LANDS));
|
||||
|
||||
if (nbLand.size() > 0) {
|
||||
// TODO - Rank non basics?
|
||||
@@ -260,7 +260,7 @@ public class CardFactoryUtil {
|
||||
return null; // no basic land was a minimum
|
||||
}
|
||||
|
||||
final CardList bLand = CardListUtil.getType(land, sminBL);
|
||||
final List<Card> bLand = CardListUtil.getType(land, sminBL);
|
||||
|
||||
for( Card ut : Iterables.filter(bLand, CardPredicates.Presets.UNTAPPED) )
|
||||
{
|
||||
@@ -285,8 +285,8 @@ public class CardFactoryUtil {
|
||||
* a boolean.
|
||||
* @return a {@link forge.Card} object.
|
||||
*/
|
||||
public static Card getBestEnchantmentAI(final CardList list, final SpellAbility spell, final boolean targeted) {
|
||||
CardList all = CardListUtil.filter(list, CardPredicates.Presets.ENCHANTMENTS);
|
||||
public static Card getBestEnchantmentAI(final List<Card> list, final SpellAbility spell, final boolean targeted) {
|
||||
List<Card> all = CardListUtil.filter(list, CardPredicates.Presets.ENCHANTMENTS);
|
||||
if (targeted) {
|
||||
all = CardListUtil.filter(all, new Predicate<Card>() {
|
||||
|
||||
@@ -311,8 +311,8 @@ public class CardFactoryUtil {
|
||||
* a {@link forge.CardList} object.
|
||||
* @return a {@link forge.Card} object.
|
||||
*/
|
||||
public static Card getBestArtifactAI(final CardList list) {
|
||||
CardList all = CardListUtil.filter(list, CardPredicates.Presets.ARTIFACTS);
|
||||
public static Card getBestArtifactAI(final List<Card> list) {
|
||||
List<Card> all = CardListUtil.filter(list, CardPredicates.Presets.ARTIFACTS);
|
||||
if (all.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
@@ -344,7 +344,7 @@ public class CardFactoryUtil {
|
||||
* a {@link forge.CardList} object.
|
||||
* @return a int.
|
||||
*/
|
||||
public static int evaluateCreatureList(final CardList list) {
|
||||
public static int evaluateCreatureList(final List<Card> list) {
|
||||
int value = 0;
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
value += CardFactoryUtil.evaluateCreature(list.get(i));
|
||||
@@ -362,7 +362,7 @@ public class CardFactoryUtil {
|
||||
* a {@link forge.CardList} object.
|
||||
* @return a int.
|
||||
*/
|
||||
public static int evaluatePermanentList(final CardList list) {
|
||||
public static int evaluatePermanentList(final List<Card> list) {
|
||||
int value = 0;
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
value += list.get(i).getCMC() + 1;
|
||||
@@ -587,7 +587,7 @@ public class CardFactoryUtil {
|
||||
* a {@link forge.CardList} object.
|
||||
* @return a {@link forge.Card} object.
|
||||
*/
|
||||
public static Card getBestAI(final CardList list) {
|
||||
public static Card getBestAI(final List<Card> 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) {
|
||||
@@ -610,8 +610,8 @@ public class CardFactoryUtil {
|
||||
* the list
|
||||
* @return the card
|
||||
*/
|
||||
public static Card getBestCreatureAI(final CardList list) {
|
||||
CardList all = CardListUtil.filter(list, CardPredicates.Presets.CREATURES);
|
||||
public static Card getBestCreatureAI(final List<Card> list) {
|
||||
List<Card> all = CardListUtil.filter(list, CardPredicates.Presets.CREATURES);
|
||||
return Aggregates.itemWithMax(all, CardPredicates.Accessors.fnEvaluateCreature);
|
||||
}
|
||||
|
||||
@@ -625,9 +625,9 @@ public class CardFactoryUtil {
|
||||
* a {@link forge.CardList} object.
|
||||
* @return a {@link forge.Card} object.
|
||||
*/
|
||||
public static Card getBestCreatureToBounceAI(final CardList list) {
|
||||
public static Card getBestCreatureToBounceAI(final List<Card> list) {
|
||||
final int tokenBonus = 40;
|
||||
CardList all = CardListUtil.filter(list, CardPredicates.Presets.CREATURES);
|
||||
List<Card> all = CardListUtil.filter(list, CardPredicates.Presets.CREATURES);
|
||||
Card biggest = null; // returns null if list.size() == 0
|
||||
int biggestvalue = 0;
|
||||
int newvalue = 0;
|
||||
@@ -661,7 +661,7 @@ public class CardFactoryUtil {
|
||||
* a {@link forge.CardList} object.
|
||||
* @return a {@link forge.Card} object.
|
||||
*/
|
||||
public static Card getWorstAI(final CardList list) {
|
||||
public static Card getWorstAI(final List<Card> list) {
|
||||
return CardFactoryUtil.getWorstPermanentAI(list, false, false, false, false);
|
||||
}
|
||||
|
||||
@@ -675,8 +675,8 @@ public class CardFactoryUtil {
|
||||
* a {@link forge.CardList} object.
|
||||
* @return a {@link forge.Card} object.
|
||||
*/
|
||||
public static Card getWorstCreatureAI(final CardList list) {
|
||||
CardList all = CardListUtil.filter(list, CardPredicates.Presets.CREATURES);
|
||||
public static Card getWorstCreatureAI(final List<Card> list) {
|
||||
List<Card> all = CardListUtil.filter(list, CardPredicates.Presets.CREATURES);
|
||||
// get smallest creature
|
||||
return Aggregates.itemWithMin(all, CardPredicates.Accessors.fnEvaluateCreature);
|
||||
}
|
||||
@@ -698,7 +698,7 @@ public class CardFactoryUtil {
|
||||
* a boolean.
|
||||
* @return a {@link forge.Card} object.
|
||||
*/
|
||||
public static Card getWorstPermanentAI(final CardList list, final boolean biasEnch, final boolean biasLand,
|
||||
public static Card getWorstPermanentAI(final List<Card> list, final boolean biasEnch, final boolean biasLand,
|
||||
final boolean biasArt, final boolean biasCreature) {
|
||||
if (list.size() == 0) {
|
||||
return null;
|
||||
@@ -721,7 +721,7 @@ public class CardFactoryUtil {
|
||||
return CardFactoryUtil.getWorstCreatureAI(CardListUtil.filter(list, CardPredicates.Presets.CREATURES));
|
||||
}
|
||||
|
||||
CardList lands = CardListUtil.filter(list, CardPredicates.Presets.LANDS);
|
||||
List<Card> lands = CardListUtil.filter(list, CardPredicates.Presets.LANDS);
|
||||
if (lands.size() > 6) {
|
||||
return CardFactoryUtil.getWorstLand(lands);
|
||||
}
|
||||
@@ -756,7 +756,7 @@ public class CardFactoryUtil {
|
||||
* a {@link java.lang.String} object.
|
||||
* @return a {@link forge.control.input.Input} object.
|
||||
*/
|
||||
public static Input inputDestroyNoRegeneration(final CardList choices, final String message) {
|
||||
public static Input inputDestroyNoRegeneration(final List<Card> choices, final String message) {
|
||||
final Input target = new Input() {
|
||||
private static final long serialVersionUID = -6637588517573573232L;
|
||||
|
||||
@@ -1046,8 +1046,8 @@ public class CardFactoryUtil {
|
||||
|
||||
@Override
|
||||
public void resolve() {
|
||||
final CardList cards = sourceCard.getController().getCardsIn(ZoneType.Library);
|
||||
final CardList sameCost = new CardList();
|
||||
final List<Card> cards = sourceCard.getController().getCardsIn(ZoneType.Library);
|
||||
final List<Card> sameCost = new ArrayList<Card>();
|
||||
|
||||
for (int i = 0; i < cards.size(); i++) {
|
||||
if (cards.get(i).getManaCost().getCMC() == sourceCard.getManaCost().getCMC()) {
|
||||
@@ -1248,8 +1248,8 @@ public class CardFactoryUtil {
|
||||
final SpellAbility desc = new Ability(sourceCard, "0") {
|
||||
@Override
|
||||
public void resolve() {
|
||||
final CardList cards = sourceCard.getController().getCardsIn(ZoneType.Graveyard);
|
||||
final CardList sameCost = new CardList();
|
||||
final List<Card> cards = sourceCard.getController().getCardsIn(ZoneType.Graveyard);
|
||||
final List<Card> sameCost = new ArrayList<Card>();
|
||||
final int cost = CardUtil.getConvertedManaCost(manacost);
|
||||
for (int i = 0; i < cards.size(); i++) {
|
||||
if (cards.get(i).getManaCost().getCMC() <= cost && cards.get(i).isType("Spirit")) {
|
||||
@@ -1301,7 +1301,7 @@ public class CardFactoryUtil {
|
||||
return desc;
|
||||
} // soulshiftTrigger()
|
||||
|
||||
// CardList choices are the only cards the user can successful select
|
||||
// List<Card> choices are the only cards the user can successful select
|
||||
/**
|
||||
* <p>
|
||||
* inputTargetSpecific.
|
||||
@@ -1319,12 +1319,12 @@ public class CardFactoryUtil {
|
||||
* a boolean.
|
||||
* @return a {@link forge.control.input.Input} object.
|
||||
*/
|
||||
public static Input inputTargetSpecific(final SpellAbility spell, final CardList choices, final String message,
|
||||
public static Input inputTargetSpecific(final SpellAbility spell, final List<Card> choices, final String message,
|
||||
final boolean targeted, final boolean free) {
|
||||
return CardFactoryUtil.inputTargetSpecific(spell, choices, message, Command.BLANK, targeted, free);
|
||||
}
|
||||
|
||||
// CardList choices are the only cards the user can successful select
|
||||
// List<Card> choices are the only cards the user can successful select
|
||||
/**
|
||||
* <p>
|
||||
* inputTargetSpecific.
|
||||
@@ -1344,7 +1344,7 @@ public class CardFactoryUtil {
|
||||
* a boolean.
|
||||
* @return a {@link forge.control.input.Input} object.
|
||||
*/
|
||||
public static Input inputTargetSpecific(final SpellAbility spell, final CardList choices, final String message,
|
||||
public static Input inputTargetSpecific(final SpellAbility spell, final List<Card> choices, final String message,
|
||||
final Command paid, final boolean targeted, final boolean free) {
|
||||
final Input target = new Input() {
|
||||
private static final long serialVersionUID = -1779224307654698954L;
|
||||
@@ -1382,7 +1382,7 @@ public class CardFactoryUtil {
|
||||
return target;
|
||||
} // inputTargetSpecific()
|
||||
|
||||
// CardList choices are the only cards the user can successful select
|
||||
// List<Card> choices are the only cards the user can successful select
|
||||
/**
|
||||
* <p>
|
||||
* inputTargetChampionSac.
|
||||
@@ -1402,7 +1402,7 @@ public class CardFactoryUtil {
|
||||
* a boolean.
|
||||
* @return a {@link forge.control.input.Input} object.
|
||||
*/
|
||||
public static Input inputTargetChampionSac(final Card crd, final SpellAbility spell, final CardList choices,
|
||||
public static Input inputTargetChampionSac(final Card crd, final SpellAbility spell, final List<Card> choices,
|
||||
final String message, final boolean targeted, final boolean free) {
|
||||
final Input target = new Input() {
|
||||
private static final long serialVersionUID = -3320425330743678663L;
|
||||
@@ -1459,7 +1459,7 @@ public class CardFactoryUtil {
|
||||
@Override
|
||||
public void showMessage() {
|
||||
// get all creatures you control
|
||||
final CardList list = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
final List<Card> list = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
|
||||
this.stopSetNext(CardFactoryUtil.inputTargetSpecific(equip, list, "Select target creature to equip",
|
||||
true, false));
|
||||
@@ -1481,7 +1481,7 @@ public class CardFactoryUtil {
|
||||
* a {@link forge.Command} object.
|
||||
* @return a {@link forge.control.input.Input} object.
|
||||
*/
|
||||
public static Input masterOfTheWildHuntInputTargetCreature(final SpellAbility spell, final CardList choices,
|
||||
public static Input masterOfTheWildHuntInputTargetCreature(final SpellAbility spell, final List<Card> choices,
|
||||
final Command paid) {
|
||||
final Input target = new Input() {
|
||||
private static final long serialVersionUID = -1779224307654698954L;
|
||||
@@ -1570,8 +1570,8 @@ public class CardFactoryUtil {
|
||||
* a boolean.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public static CardList getHumanCreatureAI(final SpellAbility spell, final boolean targeted) {
|
||||
CardList creature = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
public static List<Card> getHumanCreatureAI(final SpellAbility spell, final boolean targeted) {
|
||||
List<Card> creature = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
if (targeted) {
|
||||
creature = CardListUtil.getTargetableCards(creature, spell);
|
||||
}
|
||||
@@ -1607,9 +1607,9 @@ public class CardFactoryUtil {
|
||||
* @return a int.
|
||||
*/
|
||||
public static int getNumberOfPermanentsByColor(final String color) {
|
||||
final CardList cards = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> cards = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
|
||||
final CardList coloredPerms = new CardList();
|
||||
final List<Card> coloredPerms = new ArrayList<Card>();
|
||||
|
||||
for (int i = 0; i < cards.size(); i++) {
|
||||
if (CardUtil.getColors(cards.get(i)).contains(color)) {
|
||||
@@ -1631,7 +1631,7 @@ public class CardFactoryUtil {
|
||||
* @return a int.
|
||||
*/
|
||||
public static int getNumberOfManaSymbolsControlledByColor(final String colorAbb, final Player player) {
|
||||
final CardList cards = player.getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> cards = player.getCardsIn(ZoneType.Battlefield);
|
||||
return CardFactoryUtil.getNumberOfManaSymbolsByColor(colorAbb, cards);
|
||||
}
|
||||
|
||||
@@ -1646,7 +1646,7 @@ public class CardFactoryUtil {
|
||||
* a {@link forge.CardList} object.
|
||||
* @return a int.
|
||||
*/
|
||||
public static int getNumberOfManaSymbolsByColor(final String colorAbb, final CardList cards) {
|
||||
public static int getNumberOfManaSymbolsByColor(final String colorAbb, final List<Card> cards) {
|
||||
int count = 0;
|
||||
for (int i = 0; i < cards.size(); i++) {
|
||||
final Card c = cards.get(i);
|
||||
@@ -1850,8 +1850,8 @@ public class CardFactoryUtil {
|
||||
* a {@link forge.game.player.Player} object.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public static CardList getExternalZoneActivationCards(final Player activator) {
|
||||
final CardList cl = new CardList();
|
||||
public static List<Card> getExternalZoneActivationCards(final Player activator) {
|
||||
final List<Card> cl = new ArrayList<Card>();
|
||||
final Player opponent = activator.getOpponent();
|
||||
|
||||
cl.addAll(CardFactoryUtil.getActivateablesFromZone(activator.getZone(ZoneType.Graveyard), activator));
|
||||
@@ -1875,13 +1875,13 @@ public class CardFactoryUtil {
|
||||
* a {@link forge.game.player.Player} object.
|
||||
* @return a boolean.
|
||||
*/
|
||||
public static CardList getActivateablesFromZone(final PlayerZone zone, final Player activator) {
|
||||
public static List<Card> getActivateablesFromZone(final PlayerZone zone, final Player activator) {
|
||||
|
||||
CardList cl = new CardList(zone.getCards());
|
||||
List<Card> cl = new ArrayList<Card>(zone.getCards());
|
||||
|
||||
// Only check the top card of the library
|
||||
if (zone.is(ZoneType.Library) && !cl.isEmpty()) {
|
||||
cl = new CardList(cl.get(0));
|
||||
cl = CardListUtil.createCardList(cl.get(0));
|
||||
}
|
||||
|
||||
if (activator.isPlayer(zone.getPlayer())) {
|
||||
@@ -2002,7 +2002,7 @@ public class CardFactoryUtil {
|
||||
if (l[0].contains("Valid")) {
|
||||
final String restrictions = l[0].replace("Valid ", "");
|
||||
final String[] rest = restrictions.split(",");
|
||||
CardList cardsonbattlefield = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> cardsonbattlefield = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
cardsonbattlefield = CardListUtil.getValidCards(cardsonbattlefield, rest, players.get(0), source);
|
||||
|
||||
n = cardsonbattlefield.size();
|
||||
@@ -2020,7 +2020,7 @@ public class CardFactoryUtil {
|
||||
}
|
||||
|
||||
if (sq[0].contains("DomainPlayer")) {
|
||||
final CardList someCards = new CardList();
|
||||
final List<Card> someCards = new ArrayList<Card>();
|
||||
someCards.addAll(players.get(0).getCardsIn(ZoneType.Battlefield));
|
||||
final String[] basic = { "Forest", "Plains", "Mountain", "Island", "Swamp" };
|
||||
|
||||
@@ -2210,7 +2210,7 @@ public class CardFactoryUtil {
|
||||
String restrictions = l[0].replace("ValidGrave ", "");
|
||||
restrictions = restrictions.replace("Count$", "");
|
||||
final String[] rest = restrictions.split(",");
|
||||
CardList cards = AllZoneUtil.getCardsIn(ZoneType.Graveyard);
|
||||
List<Card> cards = AllZoneUtil.getCardsIn(ZoneType.Graveyard);
|
||||
cards = CardListUtil.getValidCards(cards, rest, cardController, c);
|
||||
|
||||
n = cards.size();
|
||||
@@ -2222,7 +2222,7 @@ public class CardFactoryUtil {
|
||||
String restrictions = l[0].replace("Valid ", "");
|
||||
restrictions = restrictions.replace("Count$", "");
|
||||
final String[] rest = restrictions.split(",");
|
||||
CardList cardsonbattlefield = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> cardsonbattlefield = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
cardsonbattlefield = CardListUtil.getValidCards(cardsonbattlefield, rest, cardController, c);
|
||||
|
||||
n = cardsonbattlefield.size();
|
||||
@@ -2249,7 +2249,7 @@ public class CardFactoryUtil {
|
||||
}
|
||||
|
||||
if (l[0].contains("GreatestPowerYouControl")) {
|
||||
final CardList list = AllZoneUtil.getCreaturesInPlay(c.getController());
|
||||
final List<Card> list = AllZoneUtil.getCreaturesInPlay(c.getController());
|
||||
int highest = 0;
|
||||
for (final Card crd : list) {
|
||||
if (crd.getNetAttack() > highest) {
|
||||
@@ -2260,7 +2260,7 @@ public class CardFactoryUtil {
|
||||
}
|
||||
|
||||
if (l[0].contains("GreatestPowerYouDontControl")) {
|
||||
final CardList list = AllZoneUtil.getCreaturesInPlay(c.getController().getOpponent());
|
||||
final List<Card> list = AllZoneUtil.getCreaturesInPlay(c.getController().getOpponent());
|
||||
int highest = 0;
|
||||
for (final Card crd : list) {
|
||||
if (crd.getNetAttack() > highest) {
|
||||
@@ -2271,7 +2271,7 @@ public class CardFactoryUtil {
|
||||
}
|
||||
|
||||
if (l[0].contains("HighestCMCRemembered")) {
|
||||
final CardList list = new CardList();
|
||||
final List<Card> list = new ArrayList<Card>();
|
||||
int highest = 0;
|
||||
for (final Object o : c.getRemembered()) {
|
||||
if (o instanceof Card) {
|
||||
@@ -2287,7 +2287,7 @@ public class CardFactoryUtil {
|
||||
}
|
||||
|
||||
if (l[0].contains("RememberedSumPower")) {
|
||||
final CardList list = new CardList();
|
||||
final List<Card> list = new ArrayList<Card>();
|
||||
for (final Object o : c.getRemembered()) {
|
||||
if (o instanceof Card) {
|
||||
list.add(AllZoneUtil.getCardState((Card) o));
|
||||
@@ -2340,7 +2340,7 @@ public class CardFactoryUtil {
|
||||
return CardFactoryUtil.doXMath(c.getRegeneratedThisTurn(), m, c);
|
||||
}
|
||||
|
||||
CardList someCards = new CardList();
|
||||
List<Card> someCards = new ArrayList<Card>();
|
||||
|
||||
// Complex counting methods
|
||||
|
||||
@@ -2484,13 +2484,13 @@ public class CardFactoryUtil {
|
||||
|
||||
// Count$TopOfLibraryCMC
|
||||
if (sq[0].contains("TopOfLibraryCMC")) {
|
||||
final CardList topcard = cardController.getCardsIn(ZoneType.Library, 1);
|
||||
final List<Card> topcard = cardController.getCardsIn(ZoneType.Library, 1);
|
||||
return CardFactoryUtil.doXMath(CardListUtil.sumCMC(topcard), m, c);
|
||||
}
|
||||
|
||||
// Count$EnchantedControllerCreatures
|
||||
if (sq[0].contains("EnchantedControllerCreatures")) {
|
||||
CardList enchantedControllerInPlay = new CardList();
|
||||
List<Card> enchantedControllerInPlay = new ArrayList<Card>();
|
||||
if (c.getEnchantingCard() != null) {
|
||||
enchantedControllerInPlay = c.getEnchantingCard().getController().getCardsIn(ZoneType.Battlefield);
|
||||
enchantedControllerInPlay = CardListUtil.getType(enchantedControllerInPlay, "Creature");
|
||||
@@ -2584,7 +2584,7 @@ public class CardFactoryUtil {
|
||||
if (sq[0].startsWith("Devoured")) {
|
||||
final String validDevoured = l[0].split(" ")[1];
|
||||
final Card csource = c;
|
||||
CardList cl = c.getDevoured();
|
||||
List<Card> cl = c.getDevoured();
|
||||
cl = CardListUtil.getValidCards(cl, validDevoured.split(","), csource.getController(), csource);
|
||||
return CardFactoryUtil.doXMath(cl.size(), m, c);
|
||||
}
|
||||
@@ -2605,8 +2605,8 @@ public class CardFactoryUtil {
|
||||
if (sq[0].contains("SumPower")) {
|
||||
final String[] restrictions = l[0].split("_");
|
||||
final String[] rest = restrictions[1].split(",");
|
||||
CardList cardsonbattlefield = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
CardList filteredCards = CardListUtil.getValidCards(cardsonbattlefield, rest, cardController, c);
|
||||
List<Card> cardsonbattlefield = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> filteredCards = CardListUtil.getValidCards(cardsonbattlefield, rest, cardController, c);
|
||||
int sumPower = 0;
|
||||
for (int i = 0; i < filteredCards.size(); i++) {
|
||||
sumPower += filteredCards.get(i).getManaCost().getCMC();
|
||||
@@ -2625,8 +2625,8 @@ public class CardFactoryUtil {
|
||||
if (sq[0].contains("SumCMC")) {
|
||||
final String[] restrictions = l[0].split("_");
|
||||
final String[] rest = restrictions[1].split(",");
|
||||
CardList cardsonbattlefield = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
CardList filteredCards = CardListUtil.getValidCards(cardsonbattlefield, rest, cardController, c);
|
||||
List<Card> cardsonbattlefield = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> filteredCards = CardListUtil.getValidCards(cardsonbattlefield, rest, cardController, c);
|
||||
return CardListUtil.sumCMC(filteredCards);
|
||||
}
|
||||
// Count$CardNumColors
|
||||
@@ -2646,7 +2646,7 @@ public class CardFactoryUtil {
|
||||
final String[] restrictions = l[0].split("_");
|
||||
final Counters cType = Counters.getType(restrictions[1]);
|
||||
final String[] validFilter = restrictions[2].split(",");
|
||||
CardList validCards = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> validCards = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
validCards = CardListUtil.getValidCards(validCards, validFilter, cardController, c);
|
||||
int cCount = 0;
|
||||
for (final Card card : validCards) {
|
||||
@@ -2702,7 +2702,7 @@ public class CardFactoryUtil {
|
||||
validFilter = workingCopy[2];
|
||||
}
|
||||
|
||||
final CardList res = CardUtil.getThisTurnEntered(destination, origin, validFilter, c);
|
||||
final List<Card> res = CardUtil.getThisTurnEntered(destination, origin, validFilter, c);
|
||||
|
||||
return CardFactoryUtil.doXMath(res.size(), m, c);
|
||||
}
|
||||
@@ -2719,7 +2719,7 @@ public class CardFactoryUtil {
|
||||
final String[] workingCopy = l[0].split("_");
|
||||
final String validFilter = workingCopy[1];
|
||||
|
||||
CardList res;
|
||||
List<Card> res;
|
||||
|
||||
if (workingCopy[0].contains("This")) {
|
||||
res = CardUtil.getThisTurnCast(validFilter, c);
|
||||
@@ -2733,7 +2733,7 @@ public class CardFactoryUtil {
|
||||
|
||||
// Count$Morbid.<True>.<False>
|
||||
if (sq[0].startsWith("Morbid")) {
|
||||
final CardList res = CardUtil.getThisTurnEntered(ZoneType.Graveyard, ZoneType.Battlefield, "Creature", c);
|
||||
final List<Card> res = CardUtil.getThisTurnEntered(ZoneType.Graveyard, ZoneType.Battlefield, "Creature", c);
|
||||
if (res.size() > 0) {
|
||||
return CardFactoryUtil.doXMath(Integer.parseInt(sq[1]), m, c);
|
||||
} else {
|
||||
@@ -3053,7 +3053,7 @@ public class CardFactoryUtil {
|
||||
* a {@link forge.Card} object.
|
||||
* @return a int.
|
||||
*/
|
||||
public static int handlePaid(final CardList paidList, final String string, final Card source) {
|
||||
public static int handlePaid(final List<Card> paidList, final String string, final Card source) {
|
||||
if (paidList == null) {
|
||||
if (string.contains(".")) {
|
||||
final String[] splitString = string.split("\\.", 2);
|
||||
@@ -3081,7 +3081,7 @@ public class CardFactoryUtil {
|
||||
if (l.length > 1) {
|
||||
m[0] = l[1];
|
||||
}
|
||||
final CardList list = CardListUtil.getValidCards(paidList, valid, source.getController(), source);
|
||||
final List<Card> list = CardListUtil.getValidCards(paidList, valid, source.getController(), source);
|
||||
return CardFactoryUtil.doXMath(list.size(), m, source);
|
||||
}
|
||||
|
||||
@@ -3148,7 +3148,7 @@ public class CardFactoryUtil {
|
||||
* a {@link forge.CardList} object.
|
||||
* @return a {@link java.lang.String} object.
|
||||
*/
|
||||
public static String getMostProminentCardName(final CardList list) {
|
||||
public static String getMostProminentCardName(final List<Card> list) {
|
||||
|
||||
if (list.size() == 0) {
|
||||
return "";
|
||||
@@ -3186,7 +3186,7 @@ public class CardFactoryUtil {
|
||||
* a {@link forge.CardList} object.
|
||||
* @return a {@link java.lang.String} object.
|
||||
*/
|
||||
public static String getMostProminentCreatureType(final CardList list) {
|
||||
public static String getMostProminentCreatureType(final List<Card> list) {
|
||||
|
||||
if (list.size() == 0) {
|
||||
return "";
|
||||
@@ -3233,7 +3233,7 @@ public class CardFactoryUtil {
|
||||
* a {@link forge.CardList} object.
|
||||
* @return a {@link java.lang.String} object.
|
||||
*/
|
||||
public static String getMostProminentColor(final CardList list) {
|
||||
public static String getMostProminentColor(final List<Card> list) {
|
||||
|
||||
final Map<String, Integer> map = new HashMap<String, Integer>();
|
||||
|
||||
@@ -3275,7 +3275,7 @@ public class CardFactoryUtil {
|
||||
* @return a int.
|
||||
*/
|
||||
public static int getUsableManaSources(final Player player) {
|
||||
CardList list = player.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = player.getCardsIn(ZoneType.Battlefield);
|
||||
list = CardListUtil.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
@@ -3300,7 +3300,7 @@ public class CardFactoryUtil {
|
||||
* a {@link forge.game.player.Player} object.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public static CardList makeTokenSaproling(final Player controller) {
|
||||
public static List<Card> makeTokenSaproling(final Player controller) {
|
||||
return CardFactoryUtil.makeToken("Saproling", "G 1 1 Saproling", controller, "G", new String[] { "Creature",
|
||||
"Saproling" }, 1, 1, new String[] { "" });
|
||||
}
|
||||
@@ -3328,10 +3328,10 @@ public class CardFactoryUtil {
|
||||
* an array of {@link java.lang.String} objects.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public static CardList makeToken(final String name, final String imageName, final Player controller,
|
||||
public static List<Card> makeToken(final String name, final String imageName, final Player controller,
|
||||
final String manaCost, final String[] types, final int baseAttack, final int baseDefense,
|
||||
final String[] intrinsicKeywords) {
|
||||
final CardList list = new CardList();
|
||||
final List<Card> list = new ArrayList<Card>();
|
||||
final Card c = new Card();
|
||||
c.setName(name);
|
||||
c.setImageName(imageName);
|
||||
@@ -3382,8 +3382,8 @@ public class CardFactoryUtil {
|
||||
* a {@link forge.CardList} object.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public static CardList copyTokens(final CardList tokenList) {
|
||||
final CardList list = new CardList();
|
||||
public static List<Card> copyTokens(final List<Card> tokenList) {
|
||||
final List<Card> list = new ArrayList<Card>();
|
||||
|
||||
for (int tokenAdd = 0; tokenAdd < tokenList.size(); tokenAdd++) {
|
||||
final Card thisToken = tokenList.get(tokenAdd);
|
||||
@@ -3395,7 +3395,7 @@ public class CardFactoryUtil {
|
||||
final List<String> kal = thisToken.getIntrinsicKeyword();
|
||||
final String[] tokenKeywords = new String[kal.size()];
|
||||
kal.toArray(tokenKeywords);
|
||||
final CardList tokens = CardFactoryUtil.makeToken(thisToken.getName(), thisToken.getImageName(),
|
||||
final List<Card> tokens = CardFactoryUtil.makeToken(thisToken.getName(), thisToken.getImageName(),
|
||||
thisToken.getController(), thisToken.getManaCost().toString(), tokenTypes, thisToken.getBaseAttack(),
|
||||
thisToken.getBaseDefense(), tokenKeywords);
|
||||
|
||||
@@ -3503,7 +3503,7 @@ public class CardFactoryUtil {
|
||||
* @return the worst land found based on the description above
|
||||
*/
|
||||
public static Card getWorstLand(final Player player) {
|
||||
final CardList lands = AllZoneUtil.getPlayerLandsInPlay(player);
|
||||
final List<Card> lands = AllZoneUtil.getPlayerLandsInPlay(player);
|
||||
return CardFactoryUtil.getWorstLand(lands);
|
||||
} // end getWorstLand
|
||||
|
||||
@@ -3516,7 +3516,7 @@ public class CardFactoryUtil {
|
||||
* a {@link forge.CardList} object.
|
||||
* @return a {@link forge.Card} object.
|
||||
*/
|
||||
public static Card getWorstLand(final CardList lands) {
|
||||
public static Card getWorstLand(final List<Card> lands) {
|
||||
Card worstLand = null;
|
||||
int maxScore = 0;
|
||||
// first, check for tapped, basic lands
|
||||
@@ -3541,7 +3541,7 @@ public class CardFactoryUtil {
|
||||
* a {@link forge.CardList} object.
|
||||
* @return a {@link forge.Card} object.
|
||||
*/
|
||||
public static Card getRandomCard(final CardList list) {
|
||||
public static Card getRandomCard(final List<Card> list) {
|
||||
if (list.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
@@ -3565,7 +3565,7 @@ public class CardFactoryUtil {
|
||||
final boolean extraLand = player.getNumLandsPlayed() > 0;
|
||||
|
||||
if (extraLand) {
|
||||
final CardList fastbonds = player.getCardsIn(ZoneType.Battlefield, "Fastbond");
|
||||
final List<Card> fastbonds = player.getCardsIn(ZoneType.Battlefield, "Fastbond");
|
||||
for (final Card f : fastbonds) {
|
||||
final SpellAbility ability = new Ability(f, "0") {
|
||||
@Override
|
||||
@@ -4134,7 +4134,7 @@ public class CardFactoryUtil {
|
||||
final Ability haunterDiesSetup = new Ability(card, "0") {
|
||||
@Override
|
||||
public void resolve() {
|
||||
final CardList creats = AllZoneUtil.getCreaturesInPlay();
|
||||
final List<Card> creats = AllZoneUtil.getCreaturesInPlay();
|
||||
for (int i = 0; i < creats.size(); i++) {
|
||||
if (!creats.get(i).canBeTargetedBy(this)) {
|
||||
creats.remove(i);
|
||||
@@ -4151,7 +4151,7 @@ public class CardFactoryUtil {
|
||||
AllZone.getInputControl().setInput(target);
|
||||
} else {
|
||||
// AI choosing what to haunt
|
||||
final CardList oppCreats = CardListUtil.filterControlledBy(creats, AllZone.getHumanPlayer());
|
||||
final List<Card> oppCreats = CardListUtil.filterControlledBy(creats, AllZone.getHumanPlayer());
|
||||
if (oppCreats.size() != 0) {
|
||||
haunterDiesWork.setTargetCard(CardFactoryUtil.getWorstCreatureAI(oppCreats));
|
||||
} else {
|
||||
@@ -4610,7 +4610,7 @@ public class CardFactoryUtil {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
final CardList lands = AllZoneUtil.getPlayerLandsInPlay(card.getController());
|
||||
final List<Card> lands = AllZoneUtil.getPlayerLandsInPlay(card.getController());
|
||||
lands.remove(card);
|
||||
if (!(lands.size() <= 2)) {
|
||||
// it enters the battlefield this way, and should not
|
||||
@@ -4639,7 +4639,7 @@ public class CardFactoryUtil {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
final CardList clICtrl = card.getOwner().getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> clICtrl = card.getOwner().getCardsIn(ZoneType.Battlefield);
|
||||
|
||||
boolean fnd = false;
|
||||
|
||||
@@ -4695,7 +4695,7 @@ public class CardFactoryUtil {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
final CardList cardsInPlay = CardListUtil.getType(AllZoneUtil.getCardsIn(ZoneType.Battlefield), "World");
|
||||
final List<Card> cardsInPlay = CardListUtil.getType(AllZoneUtil.getCardsIn(ZoneType.Battlefield), "World");
|
||||
cardsInPlay.remove(card);
|
||||
for (int i = 0; i < cardsInPlay.size(); i++) {
|
||||
Singletons.getModel().getGameAction().sacrificeDestroy(cardsInPlay.get(i));
|
||||
@@ -4782,7 +4782,7 @@ public class CardFactoryUtil {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
final CardList creats = AllZoneUtil.getCreaturesInPlay(card.getController());
|
||||
final List<Card> creats = AllZoneUtil.getCreaturesInPlay(card.getController());
|
||||
creats.remove(card);
|
||||
// System.out.println("Creats size: " + creats.size());
|
||||
|
||||
@@ -4851,7 +4851,7 @@ public class CardFactoryUtil {
|
||||
public void execute() {
|
||||
// Target as Modular is Destroyed
|
||||
if (card.getController().isComputer()) {
|
||||
CardList choices = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> choices = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
choices = CardListUtil.filter(choices, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
|
||||
@@ -17,9 +17,11 @@
|
||||
*/
|
||||
package forge.card.cost;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.card.abilityfactory.AbilityFactory;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
@@ -109,7 +111,7 @@ public class CostDiscard extends CostPartWithList {
|
||||
*/
|
||||
@Override
|
||||
public final boolean canPay(final SpellAbility ability, final Card source, final Player activator, final Cost cost) {
|
||||
CardList handList = activator.getCardsIn(ZoneType.Hand);
|
||||
List<Card> handList = activator.getCardsIn(ZoneType.Hand);
|
||||
final String type = this.getType();
|
||||
final Integer amount = this.convertAmount();
|
||||
|
||||
@@ -162,7 +164,7 @@ public class CostDiscard extends CostPartWithList {
|
||||
@Override
|
||||
public final boolean payHuman(final SpellAbility ability, final Card source, final CostPayment payment) {
|
||||
final Player activator = ability.getActivatingPlayer();
|
||||
CardList handList = activator.getCardsIn(ZoneType.Hand);
|
||||
List<Card> handList = activator.getCardsIn(ZoneType.Hand);
|
||||
final String discType = this.getType();
|
||||
final String amount = this.getAmount();
|
||||
this.resetList();
|
||||
@@ -235,7 +237,7 @@ public class CostDiscard extends CostPartWithList {
|
||||
public final boolean decideAIPayment(final SpellAbility ability, final Card source, final CostPayment payment) {
|
||||
final String type = this.getType();
|
||||
final Player activator = ability.getActivatingPlayer();
|
||||
final CardList hand = activator.getCardsIn(ZoneType.Hand);
|
||||
final List<Card> hand = activator.getCardsIn(ZoneType.Hand);
|
||||
this.resetList();
|
||||
if (type.equals("LastDrawn")) {
|
||||
if (!hand.contains(activator.getLastDrawnCard())) {
|
||||
@@ -297,7 +299,7 @@ public class CostDiscard extends CostPartWithList {
|
||||
*
|
||||
* @return a {@link forge.control.input.Input} object.
|
||||
*/
|
||||
public static Input inputDiscardCost(final String discType, final CardList handList, final SpellAbility sa,
|
||||
public static Input inputDiscardCost(final String discType, final List<Card> handList, final SpellAbility sa,
|
||||
final CostPayment payment, final CostDiscard part, final int nNeeded) {
|
||||
final SpellAbility sp = sa;
|
||||
final Input target = new Input() {
|
||||
@@ -341,7 +343,7 @@ public class CostDiscard extends CostPartWithList {
|
||||
@Override
|
||||
public void selectCard(final Card card, final PlayerZone zone) {
|
||||
if (zone.is(ZoneType.Hand) && handList.contains(card)) {
|
||||
// send in CardList for Typing
|
||||
// send in List<Card> for Typing
|
||||
card.getController().discard(card, sp);
|
||||
part.addToList(card);
|
||||
handList.remove(card);
|
||||
|
||||
@@ -19,12 +19,13 @@ package forge.card.cost;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.GameActionUtil;
|
||||
import forge.Singletons;
|
||||
@@ -145,7 +146,7 @@ public class CostExile extends CostPartWithList {
|
||||
*/
|
||||
@Override
|
||||
public final boolean canPay(final SpellAbility ability, final Card source, final Player activator, final Cost cost) {
|
||||
CardList typeList = new CardList();
|
||||
List<Card> typeList = new ArrayList<Card>();
|
||||
if (this.getFrom().equals(ZoneType.Stack)) {
|
||||
for (int i = 0; i < AllZone.getStack().size(); i++) {
|
||||
typeList.add(AllZone.getStack().peekAbility(i).getSourceCard());
|
||||
@@ -201,7 +202,7 @@ public class CostExile extends CostPartWithList {
|
||||
final String amount = this.getAmount();
|
||||
Integer c = this.convertAmount();
|
||||
final Player activator = ability.getActivatingPlayer();
|
||||
CardList list = activator.getCardsIn(this.getFrom());
|
||||
List<Card> list = activator.getCardsIn(this.getFrom());
|
||||
list = CardListUtil.getValidCards(list, this.getType().split(";"), activator, source);
|
||||
if (c == null) {
|
||||
final String sVar = ability.getSVar(amount);
|
||||
@@ -287,7 +288,7 @@ public class CostExile extends CostPartWithList {
|
||||
final int nNeeded) {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append("Exile ").append(nNeeded).append(" cards from the top of your library?");
|
||||
final CardList list = sa.getActivatingPlayer().getCardsIn(ZoneType.Library, nNeeded);
|
||||
final List<Card> list = sa.getActivatingPlayer().getCardsIn(ZoneType.Library, nNeeded);
|
||||
|
||||
if (list.size() > nNeeded) {
|
||||
// I don't believe this is possible
|
||||
@@ -329,7 +330,7 @@ public class CostExile extends CostPartWithList {
|
||||
final CostPayment payment, final int nNeeded) {
|
||||
final Input target = new Input() {
|
||||
private static final long serialVersionUID = 734256837615635021L;
|
||||
private CardList typeList;
|
||||
private List<Card> typeList;
|
||||
|
||||
@Override
|
||||
public void showMessage() {
|
||||
@@ -495,7 +496,7 @@ public class CostExile extends CostPartWithList {
|
||||
final Input target = new Input() {
|
||||
private static final long serialVersionUID = 1403915758082824694L;
|
||||
|
||||
private CardList typeList;
|
||||
private List<Card> typeList;
|
||||
private int nExiles = 0;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,10 +18,11 @@
|
||||
package forge.card.cost;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.GameActionUtil;
|
||||
import forge.Singletons;
|
||||
import forge.card.abilityfactory.AbilityFactory;
|
||||
@@ -138,7 +139,7 @@ public class CostMill extends CostPartWithList {
|
||||
c = AbilityFactory.calculateAmount(source, amount, ability);
|
||||
}
|
||||
}
|
||||
final CardList list = activator.getCardsIn(ZoneType.Library, c);
|
||||
final List<Card> list = activator.getCardsIn(ZoneType.Library, c);
|
||||
|
||||
if ((list == null) || (list.size() > c)) {
|
||||
// I don't believe this is possible
|
||||
|
||||
@@ -17,8 +17,11 @@
|
||||
*/
|
||||
package forge.card.cost;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardUtil;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
|
||||
@@ -28,14 +31,14 @@ import forge.card.spellability.SpellAbility;
|
||||
public abstract class CostPartWithList extends CostPart {
|
||||
|
||||
/** The list. */
|
||||
private CardList list = null;
|
||||
private List<Card> list = null;
|
||||
|
||||
/**
|
||||
* Gets the list.
|
||||
*
|
||||
* @return the list
|
||||
*/
|
||||
public final CardList getList() {
|
||||
public final List<Card> getList() {
|
||||
return this.list;
|
||||
}
|
||||
|
||||
@@ -45,7 +48,7 @@ public abstract class CostPartWithList extends CostPart {
|
||||
* @param setList
|
||||
* the new list
|
||||
*/
|
||||
public final void setList(final CardList setList) {
|
||||
public final void setList(final List<Card> setList) {
|
||||
this.list = setList;
|
||||
}
|
||||
|
||||
@@ -53,7 +56,7 @@ public abstract class CostPartWithList extends CostPart {
|
||||
* Reset list.
|
||||
*/
|
||||
public final void resetList() {
|
||||
this.setList(new CardList());
|
||||
this.setList(new ArrayList<Card>());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,8 +17,10 @@
|
||||
*/
|
||||
package forge.card.cost;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.Counters;
|
||||
import forge.card.abilityfactory.AbilityFactory;
|
||||
@@ -136,7 +138,7 @@ public class CostPutCounter extends CostPartWithList {
|
||||
}
|
||||
} else {
|
||||
// 3 Cards have Put a -1/-1 Counter on a Creature you control.
|
||||
final CardList typeList = CardListUtil.getValidCards(activator.getCardsIn(ZoneType.Battlefield), this.getType().split(";"), activator, source);
|
||||
final List<Card> typeList = CardListUtil.getValidCards(activator.getCardsIn(ZoneType.Battlefield), this.getType().split(";"), activator, source);
|
||||
|
||||
if (typeList.size() == 0) {
|
||||
return false;
|
||||
@@ -214,7 +216,7 @@ public class CostPutCounter extends CostPartWithList {
|
||||
c = AbilityFactory.calculateAmount(source, this.getAmount(), ability);
|
||||
}
|
||||
|
||||
final CardList typeList = CardListUtil.getValidCards(activator.getCardsIn(ZoneType.Battlefield), this.getType().split(";"), activator, source);
|
||||
final List<Card> typeList = CardListUtil.getValidCards(activator.getCardsIn(ZoneType.Battlefield), this.getType().split(";"), activator, source);
|
||||
|
||||
Card card = null;
|
||||
if (this.getType().equals("Creature.YouCtrl")) {
|
||||
@@ -248,7 +250,7 @@ public class CostPutCounter extends CostPartWithList {
|
||||
final CostPutCounter costPutCounter, final int nNeeded) {
|
||||
final Input target = new Input() {
|
||||
private static final long serialVersionUID = 2685832214519141903L;
|
||||
private CardList typeList;
|
||||
private List<Card> typeList;
|
||||
private int nPut = 0;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,8 +17,10 @@
|
||||
*/
|
||||
package forge.card.cost;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.Counters;
|
||||
import forge.card.abilityfactory.AbilityFactory;
|
||||
@@ -163,7 +165,7 @@ public class CostRemoveCounter extends CostPartWithList {
|
||||
}
|
||||
}
|
||||
else {
|
||||
final CardList typeList = CardListUtil.getValidCards(activator.getCardsIn(this.getZone()), this.getType().split(";"), activator, source);
|
||||
final List<Card> typeList = CardListUtil.getValidCards(activator.getCardsIn(this.getZone()), this.getType().split(";"), activator, source);
|
||||
if (amount != null) {
|
||||
boolean payable = false;
|
||||
for (Card c : typeList) {
|
||||
@@ -316,7 +318,7 @@ public class CostRemoveCounter extends CostPartWithList {
|
||||
final CostRemoveCounter costRemoveCounter, final int nNeeded) {
|
||||
final Input target = new Input() {
|
||||
private static final long serialVersionUID = 2685832214519141903L;
|
||||
private CardList typeList;
|
||||
private List<Card> typeList;
|
||||
private int nRemove = 0;
|
||||
|
||||
@Override
|
||||
@@ -399,7 +401,7 @@ public class CostRemoveCounter extends CostPartWithList {
|
||||
final CostRemoveCounter costRemoveCounter, final int nNeeded) {
|
||||
final Input target = new Input() {
|
||||
private static final long serialVersionUID = 734256837615635021L;
|
||||
private CardList typeList;
|
||||
private List<Card> typeList;
|
||||
private int nRemove = 0;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,11 +17,13 @@
|
||||
*/
|
||||
package forge.card.cost;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.Singletons;
|
||||
import forge.card.abilityfactory.AbilityFactory;
|
||||
@@ -107,7 +109,7 @@ public class CostReturn extends CostPartWithList {
|
||||
@Override
|
||||
public final boolean canPay(final SpellAbility ability, final Card source, final Player activator, final Cost cost) {
|
||||
if (!this.getThis()) {
|
||||
CardList typeList = activator.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> typeList = activator.getCardsIn(ZoneType.Battlefield);
|
||||
typeList = CardListUtil.getValidCards(typeList, this.getType().split(";"), activator, source);
|
||||
|
||||
final Integer amount = this.convertAmount();
|
||||
@@ -146,7 +148,7 @@ public class CostReturn extends CostPartWithList {
|
||||
final String amount = this.getAmount();
|
||||
Integer c = this.convertAmount();
|
||||
final Player activator = ability.getActivatingPlayer();
|
||||
final CardList list = activator.getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> list = activator.getCardsIn(ZoneType.Battlefield);
|
||||
if (c == null) {
|
||||
final String sVar = ability.getSVar(amount);
|
||||
// Generalize this
|
||||
@@ -213,7 +215,7 @@ public class CostReturn extends CostPartWithList {
|
||||
final CostReturn part, final int nNeeded) {
|
||||
final Input target = new Input() {
|
||||
private static final long serialVersionUID = 2685832214519141903L;
|
||||
private CardList typeList;
|
||||
private List<Card> typeList;
|
||||
private int nReturns = 0;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,9 +17,11 @@
|
||||
*/
|
||||
package forge.card.cost;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.card.abilityfactory.AbilityFactory;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
@@ -61,7 +63,7 @@ public class CostReveal extends CostPartWithList {
|
||||
*/
|
||||
@Override
|
||||
public final boolean canPay(final SpellAbility ability, final Card source, final Player activator, final Cost cost) {
|
||||
CardList handList = activator.getCardsIn(ZoneType.Hand);
|
||||
List<Card> handList = activator.getCardsIn(ZoneType.Hand);
|
||||
final String type = this.getType();
|
||||
final Integer amount = this.convertAmount();
|
||||
|
||||
@@ -97,7 +99,7 @@ public class CostReveal extends CostPartWithList {
|
||||
public final boolean decideAIPayment(final SpellAbility ability, final Card source, final CostPayment payment) {
|
||||
final String type = this.getType();
|
||||
final Player activator = ability.getActivatingPlayer();
|
||||
CardList hand = activator.getCardsIn(ZoneType.Hand);
|
||||
List<Card> hand = activator.getCardsIn(ZoneType.Hand);
|
||||
this.resetList();
|
||||
|
||||
if (this.getThis()) {
|
||||
@@ -159,7 +161,7 @@ public class CostReveal extends CostPartWithList {
|
||||
} else {
|
||||
Integer num = this.convertAmount();
|
||||
|
||||
CardList handList = activator.getCardsIn(ZoneType.Hand);
|
||||
List<Card> handList = activator.getCardsIn(ZoneType.Hand);
|
||||
handList = CardListUtil.getValidCards(handList, this.getType().split(";"), activator, ability.getSourceCard());
|
||||
|
||||
if (num == null) {
|
||||
@@ -245,7 +247,7 @@ public class CostReveal extends CostPartWithList {
|
||||
* a int.
|
||||
* @return a {@link forge.control.input.Input} object.
|
||||
*/
|
||||
public static Input inputRevealCost(final String discType, final CardList handList, final CostPayment payment,
|
||||
public static Input inputRevealCost(final String discType, final List<Card> handList, final CostPayment payment,
|
||||
final CostReveal part, final SpellAbility sa, final int nNeeded) {
|
||||
final Input target = new Input() {
|
||||
private static final long serialVersionUID = -329993322080934435L;
|
||||
@@ -286,7 +288,7 @@ public class CostReveal extends CostPartWithList {
|
||||
@Override
|
||||
public void selectCard(final Card card, final PlayerZone zone) {
|
||||
if (zone.is(ZoneType.Hand) && handList.contains(card)) {
|
||||
// send in CardList for Typing
|
||||
// send in List<Card> for Typing
|
||||
handList.remove(card);
|
||||
part.addToList(card);
|
||||
this.nReveal++;
|
||||
|
||||
@@ -17,11 +17,13 @@
|
||||
*/
|
||||
package forge.card.cost;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.Singletons;
|
||||
import forge.card.abilityfactory.AbilityFactory;
|
||||
@@ -100,7 +102,7 @@ public class CostSacrifice extends CostPartWithList {
|
||||
public final boolean canPay(final SpellAbility ability, final Card source, final Player activator, final Cost cost) {
|
||||
// You can always sac all
|
||||
if (!this.getThis()) {
|
||||
CardList typeList = activator.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> typeList = activator.getCardsIn(ZoneType.Battlefield);
|
||||
typeList = CardListUtil.getValidCards(typeList, this.getType().split(";"), activator, source);
|
||||
|
||||
final Integer amount = this.convertAmount();
|
||||
@@ -155,7 +157,7 @@ public class CostSacrifice extends CostPartWithList {
|
||||
final String amount = this.getAmount();
|
||||
final String type = this.getType();
|
||||
final Player activator = ability.getActivatingPlayer();
|
||||
CardList list = activator.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = activator.getCardsIn(ZoneType.Battlefield);
|
||||
list = CardListUtil.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");
|
||||
@@ -203,7 +205,7 @@ public class CostSacrifice extends CostPartWithList {
|
||||
if (this.getThis()) {
|
||||
this.getList().add(source);
|
||||
} else if (this.getAmount().equals("All")) {
|
||||
CardList typeList = activator.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> typeList = activator.getCardsIn(ZoneType.Battlefield);
|
||||
typeList = CardListUtil.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");
|
||||
@@ -244,7 +246,7 @@ public class CostSacrifice extends CostPartWithList {
|
||||
* TODO
|
||||
*/
|
||||
public static void sacrificeAll(final SpellAbility sa, final CostPayment payment, final CostPart part,
|
||||
final CardList typeList) {
|
||||
final List<Card> typeList) {
|
||||
// TODO Ask First
|
||||
for (final Card card : typeList) {
|
||||
payment.getAbility().addCostToHashList(card, "Sacrificed");
|
||||
@@ -272,7 +274,7 @@ public class CostSacrifice extends CostPartWithList {
|
||||
* @return a {@link forge.control.input.Input} object.
|
||||
*/
|
||||
public static Input sacrificeFromList(final SpellAbility sa, final CostPayment payment, final CostSacrifice part,
|
||||
final CardList typeList, final int nNeeded) {
|
||||
final List<Card> typeList, final int nNeeded) {
|
||||
final Input target = new Input() {
|
||||
private static final long serialVersionUID = 2685832214519141903L;
|
||||
private int nSacrifices = 0;
|
||||
|
||||
@@ -17,8 +17,10 @@
|
||||
*/
|
||||
package forge.card.cost;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates.Presets;
|
||||
import forge.card.abilityfactory.AbilityFactory;
|
||||
@@ -113,7 +115,7 @@ public class CostTapType extends CostPartWithList {
|
||||
*/
|
||||
@Override
|
||||
public final boolean canPay(final SpellAbility ability, final Card source, final Player activator, final Cost cost) {
|
||||
CardList typeList = activator.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> typeList = activator.getCardsIn(ZoneType.Battlefield);
|
||||
|
||||
typeList = CardListUtil.getValidCards(typeList, this.getType().split(";"), activator, source);
|
||||
|
||||
@@ -152,7 +154,7 @@ public class CostTapType extends CostPartWithList {
|
||||
*/
|
||||
@Override
|
||||
public final boolean payHuman(final SpellAbility ability, final Card source, final CostPayment payment) {
|
||||
CardList typeList = ability.getActivatingPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> typeList = ability.getActivatingPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
typeList = CardListUtil.getValidCards(typeList, this.getType().split(";"), ability.getActivatingPlayer(), ability.getSourceCard());
|
||||
typeList = CardListUtil.filter(typeList, Presets.UNTAPPED);
|
||||
final String amount = this.getAmount();
|
||||
@@ -186,7 +188,7 @@ public class CostTapType extends CostPartWithList {
|
||||
if (c == null) {
|
||||
final String sVar = ability.getSVar(amount);
|
||||
if (sVar.equals("XChoice")) {
|
||||
CardList typeList = ability.getActivatingPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> typeList = ability.getActivatingPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
typeList = CardListUtil.getValidCards(typeList, this.getType().split(";"), ability.getActivatingPlayer(), ability.getSourceCard());
|
||||
typeList = CardListUtil.filter(typeList, Presets.UNTAPPED);
|
||||
c = typeList.size();
|
||||
@@ -225,7 +227,7 @@ public class CostTapType extends CostPartWithList {
|
||||
* a int.
|
||||
* @return a {@link forge.control.input.Input} object.
|
||||
*/
|
||||
public static Input inputTapXCost(final CostTapType tapType, final CardList cardList, final SpellAbility sa,
|
||||
public static Input inputTapXCost(final CostTapType tapType, final List<Card> cardList, final SpellAbility sa,
|
||||
final CostPayment payment, final int nCards) {
|
||||
final Input target = new Input() {
|
||||
|
||||
@@ -256,7 +258,7 @@ public class CostTapType extends CostPartWithList {
|
||||
@Override
|
||||
public void selectCard(final Card card, final PlayerZone zone) {
|
||||
if (zone.is(ZoneType.Battlefield) && cardList.contains(card) && card.isUntapped()) {
|
||||
// send in CardList for Typing
|
||||
// send in List<Card> for Typing
|
||||
card.tap();
|
||||
tapType.addToList(card);
|
||||
cardList.remove(card);
|
||||
|
||||
@@ -17,9 +17,11 @@
|
||||
*/
|
||||
package forge.card.cost;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates.Presets;
|
||||
import forge.card.abilityfactory.AbilityFactory;
|
||||
@@ -118,7 +120,7 @@ public class CostUntapType extends CostPartWithList {
|
||||
*/
|
||||
@Override
|
||||
public final boolean canPay(final SpellAbility ability, final Card source, final Player activator, final Cost cost) {
|
||||
CardList typeList = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> typeList = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
|
||||
typeList = CardListUtil.getValidCards(typeList, this.getType().split(";"), activator, source);
|
||||
|
||||
@@ -158,7 +160,7 @@ public class CostUntapType extends CostPartWithList {
|
||||
@Override
|
||||
public final boolean payHuman(final SpellAbility ability, final Card source, final CostPayment payment) {
|
||||
final boolean untap = payment.getCost().getUntap();
|
||||
CardList typeList = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> typeList = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
typeList = CardListUtil.getValidCards(typeList, this.getType().split(";"), ability.getActivatingPlayer(), ability.getSourceCard());
|
||||
typeList = CardListUtil.filter(typeList, Presets.TAPPED);
|
||||
if (untap) {
|
||||
@@ -195,7 +197,7 @@ public class CostUntapType extends CostPartWithList {
|
||||
if (c == null) {
|
||||
final String sVar = ability.getSVar(amount);
|
||||
if (sVar.equals("XChoice")) {
|
||||
CardList typeList = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> typeList = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
typeList = CardListUtil.getValidCards(typeList, this.getType().split(";"), ability.getActivatingPlayer(), ability.getSourceCard());
|
||||
if (untap) {
|
||||
typeList.remove(source);
|
||||
@@ -237,7 +239,7 @@ public class CostUntapType extends CostPartWithList {
|
||||
* a int.
|
||||
* @return a {@link forge.control.input.Input} object.
|
||||
*/
|
||||
public static Input inputUntapYCost(final CostUntapType untapType, final CardList cardList, final SpellAbility sa,
|
||||
public static Input inputUntapYCost(final CostUntapType untapType, final List<Card> cardList, final SpellAbility sa,
|
||||
final CostPayment payment, final int nCards) {
|
||||
final Input target = new Input() {
|
||||
|
||||
@@ -268,7 +270,7 @@ public class CostUntapType extends CostPartWithList {
|
||||
@Override
|
||||
public void selectCard(final Card card, final PlayerZone zone) {
|
||||
if (zone.is(ZoneType.Battlefield) && cardList.contains(card) && card.isTapped()) {
|
||||
// send in CardList for Typing
|
||||
// send in List<Card> for Typing
|
||||
card.untap();
|
||||
untapType.addToList(card);
|
||||
cardList.remove(card);
|
||||
|
||||
@@ -17,11 +17,13 @@
|
||||
*/
|
||||
package forge.card.cost;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.Counters;
|
||||
import forge.card.abilityfactory.AbilityFactory;
|
||||
@@ -77,14 +79,14 @@ public class CostUtil {
|
||||
if (!important) {
|
||||
return false;
|
||||
}
|
||||
CardList auras = new CardList(source.getEnchantedBy());
|
||||
List<Card> auras = new ArrayList<Card>(source.getEnchantedBy());
|
||||
if (!CardListUtil.filterControlledBy(auras, source.getController()).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
CardList typeList = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> typeList = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
typeList = CardListUtil.getValidCards(typeList, type.split(","), source.getController(), source);
|
||||
if (ComputerUtil.getCardPreference(source, "SacCost", typeList) == null) {
|
||||
return false;
|
||||
@@ -119,7 +121,7 @@ public class CostUtil {
|
||||
continue;
|
||||
}
|
||||
|
||||
CardList typeList = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> typeList = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
typeList = CardListUtil.getValidCards(typeList, type.split(","), source.getController(), source);
|
||||
if (ComputerUtil.getCardPreference(source, "SacCost", typeList) == null) {
|
||||
return false;
|
||||
@@ -214,7 +216,7 @@ public class CostUtil {
|
||||
final CostDiscard disc = (CostDiscard) part;
|
||||
|
||||
final String type = disc.getType();
|
||||
CardList typeList = AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand);
|
||||
List<Card> typeList = AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand);
|
||||
if (typeList.size() > AllZone.getComputerPlayer().getMaxHandSize()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -17,11 +17,13 @@
|
||||
*/
|
||||
package forge.card.replacement;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardUtil;
|
||||
import forge.card.TriggerReplacementBase;
|
||||
@@ -253,7 +255,7 @@ public abstract class ReplacementEffect extends TriggerReplacementBase {
|
||||
if (this.getMapParams().containsKey("PresentPlayer")) {
|
||||
presentPlayer = this.getMapParams().get("PresentPlayer");
|
||||
}
|
||||
CardList list = new CardList();
|
||||
List<Card> list = new ArrayList<Card>();
|
||||
if (presentPlayer.equals("You") || presentPlayer.equals("Any")) {
|
||||
list.addAll(this.getHostCard().getController().getCardsIn(presentZone));
|
||||
}
|
||||
@@ -292,7 +294,7 @@ public abstract class ReplacementEffect extends TriggerReplacementBase {
|
||||
if (this.getMapParams().containsKey("PresentPlayer2")) {
|
||||
presentPlayer = this.getMapParams().get("PresentPlayer2");
|
||||
}
|
||||
CardList list = new CardList();
|
||||
List<Card> list = new ArrayList<Card>();
|
||||
if (presentPlayer.equals("You") || presentPlayer.equals("Any")) {
|
||||
list.addAll(this.getHostCard().getController().getCardsIn(presentZone));
|
||||
}
|
||||
@@ -352,8 +354,8 @@ public abstract class ReplacementEffect extends TriggerReplacementBase {
|
||||
}
|
||||
|
||||
if (this.getMapParams().containsKey("WerewolfUntransformCondition")) {
|
||||
final CardList you = CardUtil.getLastTurnCast("Card.YouCtrl", this.getHostCard());
|
||||
final CardList opp = CardUtil.getLastTurnCast("Card.YouDontCtrl", this.getHostCard());
|
||||
final List<Card> you = CardUtil.getLastTurnCast("Card.YouCtrl", this.getHostCard());
|
||||
final List<Card> opp = CardUtil.getLastTurnCast("Card.YouDontCtrl", this.getHostCard());
|
||||
if (!((you.size() > 1) || (opp.size() > 1))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -18,11 +18,12 @@
|
||||
package forge.card.spellability;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.card.cost.Cost;
|
||||
import forge.card.cost.CostPayment;
|
||||
import forge.card.staticability.StaticAbility;
|
||||
@@ -93,7 +94,7 @@ public abstract class AbilityActivated extends SpellAbility implements java.io.S
|
||||
}
|
||||
|
||||
// CantBeActivated static abilities
|
||||
final CardList allp = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> allp = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
for (final Card ca : allp) {
|
||||
final ArrayList<StaticAbility> staticAbilities = ca.getStaticAbilities();
|
||||
for (final StaticAbility stAb : staticAbilities) {
|
||||
|
||||
@@ -18,11 +18,12 @@
|
||||
package forge.card.spellability;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.card.cardfactory.CardFactoryUtil;
|
||||
import forge.card.cost.Cost;
|
||||
@@ -121,7 +122,7 @@ public abstract class Spell extends SpellAbility implements java.io.Serializable
|
||||
}
|
||||
|
||||
// CantBeCast static abilities
|
||||
final CardList allp = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> allp = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
allp.add(card);
|
||||
for (final Card ca : allp) {
|
||||
final ArrayList<StaticAbility> staticAbilities = ca.getStaticAbilities();
|
||||
@@ -141,7 +142,7 @@ public abstract class Spell extends SpellAbility implements java.io.Serializable
|
||||
final Card card = this.getSourceCard();
|
||||
if (card.getSVar("NeedsToPlay").length() > 0) {
|
||||
final String needsToPlay = card.getSVar("NeedsToPlay");
|
||||
CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
|
||||
list = CardListUtil.getValidCards(list, needsToPlay.split(","), card.getController(), card);
|
||||
if (list.isEmpty()) {
|
||||
|
||||
@@ -19,10 +19,11 @@ package forge.card.spellability;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.Command;
|
||||
import forge.CommandArgs;
|
||||
import forge.GameEntity;
|
||||
@@ -67,8 +68,8 @@ public abstract class SpellAbility {
|
||||
private Card sourceCard;
|
||||
private Card originalHost = null;
|
||||
|
||||
private CardList splicedCards = null;
|
||||
private CardList targetList;
|
||||
private List<Card> splicedCards = null;
|
||||
private List<Card> targetList;
|
||||
// targetList doesn't appear to be used anymore
|
||||
|
||||
private boolean spell;
|
||||
@@ -108,7 +109,7 @@ public abstract class SpellAbility {
|
||||
private final ArrayList<AbilityMana> paidAbilities = new ArrayList<AbilityMana>();
|
||||
private ArrayList<String> optionalAdditionalCosts = new ArrayList<String>();
|
||||
|
||||
private HashMap<String, CardList> paidLists = new HashMap<String, CardList>();
|
||||
private HashMap<String, List<Card>> paidLists = new HashMap<String, List<Card>>();
|
||||
|
||||
private HashMap<String, Object> triggeringObjects = new HashMap<String, Object>();
|
||||
|
||||
@@ -125,7 +126,7 @@ public abstract class SpellAbility {
|
||||
}
|
||||
};
|
||||
|
||||
private CardList tappedForConvoke = new CardList();
|
||||
private List<Card> tappedForConvoke = new ArrayList<Card>();
|
||||
|
||||
private HashMap<String, String> sVars = new HashMap<String, String>();
|
||||
|
||||
@@ -823,7 +824,7 @@ public abstract class SpellAbility {
|
||||
* @param hash
|
||||
* a {@link java.util.HashMap} object.
|
||||
*/
|
||||
public void setPaidHash(final HashMap<String, CardList> hash) {
|
||||
public void setPaidHash(final HashMap<String, List<Card>> hash) {
|
||||
this.paidLists = hash;
|
||||
}
|
||||
|
||||
@@ -834,7 +835,7 @@ public abstract class SpellAbility {
|
||||
*
|
||||
* @return a {@link java.util.HashMap} object.
|
||||
*/
|
||||
public HashMap<String, CardList> getPaidHash() {
|
||||
public HashMap<String, List<Card>> getPaidHash() {
|
||||
return this.paidLists;
|
||||
}
|
||||
|
||||
@@ -849,7 +850,7 @@ public abstract class SpellAbility {
|
||||
* @param str
|
||||
* a {@link java.lang.String} object.
|
||||
*/
|
||||
public void setPaidList(final CardList list, final String str) {
|
||||
public void setPaidList(final List<Card> list, final String str) {
|
||||
this.paidLists.put(str, list);
|
||||
}
|
||||
|
||||
@@ -862,7 +863,7 @@ public abstract class SpellAbility {
|
||||
* a {@link java.lang.String} object.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public CardList getPaidList(final String str) {
|
||||
public List<Card> getPaidList(final String str) {
|
||||
return this.paidLists.get(str);
|
||||
}
|
||||
|
||||
@@ -878,7 +879,7 @@ public abstract class SpellAbility {
|
||||
*/
|
||||
public void addCostToHashList(final Card c, final String str) {
|
||||
if (!this.paidLists.containsKey(str)) {
|
||||
this.paidLists.put(str, new CardList());
|
||||
this.paidLists.put(str, new ArrayList<Card>());
|
||||
}
|
||||
|
||||
this.paidLists.get(str).add(c);
|
||||
@@ -890,7 +891,7 @@ public abstract class SpellAbility {
|
||||
* </p>
|
||||
*/
|
||||
public void resetPaidHash() {
|
||||
this.paidLists = new HashMap<String, CardList>();
|
||||
this.paidLists = new HashMap<String, List<Card>>();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1318,7 +1319,7 @@ public abstract class SpellAbility {
|
||||
*
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public CardList getTargetList() {
|
||||
public List<Card> getTargetList() {
|
||||
return this.targetList;
|
||||
}
|
||||
|
||||
@@ -1330,7 +1331,7 @@ public abstract class SpellAbility {
|
||||
* @param list
|
||||
* a {@link forge.CardList} object.
|
||||
*/
|
||||
public void setTargetList(final CardList list) {
|
||||
public void setTargetList(final List<Card> list) {
|
||||
// The line below started to create a null error at
|
||||
// forge.CardFactoryUtil.canBeTargetedBy(CardFactoryUtil.java:3329)
|
||||
// after ForgeSVN r2699. I hope that commenting out the line below will
|
||||
@@ -1736,7 +1737,7 @@ public abstract class SpellAbility {
|
||||
*/
|
||||
public void addTappedForConvoke(final Card c) {
|
||||
if (this.tappedForConvoke == null) {
|
||||
this.tappedForConvoke = new CardList();
|
||||
this.tappedForConvoke = new ArrayList<Card>();
|
||||
}
|
||||
|
||||
this.tappedForConvoke.add(c);
|
||||
@@ -1747,7 +1748,7 @@ public abstract class SpellAbility {
|
||||
*
|
||||
* @return the tapped for convoke
|
||||
*/
|
||||
public CardList getTappedForConvoke() {
|
||||
public List<Card> getTappedForConvoke() {
|
||||
return this.tappedForConvoke;
|
||||
}
|
||||
|
||||
@@ -1763,14 +1764,14 @@ public abstract class SpellAbility {
|
||||
/**
|
||||
* @return the splicedCards
|
||||
*/
|
||||
public CardList getSplicedCards() {
|
||||
public List<Card> getSplicedCards() {
|
||||
return splicedCards;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param splicedCard the splicedCards to set
|
||||
*/
|
||||
public void setSplicedCards(CardList splicedCards) {
|
||||
public void setSplicedCards(List<Card> splicedCards) {
|
||||
this.splicedCards = splicedCards;
|
||||
}
|
||||
|
||||
@@ -1779,7 +1780,7 @@ public abstract class SpellAbility {
|
||||
*/
|
||||
public void addSplicedCards(Card splicedCard) {
|
||||
if (this.splicedCards == null) {
|
||||
this.splicedCards = new CardList();
|
||||
this.splicedCards = new ArrayList<Card>();
|
||||
}
|
||||
this.splicedCards.add(splicedCard);
|
||||
}
|
||||
|
||||
@@ -17,10 +17,13 @@
|
||||
*/
|
||||
package forge.card.spellability;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import forge.AllZoneUtil;
|
||||
import forge.CardList;
|
||||
import forge.Card;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.Singletons;
|
||||
import forge.card.abilityfactory.AbilityFactory;
|
||||
@@ -249,7 +252,7 @@ public class SpellAbilityCondition extends SpellAbilityVariables {
|
||||
}
|
||||
|
||||
if (this.getIsPresent() != null) {
|
||||
CardList list = new CardList();
|
||||
List<Card> list = new ArrayList<Card>();
|
||||
if (this.getPresentDefined() != null) {
|
||||
list.addAll(AbilityFactory.getDefinedCards(sa.getSourceCard(), this.getPresentDefined(), sa));
|
||||
} else {
|
||||
|
||||
@@ -19,10 +19,12 @@ package forge.card.spellability;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.Singletons;
|
||||
import forge.card.abilityfactory.AbilityFactory;
|
||||
@@ -353,7 +355,7 @@ public class SpellAbilityRestriction extends SpellAbilityVariables {
|
||||
}
|
||||
}
|
||||
if (this.getIsPresent() != null) {
|
||||
CardList list = AllZoneUtil.getCardsIn(this.getPresentZone());
|
||||
List<Card> list = AllZoneUtil.getCardsIn(this.getPresentZone());
|
||||
|
||||
list = CardListUtil.getValidCards(list, this.getIsPresent().split(","), activator, c);
|
||||
|
||||
|
||||
@@ -18,9 +18,10 @@
|
||||
package forge.card.spellability;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.game.player.Player;
|
||||
|
||||
/**
|
||||
@@ -49,7 +50,7 @@ public class SpellAbilityStackInstance {
|
||||
// When going to a SubAbility that SA has a Instance Choice object
|
||||
/** The tc. */
|
||||
private TargetChoices tc = null;
|
||||
private CardList splicedCards = null;
|
||||
private List<Card> splicedCards = null;
|
||||
|
||||
/** The activating player. */
|
||||
private Player activatingPlayer = null;
|
||||
@@ -67,7 +68,7 @@ public class SpellAbilityStackInstance {
|
||||
private int xManaPaid = 0;
|
||||
|
||||
// Other Paid things
|
||||
private HashMap<String, CardList> paidHash = new HashMap<String, CardList>();
|
||||
private HashMap<String, List<Card>> paidHash = new HashMap<String, List<Card>>();
|
||||
|
||||
// Additional info
|
||||
// is Kicked, is Buyback
|
||||
|
||||
@@ -25,7 +25,7 @@ import com.google.common.collect.Iterables;
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates;
|
||||
import forge.Command;
|
||||
@@ -70,7 +70,8 @@ public class SpellPermanent extends Spell {
|
||||
|
||||
@Override
|
||||
public void showMessage() {
|
||||
final CardList choice = (CardList) SpellPermanent.this.championGetCreature.execute();
|
||||
@SuppressWarnings("unchecked")
|
||||
final List<Card> choice = (List<Card>) SpellPermanent.this.championGetCreature.execute();
|
||||
|
||||
this.stopSetNext(CardFactoryUtil.inputTargetChampionSac(SpellPermanent.this.getSourceCard(),
|
||||
SpellPermanent.this.championAbilityComes, choice, "Select another "
|
||||
@@ -83,7 +84,7 @@ public class SpellPermanent extends Spell {
|
||||
private final CommandReturn championGetCreature = new CommandReturn() {
|
||||
@Override
|
||||
public Object execute() {
|
||||
final CardList cards = SpellPermanent.this.getSourceCard().getController().getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> cards = SpellPermanent.this.getSourceCard().getController().getCardsIn(ZoneType.Battlefield);
|
||||
return CardListUtil.getValidCards(cards, SpellPermanent.this.championValid, SpellPermanent.this.getSourceCard()
|
||||
.getController(), SpellPermanent.this.getSourceCard());
|
||||
}
|
||||
@@ -97,14 +98,15 @@ public class SpellPermanent extends Spell {
|
||||
final Card source = this.getSourceCard();
|
||||
final Player controller = source.getController();
|
||||
|
||||
final CardList creature = (CardList) SpellPermanent.this.championGetCreature.execute();
|
||||
@SuppressWarnings("unchecked")
|
||||
final List<Card> creature = (List<Card>) SpellPermanent.this.championGetCreature.execute();
|
||||
if (creature.size() == 0) {
|
||||
Singletons.getModel().getGameAction().sacrifice(source, null);
|
||||
return;
|
||||
} else if (controller.isHuman()) {
|
||||
AllZone.getInputControl().setInput(SpellPermanent.this.championInputComes);
|
||||
} else { // Computer
|
||||
CardList computer = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> computer = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
computer = CardListUtil.getValidCards(computer, SpellPermanent.this.championValid, controller, source);
|
||||
computer.remove(source);
|
||||
|
||||
@@ -350,19 +352,19 @@ public class SpellPermanent extends Spell {
|
||||
|
||||
// check on legendary
|
||||
if (card.isType("Legendary") && !AllZoneUtil.isCardInPlay("Mirror Gallery")) {
|
||||
final CardList list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
if (Iterables.any(list, CardPredicates.nameEquals(card.getName()))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (card.isPlaneswalker()) {
|
||||
CardList list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
list = CardListUtil.filter(list, CardPredicates.Presets.PLANEWALKERS);
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
List<String> type = card.getType();
|
||||
final String subtype = type.get(type.size() - 1);
|
||||
final CardList cl = CardListUtil.getType(list, subtype);
|
||||
final List<Card> cl = CardListUtil.getType(list, subtype);
|
||||
|
||||
if (cl.size() > 0) {
|
||||
return false;
|
||||
@@ -370,7 +372,7 @@ public class SpellPermanent extends Spell {
|
||||
}
|
||||
}
|
||||
if (card.isType("World")) {
|
||||
CardList list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
list = CardListUtil.getType(list, "World");
|
||||
if (list.size() > 0) {
|
||||
return false;
|
||||
@@ -389,7 +391,8 @@ public class SpellPermanent extends Spell {
|
||||
return false;
|
||||
}
|
||||
|
||||
final CardList cl = (CardList) this.championGetCreature.execute();
|
||||
@SuppressWarnings("unchecked")
|
||||
final List<Card> cl = (List<Card>) this.championGetCreature.execute();
|
||||
if ((o == null) || !(cl.size() > 0) || !this.getSourceCard().isInZone(ZoneType.Hand)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import com.google.common.base.Predicate;
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.card.abilityfactory.AbilityFactory;
|
||||
import forge.control.input.Input;
|
||||
@@ -269,7 +269,7 @@ public class TargetSelection {
|
||||
return;
|
||||
}
|
||||
|
||||
CardList choices = CardListUtil.getTargetableCards(CardListUtil.getValidCards(AllZoneUtil
|
||||
List<Card> choices = CardListUtil.getTargetableCards(CardListUtil.getValidCards(AllZoneUtil
|
||||
.getCardsIn(zone), this.target.getValidTgts(), this.ability.getActivatingPlayer(), this.ability.getSourceCard()), this.ability);
|
||||
|
||||
ArrayList<Object> objects = new ArrayList<Object>();
|
||||
@@ -326,7 +326,7 @@ public class TargetSelection {
|
||||
}
|
||||
} // input_targetValid
|
||||
|
||||
// CardList choices are the only cards the user can successful select
|
||||
// List<Card> choices are the only cards the user can successful select
|
||||
/**
|
||||
* <p>
|
||||
* input_targetSpecific.
|
||||
@@ -342,7 +342,7 @@ public class TargetSelection {
|
||||
* the already targeted
|
||||
* @return a {@link forge.control.input.Input} object.
|
||||
*/
|
||||
public final Input inputTargetSpecific(final CardList choices, final boolean targeted, final boolean mandatory,
|
||||
public final Input inputTargetSpecific(final List<Card> choices, final boolean targeted, final boolean mandatory,
|
||||
final ArrayList<Object> alreadyTargeted) {
|
||||
final SpellAbility sa = this.ability;
|
||||
final TargetSelection select = this;
|
||||
@@ -436,7 +436,7 @@ public class TargetSelection {
|
||||
* @param mandatory
|
||||
* a boolean.
|
||||
*/
|
||||
public final void chooseCardFromList(final CardList choices, final boolean targeted, final boolean mandatory) {
|
||||
public final void chooseCardFromList(final List<Card> choices, final boolean targeted, final boolean mandatory) {
|
||||
// Send in a list of valid cards, and popup a choice box to target
|
||||
final Card dummy = new Card();
|
||||
dummy.setName("[FINISH TARGETING]");
|
||||
@@ -454,12 +454,12 @@ public class TargetSelection {
|
||||
final Card divStack = new Card();
|
||||
divStack.setName("--CARDS IN LIBRARY:--");
|
||||
|
||||
CardList choicesZoneUnfiltered = choices;
|
||||
final CardList crdsBattle = new CardList();
|
||||
final CardList crdsExile = new CardList();
|
||||
final CardList crdsGrave = new CardList();
|
||||
final CardList crdsLibrary = new CardList();
|
||||
final CardList crdsStack = new CardList();
|
||||
List<Card> choicesZoneUnfiltered = choices;
|
||||
final List<Card> crdsBattle = new ArrayList<Card>();
|
||||
final List<Card> crdsExile = new ArrayList<Card>();
|
||||
final List<Card> crdsGrave = new ArrayList<Card>();
|
||||
final List<Card> crdsLibrary = new ArrayList<Card>();
|
||||
final List<Card> crdsStack = new ArrayList<Card>();
|
||||
for (final Card inZone : choicesZoneUnfiltered) {
|
||||
if (AllZoneUtil.getCardsIn(ZoneType.Battlefield).contains(inZone)) {
|
||||
crdsBattle.add(inZone);
|
||||
@@ -473,7 +473,7 @@ public class TargetSelection {
|
||||
crdsStack.add(inZone);
|
||||
}
|
||||
}
|
||||
CardList choicesFiltered = new CardList();
|
||||
List<Card> choicesFiltered = new ArrayList<Card>();
|
||||
if (crdsBattle.size() >= 1) {
|
||||
choicesFiltered.add(divBattlefield);
|
||||
choicesFiltered.addAll(crdsBattle);
|
||||
@@ -502,7 +502,7 @@ public class TargetSelection {
|
||||
|
||||
final Target tgt = this.getTgt();
|
||||
|
||||
final CardList choicesWithDone = choicesFiltered;
|
||||
final List<Card> choicesWithDone = choicesFiltered;
|
||||
if (tgt.isMinTargetsChosen(sa.getSourceCard(), sa)) {
|
||||
// is there a more elegant way of doing this?
|
||||
choicesWithDone.add(dummy);
|
||||
|
||||
@@ -514,7 +514,7 @@ public class StaticAbility {
|
||||
|
||||
/*
|
||||
* if(mapParams.containsKey("isPresent")) { String isPresent =
|
||||
* mapParams.get("isPresent"); CardList list =
|
||||
* mapParams.get("isPresent"); List<Card> list =
|
||||
* AllZoneUtil.getCardsInPlay();
|
||||
*
|
||||
* list = list.getValidCards(isPresent.split(","), controller,
|
||||
|
||||
@@ -20,11 +20,12 @@ package forge.card.staticability;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardUtil;
|
||||
import forge.StaticEffect;
|
||||
@@ -56,7 +57,7 @@ public class StaticAbilityContinuous {
|
||||
final Card hostCard = stAb.getHostCard();
|
||||
|
||||
final StaticEffect se = new StaticEffect();
|
||||
final CardList affectedCards = StaticAbilityContinuous.getAffectedCards(stAb);
|
||||
final List<Card> affectedCards = StaticAbilityContinuous.getAffectedCards(stAb);
|
||||
final ArrayList<Player> affectedPlayers = StaticAbilityContinuous.getAffectedPlayers(stAb);
|
||||
|
||||
se.setAffectedCards(affectedCards);
|
||||
@@ -230,7 +231,7 @@ public class StaticAbilityContinuous {
|
||||
}
|
||||
}
|
||||
|
||||
CardList cardsIGainedAbilitiesFrom = AllZoneUtil.getCardsIn(validZones);
|
||||
List<Card> cardsIGainedAbilitiesFrom = AllZoneUtil.getCardsIn(validZones);
|
||||
cardsIGainedAbilitiesFrom = CardListUtil.getValidCards(cardsIGainedAbilitiesFrom, valids, hostCard.getController(), hostCard);
|
||||
|
||||
if (cardsIGainedAbilitiesFrom.size() > 0) {
|
||||
@@ -417,17 +418,17 @@ public class StaticAbilityContinuous {
|
||||
return players;
|
||||
}
|
||||
|
||||
private static CardList getAffectedCards(final StaticAbility stAb) {
|
||||
private static List<Card> getAffectedCards(final StaticAbility stAb) {
|
||||
final HashMap<String, String> params = stAb.getMapParams();
|
||||
final Card hostCard = stAb.getHostCard();
|
||||
final Player controller = hostCard.getController();
|
||||
|
||||
if (params.containsKey("CharacteristicDefining")) {
|
||||
return new CardList(hostCard); // will always be the card itself
|
||||
return CardListUtil.createCardList(hostCard); // will always be the card itself
|
||||
}
|
||||
|
||||
// non - CharacteristicDefining
|
||||
CardList affectedCards = new CardList();
|
||||
List<Card> affectedCards = new ArrayList<Card>();
|
||||
|
||||
if (params.containsKey("AffectedZone")) {
|
||||
affectedCards.addAll(AllZoneUtil.getCardsIn(ZoneType.listValueOf(params.get("AffectedZone"))));
|
||||
@@ -437,13 +438,13 @@ public class StaticAbilityContinuous {
|
||||
|
||||
if (params.containsKey("Affected") && !params.get("Affected").contains(",")) {
|
||||
if (params.get("Affected").contains("Self")) {
|
||||
affectedCards = new CardList(hostCard);
|
||||
affectedCards = CardListUtil.createCardList(hostCard);
|
||||
} else if (params.get("Affected").contains("EnchantedBy")) {
|
||||
affectedCards = new CardList(hostCard.getEnchantingCard());
|
||||
affectedCards = CardListUtil.createCardList(hostCard.getEnchantingCard());
|
||||
} else if (params.get("Affected").contains("EquippedBy")) {
|
||||
affectedCards = new CardList(hostCard.getEquippingCard());
|
||||
affectedCards = CardListUtil.createCardList(hostCard.getEquippingCard());
|
||||
} else if (params.get("Affected").equals("EffectSource")) {
|
||||
affectedCards = new CardList(AbilityFactory.getDefinedCards(hostCard, params.get("Affected"), null));
|
||||
affectedCards = new ArrayList<Card>(AbilityFactory.getDefinedCards(hostCard, params.get("Affected"), null));
|
||||
return affectedCards;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,13 +17,14 @@
|
||||
*/
|
||||
package forge.card.trigger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardUtil;
|
||||
import forge.Singletons;
|
||||
@@ -344,7 +345,7 @@ public abstract class Trigger extends TriggerReplacementBase {
|
||||
if (this.getMapParams().containsKey("PresentPlayer")) {
|
||||
presentPlayer = this.getMapParams().get("PresentPlayer");
|
||||
}
|
||||
CardList list = new CardList();
|
||||
List<Card> list = new ArrayList<Card>();
|
||||
if (presentPlayer.equals("You") || presentPlayer.equals("Any")) {
|
||||
list.addAll(this.getHostCard().getController().getCardsIn(presentZone));
|
||||
}
|
||||
@@ -383,7 +384,7 @@ public abstract class Trigger extends TriggerReplacementBase {
|
||||
if (this.getMapParams().containsKey("PresentPlayer2")) {
|
||||
presentPlayer = this.getMapParams().get("PresentPlayer2");
|
||||
}
|
||||
CardList list = new CardList();
|
||||
List<Card> list = new ArrayList<Card>();
|
||||
if (presentPlayer.equals("You") || presentPlayer.equals("Any")) {
|
||||
list.addAll(this.getHostCard().getController().getCardsIn(presentZone));
|
||||
}
|
||||
@@ -443,8 +444,8 @@ public abstract class Trigger extends TriggerReplacementBase {
|
||||
}
|
||||
|
||||
if (this.getMapParams().containsKey("WerewolfUntransformCondition")) {
|
||||
final CardList you = CardUtil.getLastTurnCast("Card.YouCtrl", this.getHostCard());
|
||||
final CardList opp = CardUtil.getLastTurnCast("Card.YouDontCtrl", this.getHostCard());
|
||||
final List<Card> you = CardUtil.getLastTurnCast("Card.YouCtrl", this.getHostCard());
|
||||
final List<Card> opp = CardUtil.getLastTurnCast("Card.YouDontCtrl", this.getHostCard());
|
||||
if (!((you.size() > 1) || (opp.size() > 1))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -18,11 +18,12 @@
|
||||
package forge.card.trigger;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.card.spellability.SpellAbility;
|
||||
|
||||
/**
|
||||
@@ -49,7 +50,8 @@ public class TriggerAttackersDeclared extends Trigger {
|
||||
@Override
|
||||
public final boolean performTest(final Map<String, Object> runParams2) {
|
||||
if (this.getMapParams().containsKey("SingleAttacker")) {
|
||||
final CardList attackers = (CardList) runParams2.get("Attackers");
|
||||
@SuppressWarnings("unchecked")
|
||||
final List<Card> attackers = (List<Card>) runParams2.get("Attackers");
|
||||
if (attackers.size() != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -18,10 +18,11 @@
|
||||
package forge.card.trigger;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.GameEntity;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
|
||||
@@ -69,7 +70,8 @@ public class TriggerAttacks extends Trigger {
|
||||
}
|
||||
|
||||
if (this.getMapParams().containsKey("Alone")) {
|
||||
final CardList otherAttackers = (CardList) runParams2.get("OtherAttackers");
|
||||
@SuppressWarnings("unchecked")
|
||||
final List<Card> otherAttackers = (List<Card>) runParams2.get("OtherAttackers");
|
||||
if (otherAttackers == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -20,11 +20,12 @@ package forge.card.trigger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.Command;
|
||||
import forge.CommandArgs;
|
||||
@@ -64,7 +65,7 @@ public class TriggerHandler {
|
||||
* Clean up temporary triggers.
|
||||
*/
|
||||
public final void cleanUpTemporaryTriggers() {
|
||||
final CardList absolutelyAllCards = new CardList();
|
||||
final List<Card> absolutelyAllCards = new ArrayList<Card>();
|
||||
absolutelyAllCards.addAll(AllZone.getHumanPlayer().getAllCards());
|
||||
absolutelyAllCards.addAll(AllZone.getComputerPlayer().getAllCards());
|
||||
|
||||
@@ -289,7 +290,7 @@ public class TriggerHandler {
|
||||
// This is done to allow the list of triggers to be modified while
|
||||
// triggers are running.
|
||||
final ArrayList<Trigger> delayedTriggersWorkingCopy = new ArrayList<Trigger>(this.delayedTriggers);
|
||||
CardList allCards = AllZoneUtil.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES);
|
||||
List<Card> allCards = AllZoneUtil.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES);
|
||||
allCards.addAll(AllZoneUtil.getCardsIn(ZoneType.Stack));
|
||||
boolean checkStatics = false;
|
||||
|
||||
@@ -521,22 +522,22 @@ public class TriggerHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPaidHash(final HashMap<String, CardList> hash) {
|
||||
public void setPaidHash(final HashMap<String, List<Card>> hash) {
|
||||
sa[0].setPaidHash(hash);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<String, CardList> getPaidHash() {
|
||||
public HashMap<String, List<Card>> getPaidHash() {
|
||||
return sa[0].getPaidHash();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPaidList(final CardList list, final String str) {
|
||||
public void setPaidList(final List<Card> list, final String str) {
|
||||
sa[0].setPaidList(list, str);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CardList getPaidList(final String str) {
|
||||
public List<Card> getPaidList(final String str) {
|
||||
return sa[0].getPaidList(str);
|
||||
}
|
||||
|
||||
@@ -701,7 +702,7 @@ public class TriggerHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CardList getTargetList() {
|
||||
public List<Card> getTargetList() {
|
||||
return sa[0].getTargetList();
|
||||
}
|
||||
|
||||
@@ -897,7 +898,7 @@ public class TriggerHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTargetList(final CardList list) {
|
||||
public void setTargetList(final List<Card> list) {
|
||||
sa[0].setTargetList(list);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,11 +17,13 @@
|
||||
*/
|
||||
package forge.control.input;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardPredicates;
|
||||
import forge.Singletons;
|
||||
import forge.game.phase.CombatUtil;
|
||||
@@ -64,7 +66,7 @@ public class InputAttack extends Input {
|
||||
|
||||
if (AllZone.getCombat().getRemainingDefenders() == 0) {
|
||||
// Nothing left to attack, has to attack this defender
|
||||
CardList possibleAttackers = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> possibleAttackers = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
for (Card c : Iterables.filter(possibleAttackers, CardPredicates.Presets.CREATURES)) {
|
||||
if (c.hasKeyword("CARDNAME attacks each turn if able.") && CombatUtil.canAttack(c, AllZone.getCombat())
|
||||
&& !c.isAttacking()) {
|
||||
|
||||
@@ -17,11 +17,13 @@
|
||||
*/
|
||||
package forge.control.input;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.game.phase.CombatUtil;
|
||||
import forge.game.zone.PlayerZone;
|
||||
@@ -44,7 +46,7 @@ public class InputBlock extends Input {
|
||||
private static final long serialVersionUID = 6120743598368928128L;
|
||||
|
||||
private Card currentAttacker = null;
|
||||
private final HashMap<Card,CardList> allBlocking = new HashMap<Card, CardList>();
|
||||
private final HashMap<Card,List<Card>> allBlocking = new HashMap<Card, List<Card>>();
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -110,10 +112,10 @@ public class InputBlock extends Input {
|
||||
&& zone.is(ZoneType.Battlefield, AllZone.getHumanPlayer())) {
|
||||
// Create a new blockedBy list if it doesn't exist
|
||||
if (!this.allBlocking.containsKey(card)) {
|
||||
this.allBlocking.put(card, new CardList());
|
||||
this.allBlocking.put(card, new ArrayList<Card>());
|
||||
}
|
||||
|
||||
CardList attackersBlocked = this.allBlocking.get(card);
|
||||
List<Card> attackersBlocked = this.allBlocking.get(card);
|
||||
if (!attackersBlocked.contains(this.currentAttacker) &&
|
||||
CombatUtil.canBlock(this.currentAttacker, card, AllZone.getCombat())) {
|
||||
attackersBlocked.add(this.currentAttacker);
|
||||
|
||||
@@ -18,11 +18,12 @@
|
||||
package forge.control.input;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.GameAction;
|
||||
import forge.GameActionUtil;
|
||||
@@ -88,7 +89,7 @@ public class InputMulligan extends Input {
|
||||
* @return an int
|
||||
*/
|
||||
public final int doMulligan(final Player player, final GamePlayerRating playerRating) {
|
||||
final CardList hand = player.getCardsIn(ZoneType.Hand);
|
||||
final List<Card> hand = player.getCardsIn(ZoneType.Hand);
|
||||
for (final Card c : hand) {
|
||||
Singletons.getModel().getGameAction().moveToLibrary(c);
|
||||
}
|
||||
@@ -140,7 +141,7 @@ public class InputMulligan extends Input {
|
||||
// 0 in its hand
|
||||
while (aiTakesMulligan) {
|
||||
|
||||
final CardList handList = aiPlayer.getCardsIn(ZoneType.Hand);
|
||||
final List<Card> handList = aiPlayer.getCardsIn(ZoneType.Hand);
|
||||
final boolean hasLittleCmc0Cards = CardListUtil.getValidCards(handList, "Card.cmcEQ0", aiPlayer, null).size() < 2;
|
||||
aiTakesMulligan = (handList.size() > InputMulligan.AI_MULLIGAN_THRESHOLD) && hasLittleCmc0Cards;
|
||||
|
||||
@@ -152,7 +153,7 @@ public class InputMulligan extends Input {
|
||||
// Human Leylines & Chancellors
|
||||
ButtonUtil.reset();
|
||||
final AbilityFactory af = new AbilityFactory();
|
||||
final CardList humanOpeningHand = AllZone.getHumanPlayer().getCardsIn(ZoneType.Hand);
|
||||
final List<Card> humanOpeningHand = AllZone.getHumanPlayer().getCardsIn(ZoneType.Hand);
|
||||
|
||||
for (final Card c : humanOpeningHand) {
|
||||
final ArrayList<String> kws = c.getKeyword();
|
||||
@@ -178,7 +179,7 @@ public class InputMulligan extends Input {
|
||||
}
|
||||
|
||||
// Computer Leylines & Chancellors
|
||||
final CardList aiOpeningHand = AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand);
|
||||
final List<Card> aiOpeningHand = AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand);
|
||||
for (final Card c : aiOpeningHand) {
|
||||
if (!c.getName().startsWith("Leyline")) {
|
||||
final ArrayList<String> kws = c.getKeyword();
|
||||
@@ -231,7 +232,7 @@ public class InputMulligan extends Input {
|
||||
|
||||
if (c0.getName().equals("Serum Powder") && z0.is(ZoneType.Hand)) {
|
||||
if (GameActionUtil.showYesNoDialog(c0, "Use " + c0.getName() + "'s ability?")) {
|
||||
CardList hand = c0.getController().getCardsIn(ZoneType.Hand);
|
||||
List<Card> hand = c0.getController().getCardsIn(ZoneType.Hand);
|
||||
for (Card c : hand) {
|
||||
Singletons.getModel().getGameAction().exile(c);
|
||||
}
|
||||
|
||||
@@ -17,9 +17,11 @@
|
||||
*/
|
||||
package forge.control.input;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.Command;
|
||||
import forge.card.cardfactory.CardFactoryUtil;
|
||||
@@ -48,7 +50,7 @@ public class InputPayDiscardCost extends Input {
|
||||
|
||||
private int numChosen = 0;
|
||||
private int numRequired = 0;
|
||||
private CardList choiceList;
|
||||
private List<Card> choiceList;
|
||||
private CostDiscard discardCost;
|
||||
private SpellAbility ability;
|
||||
private Command paid;
|
||||
|
||||
@@ -17,9 +17,11 @@
|
||||
*/
|
||||
package forge.control.input;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.Command;
|
||||
import forge.Singletons;
|
||||
@@ -49,7 +51,7 @@ public class InputPayReturnCost extends Input {
|
||||
|
||||
private int numChosen = 0;
|
||||
private int numRequired = 0;
|
||||
private CardList choiceList;
|
||||
private List<Card> choiceList;
|
||||
private CostReturn returnCost;
|
||||
private SpellAbility ability;
|
||||
private Command paid;
|
||||
|
||||
@@ -17,9 +17,11 @@
|
||||
*/
|
||||
package forge.control.input;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.Command;
|
||||
import forge.Singletons;
|
||||
@@ -49,7 +51,7 @@ public class InputPaySacCost extends Input {
|
||||
|
||||
private int numChosen = 0;
|
||||
private int numRequired = 0;
|
||||
private CardList choiceList;
|
||||
private List<Card> choiceList;
|
||||
private CostSacrifice sacCost;
|
||||
private SpellAbility ability;
|
||||
private Command paid;
|
||||
|
||||
@@ -17,10 +17,11 @@
|
||||
*/
|
||||
package forge.deck;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.item.CardDb;
|
||||
import forge.item.CardPrinted;
|
||||
import forge.item.ItemPool;
|
||||
@@ -98,7 +99,7 @@ public class DeckSection extends ItemPool<CardPrinted> {
|
||||
* @param cardList
|
||||
* the card list
|
||||
*/
|
||||
public void add(final CardList cardList) {
|
||||
public void add(final List<Card> cardList) {
|
||||
for (final Card c : cardList) {
|
||||
this.add(c);
|
||||
}
|
||||
|
||||
@@ -10,10 +10,11 @@ import javax.swing.JOptionPane;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates.Presets;
|
||||
import forge.CardPredicates;
|
||||
@@ -64,8 +65,8 @@ public class GameNew {
|
||||
* @param iconEnemy
|
||||
*   {@link java.lang.String}
|
||||
*/
|
||||
public static void newGame(final Deck humanDeck, final Deck computerDeck, final CardList humanStart,
|
||||
final CardList computerStart, final int humanLife, final int computerLife, String iconEnemy) {
|
||||
public static void newGame(final Deck humanDeck, final Deck computerDeck, final List<Card> humanStart,
|
||||
final List<Card> computerStart, final int humanLife, final int computerLife, String iconEnemy) {
|
||||
Singletons.getControl().changeState(FControl.MATCH_SCREEN);
|
||||
CMatchUI.SINGLETON_INSTANCE.initMatch(iconEnemy);
|
||||
|
||||
@@ -375,11 +376,11 @@ public class GameNew {
|
||||
* @return an array of {@link forge.Card} objects.
|
||||
*/
|
||||
private static Iterable<Card> smoothComputerManaCurve(final Iterable<Card> in) {
|
||||
final CardList library = new CardList(in);
|
||||
final List<Card> library = Lists.newArrayList(in);
|
||||
CardListUtil.shuffle(library);
|
||||
|
||||
// remove all land, keep non-basicland in there, shuffled
|
||||
CardList land = CardListUtil.filter(library, CardPredicates.Presets.LANDS);
|
||||
List<Card> land = CardListUtil.filter(library, CardPredicates.Presets.LANDS);
|
||||
for (Card c : land) {
|
||||
if (c.isLand()) {
|
||||
library.remove(c);
|
||||
|
||||
@@ -30,7 +30,8 @@ import javax.swing.JOptionPane;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
|
||||
import forge.CardList;
|
||||
|
||||
import forge.Card;
|
||||
import forge.Constant;
|
||||
import forge.Singletons;
|
||||
import forge.card.BoosterGenerator;
|
||||
@@ -294,7 +295,7 @@ public final class BoosterDraft implements IBoosterDraft {
|
||||
int iPlayer = 0;
|
||||
for (int i = 1; i < this.pack.size(); i++) {
|
||||
|
||||
final CardList forAi = new CardList();
|
||||
final List<Card> forAi = new ArrayList<Card>();
|
||||
final List<CardPrinted> booster = this.pack.get((iHumansBooster + i) % this.pack.size());
|
||||
for (final CardPrinted cr : booster) {
|
||||
forAi.add(cr.toForgeCard());
|
||||
|
||||
@@ -380,7 +380,7 @@ public class LimitedDeck {
|
||||
* Add non-basic lands to the deck.
|
||||
*/
|
||||
// private void addNonBasicLands() {
|
||||
// CardList lands = getAiPlayables().getType("Land");
|
||||
// List<Card> lands = getAiPlayables().getType("Land");
|
||||
// while (!getColors().getColor1().equals(getColors().getColor2()) &&
|
||||
// landsNeeded > 0 && lands.size() > 0) {
|
||||
// final Card c = lands.get(0);
|
||||
|
||||
@@ -29,7 +29,7 @@ import java.util.TreeMap;
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates;
|
||||
import forge.GameActionUtil;
|
||||
@@ -50,17 +50,17 @@ import forge.gui.match.CMatchUI;
|
||||
*/
|
||||
public class Combat {
|
||||
// key is attacker Card
|
||||
// value is CardList of blockers
|
||||
private final Map<Card, CardList> attackerMap = new TreeMap<Card, CardList>();
|
||||
private final Map<Card, CardList> blockerMap = new TreeMap<Card, CardList>();
|
||||
// value is List<Card> of blockers
|
||||
private final Map<Card, List<Card>> attackerMap = new TreeMap<Card, List<Card>>();
|
||||
private final Map<Card, List<Card>> blockerMap = new TreeMap<Card, List<Card>>();
|
||||
|
||||
private final Set<Card> blocked = new HashSet<Card>();
|
||||
private final HashMap<Card, CardList> unblockedMap = new HashMap<Card, CardList>();
|
||||
private final HashMap<Card, List<Card>> unblockedMap = new HashMap<Card, List<Card>>();
|
||||
private final HashMap<Card, Integer> defendingDamageMap = new HashMap<Card, Integer>();
|
||||
|
||||
// Defenders are the Defending Player + Each controlled Planeswalker
|
||||
private List<GameEntity> defenders = new ArrayList<GameEntity>();
|
||||
private Map<GameEntity, CardList> defenderMap = new HashMap<GameEntity, CardList>();
|
||||
private Map<GameEntity, List<Card>> defenderMap = new HashMap<GameEntity, List<Card>>();
|
||||
private int currentDefender = 0;
|
||||
private int nextDefender = 0;
|
||||
|
||||
@@ -111,12 +111,12 @@ public class Combat {
|
||||
this.defenders.clear();
|
||||
this.defenderMap.clear();
|
||||
this.defenders.add((GameEntity) defender);
|
||||
this.defenderMap.put((GameEntity) defender, new CardList());
|
||||
CardList planeswalkers = defender.getCardsIn(ZoneType.Battlefield);
|
||||
this.defenderMap.put((GameEntity) defender, new ArrayList<Card>());
|
||||
List<Card> planeswalkers = defender.getCardsIn(ZoneType.Battlefield);
|
||||
planeswalkers = CardListUtil.filter(planeswalkers, CardPredicates.Presets.PLANEWALKERS);
|
||||
for (final Card pw : planeswalkers) {
|
||||
this.defenders.add((GameEntity) pw);
|
||||
this.defenderMap.put((GameEntity) pw, new CardList());
|
||||
this.defenderMap.put((GameEntity) pw, new ArrayList<Card>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ public class Combat {
|
||||
public final void setDefenders(final List<GameEntity> newDef) {
|
||||
this.defenders = newDef;
|
||||
for (GameEntity entity : this.defenders) {
|
||||
this.defenderMap.put(entity, new CardList());
|
||||
this.defenderMap.put(entity, new ArrayList<Card>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -327,17 +327,16 @@ public class Combat {
|
||||
*
|
||||
* @return an array of {@link forge.CardList} objects.
|
||||
*/
|
||||
public final CardList[] sortAttackerByDefender() {
|
||||
public final List<List<Card>> sortAttackerByDefender() {
|
||||
int size = this.defenders.size();
|
||||
final CardList[] attackers = new CardList[size];
|
||||
final ArrayList<List<Card>> attackers = new ArrayList<List<Card>>(size);
|
||||
for (int i = 0; i < size; i++) {
|
||||
attackers[i] = getAttackersByDefenderSlot(i);
|
||||
attackers.add(getAttackersByDefenderSlot(i));
|
||||
}
|
||||
|
||||
return attackers;
|
||||
}
|
||||
|
||||
public final CardList getAttackersByDefenderSlot(int slot) {
|
||||
public final List<Card> getAttackersByDefenderSlot(int slot) {
|
||||
GameEntity entity = this.defenders.get(slot);
|
||||
return this.defenderMap.get(entity);
|
||||
}
|
||||
@@ -383,7 +382,7 @@ public class Combat {
|
||||
return;
|
||||
}
|
||||
|
||||
this.attackerMap.put(c, new CardList());
|
||||
this.attackerMap.put(c, new ArrayList<Card>());
|
||||
this.attackerToDefender.put(c, defender);
|
||||
this.defenderMap.get(defender).add(c);
|
||||
}
|
||||
@@ -442,8 +441,8 @@ public class Combat {
|
||||
*
|
||||
* @return an array of {@link forge.Card} objects.
|
||||
*/
|
||||
public final CardList getAttackerList() {
|
||||
return new CardList(this.attackerMap.keySet());
|
||||
public final List<Card> getAttackerList() {
|
||||
return new ArrayList<Card>(this.attackerMap.keySet());
|
||||
} // getAttackers()
|
||||
|
||||
/**
|
||||
@@ -473,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, new CardList(attacker));
|
||||
this.blockerMap.put(blocker, CardListUtil.createCardList(attacker));
|
||||
}
|
||||
else {
|
||||
this.blockerMap.get(blocker).add(attacker);
|
||||
@@ -487,8 +486,8 @@ public class Combat {
|
||||
*
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public final CardList getAllBlockers() {
|
||||
final CardList block = new CardList();
|
||||
public final List<Card> getAllBlockers() {
|
||||
final List<Card> block = new ArrayList<Card>();
|
||||
block.addAll(blockerMap.keySet());
|
||||
|
||||
return block;
|
||||
@@ -503,11 +502,11 @@ public class Combat {
|
||||
* a {@link forge.Card} object.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public final CardList getBlockers(final Card attacker) {
|
||||
public final List<Card> getBlockers(final Card attacker) {
|
||||
if (this.getBlockingAttackerList(attacker) == null) {
|
||||
return new CardList();
|
||||
return new ArrayList<Card>();
|
||||
} else {
|
||||
return new CardList(this.getBlockingAttackerList(attacker));
|
||||
return new ArrayList<Card>(this.getBlockingAttackerList(attacker));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -520,11 +519,11 @@ public class Combat {
|
||||
* a {@link forge.Card} object.
|
||||
* @return a {@link forge.Card} object.
|
||||
*/
|
||||
public final CardList getAttackersBlockedBy(final Card blocker) {
|
||||
public final List<Card> getAttackersBlockedBy(final Card blocker) {
|
||||
if (blockerMap.containsKey(blocker)) {
|
||||
return blockerMap.get(blocker);
|
||||
}
|
||||
return new CardList();
|
||||
return new ArrayList<Card>();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -536,7 +535,7 @@ public class Combat {
|
||||
* a {@link forge.Card} object.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
private CardList getBlockingAttackerList(final Card attacker) {
|
||||
private List<Card> getBlockingAttackerList(final Card attacker) {
|
||||
return this.attackerMap.get(attacker);
|
||||
}
|
||||
|
||||
@@ -550,11 +549,11 @@ public class Combat {
|
||||
* @param blockers
|
||||
* a {@link forge.CardList} object.
|
||||
*/
|
||||
public void setBlockerList(final Card attacker, final CardList blockers) {
|
||||
public void setBlockerList(final Card attacker, final List<Card> blockers) {
|
||||
this.attackerMap.put(attacker, blockers);
|
||||
}
|
||||
|
||||
public void setAttackersBlockedByList(final Card blocker, final CardList attackers) {
|
||||
public void setAttackersBlockedByList(final Card blocker, final List<Card> attackers) {
|
||||
this.blockerMap.put(blocker, attackers);
|
||||
}
|
||||
|
||||
@@ -571,7 +570,7 @@ public class Combat {
|
||||
// is card an attacker?
|
||||
if (this.attackerMap.containsKey(c)) {
|
||||
// Keep track of all of the different maps
|
||||
CardList blockers = this.attackerMap.get(c);
|
||||
List<Card> blockers = this.attackerMap.get(c);
|
||||
this.attackerMap.remove(c);
|
||||
for (Card b : blockers) {
|
||||
this.blockerMap.get(b).remove(c);
|
||||
@@ -582,7 +581,7 @@ public class Combat {
|
||||
this.attackerToDefender.remove(c);
|
||||
this.defenderMap.get(entity).remove(c);
|
||||
} else if (this.blockerMap.containsKey(c)) { // card is a blocker
|
||||
CardList attackers = this.blockerMap.get(c);
|
||||
List<Card> attackers = this.blockerMap.get(c);
|
||||
|
||||
boolean stillDeclaring = Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS);
|
||||
this.blockerMap.remove(c);
|
||||
@@ -604,7 +603,7 @@ public class Combat {
|
||||
* a {@link forge.Card} object.
|
||||
*/
|
||||
public final void undoBlockingAssignment(final Card blocker) {
|
||||
final CardList att = this.getAttackerList();
|
||||
final List<Card> att = this.getAttackerList();
|
||||
for (final Card attacker : att) {
|
||||
if (this.getBlockers(attacker).contains(blocker)) {
|
||||
this.getBlockingAttackerList(attacker).remove(blocker);
|
||||
@@ -621,7 +620,7 @@ public class Combat {
|
||||
* </p>
|
||||
*/
|
||||
public final void verifyCreaturesInPlay() {
|
||||
final CardList all = new CardList();
|
||||
final List<Card> all = new ArrayList<Card>();
|
||||
all.addAll(this.getAttackers());
|
||||
all.addAll(this.getAllBlockers());
|
||||
|
||||
@@ -638,10 +637,10 @@ public class Combat {
|
||||
* </p>
|
||||
*/
|
||||
public final void setUnblocked() {
|
||||
final CardList attacking = this.getAttackerList();
|
||||
final List<Card> attacking = this.getAttackerList();
|
||||
|
||||
for (final Card attacker : attacking) {
|
||||
final CardList block = this.getBlockers(attacker);
|
||||
final List<Card> block = this.getBlockers(attacker);
|
||||
|
||||
if (block.size() == 0) {
|
||||
// this damage is assigned to a player by setPlayerDamage()
|
||||
@@ -657,12 +656,12 @@ public class Combat {
|
||||
}
|
||||
|
||||
private final boolean assignBlockersDamage(boolean firstStrikeDamage) {
|
||||
final CardList blockers = this.getAllBlockers();
|
||||
final List<Card> blockers = this.getAllBlockers();
|
||||
boolean assignedDamage = false;
|
||||
|
||||
for (final Card blocker : blockers) {
|
||||
if (blocker.hasDoubleStrike() || blocker.hasFirstStrike() == firstStrikeDamage) {
|
||||
CardList attackers = this.getAttackersBlockedBy(blocker);
|
||||
List<Card> attackers = this.getAttackersBlockedBy(blocker);
|
||||
|
||||
final int damage = blocker.getNetCombatDamage();
|
||||
|
||||
@@ -694,8 +693,8 @@ public class Combat {
|
||||
|
||||
private final boolean assignAttackersDamage(boolean firstStrikeDamage) {
|
||||
this.defendingDamageMap.clear(); // this should really happen in deal damage
|
||||
CardList blockers = null;
|
||||
final CardList attackers = this.getAttackerList();
|
||||
List<Card> blockers = null;
|
||||
final List<Card> attackers = this.getAttackerList();
|
||||
boolean assignedDamage = false;
|
||||
for (final Card attacker : attackers) {
|
||||
// If attacker isn't in the right first/regular strike section, continue along
|
||||
@@ -755,7 +754,7 @@ public class Combat {
|
||||
* @param damage
|
||||
* a int.
|
||||
*/
|
||||
private void distributeAIDamage(final Card attacker, final CardList block, int damage) {
|
||||
private void distributeAIDamage(final Card attacker, final List<Card> block, int damage) {
|
||||
final Card c = attacker;
|
||||
|
||||
if (attacker.hasKeyword("You may have CARDNAME assign its combat damage as though it weren't blocked.")
|
||||
@@ -808,7 +807,7 @@ public class Combat {
|
||||
final int enoughDamageToKill = b.getEnoughDamageToKill(damage, attacker, true);
|
||||
if (enoughDamageToKill <= damage) {
|
||||
damage -= enoughDamageToKill;
|
||||
final CardList cl = new CardList();
|
||||
final List<Card> cl = new ArrayList<Card>();
|
||||
cl.add(attacker);
|
||||
|
||||
b.addAssignedDamage(enoughDamageToKill, c);
|
||||
@@ -847,7 +846,7 @@ public class Combat {
|
||||
player.addCombatDamage(entry.getValue(), entry.getKey());
|
||||
}
|
||||
|
||||
final CardList unblocked = new CardList(bFirstStrike ? AllZone.getCombat().getUnblockedAttackers() : AllZone
|
||||
final List<Card> unblocked = new ArrayList<Card>(bFirstStrike ? AllZone.getCombat().getUnblockedAttackers() : AllZone
|
||||
.getCombat().getUnblockedFirstStrikeAttackers());
|
||||
|
||||
for (int j = 0; j < unblocked.size(); j++) {
|
||||
@@ -862,7 +861,7 @@ public class Combat {
|
||||
|
||||
// this can be much better below here...
|
||||
|
||||
final CardList combatants = new CardList();
|
||||
final List<Card> combatants = new ArrayList<Card>();
|
||||
combatants.addAll(AllZone.getCombat().getAttackers());
|
||||
combatants.addAll(AllZone.getCombat().getAllBlockers());
|
||||
combatants.addAll(AllZone.getCombat().getDefendingPlaneswalkers());
|
||||
@@ -950,7 +949,7 @@ public class Combat {
|
||||
* a {@link forge.Card} object.
|
||||
*/
|
||||
public final void addUnblockedAttacker(final Card c) {
|
||||
this.unblockedMap.put(c, new CardList());
|
||||
this.unblockedMap.put(c, new ArrayList<Card>());
|
||||
}
|
||||
|
||||
} // Class Combat
|
||||
|
||||
@@ -31,7 +31,7 @@ import com.google.common.base.Predicate;
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates;
|
||||
import forge.Command;
|
||||
@@ -160,7 +160,7 @@ public class CombatUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
final CardList list = AllZoneUtil.getCreaturesInPlay(blocker.getController());
|
||||
final List<Card> list = AllZoneUtil.getCreaturesInPlay(blocker.getController());
|
||||
if (list.size() < 2 && blocker.hasKeyword("CARDNAME can't attack or block alone.")) {
|
||||
return false;
|
||||
}
|
||||
@@ -168,7 +168,7 @@ public class CombatUtil {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean canBlockMoreCreatures(final Card blocker, final CardList blockedBy) {
|
||||
public static boolean canBlockMoreCreatures(final Card blocker, final List<Card> blockedBy) {
|
||||
// TODO(sol) expand this for the additional blocking keyword
|
||||
if (blockedBy.isEmpty() || blocker.hasKeyword("CARDNAME can block any number of creatures.")) {
|
||||
return true;
|
||||
@@ -286,7 +286,7 @@ public class CombatUtil {
|
||||
|
||||
String valid = StringUtils.join(walkTypes, ",");
|
||||
final Player defendingPlayer = attacker.getController().getOpponent();
|
||||
CardList defendingLands = defendingPlayer.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> defendingLands = defendingPlayer.getCardsIn(ZoneType.Battlefield);
|
||||
for (Card c : defendingLands) {
|
||||
if (c.isValid(valid, defendingPlayer, attacker)) {
|
||||
return true;
|
||||
@@ -305,7 +305,7 @@ public class CombatUtil {
|
||||
* the attackers
|
||||
* @return true, if one can be blocked
|
||||
*/
|
||||
public static boolean canBlockAtLeastOne(final Card blocker, final CardList attackers) {
|
||||
public static boolean canBlockAtLeastOne(final Card blocker, final List<Card> attackers) {
|
||||
for (Card attacker : attackers) {
|
||||
if (CombatUtil.canBlock(attacker, blocker)) {
|
||||
return true;
|
||||
@@ -323,7 +323,7 @@ public class CombatUtil {
|
||||
* the blockers
|
||||
* @return true, if successful
|
||||
*/
|
||||
public static boolean canBeBlocked(final Card attacker, final CardList blockers) {
|
||||
public static boolean canBeBlocked(final Card attacker, final List<Card> blockers) {
|
||||
if (!CombatUtil.canBeBlocked(attacker)) {
|
||||
return false;
|
||||
}
|
||||
@@ -382,8 +382,8 @@ public class CombatUtil {
|
||||
*/
|
||||
public static boolean finishedMandatoryBlocks(final Combat combat) {
|
||||
|
||||
final CardList blockers = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
final CardList attackers = combat.getAttackerList();
|
||||
final List<Card> blockers = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
final List<Card> attackers = combat.getAttackerList();
|
||||
|
||||
// if a creature does not block but should, return false
|
||||
for (final Card blocker : blockers) {
|
||||
@@ -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 CardList possibleBlockers = CardListUtil.filter(combat.getDefendingPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES);
|
||||
final List<Card> possibleBlockers = CardListUtil.filter(combat.getDefendingPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES);
|
||||
possibleBlockers.remove(blocker);
|
||||
if (!CombatUtil.canBeBlocked(attacker, possibleBlockers)) {
|
||||
must = false;
|
||||
@@ -431,18 +431,18 @@ public class CombatUtil {
|
||||
private static void orderMultipleBlockers(final Combat combat) {
|
||||
// If there are multiple blockers, the Attacker declares the Assignment Order
|
||||
final Player player = combat.getAttackingPlayer();
|
||||
final CardList attackers = combat.getAttackerList();
|
||||
final List<Card> attackers = combat.getAttackerList();
|
||||
for (final Card attacker : attackers) {
|
||||
CardList blockers = combat.getBlockers(attacker);
|
||||
List<Card> blockers = combat.getBlockers(attacker);
|
||||
if (blockers.size() <= 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
CardList orderedBlockers = null;
|
||||
List<Card> orderedBlockers = null;
|
||||
if (player.isHuman()) {
|
||||
List<Object> ordered = GuiChoose.getOrderChoices("Choose Blocking Order", "Damaged First", 0, blockers.toArray(), null);
|
||||
|
||||
orderedBlockers = new CardList();
|
||||
orderedBlockers = new ArrayList<Card>();
|
||||
for(Object o : ordered) {
|
||||
orderedBlockers.add((Card)o);
|
||||
}
|
||||
@@ -459,18 +459,18 @@ public class CombatUtil {
|
||||
private static void orderBlockingMultipleAttackers(final Combat combat) {
|
||||
// If there are multiple blockers, the Attacker declares the Assignment Order
|
||||
final Player player = combat.getDefendingPlayer();
|
||||
final CardList blockers = combat.getAllBlockers();
|
||||
final List<Card> blockers = combat.getAllBlockers();
|
||||
for (final Card blocker : blockers) {
|
||||
CardList attackers = combat.getAttackersBlockedBy(blocker);
|
||||
List<Card> attackers = combat.getAttackersBlockedBy(blocker);
|
||||
if (attackers.size() <= 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
CardList orderedAttacker = null;
|
||||
List<Card> orderedAttacker = null;
|
||||
if (player.isHuman()) {
|
||||
List<Object> ordered = GuiChoose.getOrderChoices("Choose Blocking Order", "Damaged First", 0, attackers.toArray(), null);
|
||||
|
||||
orderedAttacker = new CardList();
|
||||
orderedAttacker = new ArrayList<Card>();
|
||||
for(Object o : ordered) {
|
||||
orderedAttacker.add((Card)o);
|
||||
}
|
||||
@@ -507,8 +507,8 @@ public class CombatUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
final CardList attackers = combat.getAttackerList();
|
||||
final CardList attackersWithLure = new CardList();
|
||||
final List<Card> attackers = combat.getAttackerList();
|
||||
final List<Card> attackersWithLure = new ArrayList<Card>();
|
||||
for (final Card attacker : attackers) {
|
||||
if (attacker.hasStartOfKeyword("All creatures able to block CARDNAME do so.")
|
||||
|| (attacker.hasStartOfKeyword("CARDNAME must be blocked if able.") && combat.getBlockers(attacker)
|
||||
@@ -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 CardList blockers = CardListUtil.filter(combat.getDefendingPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES);
|
||||
final List<Card> blockers = CardListUtil.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 CardList blockers = CardListUtil.filter(combat.getDefendingPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES);
|
||||
final List<Card> blockers = CardListUtil.filter(combat.getDefendingPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES);
|
||||
blockers.remove(blocker);
|
||||
if (!CombatUtil.canBeBlocked(attacker, blockers)) {
|
||||
canBe = false;
|
||||
@@ -803,7 +803,7 @@ public class CombatUtil {
|
||||
}
|
||||
}
|
||||
|
||||
final CardList list = AllZoneUtil.getCreaturesInPlay(c.getController());
|
||||
final List<Card> list = AllZoneUtil.getCreaturesInPlay(c.getController());
|
||||
if (list.size() < 2 && c.hasKeyword("CARDNAME can't attack or block alone.")) {
|
||||
return false;
|
||||
}
|
||||
@@ -880,7 +880,7 @@ public class CombatUtil {
|
||||
if (asSeparateWords[12].matches("[0-9][0-9]?")) {
|
||||
powerLimit[0] = Integer.parseInt((asSeparateWords[12]).trim());
|
||||
|
||||
CardList list = AllZoneUtil.getCreaturesInPlay(c.getController().getOpponent());
|
||||
List<Card> list = AllZoneUtil.getCreaturesInPlay(c.getController().getOpponent());
|
||||
list = CardListUtil.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card ct) {
|
||||
@@ -897,8 +897,8 @@ public class CombatUtil {
|
||||
} // hasKeyword = CARDNAME can't attack if defending player controls an
|
||||
// untapped creature with power ...
|
||||
|
||||
final CardList list = c.getController().getOpponent().getCardsIn(ZoneType.Battlefield);
|
||||
CardList temp;
|
||||
final List<Card> list = c.getController().getOpponent().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> temp;
|
||||
for (String keyword : c.getKeyword()) {
|
||||
if (keyword.equals("CARDNAME can't attack.") || keyword.equals("CARDNAME can't attack or block.")) {
|
||||
return false;
|
||||
@@ -959,7 +959,7 @@ public class CombatUtil {
|
||||
public static int getTotalFirstStrikeBlockPower(final Card attacker, final Player player) {
|
||||
final Card att = attacker;
|
||||
|
||||
CardList list = AllZoneUtil.getCreaturesInPlay(player);
|
||||
List<Card> list = AllZoneUtil.getCreaturesInPlay(player);
|
||||
list = CardListUtil.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
@@ -1060,7 +1060,7 @@ public class CombatUtil {
|
||||
* a {@link forge.game.player.Player} object.
|
||||
* @return a int.
|
||||
*/
|
||||
public static int sumDamageIfUnblocked(final CardList attackers, final Player attacked) {
|
||||
public static int sumDamageIfUnblocked(final List<Card> attackers, final Player attacked) {
|
||||
int sum = 0;
|
||||
for (final Card attacker : attackers) {
|
||||
sum += CombatUtil.damageIfUnblocked(attacker, attacked, null);
|
||||
@@ -1080,7 +1080,7 @@ public class CombatUtil {
|
||||
* a {@link forge.game.player.Player} object.
|
||||
* @return a int.
|
||||
*/
|
||||
public static int sumPoisonIfUnblocked(final CardList attackers, final Player attacked) {
|
||||
public static int sumPoisonIfUnblocked(final List<Card> attackers, final Player attacked) {
|
||||
int sum = 0;
|
||||
for (final Card attacker : attackers) {
|
||||
sum += CombatUtil.poisonIfUnblocked(attacker, attacked, null);
|
||||
@@ -1102,12 +1102,12 @@ public class CombatUtil {
|
||||
|
||||
int damage = 0;
|
||||
|
||||
final CardList attackers = combat.getAttackersByDefenderSlot(0);
|
||||
final CardList unblocked = new CardList();
|
||||
final List<Card> attackers = combat.getAttackersByDefenderSlot(0);
|
||||
final List<Card> unblocked = new ArrayList<Card>();
|
||||
|
||||
for (final Card attacker : attackers) {
|
||||
|
||||
final CardList blockers = combat.getBlockers(attacker);
|
||||
final List<Card> blockers = combat.getBlockers(attacker);
|
||||
|
||||
if ((blockers.size() == 0)
|
||||
|| attacker.hasKeyword("You may have CARDNAME assign its combat damage "
|
||||
@@ -1144,12 +1144,12 @@ public class CombatUtil {
|
||||
|
||||
int poison = 0;
|
||||
|
||||
final CardList attackers = combat.getAttackersByDefenderSlot(0);
|
||||
final CardList unblocked = new CardList();
|
||||
final List<Card> attackers = combat.getAttackersByDefenderSlot(0);
|
||||
final List<Card> unblocked = new ArrayList<Card>();
|
||||
|
||||
for (final Card attacker : attackers) {
|
||||
|
||||
final CardList blockers = combat.getBlockers(attacker);
|
||||
final List<Card> blockers = combat.getBlockers(attacker);
|
||||
|
||||
if ((blockers.size() == 0)
|
||||
|| attacker.hasKeyword("You may have CARDNAME assign its combat damage"
|
||||
@@ -1189,11 +1189,11 @@ public class CombatUtil {
|
||||
}
|
||||
|
||||
// check for creatures that must be blocked
|
||||
final CardList attackers = combat.getAttackersByDefenderSlot(0);
|
||||
final List<Card> attackers = combat.getAttackersByDefenderSlot(0);
|
||||
|
||||
for (final Card attacker : attackers) {
|
||||
|
||||
final CardList blockers = combat.getBlockers(attacker);
|
||||
final List<Card> blockers = combat.getBlockers(attacker);
|
||||
|
||||
if (blockers.size() == 0) {
|
||||
if (!attacker.getSVar("MustBeBlocked").equals("")) {
|
||||
@@ -1243,11 +1243,11 @@ public class CombatUtil {
|
||||
}
|
||||
|
||||
// check for creatures that must be blocked
|
||||
final CardList attackers = combat.getAttackersByDefenderSlot(0);
|
||||
final List<Card> attackers = combat.getAttackersByDefenderSlot(0);
|
||||
|
||||
for (final Card attacker : attackers) {
|
||||
|
||||
final CardList blockers = combat.getBlockers(attacker);
|
||||
final List<Card> blockers = combat.getBlockers(attacker);
|
||||
|
||||
if (blockers.size() == 0) {
|
||||
if (!attacker.getSVar("MustBeBlocked").equals("")) {
|
||||
@@ -1276,7 +1276,7 @@ public class CombatUtil {
|
||||
* a {@link forge.CardList} object.
|
||||
* @return a int.
|
||||
*/
|
||||
public static int totalDamageOfBlockers(final Card attacker, final CardList defenders) {
|
||||
public static int totalDamageOfBlockers(final Card attacker, final List<Card> defenders) {
|
||||
int damage = 0;
|
||||
|
||||
for (final Card defender : defenders) {
|
||||
@@ -1350,7 +1350,7 @@ public class CombatUtil {
|
||||
* a {@link forge.CardList} object.
|
||||
* @return a int.
|
||||
*/
|
||||
public static int totalShieldDamage(final Card attacker, final CardList defenders) {
|
||||
public static int totalShieldDamage(final Card attacker, final List<Card> defenders) {
|
||||
|
||||
int defenderDefense = 0;
|
||||
|
||||
@@ -1430,7 +1430,7 @@ public class CombatUtil {
|
||||
* @return a boolean.
|
||||
*/
|
||||
public static boolean attackerWouldBeDestroyed(final Card attacker) {
|
||||
final CardList blockers = AllZone.getCombat().getBlockers(attacker);
|
||||
final List<Card> blockers = AllZone.getCombat().getBlockers(attacker);
|
||||
|
||||
for (final Card defender : blockers) {
|
||||
if (CombatUtil.canDestroyAttacker(attacker, defender, AllZone.getCombat(), true)
|
||||
@@ -1583,7 +1583,7 @@ public class CombatUtil {
|
||||
|
||||
// look out for continuous static abilities that only care for blocking
|
||||
// creatures
|
||||
final CardList cardList = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> cardList = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
for (final Card card : cardList) {
|
||||
for (final StaticAbility stAb : card.getStaticAbilities()) {
|
||||
final HashMap<String, String> params = stAb.getMapParams();
|
||||
@@ -1848,7 +1848,7 @@ public class CombatUtil {
|
||||
|
||||
// look out for continuous static abilities that only care for attacking
|
||||
// creatures
|
||||
final CardList cardList = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> cardList = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
for (final Card card : cardList) {
|
||||
for (final StaticAbility stAb : card.getStaticAbilities()) {
|
||||
final HashMap<String, String> params = stAb.getMapParams();
|
||||
@@ -1973,7 +1973,7 @@ public class CombatUtil {
|
||||
|
||||
// look out for continuous static abilities that only care for attacking
|
||||
// creatures
|
||||
final CardList cardList = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> cardList = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
for (final Card card : cardList) {
|
||||
for (final StaticAbility stAb : card.getStaticAbilities()) {
|
||||
final HashMap<String, String> params = stAb.getMapParams();
|
||||
@@ -2331,7 +2331,7 @@ public class CombatUtil {
|
||||
public static boolean blockerWouldBeDestroyed(final Card blocker) {
|
||||
// TODO THis function only checks if a single attacker at a time would destroy a blocker
|
||||
// This needs to expand to tally up damage
|
||||
final CardList attackers = AllZone.getCombat().getAttackersBlockedBy(blocker);
|
||||
final List<Card> attackers = AllZone.getCombat().getAttackersBlockedBy(blocker);
|
||||
|
||||
for(Card attacker : attackers) {
|
||||
if (CombatUtil.canDestroyBlocker(blocker, attacker, AllZone.getCombat(), true)
|
||||
@@ -2480,7 +2480,7 @@ public class CombatUtil {
|
||||
* </p>
|
||||
*/
|
||||
public static void removeAllDamage() {
|
||||
final CardList cl = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> cl = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
for (final Card c : cl) {
|
||||
c.setDamage(0);
|
||||
}
|
||||
@@ -2498,17 +2498,18 @@ public class CombatUtil {
|
||||
// Append Defending Player/Planeswalker
|
||||
final Combat combat = AllZone.getCombat();
|
||||
final List<GameEntity> defenders = combat.getDefenders();
|
||||
final CardList[] attackers = combat.sortAttackerByDefender();
|
||||
final List<List<Card>> attackers = combat.sortAttackerByDefender();
|
||||
|
||||
// Not a big fan of the triple nested loop here
|
||||
for (int def = 0; def < defenders.size(); def++) {
|
||||
if ((attackers[def] == null) || (attackers[def].size() == 0)) {
|
||||
List<Card> attacker = attackers.get(def);
|
||||
if ((attacker == null) || (attacker.size() == 0)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
sb.append(combat.getAttackingPlayer()).append(" declared ");
|
||||
for (final Card attacker : attackers[def]) {
|
||||
sb.append(attacker).append(" ");
|
||||
for (final Card atk : attacker) {
|
||||
sb.append(atk).append(" ");
|
||||
}
|
||||
|
||||
sb.append("attacking ").append(defenders.get(def).toString()).append(".");
|
||||
@@ -2525,17 +2526,17 @@ public class CombatUtil {
|
||||
public static String getCombatBlockForLog() {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
|
||||
CardList defend = null;
|
||||
List<Card> defend = null;
|
||||
|
||||
// Loop through Defenders
|
||||
// Append Defending Player/Planeswalker
|
||||
final Combat combat = AllZone.getCombat();
|
||||
final List<GameEntity> defenders = combat.getDefenders();
|
||||
final CardList[] attackers = combat.sortAttackerByDefender();
|
||||
final List<List<Card>> attackers = combat.sortAttackerByDefender();
|
||||
|
||||
// Not a big fan of the triple nested loop here
|
||||
for (int def = 0; def < defenders.size(); def++) {
|
||||
final CardList list = attackers[def];
|
||||
final List<Card> list = attackers.get(def);
|
||||
|
||||
for (final Card attacker : list) {
|
||||
sb.append(combat.getDefendingPlayer()).append(" assigned ");
|
||||
@@ -2575,11 +2576,12 @@ public class CombatUtil {
|
||||
// Loop through Defenders
|
||||
// Append Defending Player/Planeswalker
|
||||
final List<GameEntity> defenders = AllZone.getCombat().getDefenders();
|
||||
final CardList[] attackers = AllZone.getCombat().sortAttackerByDefender();
|
||||
final List<List<Card>> attackers = AllZone.getCombat().sortAttackerByDefender();
|
||||
|
||||
// Not a big fan of the triple nested loop here
|
||||
for (int def = 0; def < defenders.size(); def++) {
|
||||
if ((attackers[def] == null) || (attackers[def].size() == 0)) {
|
||||
List<Card> atk = attackers.get(def);
|
||||
if ((atk == null) || (atk.size() == 0)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -2591,14 +2593,12 @@ public class CombatUtil {
|
||||
display.append(defenders.get(def).toString());
|
||||
display.append("\n");
|
||||
|
||||
final CardList list = attackers[def];
|
||||
|
||||
for (final Card c : list) {
|
||||
for (final Card c : atk) {
|
||||
// loop through attackers
|
||||
display.append("-> ");
|
||||
display.append(CombatUtil.combatantToString(c)).append("\n");
|
||||
|
||||
CardList blockers = AllZone.getCombat().getBlockers(c);
|
||||
List<Card> blockers = AllZone.getCombat().getBlockers(c);
|
||||
|
||||
// loop through blockers
|
||||
for (final Card element : blockers) {
|
||||
@@ -2739,7 +2739,7 @@ public class CombatUtil {
|
||||
// Run triggers
|
||||
final HashMap<String, Object> runParams = new HashMap<String, Object>();
|
||||
runParams.put("Attacker", c);
|
||||
final CardList otherAttackers = AllZone.getCombat().getAttackerList();
|
||||
final List<Card> otherAttackers = AllZone.getCombat().getAttackerList();
|
||||
otherAttackers.remove(c);
|
||||
runParams.put("OtherAttackers", otherAttackers);
|
||||
runParams.put("Attacked", AllZone.getCombat().getDefenderByAttacker(c));
|
||||
@@ -2761,7 +2761,7 @@ public class CombatUtil {
|
||||
@Override
|
||||
public void resolve() {
|
||||
if (crd.getController().isHuman()) {
|
||||
final CardList list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
ComputerUtil.sacrificePermanents(a, list, false, this);
|
||||
} else {
|
||||
AbilityFactorySacrifice.sacrificeHuman(AllZone.getHumanPlayer(), a, "Permanent", this,
|
||||
@@ -2829,7 +2829,7 @@ public class CombatUtil {
|
||||
final PlayerZone lib = player.getZone(ZoneType.Library);
|
||||
|
||||
if (lib.size() > 0) {
|
||||
final CardList cl = new CardList();
|
||||
final List<Card> cl = new ArrayList<Card>();
|
||||
cl.add(lib.get(0));
|
||||
GuiChoose.oneOrNone("Top card", cl);
|
||||
final Card top = lib.get(0);
|
||||
@@ -2871,7 +2871,7 @@ public class CombatUtil {
|
||||
* @param cl
|
||||
* a {@link forge.CardList} object.
|
||||
*/
|
||||
public static void checkDeclareBlockers(final CardList cl) {
|
||||
public static void checkDeclareBlockers(final List<Card> cl) {
|
||||
for (final Card c : cl) {
|
||||
if (!c.getDamageHistory().getCreatureBlockedThisCombat()) {
|
||||
for (final Ability ab : CardFactoryUtil.getBushidoEffects(c)) {
|
||||
@@ -3078,7 +3078,7 @@ public class CombatUtil {
|
||||
final Ability ability4 = new Ability(c, "0") {
|
||||
@Override
|
||||
public void resolve() {
|
||||
CardList enchantments = attacker.getController().getCardsIn(ZoneType.Library);
|
||||
List<Card> enchantments = attacker.getController().getCardsIn(ZoneType.Library);
|
||||
enchantments = CardListUtil.filter(enchantments, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
|
||||
@@ -17,12 +17,14 @@
|
||||
*/
|
||||
package forge.game.phase;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.Counters;
|
||||
import forge.Singletons;
|
||||
@@ -55,7 +57,7 @@ public class EndOfTurn extends Phase implements java.io.Serializable {
|
||||
|
||||
// TODO - should this freeze the Stack?
|
||||
|
||||
final CardList all = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> all = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
|
||||
//EndOfTurn.endOfTurnWallOfReverence();
|
||||
EndOfTurn.endOfTurnLighthouseChronologist();
|
||||
@@ -152,7 +154,7 @@ public class EndOfTurn extends Phase implements java.io.Serializable {
|
||||
if (AllZoneUtil.isCardInPlay(vale)) {
|
||||
vale.addController(vale.getController().getOpponent());
|
||||
// Singletons.getModel().getGameAction().changeController(
|
||||
// new CardList(vale), vale.getController(),
|
||||
// new ArrayList<Card>(vale), vale.getController(),
|
||||
// vale.getController().getOpponent());
|
||||
|
||||
vale.removeAllExtrinsicKeyword("An opponent gains control of CARDNAME "
|
||||
@@ -231,7 +233,7 @@ public class EndOfTurn extends Phase implements java.io.Serializable {
|
||||
private static void endOfTurnLighthouseChronologist() {
|
||||
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
|
||||
final Player opponent = player.getOpponent();
|
||||
CardList list = opponent.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = opponent.getCardsIn(ZoneType.Battlefield);
|
||||
|
||||
list = CardListUtil.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
package forge.game.phase;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Observer;
|
||||
import java.util.Stack;
|
||||
|
||||
@@ -25,7 +26,7 @@ import com.esotericsoftware.minlog.Log;
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates;
|
||||
import forge.GameActionUtil;
|
||||
@@ -425,7 +426,7 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
|
||||
|
||||
case CLEANUP:
|
||||
// Reset Damage received map
|
||||
final CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
for (final Card c : list) {
|
||||
c.resetPreventNextDamage();
|
||||
c.resetReceivedDamageFromThisTurn();
|
||||
@@ -451,8 +452,8 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
|
||||
}
|
||||
|
||||
AllZone.getEndOfTurn().executeUntil();
|
||||
final CardList cHand = AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand);
|
||||
final CardList hHand = AllZone.getHumanPlayer().getCardsIn(ZoneType.Hand);
|
||||
final List<Card> cHand = AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand);
|
||||
final List<Card> hHand = AllZone.getHumanPlayer().getCardsIn(ZoneType.Hand);
|
||||
for (final Card c : cHand) {
|
||||
c.setDrawnThisTurn(false);
|
||||
}
|
||||
@@ -660,7 +661,7 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
|
||||
*/
|
||||
private boolean skipTurnTimeVault(Player turn) {
|
||||
// time vault:
|
||||
CardList vaults = turn.getCardsIn(ZoneType.Battlefield, "Time Vault");
|
||||
List<Card> vaults = turn.getCardsIn(ZoneType.Battlefield, "Time Vault");
|
||||
vaults = CardListUtil.filter(vaults, CardPredicates.Presets.TAPPED);
|
||||
|
||||
if (vaults.size() > 0) {
|
||||
@@ -830,7 +831,7 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
|
||||
*/
|
||||
public final void resetAttackedThisCombat(final Player player) {
|
||||
// resets the status of attacked/blocked this phase
|
||||
CardList list = player.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = player.getCardsIn(ZoneType.Battlefield);
|
||||
|
||||
list = CardListUtil.filter(list, CardPredicates.Presets.CREATURES);
|
||||
|
||||
|
||||
@@ -17,14 +17,16 @@
|
||||
*/
|
||||
package forge.game.phase;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates.Presets;
|
||||
import forge.Singletons;
|
||||
@@ -94,7 +96,7 @@ public class PhaseUtil {
|
||||
AllZone.getCombat().setDefendingPlayer(turn.getOpponent());
|
||||
|
||||
// Tokens starting game in play now actually suffer from Sum. Sickness again
|
||||
final CardList list = turn.getCardsIncludePhasingIn(ZoneType.Battlefield);
|
||||
final List<Card> list = turn.getCardsIncludePhasingIn(ZoneType.Battlefield);
|
||||
for (final Card c : list) {
|
||||
if (turn.getTurn() > 0 || !c.isStartsGameInPlay()) {
|
||||
c.setSickness(false);
|
||||
@@ -104,7 +106,7 @@ public class PhaseUtil {
|
||||
|
||||
Singletons.getModel().getGameAction().resetActivationsPerTurn();
|
||||
|
||||
final CardList lands = CardListUtil.filter(AllZoneUtil.getPlayerLandsInPlay(turn), Presets.UNTAPPED);
|
||||
final List<Card> lands = CardListUtil.filter(AllZoneUtil.getPlayerLandsInPlay(turn), Presets.UNTAPPED);
|
||||
turn.setNumPowerSurgeLands(lands.size());
|
||||
|
||||
// anything before this point happens regardless of whether the Untap
|
||||
@@ -289,7 +291,7 @@ public class PhaseUtil {
|
||||
PhaseUtil.verifyCombat();
|
||||
|
||||
// Handles removing cards like Mogg Flunkies from combat if group attack didn't occur
|
||||
final CardList filterList = AllZone.getCombat().getAttackerList();
|
||||
final List<Card> filterList = AllZone.getCombat().getAttackerList();
|
||||
for (Card c : filterList) {
|
||||
if (c.hasKeyword("CARDNAME can't attack or block alone.") && c.isAttacking()) {
|
||||
if (AllZone.getCombat().getAttackers().size() < 2) {
|
||||
@@ -298,7 +300,7 @@ public class PhaseUtil {
|
||||
}
|
||||
}
|
||||
|
||||
final CardList list = AllZone.getCombat().getAttackerList();
|
||||
final List<Card> list = AllZone.getCombat().getAttackerList();
|
||||
|
||||
// TODO move propaganda to happen as the Attacker is Declared
|
||||
// Remove illegal Propaganda attacks first only for attacking the Player
|
||||
@@ -317,7 +319,7 @@ public class PhaseUtil {
|
||||
* </p>
|
||||
*/
|
||||
public static void handleAttackingTriggers() {
|
||||
final CardList list = AllZone.getCombat().getAttackerList();
|
||||
final List<Card> list = AllZone.getCombat().getAttackerList();
|
||||
AllZone.getStack().freezeStack();
|
||||
// Then run other Attacker bonuses
|
||||
// check for exalted:
|
||||
@@ -357,7 +359,7 @@ public class PhaseUtil {
|
||||
PhaseUtil.verifyCombat();
|
||||
|
||||
// Handles removing cards like Mogg Flunkies from combat if group block didn't occur
|
||||
final CardList filterList = AllZone.getCombat().getAllBlockers();
|
||||
final List<Card> filterList = AllZone.getCombat().getAllBlockers();
|
||||
for (Card c : filterList) {
|
||||
if (c.hasKeyword("CARDNAME can't attack or block alone.") && c.isBlocking()) {
|
||||
if (AllZone.getCombat().getAllBlockers().size() < 2) {
|
||||
@@ -370,7 +372,7 @@ public class PhaseUtil {
|
||||
|
||||
AllZone.getCombat().setUnblocked();
|
||||
|
||||
CardList list = new CardList();
|
||||
List<Card> list = new ArrayList<Card>();
|
||||
list.addAll(AllZone.getCombat().getAllBlockers());
|
||||
|
||||
list = CardListUtil.filter(list, new Predicate<Card>() {
|
||||
@@ -380,12 +382,12 @@ public class PhaseUtil {
|
||||
}
|
||||
});
|
||||
|
||||
final CardList attList = AllZone.getCombat().getAttackerList();
|
||||
final List<Card> attList = AllZone.getCombat().getAttackerList();
|
||||
|
||||
CombatUtil.checkDeclareBlockers(list);
|
||||
|
||||
for (final Card a : attList) {
|
||||
final CardList blockList = AllZone.getCombat().getBlockers(a);
|
||||
final List<Card> blockList = AllZone.getCombat().getBlockers(a);
|
||||
for (final Card b : blockList) {
|
||||
CombatUtil.checkBlockedAttackers(a, b);
|
||||
}
|
||||
|
||||
@@ -18,13 +18,14 @@
|
||||
package forge.game.phase;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates.Presets;
|
||||
import forge.Counters;
|
||||
@@ -86,7 +87,7 @@ public class Untap extends Phase implements java.io.Serializable {
|
||||
return false;
|
||||
}
|
||||
|
||||
final CardList allp = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> allp = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
for (final Card ca : allp) {
|
||||
if (ca.hasStartOfKeyword("Permanents don't untap during their controllers' untap steps")) {
|
||||
final int keywordPosition = ca
|
||||
@@ -113,7 +114,7 @@ public class Untap extends Phase implements java.io.Serializable {
|
||||
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
|
||||
final Predicate<Card> tappedCanUntap = Predicates.and(Presets.TAPPED, Presets.CANUNTAP);
|
||||
|
||||
CardList list = player.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = player.getCardsIn(ZoneType.Battlefield);
|
||||
|
||||
for (final Card c : list) {
|
||||
if (c.getBounceAtUntap() && c.getName().contains("Undiscovered Paradise")) {
|
||||
@@ -188,7 +189,7 @@ public class Untap extends Phase implements java.io.Serializable {
|
||||
}
|
||||
|
||||
// opponent untapping during your untap phase
|
||||
final CardList opp = player.getOpponent().getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> opp = player.getOpponent().getCardsIn(ZoneType.Battlefield);
|
||||
for (final Card oppCard : opp) {
|
||||
if (oppCard.hasKeyword("CARDNAME untaps during each other player's untap step.")) {
|
||||
oppCard.untap();
|
||||
@@ -200,7 +201,7 @@ public class Untap extends Phase implements java.io.Serializable {
|
||||
|
||||
if (Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn().isComputer()) {
|
||||
// search for lands the computer has and only untap 1
|
||||
CardList landList = AllZoneUtil.getPlayerLandsInPlay(AllZone.getComputerPlayer());
|
||||
List<Card> landList = AllZoneUtil.getPlayerLandsInPlay(AllZone.getComputerPlayer());
|
||||
|
||||
landList = CardListUtil.filter(landList, tappedCanUntap);
|
||||
if (landList.size() > 0) {
|
||||
@@ -229,7 +230,7 @@ public class Untap extends Phase implements java.io.Serializable {
|
||||
}
|
||||
} // selectCard()
|
||||
}; // Input
|
||||
CardList landList = AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer());
|
||||
List<Card> landList = AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer());
|
||||
landList = CardListUtil.filter(landList, tappedCanUntap);
|
||||
if (landList.size() > 0) {
|
||||
AllZone.getInputControl().setInput(target);
|
||||
@@ -238,7 +239,7 @@ 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()) {
|
||||
CardList artList = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> artList = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
artList = CardListUtil.filter(artList, Presets.ARTIFACTS);
|
||||
artList = CardListUtil.filter(artList, tappedCanUntap);
|
||||
if (artList.size() > 0) {
|
||||
@@ -268,7 +269,7 @@ public class Untap extends Phase implements java.io.Serializable {
|
||||
}
|
||||
} // selectCard()
|
||||
}; // Input
|
||||
CardList artList = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> artList = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
artList = CardListUtil.filter(artList, Presets.ARTIFACTS);
|
||||
artList = CardListUtil.filter(artList, tappedCanUntap);
|
||||
if (artList.size() > 0) {
|
||||
@@ -278,7 +279,7 @@ public class Untap extends Phase implements java.io.Serializable {
|
||||
}
|
||||
if ((AllZoneUtil.isCardInPlay("Smoke") || AllZoneUtil.isCardInPlay("Stoic Angel"))) {
|
||||
if (Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn().isComputer()) {
|
||||
CardList creatures = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
||||
List<Card> creatures = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
||||
creatures = CardListUtil.filter(creatures, tappedCanUntap);
|
||||
if (creatures.size() > 0) {
|
||||
creatures.get(0).untap();
|
||||
@@ -307,7 +308,7 @@ public class Untap extends Phase implements java.io.Serializable {
|
||||
}
|
||||
} // selectCard()
|
||||
}; // Input
|
||||
CardList creatures = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
List<Card> creatures = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
creatures = CardListUtil.filter(creatures, tappedCanUntap);
|
||||
if (creatures.size() > 0) {
|
||||
AllZone.getInputControl().setInput(target);
|
||||
@@ -343,7 +344,7 @@ public class Untap extends Phase implements java.io.Serializable {
|
||||
|
||||
private static void doPhasing(final Player turn) {
|
||||
// Needs to include phased out cards
|
||||
final CardList list = CardListUtil.filter(turn.getCardsIncludePhasingIn(ZoneType.Battlefield), new Predicate<Card>() {
|
||||
final List<Card> list = CardListUtil.filter(turn.getCardsIncludePhasingIn(ZoneType.Battlefield), new Predicate<Card>() {
|
||||
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
package forge.game.phase;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.Iterables;
|
||||
@@ -25,7 +26,7 @@ import com.google.common.collect.Iterables;
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates;
|
||||
import forge.CardPredicates.Presets;
|
||||
@@ -126,7 +127,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
private static void upkeepBraidOfFire() {
|
||||
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
|
||||
|
||||
final CardList braids = player.getCardsIn(ZoneType.Battlefield, "Braid of Fire");
|
||||
final List<Card> braids = player.getCardsIn(ZoneType.Battlefield, "Braid of Fire");
|
||||
|
||||
for (int i = 0; i < braids.size(); i++) {
|
||||
final Card c = braids.get(i);
|
||||
@@ -164,7 +165,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
* </p>
|
||||
*/
|
||||
private static void upkeepEcho() {
|
||||
CardList list = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn().getCardsIn(ZoneType.Battlefield);
|
||||
list = CardListUtil.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
@@ -225,7 +226,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
private static void upkeepSlowtrips() {
|
||||
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
|
||||
|
||||
CardList list = player.getSlowtripList();
|
||||
List<Card> list = player.getSlowtripList();
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
final Card card = list.get(i);
|
||||
@@ -279,7 +280,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
* </p>
|
||||
*/
|
||||
private static void upkeepUpkeepCost() {
|
||||
final CardList list = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn().getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> list = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn().getCardsIn(ZoneType.Battlefield);
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
final Card c = list.get(i);
|
||||
@@ -474,22 +475,22 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
* regenerated.
|
||||
*/
|
||||
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
|
||||
final CardList the = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "The Abyss");
|
||||
final CardList magus = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Magus of the Abyss");
|
||||
final List<Card> the = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "The Abyss");
|
||||
final List<Card> magus = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Magus of the Abyss");
|
||||
|
||||
final CardList cards = new CardList();
|
||||
final List<Card> cards = new ArrayList<Card>();
|
||||
cards.addAll(the);
|
||||
cards.addAll(magus);
|
||||
|
||||
for (final Card c : cards) {
|
||||
final Card abyss = c;
|
||||
|
||||
final CardList abyssGetTargets = CardListUtil.filter(AllZoneUtil.getCreaturesInPlay(player), Presets.NON_ARTIFACTS);
|
||||
final List<Card> abyssGetTargets = CardListUtil.filter(AllZoneUtil.getCreaturesInPlay(player), Presets.NON_ARTIFACTS);
|
||||
|
||||
final Ability sacrificeCreature = new Ability(abyss, "") {
|
||||
@Override
|
||||
public void resolve() {
|
||||
final CardList targets = CardListUtil.getTargetableCards(abyssGetTargets, this);
|
||||
final List<Card> targets = CardListUtil.getTargetableCards(abyssGetTargets, this);
|
||||
if (player.isHuman()) {
|
||||
if (targets.size() > 0) {
|
||||
AllZone.getInputControl().setInput(new Input() {
|
||||
@@ -516,7 +517,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
}
|
||||
} else { // computer
|
||||
|
||||
final CardList indestruct = CardListUtil.getKeyword(targets, "Indestructible");
|
||||
final List<Card> indestruct = CardListUtil.getKeyword(targets, "Indestructible");
|
||||
if (indestruct.size() > 0) {
|
||||
Singletons.getModel().getGameAction().destroyNoRegeneration(indestruct.get(0));
|
||||
} else if (targets.size() > 0) {
|
||||
@@ -550,9 +551,9 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
* least power, you choose one of them.
|
||||
*/
|
||||
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
|
||||
final CardList drops = player.getCardsIn(ZoneType.Battlefield, "Drop of Honey");
|
||||
final List<Card> drops = player.getCardsIn(ZoneType.Battlefield, "Drop of Honey");
|
||||
drops.addAll(player.getCardsIn(ZoneType.Battlefield, "Porphyry Nodes"));
|
||||
final CardList cards = drops;
|
||||
final List<Card> cards = drops;
|
||||
|
||||
for (int i = 0; i < cards.size(); i++) {
|
||||
final Card c = cards.get(i);
|
||||
@@ -560,7 +561,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
final Ability ability = new Ability(c, "") {
|
||||
@Override
|
||||
public void resolve() {
|
||||
final CardList creatures = AllZoneUtil.getCreaturesInPlay();
|
||||
final List<Card> creatures = AllZoneUtil.getCreaturesInPlay();
|
||||
if (creatures.size() > 0) {
|
||||
CardListUtil.sortAttackLowFirst(creatures);
|
||||
final int power = creatures.get(0).getNetAttack();
|
||||
@@ -575,8 +576,8 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
}
|
||||
} // resolve
|
||||
|
||||
private CardList getLowestPowerList(final CardList original) {
|
||||
final CardList lowestPower = new CardList();
|
||||
private List<Card> getLowestPowerList(final List<Card> original) {
|
||||
final List<Card> lowestPower = new ArrayList<Card>();
|
||||
final int power = original.get(0).getNetAttack();
|
||||
int i = 0;
|
||||
while ((i < original.size()) && (original.get(i).getNetAttack() == power)) {
|
||||
@@ -586,9 +587,9 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
return lowestPower;
|
||||
}
|
||||
|
||||
private Card getCompyCardToDestroy(final CardList original) {
|
||||
final CardList options = this.getLowestPowerList(original);
|
||||
final CardList humanCreatures = CardListUtil.filter(options, new Predicate<Card>() {
|
||||
private Card getCompyCardToDestroy(final List<Card> original) {
|
||||
final List<Card> options = this.getLowestPowerList(original);
|
||||
final List<Card> humanCreatures = CardListUtil.filter(options, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
return c.getController().isHuman();
|
||||
@@ -626,7 +627,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
*/
|
||||
|
||||
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
|
||||
final CardList cards = player.getCardsIn(ZoneType.Battlefield, "Demonic Hordes");
|
||||
final List<Card> cards = player.getCardsIn(ZoneType.Battlefield, "Demonic Hordes");
|
||||
|
||||
for (int i = 0; i < cards.size(); i++) {
|
||||
|
||||
@@ -635,7 +636,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
final Ability noPay = new Ability(c, "B B B") {
|
||||
@Override
|
||||
public void resolve() {
|
||||
final CardList playerLand = AllZoneUtil.getPlayerLandsInPlay(player);
|
||||
final List<Card> playerLand = AllZoneUtil.getPlayerLandsInPlay(player);
|
||||
|
||||
c.tap();
|
||||
if (c.getController().isComputer()) {
|
||||
@@ -714,7 +715,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
private static void upkeepInkDissolver() {
|
||||
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
|
||||
final Player opponent = player.getOpponent();
|
||||
final CardList kinship = player.getCardsIn(ZoneType.Battlefield, "Ink Dissolver");
|
||||
final List<Card> kinship = player.getCardsIn(ZoneType.Battlefield, "Ink Dissolver");
|
||||
|
||||
final PlayerZone library = player.getZone(ZoneType.Library);
|
||||
// Players would not choose to trigger Kinship ability if library is
|
||||
@@ -800,7 +801,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
*/
|
||||
private static void upkeepKithkinZephyrnaut() {
|
||||
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
|
||||
final CardList kinship = player.getCardsIn(ZoneType.Battlefield, "Kithkin Zephyrnaut");
|
||||
final List<Card> kinship = player.getCardsIn(ZoneType.Battlefield, "Kithkin Zephyrnaut");
|
||||
|
||||
final PlayerZone library = player.getZone(ZoneType.Library);
|
||||
// Players would not choose to trigger Kinship ability if library is
|
||||
@@ -902,7 +903,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
*/
|
||||
private static void upkeepLeafCrownedElder() {
|
||||
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
|
||||
final CardList kinship = player.getCardsIn(ZoneType.Battlefield, "Leaf-Crowned Elder");
|
||||
final List<Card> kinship = player.getCardsIn(ZoneType.Battlefield, "Leaf-Crowned Elder");
|
||||
|
||||
final PlayerZone library = player.getZone(ZoneType.Library);
|
||||
// Players would not choose to trigger Kinship ability if library is
|
||||
@@ -1002,7 +1003,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
*/
|
||||
private static void upkeepMudbuttonClanger() {
|
||||
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
|
||||
final CardList kinship = player.getCardsIn(ZoneType.Battlefield, "Mudbutton Clanger");
|
||||
final List<Card> kinship = player.getCardsIn(ZoneType.Battlefield, "Mudbutton Clanger");
|
||||
|
||||
final PlayerZone library = player.getZone(ZoneType.Library);
|
||||
// Players would not choose to trigger Kinship ability if library is
|
||||
@@ -1099,7 +1100,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
*/
|
||||
private static void upkeepNightshadeSchemers() {
|
||||
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
|
||||
final CardList kinship = player.getCardsIn(ZoneType.Battlefield, "Nightshade Schemers");
|
||||
final List<Card> kinship = player.getCardsIn(ZoneType.Battlefield, "Nightshade Schemers");
|
||||
final Player opponent = player.getOpponent();
|
||||
|
||||
final PlayerZone library = player.getZone(ZoneType.Library);
|
||||
@@ -1184,7 +1185,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
*/
|
||||
private static void upkeepPyroclastConsul() {
|
||||
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
|
||||
final CardList kinship = player.getCardsIn(ZoneType.Battlefield, "Pyroclast Consul");
|
||||
final List<Card> kinship = player.getCardsIn(ZoneType.Battlefield, "Pyroclast Consul");
|
||||
|
||||
final PlayerZone library = player.getZone(ZoneType.Library);
|
||||
// Players would not choose to trigger Kinship ability if library is
|
||||
@@ -1213,11 +1214,11 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
boolean wantDamageCreatures = false;
|
||||
final String[] smallCreatures = { "Creature.toughnessLE2" };
|
||||
|
||||
CardList humanCreatures = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
List<Card> humanCreatures = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
humanCreatures = CardListUtil.getValidCards(humanCreatures, smallCreatures, k.getController(), k);
|
||||
humanCreatures = CardListUtil.getNotKeyword(humanCreatures, "Indestructible");
|
||||
|
||||
CardList computerCreatures = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
||||
List<Card> computerCreatures = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
||||
computerCreatures = CardListUtil.getValidCards(computerCreatures, smallCreatures, k.getController(), k);
|
||||
computerCreatures = CardListUtil.getNotKeyword(computerCreatures, "Indestructible");
|
||||
|
||||
@@ -1251,7 +1252,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
}
|
||||
|
||||
if (wantDamageCreatures) {
|
||||
final CardList allCreatures = AllZoneUtil.getCreaturesInPlay();
|
||||
final List<Card> allCreatures = AllZoneUtil.getCreaturesInPlay();
|
||||
for (final Card crd : allCreatures) {
|
||||
crd.addDamage(2, k);
|
||||
}
|
||||
@@ -1283,7 +1284,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
*/
|
||||
private static void upkeepSensationGorger() {
|
||||
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
|
||||
final CardList kinship = player.getCardsIn(ZoneType.Battlefield, "Sensation Gorger");
|
||||
final List<Card> kinship = player.getCardsIn(ZoneType.Battlefield, "Sensation Gorger");
|
||||
final Player opponent = player.getOpponent();
|
||||
|
||||
final PlayerZone library = player.getZone(ZoneType.Library);
|
||||
@@ -1375,7 +1376,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
*/
|
||||
private static void upkeepSqueakingPieGrubfellows() {
|
||||
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
|
||||
final CardList kinship = player.getCardsIn(ZoneType.Battlefield, "Squeaking Pie Grubfellows");
|
||||
final List<Card> kinship = player.getCardsIn(ZoneType.Battlefield, "Squeaking Pie Grubfellows");
|
||||
final Player opponent = player.getOpponent();
|
||||
|
||||
final PlayerZone library = player.getZone(ZoneType.Library);
|
||||
@@ -1461,7 +1462,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
*/
|
||||
private static void upkeepWanderingGraybeard() {
|
||||
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
|
||||
final CardList kinship = player.getCardsIn(ZoneType.Battlefield, "Wandering Graybeard");
|
||||
final List<Card> kinship = player.getCardsIn(ZoneType.Battlefield, "Wandering Graybeard");
|
||||
|
||||
final PlayerZone library = player.getZone(ZoneType.Library);
|
||||
// Players would not choose to trigger Kinship ability if library is
|
||||
@@ -1545,7 +1546,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
*/
|
||||
private static void upkeepWaterspoutWeavers() {
|
||||
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
|
||||
final CardList kinship = player.getCardsIn(ZoneType.Battlefield, "Waterspout Weavers");
|
||||
final List<Card> kinship = player.getCardsIn(ZoneType.Battlefield, "Waterspout Weavers");
|
||||
|
||||
final PlayerZone library = player.getZone(ZoneType.Library);
|
||||
// Players would not choose to trigger Kinship ability if library is
|
||||
@@ -1602,7 +1603,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
}
|
||||
|
||||
if (wantMerfolkBuff) {
|
||||
final CardList creatures = AllZoneUtil.getCreaturesInPlay(player);
|
||||
final List<Card> creatures = AllZoneUtil.getCreaturesInPlay(player);
|
||||
for (int i = 0; i < creatures.size(); i++) {
|
||||
if (!creatures.get(i).hasKeyword("Flying")) {
|
||||
creatures.get(i).addExtrinsicKeyword("Flying");
|
||||
@@ -1613,7 +1614,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
final CardList creatures = AllZoneUtil.getCreaturesInPlay(player);
|
||||
final List<Card> creatures = AllZoneUtil.getCreaturesInPlay(player);
|
||||
for (int i = 0; i < creatures.size(); i++) {
|
||||
if (creatures.get(i).hasKeyword("Flying")) {
|
||||
creatures.get(i).removeExtrinsicKeyword("Flying");
|
||||
@@ -1650,7 +1651,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
*/
|
||||
private static void upkeepWinnowerPatrol() {
|
||||
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
|
||||
final CardList kinship = player.getCardsIn(ZoneType.Battlefield, "Winnower Patrol");
|
||||
final List<Card> kinship = player.getCardsIn(ZoneType.Battlefield, "Winnower Patrol");
|
||||
|
||||
final PlayerZone library = player.getZone(ZoneType.Library);
|
||||
// Players would not choose to trigger Kinship ability if library is
|
||||
@@ -1734,7 +1735,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
*/
|
||||
private static void upkeepWolfSkullShaman() {
|
||||
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
|
||||
final CardList kinship = player.getCardsIn(ZoneType.Battlefield, "Wolf-Skull Shaman");
|
||||
final List<Card> kinship = player.getCardsIn(ZoneType.Battlefield, "Wolf-Skull Shaman");
|
||||
|
||||
final PlayerZone library = player.getZone(ZoneType.Library);
|
||||
// Players would not choose to trigger Kinship ability if library is
|
||||
@@ -1826,7 +1827,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
private static void upkeepSuspend() {
|
||||
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
|
||||
|
||||
CardList list = player.getCardsIn(ZoneType.Exile);
|
||||
List<Card> list = player.getCardsIn(ZoneType.Exile);
|
||||
|
||||
list = CardListUtil.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
@@ -1855,7 +1856,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
private static void upkeepVanishing() {
|
||||
|
||||
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
|
||||
CardList list = player.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = player.getCardsIn(ZoneType.Battlefield);
|
||||
list = CardListUtil.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
@@ -1892,7 +1893,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
private static void upkeepFading() {
|
||||
|
||||
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
|
||||
CardList list = player.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = player.getCardsIn(ZoneType.Battlefield);
|
||||
list = CardListUtil.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
@@ -1932,7 +1933,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
* </p>
|
||||
*/
|
||||
private static void upkeepOathOfDruids() {
|
||||
final CardList oathList = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Oath of Druids");
|
||||
final List<Card> oathList = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Oath of Druids");
|
||||
if (oathList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
@@ -1945,7 +1946,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
final Ability ability = new Ability(oath, "0") {
|
||||
@Override
|
||||
public void resolve() {
|
||||
final CardList libraryList = player.getCardsIn(ZoneType.Library);
|
||||
final List<Card> libraryList = player.getCardsIn(ZoneType.Library);
|
||||
final PlayerZone battlefield = player.getZone(ZoneType.Battlefield);
|
||||
boolean oathFlag = true;
|
||||
|
||||
@@ -1958,8 +1959,8 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
oathFlag = false;
|
||||
}
|
||||
} else { // if player == Computer
|
||||
final CardList creaturesInLibrary = CardListUtil.filter(player.getCardsIn(ZoneType.Library), CardPredicates.Presets.CREATURES);
|
||||
final CardList creaturesInBattlefield = CardListUtil.filter(player.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES);
|
||||
final List<Card> creaturesInLibrary = CardListUtil.filter(player.getCardsIn(ZoneType.Library), CardPredicates.Presets.CREATURES);
|
||||
final List<Card> creaturesInBattlefield = CardListUtil.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
|
||||
@@ -1972,7 +1973,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
}
|
||||
|
||||
if (oathFlag) {
|
||||
final CardList cardsToReveal = new CardList();
|
||||
final List<Card> cardsToReveal = new ArrayList<Card>();
|
||||
final int max = libraryList.size();
|
||||
for (int i = 0; i < max; i++) {
|
||||
final Card c = libraryList.get(i);
|
||||
@@ -2013,7 +2014,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
* </p>
|
||||
*/
|
||||
private static void upkeepOathOfGhouls() {
|
||||
final CardList oathList = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Oath of Ghouls");
|
||||
final List<Card> oathList = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Oath of Ghouls");
|
||||
if (oathList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
@@ -2025,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 CardList graveyardCreatures = CardListUtil.filter(player.getCardsIn(ZoneType.Graveyard), CardPredicates.Presets.CREATURES);
|
||||
final List<Card> graveyardCreatures = CardListUtil.filter(player.getCardsIn(ZoneType.Graveyard), CardPredicates.Presets.CREATURES);
|
||||
|
||||
if (AllZoneUtil.compareTypeAmountInGraveyard(player, "Creature") > 0) {
|
||||
if (player.isHuman()) {
|
||||
@@ -2063,8 +2064,8 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
*/
|
||||
private static void upkeepKarma() {
|
||||
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
|
||||
final CardList karmas = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Karma");
|
||||
final CardList swamps = CardListUtil.getType(player.getCardsIn(ZoneType.Battlefield), "Swamp");
|
||||
final List<Card> karmas = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Karma");
|
||||
final List<Card> swamps = CardListUtil.getType(player.getCardsIn(ZoneType.Battlefield), "Swamp");
|
||||
|
||||
// determine how much damage to deal the current player
|
||||
final int damage = swamps.size();
|
||||
@@ -2108,7 +2109,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
* controlled at the beginning of this turn.
|
||||
*/
|
||||
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
|
||||
final CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Power Surge");
|
||||
final List<Card> list = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Power Surge");
|
||||
final int damage = player.getNumPowerSurgeLands();
|
||||
|
||||
for (final Card surge : list) {
|
||||
@@ -2138,14 +2139,14 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
*/
|
||||
private static void upkeepTangleWire() {
|
||||
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
|
||||
final CardList wires = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Tangle Wire");
|
||||
final List<Card> wires = AllZoneUtil.getCardsIn(ZoneType.Battlefield, "Tangle Wire");
|
||||
|
||||
for (final Card source : wires) {
|
||||
final SpellAbility ability = new Ability(source, "0") {
|
||||
@Override
|
||||
public void resolve() {
|
||||
final int num = source.getCounters(Counters.FADE);
|
||||
final CardList list = CardListUtil.filter(player.getCardsIn(ZoneType.Battlefield), new Predicate<Card>() {
|
||||
final List<Card> list = CardListUtil.filter(player.getCardsIn(ZoneType.Battlefield), new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
return (c.isArtifact() || c.isLand() || c.isCreature()) && c.isUntapped();
|
||||
@@ -2156,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
|
||||
CardList betterList = CardListUtil.filter(list, new Predicate<Card>() {
|
||||
List<Card> betterList = CardListUtil.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
if (c.isCreature()) {
|
||||
@@ -2230,7 +2231,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
private static void upkeepBlazeCounters() {
|
||||
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
|
||||
|
||||
CardList blaze = player.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> blaze = player.getCardsIn(ZoneType.Battlefield);
|
||||
blaze = CardListUtil.filter(blaze, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
@@ -2265,7 +2266,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
private static void upkeepCurseOfMisfortunes() {
|
||||
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
|
||||
|
||||
final CardList misfortunes = player.getCardsIn(ZoneType.Battlefield, "Curse of Misfortunes");
|
||||
final List<Card> misfortunes = player.getCardsIn(ZoneType.Battlefield, "Curse of Misfortunes");
|
||||
|
||||
for (int i = 0; i < misfortunes.size(); i++) {
|
||||
final Card source = misfortunes.get(i);
|
||||
@@ -2273,8 +2274,8 @@ public class Upkeep extends Phase implements java.io.Serializable {
|
||||
final Ability ability = new Ability(source, "0") {
|
||||
@Override
|
||||
public void resolve() {
|
||||
CardList enchantmentsInLibrary = source.getController().getCardsIn(ZoneType.Library);
|
||||
final CardList enchantmentsAttached = new CardList(source.getEnchantingPlayer().getEnchantedBy());
|
||||
List<Card> enchantmentsInLibrary = source.getController().getCardsIn(ZoneType.Library);
|
||||
final List<Card> enchantmentsAttached = new ArrayList<Card>(source.getEnchantingPlayer().getEnchantedBy());
|
||||
enchantmentsInLibrary = CardListUtil.filter(enchantmentsInLibrary, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
|
||||
@@ -17,13 +17,14 @@
|
||||
*/
|
||||
package forge.game.player;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates;
|
||||
import forge.Singletons;
|
||||
@@ -134,7 +135,7 @@ public class AIPlayer extends Player {
|
||||
*/
|
||||
@Override
|
||||
public final boolean dredge() {
|
||||
final CardList dredgers = this.getDredge();
|
||||
final List<Card> dredgers = this.getDredge();
|
||||
final Random random = MyRandom.getRandom();
|
||||
|
||||
// use dredge if there are more than one of them in your graveyard
|
||||
@@ -164,10 +165,10 @@ public class AIPlayer extends Player {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final CardList discard(final int num, final SpellAbility sa, final boolean duringResolution) {
|
||||
public final List<Card> discard(final int num, final SpellAbility sa, final boolean duringResolution) {
|
||||
int max = this.getCardsIn(ZoneType.Hand).size();
|
||||
max = Math.min(max, num);
|
||||
final CardList discarded = ComputerUtil.discardNumTypeAI(max, null, sa);
|
||||
final List<Card> discarded = ComputerUtil.discardNumTypeAI(max, null, sa);
|
||||
for (int i = 0; i < discarded.size(); i++) {
|
||||
this.doDiscard(discarded.get(i), sa);
|
||||
}
|
||||
@@ -178,8 +179,8 @@ public class AIPlayer extends Player {
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void discardUnless(final int num, final String uType, final SpellAbility sa) {
|
||||
final CardList hand = this.getCardsIn(ZoneType.Hand);
|
||||
final CardList tHand = CardListUtil.getType(hand, uType);
|
||||
final List<Card> hand = this.getCardsIn(ZoneType.Hand);
|
||||
final List<Card> tHand = CardListUtil.getType(hand, uType);
|
||||
|
||||
if (tHand.size() > 0) {
|
||||
Card toDiscard = Aggregates.itemWithMin(tHand, CardPredicates.Accessors.fnGetCmc);
|
||||
@@ -194,18 +195,18 @@ public class AIPlayer extends Player {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected final void doScry(final CardList topN, final int n) {
|
||||
protected final void doScry(final List<Card> topN, final int n) {
|
||||
int num = n;
|
||||
for (int i = 0; i < num; i++) {
|
||||
boolean bottom = false;
|
||||
if (topN.get(i).isBasicLand()) {
|
||||
CardList bl = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> bl = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
int nBasicLands = Iterables.size(Iterables.filter(bl, CardPredicates.Presets.BASIC_LANDS));
|
||||
|
||||
bottom = nBasicLands > 5; // if control more than 5 Basic land,
|
||||
// probably don't need more
|
||||
} else if (topN.get(i).isCreature()) {
|
||||
CardList cl = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> cl = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
cl = CardListUtil.filter(cl, CardPredicates.Presets.CREATURES);
|
||||
bottom = cl.size() > 5; // if control more than 5 Creatures,
|
||||
// probably don't need more
|
||||
@@ -229,7 +230,7 @@ public class AIPlayer extends Player {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void sacrificePermanent(final String prompt, final CardList choices) {
|
||||
public final void sacrificePermanent(final String prompt, final List<Card> choices) {
|
||||
if (choices.size() > 0) {
|
||||
// TODO - this could probably use better AI
|
||||
final Card c = CardFactoryUtil.getWorstPermanentAI(choices, false, false, false, false);
|
||||
|
||||
@@ -26,7 +26,7 @@ import com.esotericsoftware.minlog.Log;
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.card.abilityfactory.AbilityFactory;
|
||||
import forge.card.cardfactory.CardFactoryUtil;
|
||||
@@ -79,7 +79,7 @@ public class ComputerAIGeneral implements Computer {
|
||||
* a {@link java.lang.String} object.
|
||||
*/
|
||||
private void playSpellAbilitiesStackEmpty() {
|
||||
final CardList list = getAvailableCards();
|
||||
final List<Card> list = getAvailableCards();
|
||||
|
||||
final boolean nextPhase = ComputerUtil.playSpellAbilities(getSpellAbilities(list));
|
||||
|
||||
@@ -96,7 +96,7 @@ public class ComputerAIGeneral implements Computer {
|
||||
* @return a boolean.
|
||||
*/
|
||||
public static boolean hasACardGivingHaste() {
|
||||
final CardList all = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> all = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
all.addAll(CardFactoryUtil.getExternalZoneActivationCards(AllZone.getComputerPlayer()));
|
||||
all.addAll(AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand));
|
||||
|
||||
@@ -129,10 +129,10 @@ public class ComputerAIGeneral implements Computer {
|
||||
*
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
private CardList getAvailableCards() {
|
||||
private List<Card> getAvailableCards() {
|
||||
final Player computer = AllZone.getComputerPlayer();
|
||||
final Player human = AllZone.getHumanPlayer();
|
||||
CardList all = computer.getCardsIn(ZoneType.Hand);
|
||||
List<Card> all = computer.getCardsIn(ZoneType.Hand);
|
||||
all.addAll(computer.getCardsIn(ZoneType.Battlefield));
|
||||
all.addAll(computer.getCardsIn(ZoneType.Exile));
|
||||
all.addAll(computer.getCardsIn(ZoneType.Graveyard));
|
||||
@@ -210,7 +210,7 @@ public class ComputerAIGeneral implements Computer {
|
||||
private ArrayList<SpellAbility> getPossibleETBCounters() {
|
||||
final Player computer = AllZone.getComputerPlayer();
|
||||
final Player human = AllZone.getHumanPlayer();
|
||||
CardList all = computer.getCardsIn(ZoneType.Hand);
|
||||
List<Card> all = computer.getCardsIn(ZoneType.Hand);
|
||||
all.addAll(computer.getCardsIn(ZoneType.Exile));
|
||||
all.addAll(computer.getCardsIn(ZoneType.Graveyard));
|
||||
if (!computer.getCardsIn(ZoneType.Library).isEmpty()) {
|
||||
@@ -238,7 +238,7 @@ public class ComputerAIGeneral implements Computer {
|
||||
* a {@link forge.CardList} object.
|
||||
* @return an array of {@link forge.card.spellability.SpellAbility} objects.
|
||||
*/
|
||||
private ArrayList<SpellAbility> getSpellAbilities(final CardList l) {
|
||||
private ArrayList<SpellAbility> getSpellAbilities(final List<Card> l) {
|
||||
final ArrayList<SpellAbility> spellAbilities = new ArrayList<SpellAbility>();
|
||||
for (final Card c : l) {
|
||||
for (final SpellAbility sa : c.getNonManaSpellAbilities()) {
|
||||
@@ -257,7 +257,7 @@ public class ComputerAIGeneral implements Computer {
|
||||
* a {@link forge.CardList} object.
|
||||
* @return a {@link java.util.ArrayList} object.
|
||||
*/
|
||||
private ArrayList<SpellAbility> getPlayableCounters(final CardList l) {
|
||||
private ArrayList<SpellAbility> getPlayableCounters(final List<Card> l) {
|
||||
final ArrayList<SpellAbility> spellAbility = new ArrayList<SpellAbility>();
|
||||
for (final Card c : l) {
|
||||
for (final SpellAbility sa : c.getNonManaSpellAbilities()) {
|
||||
@@ -307,7 +307,7 @@ public class ComputerAIGeneral implements Computer {
|
||||
*/
|
||||
@Override
|
||||
public final void declareBlockers() {
|
||||
final CardList blockers = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
||||
final List<Card> blockers = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
||||
|
||||
AllZone.setCombat(ComputerUtilBlock.getBlockers(AllZone.getCombat(), blockers));
|
||||
|
||||
@@ -347,7 +347,7 @@ public class ComputerAIGeneral implements Computer {
|
||||
Singletons.getModel().getGameState().getPhaseHandler().passPriority();
|
||||
return;
|
||||
}
|
||||
final CardList cards = getAvailableCards();
|
||||
final List<Card> cards = getAvailableCards();
|
||||
// top of stack is owned by human,
|
||||
ArrayList<SpellAbility> possibleCounters = getPlayableCounters(cards);
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ import com.google.common.collect.Iterables;
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates;
|
||||
import forge.CardPredicates.Presets;
|
||||
@@ -991,7 +991,7 @@ public class ComputerUtil {
|
||||
*
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public static CardList getAvailableMana(boolean checkPlayable) {
|
||||
public static List<Card> getAvailableMana(boolean checkPlayable) {
|
||||
return ComputerUtil.getAvailableMana(AllZone.getComputerPlayer(), checkPlayable);
|
||||
} // getAvailableMana()
|
||||
|
||||
@@ -1006,9 +1006,9 @@ public class ComputerUtil {
|
||||
* @param checkPlayable
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public static CardList getAvailableMana(final Player player, final boolean checkPlayable) {
|
||||
final CardList list = player.getCardsIn(ZoneType.Battlefield);
|
||||
final CardList manaSources = CardListUtil.filter(list, new Predicate<Card>() {
|
||||
public static List<Card> getAvailableMana(final Player player, final boolean checkPlayable) {
|
||||
final List<Card> list = player.getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> manaSources = CardListUtil.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
if (checkPlayable) {
|
||||
@@ -1026,15 +1026,15 @@ public class ComputerUtil {
|
||||
}
|
||||
}); // CardListFilter
|
||||
|
||||
final CardList sortedManaSources = new CardList();
|
||||
final CardList otherManaSources = new CardList();
|
||||
final CardList colorlessManaSources = new CardList();
|
||||
final CardList oneManaSources = new CardList();
|
||||
final CardList twoManaSources = new CardList();
|
||||
final CardList threeManaSources = new CardList();
|
||||
final CardList fourManaSources = new CardList();
|
||||
final CardList fiveManaSources = new CardList();
|
||||
final CardList anyColorManaSources = new CardList();
|
||||
final List<Card> sortedManaSources = new ArrayList<Card>();
|
||||
final List<Card> otherManaSources = new ArrayList<Card>();
|
||||
final List<Card> colorlessManaSources = new ArrayList<Card>();
|
||||
final List<Card> oneManaSources = new ArrayList<Card>();
|
||||
final List<Card> twoManaSources = new ArrayList<Card>();
|
||||
final List<Card> threeManaSources = new ArrayList<Card>();
|
||||
final List<Card> fourManaSources = new ArrayList<Card>();
|
||||
final List<Card> fiveManaSources = new ArrayList<Card>();
|
||||
final List<Card> anyColorManaSources = new ArrayList<Card>();
|
||||
|
||||
// Sort mana sources
|
||||
// 1. Use lands that can only produce colorless mana without
|
||||
@@ -1129,7 +1129,7 @@ public class ComputerUtil {
|
||||
* @param player
|
||||
* a {@link forge.game.player.Player} object.
|
||||
* @param checkPlayable TODO
|
||||
* @return HashMap<String, CardList>
|
||||
* @return HashMap<String, List<Card>>
|
||||
*/
|
||||
public static HashMap<String, ArrayList<AbilityMana>> mapManaSources(final Player player, boolean checkPlayable) {
|
||||
final HashMap<String, ArrayList<AbilityMana>> manaMap = new HashMap<String, ArrayList<AbilityMana>>();
|
||||
@@ -1143,7 +1143,7 @@ public class ComputerUtil {
|
||||
final ArrayList<AbilityMana> snowSources = new ArrayList<AbilityMana>();
|
||||
|
||||
// Get list of current available mana sources
|
||||
final CardList manaSources = ComputerUtil.getAvailableMana(checkPlayable);
|
||||
final List<Card> manaSources = ComputerUtil.getAvailableMana(checkPlayable);
|
||||
|
||||
// Loop over all mana sources
|
||||
for (int i = 0; i < manaSources.size(); i++) {
|
||||
@@ -1304,11 +1304,11 @@ public class ComputerUtil {
|
||||
if (!computer.canPlayLand()) {
|
||||
return false;
|
||||
}
|
||||
final CardList hand = AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand);
|
||||
CardList landList = CardListUtil.filter(hand, Presets.LANDS);
|
||||
CardList nonLandList = CardListUtil.filter(hand, Predicates.not(CardPredicates.Presets.LANDS));
|
||||
final List<Card> hand = AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand);
|
||||
List<Card> landList = CardListUtil.filter(hand, Presets.LANDS);
|
||||
List<Card> nonLandList = CardListUtil.filter(hand, Predicates.not(CardPredicates.Presets.LANDS));
|
||||
|
||||
final CardList lands = computer.getCardsIn(ZoneType.Graveyard);
|
||||
final List<Card> lands = computer.getCardsIn(ZoneType.Graveyard);
|
||||
for (final Card crd : lands) {
|
||||
if (crd.isLand() && crd.hasKeyword("May be played")) {
|
||||
landList.add(crd);
|
||||
@@ -1318,9 +1318,9 @@ public class ComputerUtil {
|
||||
return false;
|
||||
}
|
||||
if (landList.size() == 1 && nonLandList.size() < 3) {
|
||||
CardList cardsInPlay = computer.getCardsIn(ZoneType.Battlefield);
|
||||
CardList landsInPlay = CardListUtil.filter(cardsInPlay, Presets.LANDS);
|
||||
CardList allCards = computer.getCardsIn(ZoneType.Graveyard);
|
||||
List<Card> cardsInPlay = computer.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> landsInPlay = CardListUtil.filter(cardsInPlay, Presets.LANDS);
|
||||
List<Card> allCards = computer.getCardsIn(ZoneType.Graveyard);
|
||||
allCards.addAll(cardsInPlay);
|
||||
int maxCmcInHand = Aggregates.max(hand, CardPredicates.Accessors.fnGetCmc);
|
||||
int max = Math.max(maxCmcInHand, 6);
|
||||
@@ -1345,7 +1345,7 @@ public class ComputerUtil {
|
||||
public boolean apply(final Card c) {
|
||||
if (c.getSVar("NeedsToPlay").length() > 0) {
|
||||
final String needsToPlay = c.getSVar("NeedsToPlay");
|
||||
CardList list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
|
||||
list = CardListUtil.getValidCards(list, needsToPlay.split(","), c.getController(), c);
|
||||
if (list.isEmpty()) {
|
||||
@@ -1353,7 +1353,7 @@ public class ComputerUtil {
|
||||
}
|
||||
}
|
||||
if (c.isType("Legendary") && !c.getName().equals("Flagstones of Trokair")) {
|
||||
final CardList list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
if (Iterables.any(list, CardPredicates.nameEquals(c.getName()))) {
|
||||
return false;
|
||||
}
|
||||
@@ -1363,8 +1363,8 @@ public class ComputerUtil {
|
||||
// available
|
||||
final ArrayList<SpellAbility> spellAbilities = c.getSpellAbilities();
|
||||
|
||||
final CardList hand = AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand);
|
||||
CardList lands = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> hand = AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand);
|
||||
List<Card> lands = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
lands.addAll(hand);
|
||||
lands = CardListUtil.filter(lands, CardPredicates.Presets.LANDS);
|
||||
int maxCmcInHand = Aggregates.max(hand, CardPredicates.Accessors.fnGetCmc);
|
||||
@@ -1391,7 +1391,7 @@ public class ComputerUtil {
|
||||
Card land = landList.get(ix);
|
||||
//play basic lands that are needed the most
|
||||
if (!Iterables.any(landList, CardPredicates.Presets.BASIC_LANDS)) {
|
||||
final CardList combined = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> combined = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
|
||||
final ArrayList<String> basics = new ArrayList<String>();
|
||||
|
||||
@@ -1445,12 +1445,12 @@ public class ComputerUtil {
|
||||
* a {@link forge.CardList} object.
|
||||
* @return a {@link forge.Card} object.
|
||||
*/
|
||||
public static Card getCardPreference(final Card activate, final String pref, final CardList typeList) {
|
||||
public static Card getCardPreference(final Card activate, final String pref, final List<Card> typeList) {
|
||||
|
||||
if (activate != null) {
|
||||
final String[] prefValid = activate.getSVar("AIPreference").split("\\$");
|
||||
if (prefValid[0].equals(pref)) {
|
||||
final CardList prefList = CardListUtil.getValidCards(typeList, prefValid[1].split(","), activate.getController(), activate);
|
||||
final List<Card> prefList = CardListUtil.getValidCards(typeList, prefValid[1].split(","), activate.getController(), activate);
|
||||
if (prefList.size() != 0) {
|
||||
CardListUtil.shuffle(prefList);
|
||||
return prefList.get(0);
|
||||
@@ -1461,7 +1461,7 @@ 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 CardList sacMeList = CardListUtil.filter(typeList, new Predicate<Card>() {
|
||||
final List<Card> sacMeList = CardListUtil.filter(typeList, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
return (!c.getSVar("SacMe").equals("") && (Integer.parseInt(c.getSVar("SacMe")) == priority));
|
||||
@@ -1491,10 +1491,10 @@ public class ComputerUtil {
|
||||
}
|
||||
|
||||
// Discard lands
|
||||
final CardList landsInHand = CardListUtil.getType(typeList, "Land");
|
||||
final List<Card> landsInHand = CardListUtil.getType(typeList, "Land");
|
||||
if (!landsInHand.isEmpty()) {
|
||||
final CardList landsInPlay = CardListUtil.getType(AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield), "Land");
|
||||
final CardList nonLandsInHand = CardListUtil.getNotType(AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand), "Land");
|
||||
final List<Card> landsInPlay = CardListUtil.getType(AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield), "Land");
|
||||
final List<Card> nonLandsInHand = CardListUtil.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)) {
|
||||
@@ -1522,10 +1522,10 @@ public class ComputerUtil {
|
||||
* a int.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public static CardList chooseSacrificeType(final String type, final Card activate, final Card target,
|
||||
public static List<Card> chooseSacrificeType(final String type, final Card activate, final Card target,
|
||||
final int amount) {
|
||||
Player activator = AllZone.getComputerPlayer();
|
||||
CardList typeList = activator.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> typeList = activator.getCardsIn(ZoneType.Battlefield);
|
||||
typeList = CardListUtil.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");
|
||||
@@ -1539,7 +1539,7 @@ public class ComputerUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
final CardList sacList = new CardList();
|
||||
final List<Card> sacList = new ArrayList<Card>();
|
||||
int count = 0;
|
||||
|
||||
while (count < amount) {
|
||||
@@ -1573,10 +1573,10 @@ public class ComputerUtil {
|
||||
* no restrictions.
|
||||
* @param sa
|
||||
* a {@link forge.card.spellability.SpellAbility} object.
|
||||
* @return a CardList of discarded cards.
|
||||
* @return a List<Card> of discarded cards.
|
||||
*/
|
||||
public static CardList discardNumTypeAI(final int numDiscard, final String[] uTypes, final SpellAbility sa) {
|
||||
CardList hand = AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand);
|
||||
public static List<Card> discardNumTypeAI(final int numDiscard, final String[] uTypes, final SpellAbility sa) {
|
||||
List<Card> hand = AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand);
|
||||
Card sourceCard = null;
|
||||
|
||||
if ((uTypes != null) && (sa != null)) {
|
||||
@@ -1587,7 +1587,7 @@ public class ComputerUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
final CardList discardList = new CardList();
|
||||
final List<Card> discardList = new ArrayList<Card>();
|
||||
int count = 0;
|
||||
if (sa != null) {
|
||||
sourceCard = sa.getSourceCard();
|
||||
@@ -1626,7 +1626,7 @@ public class ComputerUtil {
|
||||
}
|
||||
List<Card> aiCards = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
final int numLandsInPlay = Iterables.size(Iterables.filter(aiCards, CardPredicates.Presets.LANDS));
|
||||
final CardList landsInHand = CardListUtil.filter(hand, CardPredicates.Presets.LANDS);
|
||||
final List<Card> landsInHand = CardListUtil.filter(hand, CardPredicates.Presets.LANDS);
|
||||
final int numLandsInHand = landsInHand.size();
|
||||
|
||||
// Discard a land
|
||||
@@ -1671,7 +1671,7 @@ public class ComputerUtil {
|
||||
* a int.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public static CardList chooseExileType(final String type, final Card activate, final Card target, final int amount) {
|
||||
public static List<Card> chooseExileType(final String type, final Card activate, final Card target, final int amount) {
|
||||
return ComputerUtil.chooseExileFrom(ZoneType.Battlefield, type, activate, target, amount);
|
||||
}
|
||||
|
||||
@@ -1690,7 +1690,7 @@ public class ComputerUtil {
|
||||
* a int.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public static CardList chooseExileFromHandType(final String type, final Card activate, final Card target,
|
||||
public static List<Card> chooseExileFromHandType(final String type, final Card activate, final Card target,
|
||||
final int amount) {
|
||||
return ComputerUtil.chooseExileFrom(ZoneType.Hand, type, activate, target, amount);
|
||||
}
|
||||
@@ -1710,7 +1710,7 @@ public class ComputerUtil {
|
||||
* a int.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public static CardList chooseExileFromGraveType(final String type, final Card activate, final Card target,
|
||||
public static List<Card> chooseExileFromGraveType(final String type, final Card activate, final Card target,
|
||||
final int amount) {
|
||||
return ComputerUtil.chooseExileFrom(ZoneType.Graveyard, type, activate, target, amount);
|
||||
}
|
||||
@@ -1730,7 +1730,7 @@ public class ComputerUtil {
|
||||
* a int.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public static CardList chooseExileFromStackType(final String type, final Card activate, final Card target,
|
||||
public static List<Card> chooseExileFromStackType(final String type, final Card activate, final Card target,
|
||||
final int amount) {
|
||||
return ComputerUtil.chooseExileFrom(ZoneType.Stack, type, activate, target, amount);
|
||||
}
|
||||
@@ -1752,9 +1752,9 @@ public class ComputerUtil {
|
||||
* a int.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public static CardList chooseExileFrom(final ZoneType zone, final String type, final Card activate,
|
||||
public static List<Card> chooseExileFrom(final ZoneType zone, final String type, final Card activate,
|
||||
final Card target, final int amount) {
|
||||
CardList typeList = new CardList();
|
||||
List<Card> typeList = new ArrayList<Card>();
|
||||
if (zone.equals(ZoneType.Stack)) {
|
||||
for (int i = 0; i < AllZone.getStack().size(); i++) {
|
||||
typeList.add(AllZone.getStack().peekAbility(i).getSourceCard());
|
||||
@@ -1773,7 +1773,7 @@ public class ComputerUtil {
|
||||
}
|
||||
|
||||
CardListUtil.sortAttackLowFirst(typeList);
|
||||
final CardList exileList = new CardList();
|
||||
final List<Card> exileList = new ArrayList<Card>();
|
||||
|
||||
for (int i = 0; i < amount; i++) {
|
||||
exileList.add(typeList.get(i));
|
||||
@@ -1796,8 +1796,8 @@ public class ComputerUtil {
|
||||
* a int.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public static CardList chooseTapType(final String type, final Card activate, final boolean tap, final int amount) {
|
||||
CardList typeList = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
public static List<Card> chooseTapType(final String type, final Card activate, final boolean tap, final int amount) {
|
||||
List<Card> typeList = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
typeList = CardListUtil.getValidCards(typeList, type.split(","), activate.getController(), activate);
|
||||
|
||||
// is this needed?
|
||||
@@ -1813,7 +1813,7 @@ public class ComputerUtil {
|
||||
|
||||
CardListUtil.sortAttackLowFirst(typeList);
|
||||
|
||||
final CardList tapList = new CardList();
|
||||
final List<Card> tapList = new ArrayList<Card>();
|
||||
|
||||
for (int i = 0; i < amount; i++) {
|
||||
tapList.add(typeList.get(i));
|
||||
@@ -1836,8 +1836,8 @@ public class ComputerUtil {
|
||||
* a int.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public static CardList chooseUntapType(final String type, final Card activate, final boolean untap, final int amount) {
|
||||
CardList typeList = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
public static List<Card> chooseUntapType(final String type, final Card activate, final boolean untap, final int amount) {
|
||||
List<Card> typeList = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
typeList = CardListUtil.getValidCards(typeList, type.split(","), activate.getController(), activate);
|
||||
|
||||
// is this needed?
|
||||
@@ -1853,7 +1853,7 @@ public class ComputerUtil {
|
||||
|
||||
CardListUtil.sortAttack(typeList);
|
||||
|
||||
final CardList untapList = new CardList();
|
||||
final List<Card> untapList = new ArrayList<Card>();
|
||||
|
||||
for (int i = 0; i < amount; i++) {
|
||||
untapList.add(typeList.get(i));
|
||||
@@ -1876,8 +1876,8 @@ public class ComputerUtil {
|
||||
* a int.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public static CardList chooseReturnType(final String type, final Card activate, final Card target, final int amount) {
|
||||
CardList typeList = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
public static List<Card> chooseReturnType(final String type, final Card activate, final Card target, final int amount) {
|
||||
List<Card> typeList = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
typeList = CardListUtil.getValidCards(typeList, type.split(","), activate.getController(), activate);
|
||||
if ((target != null) && target.getController().isComputer() && typeList.contains(target)) {
|
||||
// bounce
|
||||
@@ -1893,7 +1893,7 @@ public class ComputerUtil {
|
||||
}
|
||||
|
||||
CardListUtil.sortAttackLowFirst(typeList);
|
||||
final CardList returnList = new CardList();
|
||||
final List<Card> returnList = new ArrayList<Card>();
|
||||
|
||||
for (int i = 0; i < amount; i++) {
|
||||
returnList.add(typeList.get(i));
|
||||
@@ -1908,8 +1908,8 @@ public class ComputerUtil {
|
||||
*
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public static CardList getPossibleAttackers() {
|
||||
CardList list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
public static List<Card> getPossibleAttackers() {
|
||||
List<Card> list = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
list = CardListUtil.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
@@ -1941,7 +1941,7 @@ public class ComputerUtil {
|
||||
* @return a {@link forge.game.phase.Combat} object.
|
||||
*/
|
||||
public static Combat getBlockers() {
|
||||
final CardList blockers = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> blockers = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
|
||||
return ComputerUtilBlock.getBlockers(AllZone.getCombat(), blockers);
|
||||
}
|
||||
@@ -2020,9 +2020,9 @@ public class ComputerUtil {
|
||||
* the source SpellAbility
|
||||
* @return the card list
|
||||
*/
|
||||
public static CardList sacrificePermanents(final int amount, final CardList list, final boolean destroy,
|
||||
public static List<Card> sacrificePermanents(final int amount, final List<Card> list, final boolean destroy,
|
||||
SpellAbility source) {
|
||||
final CardList sacList = new CardList();
|
||||
final List<Card> sacList = new ArrayList<Card>();
|
||||
// used in Annihilator and AF_Sacrifice
|
||||
int max = list.size();
|
||||
if (max > amount) {
|
||||
@@ -2036,7 +2036,7 @@ public class ComputerUtil {
|
||||
Card c = null;
|
||||
|
||||
if (destroy) {
|
||||
final CardList indestructibles = CardListUtil.getKeyword(list, "Indestructible");
|
||||
final List<Card> indestructibles = CardListUtil.getKeyword(list, "Indestructible");
|
||||
if (!indestructibles.isEmpty()) {
|
||||
c = indestructibles.get(0);
|
||||
}
|
||||
@@ -2104,7 +2104,7 @@ public class ComputerUtil {
|
||||
}
|
||||
|
||||
final Player controller = card.getController();
|
||||
final CardList l = controller.getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> l = controller.getCardsIn(ZoneType.Battlefield);
|
||||
for (final Card c : l) {
|
||||
for (final SpellAbility sa : c.getSpellAbility()) {
|
||||
// This try/catch should fix the "computer is thinking" bug
|
||||
@@ -2155,7 +2155,7 @@ public class ComputerUtil {
|
||||
int prevented = 0;
|
||||
|
||||
final Player controller = card.getController();
|
||||
final CardList l = controller.getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> l = controller.getCardsIn(ZoneType.Battlefield);
|
||||
for (final Card c : l) {
|
||||
for (final SpellAbility sa : c.getSpellAbility()) {
|
||||
// if SA is from AF_Counter don't add to getPlayable
|
||||
@@ -2210,7 +2210,7 @@ public class ComputerUtil {
|
||||
}
|
||||
|
||||
// get all cards the computer controls with BuffedBy
|
||||
final CardList buffed = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> buffed = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
for (int j = 0; j < buffed.size(); j++) {
|
||||
final Card buffedcard = buffed.get(j);
|
||||
if (buffedcard.getSVar("BuffedBy").length() > 0) {
|
||||
@@ -2232,7 +2232,7 @@ public class ComputerUtil {
|
||||
} // BuffedBy
|
||||
|
||||
// get all cards the human controls with AntiBuffedBy
|
||||
final CardList antibuffed = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> antibuffed = AllZone.getHumanPlayer().getCardsIn(ZoneType.Battlefield);
|
||||
for (int k = 0; k < antibuffed.size(); k++) {
|
||||
final Card buffedcard = antibuffed.get(k);
|
||||
if (buffedcard.getSVar("AntiBuffedBy").length() > 0) {
|
||||
@@ -2243,10 +2243,10 @@ public class ComputerUtil {
|
||||
}
|
||||
}
|
||||
} // AntiBuffedBy
|
||||
final CardList vengevines = AllZone.getComputerPlayer().getCardsIn(ZoneType.Graveyard, "Vengevine");
|
||||
final List<Card> vengevines = AllZone.getComputerPlayer().getCardsIn(ZoneType.Graveyard, "Vengevine");
|
||||
if (vengevines.size() > 0) {
|
||||
final CardList creatures = AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand);
|
||||
final CardList creatures2 = new CardList();
|
||||
final List<Card> creatures = AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand);
|
||||
final List<Card> creatures2 = new ArrayList<Card>();
|
||||
for (int i = 0; i < creatures.size(); i++) {
|
||||
if (creatures.get(i).isCreature() && creatures.get(i).getManaCost().getCMC() <= 3) {
|
||||
creatures2.add(creatures.get(i));
|
||||
@@ -2273,7 +2273,7 @@ public class ComputerUtil {
|
||||
// Otherwise, if life is possibly in danger, then this is fine.
|
||||
Combat combat = new Combat();
|
||||
combat.initiatePossibleDefenders(AllZone.getComputerPlayer());
|
||||
CardList attackers = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
List<Card> attackers = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||
for (Card att : attackers) {
|
||||
if (CombatUtil.canAttackNextTurn(att)) {
|
||||
combat.addAttacker(att);
|
||||
@@ -2297,9 +2297,9 @@ public class ComputerUtil {
|
||||
if (!discard.getSVar("DiscardMe").equals("")) {
|
||||
return true;
|
||||
}
|
||||
final CardList landsInPlay = CardListUtil.filter(AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.LANDS);
|
||||
final CardList landsInHand = CardListUtil.filter(AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand), CardPredicates.Presets.LANDS);
|
||||
final CardList nonLandsInHand = CardListUtil.getNotType(AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand), "Land");
|
||||
final List<Card> landsInPlay = CardListUtil.filter(AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.LANDS);
|
||||
final List<Card> landsInHand = CardListUtil.filter(AllZone.getComputerPlayer().getCardsIn(ZoneType.Hand), CardPredicates.Presets.LANDS);
|
||||
final List<Card> nonLandsInHand = CardListUtil.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()) {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package forge.game.player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
@@ -25,7 +26,7 @@ import com.google.common.base.Predicate;
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates;
|
||||
import forge.Counters;
|
||||
@@ -52,14 +53,14 @@ import forge.util.MyRandom;
|
||||
public class ComputerUtilAttack {
|
||||
|
||||
// possible attackers and blockers
|
||||
private final CardList attackers;
|
||||
private final CardList blockers;
|
||||
private final List<Card> attackers;
|
||||
private final List<Card> blockers;
|
||||
|
||||
private final Random random = MyRandom.getRandom();
|
||||
private final int randomInt = this.random.nextInt();
|
||||
|
||||
private CardList humanList; // holds human player creatures
|
||||
private CardList computerList; // holds computer creatures
|
||||
private List<Card> humanList; // holds human player creatures
|
||||
private List<Card> computerList; // holds computer creatures
|
||||
|
||||
private int aiAggression = 0; // added by Masher, how aggressive the ai
|
||||
// attack will be depending on circumstances
|
||||
@@ -74,11 +75,11 @@ public class ComputerUtilAttack {
|
||||
* @param possibleBlockers
|
||||
* a {@link forge.CardList} object.
|
||||
*/
|
||||
public ComputerUtilAttack(final CardList possibleAttackers, final CardList possibleBlockers) {
|
||||
this.humanList = new CardList(possibleBlockers);
|
||||
public ComputerUtilAttack(final List<Card> possibleAttackers, final List<Card> possibleBlockers) {
|
||||
this.humanList = new ArrayList<Card>(possibleBlockers);
|
||||
this.humanList = CardListUtil.filter(this.humanList, CardPredicates.Presets.CREATURES);
|
||||
|
||||
this.computerList = new CardList(possibleAttackers);
|
||||
this.computerList = new ArrayList<Card>(possibleAttackers);
|
||||
this.computerList = CardListUtil.filter(this.computerList, CardPredicates.Presets.CREATURES);
|
||||
|
||||
this.attackers = this.getPossibleAttackers(possibleAttackers);
|
||||
@@ -94,8 +95,8 @@ public class ComputerUtilAttack {
|
||||
* a {@link forge.CardList} object.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public final CardList sortAttackers(final CardList in) {
|
||||
final CardList list = new CardList();
|
||||
public final List<Card> sortAttackers(final List<Card> in) {
|
||||
final List<Card> list = new ArrayList<Card>();
|
||||
|
||||
// Cards with triggers should come first (for Battle Cry)
|
||||
for (final Card attacker : in) {
|
||||
@@ -144,7 +145,7 @@ public class ComputerUtilAttack {
|
||||
return true;
|
||||
}
|
||||
|
||||
final CardList controlledByCompy = AllZone.getComputerPlayer().getAllCards();
|
||||
final List<Card> controlledByCompy = AllZone.getComputerPlayer().getAllCards();
|
||||
for (final Card c : controlledByCompy) {
|
||||
for (final Trigger trigger : c.getTriggers()) {
|
||||
if (CombatUtil.combatTriggerWillTrigger(attacker, null, trigger, combat)) {
|
||||
@@ -165,8 +166,8 @@ public class ComputerUtilAttack {
|
||||
* a {@link forge.CardList} object.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public final CardList getPossibleAttackers(final CardList in) {
|
||||
CardList list = new CardList(in);
|
||||
public final List<Card> getPossibleAttackers(final List<Card> in) {
|
||||
List<Card> list = new ArrayList<Card>(in);
|
||||
list = CardListUtil.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
@@ -187,8 +188,8 @@ public class ComputerUtilAttack {
|
||||
* a {@link forge.CardList} object.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public final CardList getPossibleBlockers(final CardList blockers, final CardList attackers) {
|
||||
CardList possibleBlockers = new CardList(blockers);
|
||||
public final List<Card> getPossibleBlockers(final List<Card> blockers, final List<Card> attackers) {
|
||||
List<Card> possibleBlockers = new ArrayList<Card>(blockers);
|
||||
possibleBlockers = CardListUtil.filter(possibleBlockers, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
@@ -209,8 +210,8 @@ public class ComputerUtilAttack {
|
||||
* a {@link forge.CardList} object.
|
||||
* @return a boolean.
|
||||
*/
|
||||
public final boolean canBlockAnAttacker(final Card c, final CardList attackers) {
|
||||
final CardList attackerList = new CardList(attackers);
|
||||
public final boolean canBlockAnAttacker(final Card c, final List<Card> attackers) {
|
||||
final List<Card> attackerList = new ArrayList<Card>(attackers);
|
||||
if (!c.isCreature()) {
|
||||
return false;
|
||||
}
|
||||
@@ -236,10 +237,10 @@ public class ComputerUtilAttack {
|
||||
* a {@link forge.game.phase.Combat} object.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public final CardList notNeededAsBlockers(final CardList attackers, final Combat combat) {
|
||||
final CardList notNeededAsBlockers = new CardList(attackers);
|
||||
public final List<Card> notNeededAsBlockers(final List<Card> attackers, final Combat combat) {
|
||||
final List<Card> notNeededAsBlockers = new ArrayList<Card>(attackers);
|
||||
int fixedBlockers = 0;
|
||||
final CardList vigilantes = new CardList();
|
||||
final List<Card> vigilantes = new ArrayList<Card>();
|
||||
//check for time walks
|
||||
if (Singletons.getModel().getGameState().getPhaseHandler().isNextTurn(AllZone.getComputerPlayer())) {
|
||||
return attackers;
|
||||
@@ -267,7 +268,7 @@ public class ComputerUtilAttack {
|
||||
int blockersNeeded = this.humanList.size();
|
||||
|
||||
// don't hold back creatures that can't block any of the human creatures
|
||||
final CardList list = this.getPossibleBlockers(attackers, this.humanList);
|
||||
final List<Card> list = this.getPossibleBlockers(attackers, this.humanList);
|
||||
|
||||
//Calculate the amount of creatures necessary
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
@@ -380,7 +381,7 @@ public class ComputerUtilAttack {
|
||||
// Beastmaster Ascension
|
||||
if (AllZoneUtil.isCardInPlay("Beastmaster Ascension", AllZone.getComputerPlayer())
|
||||
&& (this.attackers.size() > 1)) {
|
||||
final CardList beastions = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield, "Beastmaster Ascension");
|
||||
final List<Card> beastions = AllZone.getComputerPlayer().getCardsIn(ZoneType.Battlefield, "Beastmaster Ascension");
|
||||
int minCreatures = 7;
|
||||
for (final Card beastion : beastions) {
|
||||
final int counters = beastion.getCounters(Counters.QUEST);
|
||||
@@ -393,9 +394,9 @@ public class ComputerUtilAttack {
|
||||
|
||||
CardListUtil.sortAttack(this.attackers);
|
||||
|
||||
final CardList unblockedAttackers = new CardList();
|
||||
final CardList remainingAttackers = new CardList(this.attackers);
|
||||
final CardList remainingBlockers = new CardList(this.blockers);
|
||||
final List<Card> unblockedAttackers = new ArrayList<Card>();
|
||||
final List<Card> remainingAttackers = new ArrayList<Card>(this.attackers);
|
||||
final List<Card> remainingBlockers = new ArrayList<Card>(this.blockers);
|
||||
final Player human = AllZone.getHumanPlayer();
|
||||
final Player computer = AllZone.getComputerPlayer();
|
||||
|
||||
@@ -513,7 +514,7 @@ public class ComputerUtilAttack {
|
||||
final boolean bAssault = this.doAssault();
|
||||
// Determine who will be attacked
|
||||
this.chooseDefender(combat, bAssault);
|
||||
CardList attackersLeft = new CardList(this.attackers);
|
||||
List<Card> attackersLeft = new ArrayList<Card>(this.attackers);
|
||||
// Attackers that don't really have a choice
|
||||
for (final Card attacker : this.attackers) {
|
||||
if (!CombatUtil.canAttack(attacker, combat)) {
|
||||
@@ -594,7 +595,7 @@ public class ComputerUtilAttack {
|
||||
int humanForcesForAttritionalAttack = 0;
|
||||
|
||||
// examine the potential forces
|
||||
final CardList nextTurnAttackers = new CardList();
|
||||
final List<Card> nextTurnAttackers = new ArrayList<Card>();
|
||||
int candidateCounterAttackDamage = 0;
|
||||
// int candidateTotalBlockDamage = 0;
|
||||
for (final Card pCard : this.humanList) {
|
||||
@@ -623,7 +624,7 @@ public class ComputerUtilAttack {
|
||||
}
|
||||
|
||||
// get the potential damage and strength of the AI forces
|
||||
final CardList candidateAttackers = new CardList();
|
||||
final List<Card> candidateAttackers = new ArrayList<Card>();
|
||||
int candidateUnblockedDamage = 0;
|
||||
for (final Card pCard : this.computerList) {
|
||||
// if the creature can attack then it's a potential attacker this
|
||||
@@ -685,7 +686,7 @@ public class ComputerUtilAttack {
|
||||
// get player life total
|
||||
int humanLife = AllZone.getHumanPlayer().getLife();
|
||||
// get the list of attackers up to the first blocked one
|
||||
final CardList attritionalAttackers = new CardList();
|
||||
final List<Card> attritionalAttackers = new ArrayList<Card>();
|
||||
for (int x = 0; x < (this.attackers.size() - humanForces); x++) {
|
||||
attritionalAttackers.add(this.attackers.get(x));
|
||||
}
|
||||
@@ -816,7 +817,7 @@ public class ComputerUtilAttack {
|
||||
final int blockNum = this.blockers.size();
|
||||
int attackNum = 0;
|
||||
int damage = 0;
|
||||
CardList attacking = combat.getAttackersByDefenderSlot(combat.getCurrentDefenderNumber());
|
||||
List<Card> attacking = combat.getAttackersByDefenderSlot(combat.getCurrentDefenderNumber());
|
||||
CardListUtil.sortAttackLowFirst(attacking);
|
||||
for (Card atta : attacking) {
|
||||
if (attackNum >= blockNum || !CombatUtil.canBeBlocked(attacker, this.blockers)) {
|
||||
@@ -846,7 +847,7 @@ public class ComputerUtilAttack {
|
||||
* @return a int.
|
||||
*/
|
||||
public final int countExaltedBonus(final Player player) {
|
||||
CardList list = player.getCardsIn(ZoneType.Battlefield);
|
||||
List<Card> list = player.getCardsIn(ZoneType.Battlefield);
|
||||
list = CardListUtil.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
@@ -889,7 +890,7 @@ public class ComputerUtilAttack {
|
||||
* a {@link forge.game.phase.Combat} object.
|
||||
* @return a boolean.
|
||||
*/
|
||||
public final boolean shouldAttack(final Card attacker, final CardList defenders, final Combat combat) {
|
||||
public final boolean shouldAttack(final Card attacker, final List<Card> defenders, final Combat combat) {
|
||||
boolean canBeKilledByOne = false; // indicates if the attacker can be
|
||||
// killed by a single blocker
|
||||
boolean canKillAll = true; // indicates if the attacker can kill all
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package forge.game.player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
@@ -24,7 +25,7 @@ import com.google.common.base.Predicates;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates;
|
||||
import forge.Counters;
|
||||
@@ -44,21 +45,21 @@ import forge.game.phase.CombatUtil;
|
||||
*/
|
||||
public class ComputerUtilBlock {
|
||||
/** Constant <code>attackers</code>. */
|
||||
private static CardList attackers = new CardList(); // all attackers
|
||||
private static List<Card> attackers = new ArrayList<Card>(); // all attackers
|
||||
/** Constant <code>attackersLeft</code>. */
|
||||
private static CardList attackersLeft = new CardList(); // keeps track of
|
||||
private static List<Card> attackersLeft = new ArrayList<Card>(); // keeps track of
|
||||
// all currently
|
||||
// unblocked
|
||||
// attackers
|
||||
/** Constant <code>blockedButUnkilled</code>. */
|
||||
private static CardList blockedButUnkilled = new CardList(); // blocked
|
||||
private static List<Card> blockedButUnkilled = new ArrayList<Card>(); // blocked
|
||||
// attackers
|
||||
// that
|
||||
// currently
|
||||
// wouldn't be
|
||||
// destroyed
|
||||
/** Constant <code>blockersLeft</code>. */
|
||||
private static CardList blockersLeft = new CardList(); // keeps track of all
|
||||
private static List<Card> blockersLeft = new ArrayList<Card>(); // keeps track of all
|
||||
// unassigned
|
||||
// blockers
|
||||
/** Constant <code>diff=0</code>. */
|
||||
@@ -73,7 +74,7 @@ public class ComputerUtilBlock {
|
||||
*
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
private static CardList getAttackers() {
|
||||
private static List<Card> getAttackers() {
|
||||
return ComputerUtilBlock.attackers;
|
||||
}
|
||||
|
||||
@@ -85,7 +86,7 @@ public class ComputerUtilBlock {
|
||||
* @param cardList
|
||||
* a {@link forge.CardList} object.
|
||||
*/
|
||||
private static void setAttackers(final CardList cardList) {
|
||||
private static void setAttackers(final List<Card> cardList) {
|
||||
ComputerUtilBlock.attackers = (cardList);
|
||||
}
|
||||
|
||||
@@ -96,7 +97,7 @@ public class ComputerUtilBlock {
|
||||
*
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
private static CardList getAttackersLeft() {
|
||||
private static List<Card> getAttackersLeft() {
|
||||
return ComputerUtilBlock.attackersLeft;
|
||||
}
|
||||
|
||||
@@ -108,7 +109,7 @@ public class ComputerUtilBlock {
|
||||
* @param cardList
|
||||
* a {@link forge.CardList} object.
|
||||
*/
|
||||
private static void setAttackersLeft(final CardList cardList) {
|
||||
private static void setAttackersLeft(final List<Card> cardList) {
|
||||
ComputerUtilBlock.attackersLeft = (cardList);
|
||||
}
|
||||
|
||||
@@ -119,7 +120,7 @@ public class ComputerUtilBlock {
|
||||
*
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
private static CardList getBlockedButUnkilled() {
|
||||
private static List<Card> getBlockedButUnkilled() {
|
||||
return ComputerUtilBlock.blockedButUnkilled;
|
||||
|
||||
}
|
||||
@@ -132,7 +133,7 @@ public class ComputerUtilBlock {
|
||||
* @param cardList
|
||||
* a {@link forge.CardList} object.
|
||||
*/
|
||||
private static void setBlockedButUnkilled(final CardList cardList) {
|
||||
private static void setBlockedButUnkilled(final List<Card> cardList) {
|
||||
ComputerUtilBlock.blockedButUnkilled = (cardList);
|
||||
}
|
||||
|
||||
@@ -143,7 +144,7 @@ public class ComputerUtilBlock {
|
||||
*
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
private static CardList getBlockersLeft() {
|
||||
private static List<Card> getBlockersLeft() {
|
||||
return ComputerUtilBlock.blockersLeft;
|
||||
}
|
||||
|
||||
@@ -155,7 +156,7 @@ public class ComputerUtilBlock {
|
||||
* @param cardList
|
||||
* a {@link forge.CardList} object.
|
||||
*/
|
||||
private static void setBlockersLeft(final CardList cardList) {
|
||||
private static void setBlockersLeft(final List<Card> cardList) {
|
||||
ComputerUtilBlock.blockersLeft = (cardList);
|
||||
}
|
||||
|
||||
@@ -196,8 +197,8 @@ public class ComputerUtilBlock {
|
||||
* a {@link forge.game.phase.Combat} object.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
private static CardList getPossibleBlockers(final Card attacker, final CardList blockersLeft, final Combat combat) {
|
||||
final CardList blockers = new CardList();
|
||||
private static List<Card> getPossibleBlockers(final Card attacker, final List<Card> blockersLeft, final Combat combat) {
|
||||
final List<Card> blockers = new ArrayList<Card>();
|
||||
|
||||
for (final Card blocker : blockersLeft) {
|
||||
// if the blocker can block a creature with lure it can't block a
|
||||
@@ -224,8 +225,8 @@ public class ComputerUtilBlock {
|
||||
* a {@link forge.game.phase.Combat} object.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
private static CardList getSafeBlockers(final Card attacker, final CardList blockersLeft, final Combat combat) {
|
||||
final CardList blockers = new CardList();
|
||||
private static List<Card> getSafeBlockers(final Card attacker, final List<Card> blockersLeft, final Combat combat) {
|
||||
final List<Card> blockers = new ArrayList<Card>();
|
||||
|
||||
for (final Card b : blockersLeft) {
|
||||
if (!CombatUtil.canDestroyBlocker(b, attacker, combat, false)) {
|
||||
@@ -250,8 +251,8 @@ public class ComputerUtilBlock {
|
||||
* a {@link forge.game.phase.Combat} object.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
private static CardList getKillingBlockers(final Card attacker, final CardList blockersLeft, final Combat combat) {
|
||||
final CardList blockers = new CardList();
|
||||
private static List<Card> getKillingBlockers(final Card attacker, final List<Card> blockersLeft, final Combat combat) {
|
||||
final List<Card> blockers = new ArrayList<Card>();
|
||||
|
||||
for (final Card b : blockersLeft) {
|
||||
if (CombatUtil.canDestroyAttacker(attacker, b, combat, false)) {
|
||||
@@ -271,19 +272,21 @@ public class ComputerUtilBlock {
|
||||
* a {@link forge.game.phase.Combat} object.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public static CardList sortPotentialAttackers(final Combat combat) {
|
||||
final CardList[] attackerLists = combat.sortAttackerByDefender();
|
||||
final CardList sortedAttackers = new CardList();
|
||||
public static List<Card> sortPotentialAttackers(final Combat combat) {
|
||||
final List<List<Card>> attackerLists = combat.sortAttackerByDefender();
|
||||
final List<Card> sortedAttackers = new ArrayList<Card>();
|
||||
final List<Card> firstAttacker = attackerLists.get(0);
|
||||
|
||||
final List<GameEntity> defenders = combat.getDefenders();
|
||||
|
||||
|
||||
// Begin with the attackers that pose the biggest threat
|
||||
CardListUtil.sortByEvaluateCreature(attackerLists[0]);
|
||||
CardListUtil.sortAttack(attackerLists[0]);
|
||||
CardListUtil.sortByEvaluateCreature(firstAttacker);
|
||||
CardListUtil.sortAttack(firstAttacker);
|
||||
|
||||
// If I don't have any planeswalkers than sorting doesn't really matter
|
||||
if (defenders.size() == 1) {
|
||||
return attackerLists[0];
|
||||
return firstAttacker;
|
||||
}
|
||||
|
||||
final boolean bLifeInDanger = CombatUtil.lifeInDanger(combat);
|
||||
@@ -293,23 +296,23 @@ public class ComputerUtilBlock {
|
||||
// defend planeswalkers with more loyalty before planeswalkers with less
|
||||
// loyalty
|
||||
// if planeswalker will be too difficult to defend don't even bother
|
||||
for (int i = 1; i < attackerLists.length; i++) {
|
||||
for (List<Card> attacker : attackerLists) {
|
||||
// Begin with the attackers that pose the biggest threat
|
||||
CardListUtil.sortAttack(attackerLists[i]);
|
||||
for (final Card c : attackerLists[i]) {
|
||||
CardListUtil.sortAttack(attacker);
|
||||
for (final Card c : attacker) {
|
||||
sortedAttackers.add(c);
|
||||
}
|
||||
}
|
||||
|
||||
if (bLifeInDanger) {
|
||||
// add creatures attacking the Player to the front of the list
|
||||
for (final Card c : attackerLists[0]) {
|
||||
for (final Card c : firstAttacker) {
|
||||
sortedAttackers.add(0, c);
|
||||
}
|
||||
|
||||
} else {
|
||||
// add creatures attacking the Player to the back of the list
|
||||
for (final Card c : attackerLists[0]) {
|
||||
for (final Card c : firstAttacker) {
|
||||
sortedAttackers.add(c);
|
||||
}
|
||||
}
|
||||
@@ -332,7 +335,7 @@ public class ComputerUtilBlock {
|
||||
*/
|
||||
private static Combat makeGoodBlocks(final Combat combat) {
|
||||
|
||||
CardList currentAttackers = new CardList(ComputerUtilBlock.getAttackersLeft());
|
||||
List<Card> currentAttackers = new ArrayList<Card>(ComputerUtilBlock.getAttackersLeft());
|
||||
|
||||
for (final Card attacker : ComputerUtilBlock.getAttackersLeft()) {
|
||||
|
||||
@@ -342,11 +345,11 @@ public class ComputerUtilBlock {
|
||||
|
||||
Card blocker = null;
|
||||
|
||||
final CardList blockers = ComputerUtilBlock.getPossibleBlockers(attacker,
|
||||
final List<Card> blockers = ComputerUtilBlock.getPossibleBlockers(attacker,
|
||||
ComputerUtilBlock.getBlockersLeft(), combat);
|
||||
|
||||
final CardList safeBlockers = ComputerUtilBlock.getSafeBlockers(attacker, blockers, combat);
|
||||
CardList killingBlockers;
|
||||
final List<Card> safeBlockers = ComputerUtilBlock.getSafeBlockers(attacker, blockers, combat);
|
||||
List<Card> killingBlockers;
|
||||
|
||||
if (safeBlockers.size() > 0) {
|
||||
// 1.Blockers that can destroy the attacker but won't get
|
||||
@@ -384,7 +387,7 @@ public class ComputerUtilBlock {
|
||||
combat.addBlocker(attacker, blocker);
|
||||
}
|
||||
}
|
||||
ComputerUtilBlock.setAttackersLeft(new CardList(currentAttackers));
|
||||
ComputerUtilBlock.setAttackersLeft(new ArrayList<Card>(currentAttackers));
|
||||
return combat;
|
||||
}
|
||||
|
||||
@@ -401,15 +404,15 @@ public class ComputerUtilBlock {
|
||||
final static Predicate<Card> 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) {
|
||||
CardList currentAttackers = CardListUtil.filter(ComputerUtilBlock.getAttackersLeft(), Predicates.not(rampagesOrNeedsManyToBlock));
|
||||
CardList blockers;
|
||||
List<Card> currentAttackers = CardListUtil.filter(ComputerUtilBlock.getAttackersLeft(), Predicates.not(rampagesOrNeedsManyToBlock));
|
||||
List<Card> blockers;
|
||||
|
||||
// Try to block an attacker without first strike with a gang of first strikers
|
||||
for (final Card attacker : ComputerUtilBlock.getAttackersLeft()) {
|
||||
if (!attacker.hasKeyword("First Strike") && !attacker.hasKeyword("Double Strike")) {
|
||||
blockers = ComputerUtilBlock.getPossibleBlockers(attacker, ComputerUtilBlock.getBlockersLeft(), combat);
|
||||
final CardList firstStrikeBlockers = new CardList();
|
||||
final CardList blockGang = new CardList();
|
||||
final List<Card> firstStrikeBlockers = new ArrayList<Card>();
|
||||
final List<Card> blockGang = new ArrayList<Card>();
|
||||
for (int i = 0; i < blockers.size(); i++) {
|
||||
if (blockers.get(i).hasFirstStrike() || blockers.get(i).hasDoubleStrike()) {
|
||||
firstStrikeBlockers.add(blockers.get(i));
|
||||
@@ -441,14 +444,14 @@ public class ComputerUtilBlock {
|
||||
}
|
||||
}
|
||||
|
||||
ComputerUtilBlock.setAttackersLeft(new CardList(currentAttackers));
|
||||
currentAttackers = new CardList(ComputerUtilBlock.getAttackersLeft());
|
||||
ComputerUtilBlock.setAttackersLeft(new ArrayList<Card>(currentAttackers));
|
||||
currentAttackers = new ArrayList<Card>(ComputerUtilBlock.getAttackersLeft());
|
||||
|
||||
// Try to block an attacker with two blockers of which only one will die
|
||||
for (final Card attacker : ComputerUtilBlock.getAttackersLeft()) {
|
||||
blockers = ComputerUtilBlock.getPossibleBlockers(attacker, ComputerUtilBlock.getBlockersLeft(), combat);
|
||||
CardList usableBlockers;
|
||||
final CardList blockGang = new CardList();
|
||||
List<Card> usableBlockers;
|
||||
final List<Card> blockGang = new ArrayList<Card>();
|
||||
int absorbedDamage = 0; // The amount of damage needed to kill the
|
||||
// first blocker
|
||||
int currentValue = 0; // The value of the creatures in the blockgang
|
||||
@@ -509,7 +512,7 @@ public class ComputerUtilBlock {
|
||||
}
|
||||
}
|
||||
|
||||
ComputerUtilBlock.setAttackersLeft(new CardList(currentAttackers));
|
||||
ComputerUtilBlock.setAttackersLeft(new ArrayList<Card>(currentAttackers));
|
||||
return combat;
|
||||
}
|
||||
|
||||
@@ -525,8 +528,8 @@ public class ComputerUtilBlock {
|
||||
*/
|
||||
private static Combat makeTradeBlocks(final Combat combat) {
|
||||
|
||||
CardList currentAttackers = new CardList(ComputerUtilBlock.getAttackersLeft());
|
||||
CardList killingBlockers;
|
||||
List<Card> currentAttackers = new ArrayList<Card>(ComputerUtilBlock.getAttackersLeft());
|
||||
List<Card> killingBlockers;
|
||||
|
||||
for (final Card attacker : ComputerUtilBlock.getAttackersLeft()) {
|
||||
|
||||
@@ -543,7 +546,7 @@ public class ComputerUtilBlock {
|
||||
currentAttackers.remove(attacker);
|
||||
}
|
||||
}
|
||||
ComputerUtilBlock.setAttackersLeft(new CardList(currentAttackers));
|
||||
ComputerUtilBlock.setAttackersLeft(new ArrayList<Card>(currentAttackers));
|
||||
return combat;
|
||||
}
|
||||
|
||||
@@ -559,8 +562,8 @@ public class ComputerUtilBlock {
|
||||
*/
|
||||
private static Combat makeChumpBlocks(final Combat combat) {
|
||||
|
||||
CardList currentAttackers = new CardList(ComputerUtilBlock.getAttackersLeft());
|
||||
CardList chumpBlockers;
|
||||
List<Card> currentAttackers = new ArrayList<Card>(ComputerUtilBlock.getAttackersLeft());
|
||||
List<Card> chumpBlockers;
|
||||
|
||||
for (final Card attacker : ComputerUtilBlock.getAttackersLeft()) {
|
||||
|
||||
@@ -578,7 +581,7 @@ public class ComputerUtilBlock {
|
||||
ComputerUtilBlock.getBlockedButUnkilled().add(attacker);
|
||||
}
|
||||
}
|
||||
ComputerUtilBlock.setAttackersLeft(new CardList(currentAttackers));
|
||||
ComputerUtilBlock.setAttackersLeft(new ArrayList<Card>(currentAttackers));
|
||||
return combat;
|
||||
}
|
||||
|
||||
@@ -595,9 +598,9 @@ public class ComputerUtilBlock {
|
||||
*/
|
||||
private static Combat reinforceBlockersAgainstTrample(final Combat combat) {
|
||||
|
||||
CardList chumpBlockers;
|
||||
List<Card> chumpBlockers;
|
||||
|
||||
CardList tramplingAttackers = CardListUtil.getKeyword(ComputerUtilBlock.getAttackers(), "Trample");
|
||||
List<Card> tramplingAttackers = CardListUtil.getKeyword(ComputerUtilBlock.getAttackers(), "Trample");
|
||||
tramplingAttackers = CardListUtil.filter(tramplingAttackers, Predicates.not(rampagesOrNeedsManyToBlock));
|
||||
|
||||
// TODO - should check here for a "rampage-like" trigger that replaced
|
||||
@@ -642,10 +645,10 @@ public class ComputerUtilBlock {
|
||||
*/
|
||||
private static Combat reinforceBlockersToKill(final Combat combat) {
|
||||
|
||||
CardList safeBlockers;
|
||||
CardList blockers;
|
||||
List<Card> safeBlockers;
|
||||
List<Card> blockers;
|
||||
|
||||
CardList targetAttackers = CardListUtil.filter(ComputerUtilBlock.getBlockedButUnkilled(), Predicates.not(rampagesOrNeedsManyToBlock));
|
||||
List<Card> targetAttackers = CardListUtil.filter(ComputerUtilBlock.getBlockedButUnkilled(), Predicates.not(rampagesOrNeedsManyToBlock));
|
||||
|
||||
// TODO - should check here for a "rampage-like" trigger that replaced
|
||||
// the keyword:
|
||||
@@ -678,7 +681,7 @@ public class ComputerUtilBlock {
|
||||
safeBlockers = CardListUtil.getKeyword(blockers, "First Strike");
|
||||
safeBlockers.addAll(CardListUtil.getKeyword(blockers, "Double Strike"));
|
||||
} else {
|
||||
safeBlockers = new CardList(blockers);
|
||||
safeBlockers = new ArrayList<Card>(blockers);
|
||||
}
|
||||
|
||||
for (final Card blocker : safeBlockers) {
|
||||
@@ -712,25 +715,25 @@ public class ComputerUtilBlock {
|
||||
* a {@link forge.CardList} object.
|
||||
* @return a {@link forge.game.phase.Combat} object.
|
||||
*/
|
||||
private static Combat resetBlockers(final Combat combat, final CardList possibleBlockers) {
|
||||
private static Combat resetBlockers(final Combat combat, final List<Card> possibleBlockers) {
|
||||
|
||||
final CardList oldBlockers = combat.getAllBlockers();
|
||||
final List<Card> oldBlockers = combat.getAllBlockers();
|
||||
for (final Card blocker : oldBlockers) {
|
||||
combat.removeFromCombat(blocker);
|
||||
}
|
||||
|
||||
ComputerUtilBlock.setAttackersLeft(new CardList(ComputerUtilBlock.getAttackers())); // keeps
|
||||
ComputerUtilBlock.setAttackersLeft(new ArrayList<Card>(ComputerUtilBlock.getAttackers())); // keeps
|
||||
// track
|
||||
// of all
|
||||
// currently
|
||||
// unblocked
|
||||
// attackers
|
||||
ComputerUtilBlock.setBlockersLeft(new CardList(possibleBlockers)); // keeps
|
||||
ComputerUtilBlock.setBlockersLeft(new ArrayList<Card>(possibleBlockers)); // keeps
|
||||
// track of
|
||||
// all
|
||||
// unassigned
|
||||
// blockers
|
||||
ComputerUtilBlock.setBlockedButUnkilled(new CardList()); // keeps track
|
||||
ComputerUtilBlock.setBlockedButUnkilled(new ArrayList<Card>()); // keeps track
|
||||
// of all
|
||||
// blocked
|
||||
// attackers that currently
|
||||
@@ -751,7 +754,7 @@ public class ComputerUtilBlock {
|
||||
* a {@link forge.CardList} object.
|
||||
* @return a {@link forge.game.phase.Combat} object.
|
||||
*/
|
||||
public static Combat getBlockers(final Combat originalCombat, final CardList possibleBlockers) {
|
||||
public static Combat getBlockers(final Combat originalCombat, final List<Card> possibleBlockers) {
|
||||
|
||||
Combat combat = originalCombat;
|
||||
|
||||
@@ -762,13 +765,13 @@ public class ComputerUtilBlock {
|
||||
}
|
||||
|
||||
// keeps track of all currently unblocked attackers
|
||||
ComputerUtilBlock.setAttackersLeft(new CardList(ComputerUtilBlock.getAttackers()));
|
||||
ComputerUtilBlock.setAttackersLeft(new ArrayList<Card>(ComputerUtilBlock.getAttackers()));
|
||||
// keeps track of all unassigned blockers
|
||||
ComputerUtilBlock.setBlockersLeft(new CardList(possibleBlockers));
|
||||
ComputerUtilBlock.setBlockersLeft(new ArrayList<Card>(possibleBlockers));
|
||||
// keeps track of all blocked attackers that currently wouldn't be destroyed
|
||||
ComputerUtilBlock.setBlockedButUnkilled(new CardList());
|
||||
CardList blockers;
|
||||
CardList chumpBlockers;
|
||||
ComputerUtilBlock.setBlockedButUnkilled(new ArrayList<Card>());
|
||||
List<Card> blockers;
|
||||
List<Card> chumpBlockers;
|
||||
|
||||
ComputerUtilBlock.setDiff((AllZone.getComputerPlayer().getLife() * 2) - 5); // This
|
||||
// is
|
||||
@@ -909,7 +912,7 @@ public class ComputerUtilBlock {
|
||||
return combat;
|
||||
}
|
||||
|
||||
public static CardList orderBlockers(Card attacker, CardList blockers) {
|
||||
public static List<Card> orderBlockers(Card attacker, List<Card> blockers) {
|
||||
// very very simple ordering of blockers, sort by evaluate, then sort by attack
|
||||
//final int damage = attacker.getNetCombatDamage();
|
||||
CardListUtil.sortByEvaluateCreature(blockers);
|
||||
@@ -921,7 +924,7 @@ public class ComputerUtilBlock {
|
||||
return blockers;
|
||||
}
|
||||
|
||||
public static CardList orderAttackers(Card attacker, CardList blockers) {
|
||||
public static List<Card> orderAttackers(Card attacker, List<Card> blockers) {
|
||||
// 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();
|
||||
|
||||
@@ -17,9 +17,12 @@
|
||||
*/
|
||||
package forge.game.player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import forge.AllZone;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.Singletons;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
import forge.control.input.Input;
|
||||
@@ -148,11 +151,11 @@ public class HumanPlayer extends Player {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final CardList discard(final int num, final SpellAbility sa, final boolean duringResolution) {
|
||||
public final List<Card> discard(final int num, final SpellAbility sa, final boolean duringResolution) {
|
||||
AllZone.getInputControl().setInput(PlayerUtil.inputDiscard(num, sa), duringResolution);
|
||||
|
||||
// why is CardList returned?
|
||||
return new CardList();
|
||||
// why is List<Card> returned?
|
||||
return new ArrayList<Card>();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@@ -178,7 +181,7 @@ public class HumanPlayer extends Player {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected final void doScry(final CardList topN, final int n) {
|
||||
protected final void doScry(final List<Card> topN, final int n) {
|
||||
int num = n;
|
||||
for (int i = 0; i < num; i++) {
|
||||
final Card c = GuiChoose.oneOrNone("Put on bottom of library.", topN);
|
||||
@@ -203,7 +206,7 @@ public class HumanPlayer extends Player {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void sacrificePermanent(final String prompt, final CardList choices) {
|
||||
public final void sacrificePermanent(final String prompt, final List<Card> choices) {
|
||||
final Input in = PlayerUtil.inputSacrificePermanent(choices, prompt);
|
||||
AllZone.getInputControl().setInput(in);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ import com.google.common.collect.Iterables;
|
||||
import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.Card;
|
||||
import forge.CardList;
|
||||
|
||||
import forge.CardListUtil;
|
||||
import forge.CardPredicates;
|
||||
import forge.CardUtil;
|
||||
@@ -124,7 +124,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
private int numDrawnThisTurn = 0;
|
||||
|
||||
/** The slowtrip list. */
|
||||
private CardList slowtripList = new CardList();
|
||||
private List<Card> slowtripList = new ArrayList<Card>();
|
||||
|
||||
/** The keywords. */
|
||||
private ArrayList<String> keywords = new ArrayList<String>();
|
||||
@@ -199,7 +199,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
this.setPreventNextDamage(0);
|
||||
this.lastDrawnCard = null;
|
||||
this.numDrawnThisTurn = 0;
|
||||
this.slowtripList = new CardList();
|
||||
this.slowtripList = new ArrayList<Card>();
|
||||
this.nTurns = 0;
|
||||
this.altWin = false;
|
||||
this.altWinSourceName = null;
|
||||
@@ -647,7 +647,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
}
|
||||
|
||||
// Prevent Damage static abilities
|
||||
final CardList allp = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> allp = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
for (final Card ca : allp) {
|
||||
final ArrayList<StaticAbility> staticAbilities = ca.getStaticAbilities();
|
||||
for (final StaticAbility stAb : staticAbilities) {
|
||||
@@ -784,7 +784,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
|
||||
if (AllZoneUtil.isCardInPlay("Crumbling Sanctuary")) {
|
||||
for (int i = 0; i < damage; i++) {
|
||||
final CardList lib = this.getCardsIn(ZoneType.Library);
|
||||
final List<Card> lib = this.getCardsIn(ZoneType.Library);
|
||||
if (lib.size() > 0) {
|
||||
Singletons.getModel().getGameAction().exile(lib.get(0));
|
||||
}
|
||||
@@ -1159,9 +1159,9 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
* drawCard.
|
||||
* </p>
|
||||
*
|
||||
* @return a CardList of cards actually drawn
|
||||
* @return a List<Card> of cards actually drawn
|
||||
*/
|
||||
public final CardList drawCard() {
|
||||
public final List<Card> drawCard() {
|
||||
return this.drawCards(1);
|
||||
}
|
||||
|
||||
@@ -1170,9 +1170,9 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
* drawCards.
|
||||
* </p>
|
||||
*
|
||||
* @return a CardList of cards actually drawn
|
||||
* @return a List<Card> of cards actually drawn
|
||||
*/
|
||||
public final CardList drawCards() {
|
||||
public final List<Card> drawCards() {
|
||||
return this.drawCards(1);
|
||||
}
|
||||
|
||||
@@ -1192,9 +1192,9 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
*
|
||||
* @param n
|
||||
* a int.
|
||||
* @return a CardList of cards actually drawn
|
||||
* @return a List<Card> of cards actually drawn
|
||||
*/
|
||||
public final CardList drawCards(final int n) {
|
||||
public final List<Card> drawCards(final int n) {
|
||||
return this.drawCards(n, false);
|
||||
}
|
||||
|
||||
@@ -1208,10 +1208,10 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
* @param firstFromDraw
|
||||
* true if this is the card drawn from that player's draw step
|
||||
* each turn
|
||||
* @return a CardList of cards actually drawn
|
||||
* @return a List<Card> of cards actually drawn
|
||||
*/
|
||||
public final CardList drawCards(final int n, final boolean firstFromDraw) {
|
||||
final CardList drawn = new CardList();
|
||||
public final List<Card> drawCards(final int n, final boolean firstFromDraw) {
|
||||
final List<Card> drawn = new ArrayList<Card>();
|
||||
|
||||
if (!this.canDraw()) {
|
||||
return drawn;
|
||||
@@ -1250,10 +1250,10 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
* doDraw.
|
||||
* </p>
|
||||
*
|
||||
* @return a CardList of cards actually drawn
|
||||
* @return a List<Card> of cards actually drawn
|
||||
*/
|
||||
private CardList doDraw() {
|
||||
final CardList drawn = new CardList();
|
||||
private List<Card> doDraw() {
|
||||
final List<Card> drawn = new ArrayList<Card>();
|
||||
final PlayerZone library = this.getZone(ZoneType.Library);
|
||||
|
||||
// Replacement effects
|
||||
@@ -1273,7 +1273,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
|
||||
if ((this.numDrawnThisTurn == 0) && this.isComputer()) {
|
||||
boolean reveal = false;
|
||||
final CardList cards = this.getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> cards = this.getCardsIn(ZoneType.Battlefield);
|
||||
for (final Card card : cards) {
|
||||
if (card.hasKeyword("Reveal the first card you draw each turn")) {
|
||||
reveal = true;
|
||||
@@ -1327,15 +1327,15 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
|
||||
/**
|
||||
* gets a list of all cards in the requested zone. This function makes a
|
||||
* CardList from Card[].
|
||||
* List<Card> from Card[].
|
||||
*
|
||||
* @param zone
|
||||
* the zone
|
||||
* @return a CardList with all the cards currently in requested zone
|
||||
* @return a List<Card> with all the cards currently in requested zone
|
||||
*/
|
||||
public final CardList getCardsIn(final ZoneType zone) {
|
||||
public final List<Card> getCardsIn(final ZoneType zone) {
|
||||
final List<Card> cards = zone == ZoneType.Stack ? AllZone.getStackZone().getCards() : this.getZone(zone).getCards();
|
||||
return new CardList(cards);
|
||||
return new ArrayList<Card>(cards);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1343,7 +1343,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
*
|
||||
* @return the all cards
|
||||
*/
|
||||
public final CardList getAllCards() {
|
||||
public final List<Card> getAllCards() {
|
||||
return this.getCardsIn(Player.ALL_ZONES);
|
||||
}
|
||||
|
||||
@@ -1354,24 +1354,24 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
* the zone
|
||||
* @return the cards include phasing in
|
||||
*/
|
||||
public final CardList getCardsIncludePhasingIn(final ZoneType zone) {
|
||||
public final List<Card> getCardsIncludePhasingIn(final ZoneType zone) {
|
||||
final List<Card> cards = zone == ZoneType.Stack ? AllZone.getStackZone().getCards() : this.getZone(zone)
|
||||
.getCards(false);
|
||||
return new CardList(cards);
|
||||
return new ArrayList<Card>(cards);
|
||||
}
|
||||
|
||||
/**
|
||||
* gets a list of first N cards in the requested zone. This function makes a
|
||||
* CardList from Card[].
|
||||
* List<Card> from Card[].
|
||||
*
|
||||
* @param zone
|
||||
* the zone
|
||||
* @param n
|
||||
* the n
|
||||
* @return a CardList with all the cards currently in requested zone
|
||||
* @return a List<Card> with all the cards currently in requested zone
|
||||
*/
|
||||
public final CardList getCardsIn(final ZoneType zone, final int n) {
|
||||
return new CardList(this.getZone(zone).getCards(n));
|
||||
public final List<Card> getCardsIn(final ZoneType zone, final int n) {
|
||||
return new ArrayList<Card>(this.getZone(zone).getCards(n));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1379,10 +1379,10 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
*
|
||||
* @param zones
|
||||
* the zones
|
||||
* @return a CardList with all the cards currently in requested zones
|
||||
* @return a List<Card> with all the cards currently in requested zones
|
||||
*/
|
||||
public final CardList getCardsIn(final List<ZoneType> zones) {
|
||||
final CardList result = new CardList();
|
||||
public final List<Card> getCardsIn(final List<ZoneType> zones) {
|
||||
final List<Card> result = new ArrayList<Card>();
|
||||
for (final ZoneType z : zones) {
|
||||
if (z == ZoneType.Stack) {
|
||||
for (Card c : AllZone.getStackZone().getCards()) {
|
||||
@@ -1399,8 +1399,8 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
return result;
|
||||
}
|
||||
|
||||
public final CardList getCardsIn(final ZoneType... zones) {
|
||||
final CardList result = new CardList();
|
||||
public final List<Card> getCardsIn(final ZoneType... zones) {
|
||||
final List<Card> result = new ArrayList<Card>();
|
||||
for (final ZoneType z : zones) {
|
||||
if (this.getZone(z) != null) {
|
||||
result.addAll(this.getZone(z).getCards());
|
||||
@@ -1410,15 +1410,15 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
}
|
||||
/**
|
||||
* gets a list of all cards with requested cardName in a given player's
|
||||
* requested zone. This function makes a CardList from Card[].
|
||||
* requested zone. This function makes a List<Card> from Card[].
|
||||
*
|
||||
* @param zone
|
||||
* the zone
|
||||
* @param cardName
|
||||
* the card name
|
||||
* @return a CardList with all the cards currently in that player's library
|
||||
* @return a List<Card> with all the cards currently in that player's library
|
||||
*/
|
||||
public final CardList getCardsIn(final ZoneType zone, final String cardName) {
|
||||
public final List<Card> getCardsIn(final ZoneType zone, final String cardName) {
|
||||
return CardListUtil.filter(this.getCardsIn(zone), CardPredicates.nameEquals(cardName));
|
||||
}
|
||||
|
||||
@@ -1429,9 +1429,9 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
*
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
protected final CardList getDredge() {
|
||||
final CardList dredge = new CardList();
|
||||
final CardList cl = this.getCardsIn(ZoneType.Graveyard);
|
||||
protected final List<Card> getDredge() {
|
||||
final List<Card> dredge = new ArrayList<Card>();
|
||||
final List<Card> cl = this.getCardsIn(ZoneType.Graveyard);
|
||||
|
||||
for (final Card c : cl) {
|
||||
final ArrayList<String> kw = c.getKeyword();
|
||||
@@ -1514,7 +1514,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
* a boolean.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public abstract CardList discard(final int num, final SpellAbility sa, boolean duringResolution);
|
||||
public abstract List<Card> discard(final int num, final SpellAbility sa, boolean duringResolution);
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -1525,7 +1525,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
* a {@link forge.card.spellability.SpellAbility} object.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public final CardList discard(final SpellAbility sa) {
|
||||
public final List<Card> discard(final SpellAbility sa) {
|
||||
return this.discard(1, sa, false);
|
||||
}
|
||||
|
||||
@@ -1540,9 +1540,9 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
* a {@link forge.card.spellability.SpellAbility} object.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public final CardList discard(final Card c, final SpellAbility sa) {
|
||||
public final List<Card> discard(final Card c, final SpellAbility sa) {
|
||||
this.doDiscard(c, sa);
|
||||
return new CardList(c);
|
||||
return CardListUtil.createCardList(c);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1596,8 +1596,8 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
* a {@link forge.card.spellability.SpellAbility} object.
|
||||
* @return the card list
|
||||
*/
|
||||
public final CardList discardHand(final SpellAbility sa) {
|
||||
final CardList list = this.getCardsIn(ZoneType.Hand);
|
||||
public final List<Card> discardHand(final SpellAbility sa) {
|
||||
final List<Card> list = this.getCardsIn(ZoneType.Hand);
|
||||
this.discardRandom(list.size(), sa);
|
||||
return list;
|
||||
}
|
||||
@@ -1609,9 +1609,9 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
*
|
||||
* @param sa
|
||||
* a {@link forge.card.spellability.SpellAbility} object.
|
||||
* @return a CardList of cards discarded
|
||||
* @return a List<Card> of cards discarded
|
||||
*/
|
||||
public final CardList discardRandom(final SpellAbility sa) {
|
||||
public final List<Card> discardRandom(final SpellAbility sa) {
|
||||
return this.discardRandom(1, sa);
|
||||
}
|
||||
|
||||
@@ -1624,9 +1624,9 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
* a int.
|
||||
* @param sa
|
||||
* a {@link forge.card.spellability.SpellAbility} object.
|
||||
* @return a CardList of cards discarded
|
||||
* @return a List<Card> of cards discarded
|
||||
*/
|
||||
public final CardList discardRandom(final int num, final SpellAbility sa) {
|
||||
public final List<Card> discardRandom(final int num, final SpellAbility sa) {
|
||||
return this.discardRandom(num, sa, "Card");
|
||||
}
|
||||
|
||||
@@ -1641,12 +1641,12 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
* a {@link forge.card.spellability.SpellAbility} object.
|
||||
* @param valid
|
||||
* a valid expression
|
||||
* @return a CardList of cards discarded
|
||||
* @return a List<Card> of cards discarded
|
||||
*/
|
||||
public final CardList discardRandom(final int num, final SpellAbility sa, final String valid) {
|
||||
final CardList discarded = new CardList();
|
||||
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++) {
|
||||
CardList list = this.getCardsIn(ZoneType.Hand);
|
||||
List<Card> list = this.getCardsIn(ZoneType.Hand);
|
||||
list = CardListUtil.getValidCards(list, valid, sa.getSourceCard().getController(), sa.getSourceCard());
|
||||
if (list.size() != 0) {
|
||||
final Card disc = CardUtil.getRandom(list);
|
||||
@@ -1680,7 +1680,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
* a int.
|
||||
* @return the card list
|
||||
*/
|
||||
public final CardList mill(final int n) {
|
||||
public final List<Card> mill(final int n) {
|
||||
return this.mill(n, ZoneType.Graveyard, false);
|
||||
}
|
||||
|
||||
@@ -1697,9 +1697,9 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
* a boolean.
|
||||
* @return the card list
|
||||
*/
|
||||
public final CardList mill(final int n, final ZoneType zone, final boolean bottom) {
|
||||
final CardList lib = this.getCardsIn(ZoneType.Library);
|
||||
final CardList milled = new CardList();
|
||||
public final List<Card> mill(final int n, final ZoneType zone, final boolean bottom) {
|
||||
final List<Card> lib = this.getCardsIn(ZoneType.Library);
|
||||
final List<Card> milled = new ArrayList<Card>();
|
||||
|
||||
final int max = Math.min(n, lib.size());
|
||||
|
||||
@@ -1773,7 +1773,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
* @param n
|
||||
* a int.
|
||||
*/
|
||||
protected abstract void doScry(CardList topN, int n);
|
||||
protected abstract void doScry(List<Card> topN, int n);
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -1784,7 +1784,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
* a int.
|
||||
*/
|
||||
public final void scry(int numScry) {
|
||||
final CardList topN = new CardList();
|
||||
final List<Card> topN = new ArrayList<Card>();
|
||||
final PlayerZone library = this.getZone(ZoneType.Library);
|
||||
numScry = Math.min(numScry, library.size());
|
||||
for (int i = 0; i < numScry; i++) {
|
||||
@@ -1841,7 +1841,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
}
|
||||
|
||||
// CantBeCast static abilities
|
||||
final CardList allp = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
final List<Card> allp = AllZoneUtil.getCardsIn(ZoneType.Battlefield);
|
||||
for (final Card ca : allp) {
|
||||
final ArrayList<StaticAbility> staticAbilities = ca.getStaticAbilities();
|
||||
for (final StaticAbility stAb : staticAbilities) {
|
||||
@@ -1889,7 +1889,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
* @return a {@link forge.Card} object.
|
||||
*/
|
||||
public final Card getPlaneswalker() {
|
||||
final CardList c = CardListUtil.filter(this.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.PLANEWALKERS);
|
||||
final List<Card> c = CardListUtil.filter(this.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.PLANEWALKERS);
|
||||
if ((null != c) && (c.size() > 0)) {
|
||||
return c.get(0);
|
||||
} else {
|
||||
@@ -1990,7 +1990,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
*
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public final CardList getSlowtripList() {
|
||||
public final List<Card> getSlowtripList() {
|
||||
return this.slowtripList;
|
||||
}
|
||||
|
||||
@@ -2100,7 +2100,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
* @param choices
|
||||
* a {@link forge.CardList} object.
|
||||
*/
|
||||
public abstract void sacrificePermanent(String prompt, CardList choices);
|
||||
public abstract void sacrificePermanent(String prompt, List<Card> choices);
|
||||
|
||||
// Game win/loss
|
||||
|
||||
@@ -2287,7 +2287,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
* @return a boolean.
|
||||
*/
|
||||
public final boolean hasMetalcraft() {
|
||||
final CardList list = CardListUtil.filter(this.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.ARTIFACTS);
|
||||
final List<Card> list = CardListUtil.filter(this.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.ARTIFACTS);
|
||||
return list.size() >= 3;
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user