mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Commonly used CardFilters moved to CardListFilter file
This commit is contained in:
@@ -30,7 +30,7 @@ public final class AllZoneUtil {
|
|||||||
*/
|
*/
|
||||||
public static CardList getCreaturesInPlay(final Player player) {
|
public static CardList getCreaturesInPlay(final Player player) {
|
||||||
CardList creats = player.getCardsIn(Zone.Battlefield);
|
CardList creats = player.getCardsIn(Zone.Battlefield);
|
||||||
return creats.filter(AllZoneUtil.creatures);
|
return creats.filter(CardListFilter.creatures);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -108,7 +108,7 @@ public final class AllZoneUtil {
|
|||||||
*/
|
*/
|
||||||
public static CardList getCreaturesInPlay() {
|
public static CardList getCreaturesInPlay() {
|
||||||
CardList creats = getCardsIn(Zone.Battlefield);
|
CardList creats = getCardsIn(Zone.Battlefield);
|
||||||
return creats.filter(AllZoneUtil.creatures);
|
return creats.filter(CardListFilter.creatures);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////// Lands
|
///////////////// Lands
|
||||||
@@ -121,7 +121,7 @@ public final class AllZoneUtil {
|
|||||||
*/
|
*/
|
||||||
public static CardList getPlayerLandsInPlay(final Player player) {
|
public static CardList getPlayerLandsInPlay(final Player player) {
|
||||||
CardList cards = player.getCardsIn(Zone.Battlefield);
|
CardList cards = player.getCardsIn(Zone.Battlefield);
|
||||||
return cards.filter(lands);
|
return cards.filter(CardListFilter.lands);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -131,7 +131,7 @@ public final class AllZoneUtil {
|
|||||||
*/
|
*/
|
||||||
public static CardList getLandsInPlay() {
|
public static CardList getLandsInPlay() {
|
||||||
CardList cards = getCardsIn(Zone.Battlefield);
|
CardList cards = getCardsIn(Zone.Battlefield);
|
||||||
return cards.filter(lands);
|
return cards.filter(CardListFilter.lands);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@@ -345,141 +345,7 @@ public final class AllZoneUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* a CardListFilter to get all cards that are tapped.
|
|
||||||
*/
|
|
||||||
public static final CardListFilter tapped = new CardListFilter() {
|
|
||||||
public boolean addCard(final Card c) {
|
|
||||||
return c.isTapped();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* a CardListFilter to get all cards that are untapped.
|
|
||||||
*/
|
|
||||||
public static final CardListFilter untapped = new CardListFilter() {
|
|
||||||
public boolean addCard(final Card c) {
|
|
||||||
return c.isUntapped();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* a CardListFilter to get all creatures.
|
|
||||||
*/
|
|
||||||
public static final CardListFilter creatures = new CardListFilter() {
|
|
||||||
public boolean addCard(final Card c) {
|
|
||||||
return c.isCreature();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* a CardListFilter to get all enchantments.
|
|
||||||
*/
|
|
||||||
public static final CardListFilter enchantments = new CardListFilter() {
|
|
||||||
public boolean addCard(final Card c) {
|
|
||||||
return c.isEnchantment();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* a CardListFilter to get all equipment.
|
|
||||||
*/
|
|
||||||
public static final CardListFilter equipment = new CardListFilter() {
|
|
||||||
public boolean addCard(final Card c) {
|
|
||||||
return c.isEquipment();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* a CardListFilter to get all unenchanted cards in a list.
|
|
||||||
*/
|
|
||||||
public static final CardListFilter unenchanted = new CardListFilter() {
|
|
||||||
public boolean addCard(final Card c) {
|
|
||||||
return !c.isEnchanted();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* a CardListFilter to get all enchanted cards in a list.
|
|
||||||
*/
|
|
||||||
public static final CardListFilter enchanted = new CardListFilter() {
|
|
||||||
public boolean addCard(final Card c) {
|
|
||||||
return c.isEnchanted();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* a CardListFilter to get all nontoken cards.
|
|
||||||
*/
|
|
||||||
public static final CardListFilter nonToken = new CardListFilter() {
|
|
||||||
public boolean addCard(final Card c) {
|
|
||||||
return !c.isToken();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* a CardListFilter to get all token cards.
|
|
||||||
*/
|
|
||||||
public static final CardListFilter token = new CardListFilter() {
|
|
||||||
public boolean addCard(final Card c) {
|
|
||||||
return c.isToken();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* a CardListFilter to get all nonbasic lands.
|
|
||||||
*/
|
|
||||||
public static final CardListFilter nonBasicLand = new CardListFilter() {
|
|
||||||
public boolean addCard(final Card c) {
|
|
||||||
return !c.isBasicLand();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* a CardListFilter to get all basicLands.
|
|
||||||
*/
|
|
||||||
public static final CardListFilter basicLands = new CardListFilter() {
|
|
||||||
public boolean addCard(final Card c) {
|
|
||||||
//the isBasicLand() check here may be sufficient...
|
|
||||||
return c.isLand() && c.isBasicLand();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* a CardListFilter to get all artifacts.
|
|
||||||
*/
|
|
||||||
public static final CardListFilter artifacts = new CardListFilter() {
|
|
||||||
public boolean addCard(final Card c) {
|
|
||||||
return c.isArtifact();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* a CardListFilter to get all nonartifacts.
|
|
||||||
*/
|
|
||||||
public static final CardListFilter nonartifacts = new CardListFilter() {
|
|
||||||
public boolean addCard(final Card c) {
|
|
||||||
return !c.isArtifact();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* a CardListFilter to get all lands.
|
|
||||||
*/
|
|
||||||
public static final CardListFilter lands = new CardListFilter() {
|
|
||||||
public boolean addCard(final Card c) {
|
|
||||||
return c.isLand();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* a CardListFilter to get all nonlands.
|
|
||||||
*/
|
|
||||||
public static final CardListFilter nonlands = new CardListFilter() {
|
|
||||||
public boolean addCard(final Card c) {
|
|
||||||
return !c.isLand();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get a CardListFilter to filter in only cards that can be targeted.
|
* get a CardListFilter to filter in only cards that can be targeted.
|
||||||
@@ -526,51 +392,6 @@ public final class AllZoneUtil {
|
|||||||
return filter;
|
return filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* a CardListFilter to get all cards that are black.
|
|
||||||
*/
|
|
||||||
public static final CardListFilter black = new CardListFilter() {
|
|
||||||
public boolean addCard(final Card c) {
|
|
||||||
return c.isBlack();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* a CardListFilter to get all cards that are blue.
|
|
||||||
*/
|
|
||||||
public static final CardListFilter blue = new CardListFilter() {
|
|
||||||
public boolean addCard(final Card c) {
|
|
||||||
return c.isBlue();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* a CardListFilter to get all cards that are green.
|
|
||||||
*/
|
|
||||||
public static final CardListFilter green = new CardListFilter() {
|
|
||||||
public boolean addCard(final Card c) {
|
|
||||||
return c.isGreen();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* a CardListFilter to get all cards that are red.
|
|
||||||
*/
|
|
||||||
public static final CardListFilter red = new CardListFilter() {
|
|
||||||
public boolean addCard(final Card c) {
|
|
||||||
return c.isRed();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* a CardListFilter to get all cards that are white.
|
|
||||||
*/
|
|
||||||
public static final CardListFilter white = new CardListFilter() {
|
|
||||||
public boolean addCard(final Card c) {
|
|
||||||
return c.isWhite();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* a CardListFilter to get all cards that are a part of this game.
|
* a CardListFilter to get all cards that are a part of this game.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import java.util.TreeMap;
|
|||||||
import com.esotericsoftware.minlog.Log;
|
import com.esotericsoftware.minlog.Log;
|
||||||
|
|
||||||
import forge.Constant.Zone;
|
import forge.Constant.Zone;
|
||||||
import forge.card.abilityFactory.AbilityFactory;
|
|
||||||
import forge.card.cardFactory.CardFactoryUtil;
|
import forge.card.cardFactory.CardFactoryUtil;
|
||||||
import forge.card.cost.Cost;
|
import forge.card.cost.Cost;
|
||||||
import forge.card.mana.ManaCost;
|
import forge.card.mana.ManaCost;
|
||||||
|
|||||||
@@ -14,4 +14,187 @@ public interface CardListFilter {
|
|||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
boolean addCard(Card c);
|
boolean addCard(Card c);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a CardListFilter to get all cards that are tapped.
|
||||||
|
*/
|
||||||
|
public static final CardListFilter tapped = new CardListFilter() {
|
||||||
|
public boolean addCard(final Card c) {
|
||||||
|
return c.isTapped();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a CardListFilter to get all cards that are untapped.
|
||||||
|
*/
|
||||||
|
public static final CardListFilter untapped = new CardListFilter() {
|
||||||
|
public boolean addCard(final Card c) {
|
||||||
|
return c.isUntapped();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a CardListFilter to get all creatures.
|
||||||
|
*/
|
||||||
|
public static final CardListFilter creatures = new CardListFilter() {
|
||||||
|
public boolean addCard(final Card c) {
|
||||||
|
return c.isCreature();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a CardListFilter to get all enchantments.
|
||||||
|
*/
|
||||||
|
public static final CardListFilter enchantments = new CardListFilter() {
|
||||||
|
public boolean addCard(final Card c) {
|
||||||
|
return c.isEnchantment();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a CardListFilter to get all equipment.
|
||||||
|
*/
|
||||||
|
public static final CardListFilter equipment = new CardListFilter() {
|
||||||
|
public boolean addCard(final Card c) {
|
||||||
|
return c.isEquipment();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a CardListFilter to get all unenchanted cards in a list.
|
||||||
|
*/
|
||||||
|
public static final CardListFilter unenchanted = new CardListFilter() {
|
||||||
|
public boolean addCard(final Card c) {
|
||||||
|
return !c.isEnchanted();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a CardListFilter to get all enchanted cards in a list.
|
||||||
|
*/
|
||||||
|
public static final CardListFilter enchanted = new CardListFilter() {
|
||||||
|
public boolean addCard(final Card c) {
|
||||||
|
return c.isEnchanted();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a CardListFilter to get all nontoken cards.
|
||||||
|
*/
|
||||||
|
public static final CardListFilter nonToken = new CardListFilter() {
|
||||||
|
public boolean addCard(final Card c) {
|
||||||
|
return !c.isToken();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a CardListFilter to get all token cards.
|
||||||
|
*/
|
||||||
|
public static final CardListFilter token = new CardListFilter() {
|
||||||
|
public boolean addCard(final Card c) {
|
||||||
|
return c.isToken();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a CardListFilter to get all nonbasic lands.
|
||||||
|
*/
|
||||||
|
public static final CardListFilter nonBasicLand = new CardListFilter() {
|
||||||
|
public boolean addCard(final Card c) {
|
||||||
|
return !c.isBasicLand();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a CardListFilter to get all basicLands.
|
||||||
|
*/
|
||||||
|
public static final CardListFilter basicLands = new CardListFilter() {
|
||||||
|
public boolean addCard(final Card c) {
|
||||||
|
//the isBasicLand() check here may be sufficient...
|
||||||
|
return c.isLand() && c.isBasicLand();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a CardListFilter to get all artifacts.
|
||||||
|
*/
|
||||||
|
public static final CardListFilter artifacts = new CardListFilter() {
|
||||||
|
public boolean addCard(final Card c) {
|
||||||
|
return c.isArtifact();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a CardListFilter to get all nonartifacts.
|
||||||
|
*/
|
||||||
|
public static final CardListFilter nonartifacts = new CardListFilter() {
|
||||||
|
public boolean addCard(final Card c) {
|
||||||
|
return !c.isArtifact();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a CardListFilter to get all lands.
|
||||||
|
*/
|
||||||
|
public static final CardListFilter lands = new CardListFilter() {
|
||||||
|
public boolean addCard(final Card c) {
|
||||||
|
return c.isLand();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a CardListFilter to get all nonlands.
|
||||||
|
*/
|
||||||
|
public static final CardListFilter nonlands = new CardListFilter() {
|
||||||
|
public boolean addCard(final Card c) {
|
||||||
|
return !c.isLand();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a CardListFilter to get all cards that are black.
|
||||||
|
*/
|
||||||
|
public static final CardListFilter black = new CardListFilter() {
|
||||||
|
public boolean addCard(final Card c) {
|
||||||
|
return c.isBlack();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a CardListFilter to get all cards that are blue.
|
||||||
|
*/
|
||||||
|
public static final CardListFilter blue = new CardListFilter() {
|
||||||
|
public boolean addCard(final Card c) {
|
||||||
|
return c.isBlue();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a CardListFilter to get all cards that are green.
|
||||||
|
*/
|
||||||
|
public static final CardListFilter green = new CardListFilter() {
|
||||||
|
public boolean addCard(final Card c) {
|
||||||
|
return c.isGreen();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a CardListFilter to get all cards that are red.
|
||||||
|
*/
|
||||||
|
public static final CardListFilter red = new CardListFilter() {
|
||||||
|
public boolean addCard(final Card c) {
|
||||||
|
return c.isRed();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a CardListFilter to get all cards that are white.
|
||||||
|
*/
|
||||||
|
public static final CardListFilter white = new CardListFilter() {
|
||||||
|
public boolean addCard(final Card c) {
|
||||||
|
return c.isWhite();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1751,7 +1751,7 @@ public class CombatUtil {
|
|||||||
} else if (c.getName().equals("Spectral Force")) {
|
} else if (c.getName().equals("Spectral Force")) {
|
||||||
Player opp = c.getController().getOpponent();
|
Player opp = c.getController().getOpponent();
|
||||||
CardList list = opp.getCardsIn(Zone.Battlefield);
|
CardList list = opp.getCardsIn(Zone.Battlefield);
|
||||||
list = list.filter(AllZoneUtil.black);
|
list = list.filter(CardListFilter.black);
|
||||||
if (list.size() == 0) {
|
if (list.size() == 0) {
|
||||||
c.addExtrinsicKeyword("This card doesn't untap during your next untap step.");
|
c.addExtrinsicKeyword("This card doesn't untap during your next untap step.");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -775,7 +775,7 @@ public class ComputerUtil {
|
|||||||
static public boolean chooseLandsToPlay() {
|
static public boolean chooseLandsToPlay() {
|
||||||
Player computer = AllZone.getComputerPlayer();
|
Player computer = AllZone.getComputerPlayer();
|
||||||
CardList landList = computer.getCardsIn(Zone.Hand);
|
CardList landList = computer.getCardsIn(Zone.Hand);
|
||||||
landList = landList.filter(AllZoneUtil.lands);
|
landList = landList.filter(CardListFilter.lands);
|
||||||
|
|
||||||
|
|
||||||
CardList lands = AllZoneUtil.getPlayerTypeIn(computer, Zone.Graveyard, "Land");
|
CardList lands = AllZoneUtil.getPlayerTypeIn(computer, Zone.Graveyard, "Land");
|
||||||
@@ -1073,7 +1073,7 @@ public class ComputerUtil {
|
|||||||
typeList = typeList.getValidCards(type.split(","), activate.getController(), activate);
|
typeList = typeList.getValidCards(type.split(","), activate.getController(), activate);
|
||||||
|
|
||||||
//is this needed?
|
//is this needed?
|
||||||
typeList = typeList.filter(AllZoneUtil.untapped);
|
typeList = typeList.filter(CardListFilter.untapped);
|
||||||
|
|
||||||
if (tap)
|
if (tap)
|
||||||
typeList.remove(activate);
|
typeList.remove(activate);
|
||||||
|
|||||||
@@ -1449,9 +1449,9 @@ public class GameAction {
|
|||||||
public final void seeWhoPlaysFirst() {
|
public final void seeWhoPlaysFirst() {
|
||||||
|
|
||||||
CardList HLibrary = AllZone.getHumanPlayer().getCardsIn(Zone.Library);
|
CardList HLibrary = AllZone.getHumanPlayer().getCardsIn(Zone.Library);
|
||||||
HLibrary = HLibrary.filter(AllZoneUtil.nonlands);
|
HLibrary = HLibrary.filter(CardListFilter.nonlands);
|
||||||
CardList CLibrary = AllZone.getComputerPlayer().getCardsIn(Zone.Library);
|
CardList CLibrary = AllZone.getComputerPlayer().getCardsIn(Zone.Library);
|
||||||
CLibrary = CLibrary.filter(AllZoneUtil.nonlands);
|
CLibrary = CLibrary.filter(CardListFilter.nonlands);
|
||||||
|
|
||||||
boolean Starter_Determined = false;
|
boolean Starter_Determined = false;
|
||||||
int Cut_Count = 0;
|
int Cut_Count = 0;
|
||||||
@@ -2058,7 +2058,7 @@ public class GameAction {
|
|||||||
if (originalCard.getName().equals("Khalni Hydra") && spell.isSpell() == true) {
|
if (originalCard.getName().equals("Khalni Hydra") && spell.isSpell() == true) {
|
||||||
Player player = AllZone.getPhase().getPlayerTurn();
|
Player player = AllZone.getPhase().getPlayerTurn();
|
||||||
CardList playerCreature = AllZoneUtil.getCreaturesInPlay(player);
|
CardList playerCreature = AllZoneUtil.getCreaturesInPlay(player);
|
||||||
playerCreature = playerCreature.filter(AllZoneUtil.green);
|
playerCreature = playerCreature.filter(CardListFilter.green);
|
||||||
String manaC = manaCost + " ";
|
String manaC = manaCost + " ";
|
||||||
if (playerCreature.size() > 0) {
|
if (playerCreature.size() > 0) {
|
||||||
for (int i = 0; i < playerCreature.size(); i++) {
|
for (int i = 0; i < playerCreature.size(); i++) {
|
||||||
|
|||||||
@@ -936,7 +936,7 @@ public final class GameActionUtil {
|
|||||||
|
|
||||||
public void execute() {
|
public void execute() {
|
||||||
CardList list = src.getController().getCardsIn(Zone.Graveyard);
|
CardList list = src.getController().getCardsIn(Zone.Graveyard);
|
||||||
list = list.filter(AllZoneUtil.creatures);
|
list = list.filter(CardListFilter.creatures);
|
||||||
|
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
AllZone.getStack().addSimultaneousStackEntry(ability);
|
AllZone.getStack().addSimultaneousStackEntry(ability);
|
||||||
@@ -1035,7 +1035,7 @@ public final class GameActionUtil {
|
|||||||
public void resolve() {
|
public void resolve() {
|
||||||
for (int i = 0; i < damage; i++) {
|
for (int i = 0; i < damage; i++) {
|
||||||
CardList nonTokens = player.getCardsIn(Zone.Battlefield);
|
CardList nonTokens = player.getCardsIn(Zone.Battlefield);
|
||||||
nonTokens = nonTokens.filter(AllZoneUtil.nonToken);
|
nonTokens = nonTokens.filter(CardListFilter.nonToken);
|
||||||
if (nonTokens.size() == 0) {
|
if (nonTokens.size() == 0) {
|
||||||
player.loseConditionMet(GameLossReason.SpellEffect, lich.getName());
|
player.loseConditionMet(GameLossReason.SpellEffect, lich.getName());
|
||||||
} else {
|
} else {
|
||||||
@@ -1836,7 +1836,7 @@ public final class GameActionUtil {
|
|||||||
produces.put("Swamp", "B");
|
produces.put("Swamp", "B");
|
||||||
|
|
||||||
CardList lands = AllZoneUtil.getCardsInGame();
|
CardList lands = AllZoneUtil.getCardsInGame();
|
||||||
lands = lands.filter(AllZoneUtil.lands);
|
lands = lands.filter(CardListFilter.lands);
|
||||||
|
|
||||||
//remove all abilities granted by this Command
|
//remove all abilities granted by this Command
|
||||||
for (Card land : lands) {
|
for (Card land : lands) {
|
||||||
|
|||||||
@@ -682,7 +682,7 @@ public class MagicStack extends MyObservable {
|
|||||||
if (sp.isSpell() && AllZoneUtil.isCardInPlay("Bazaar of Wonders")) {
|
if (sp.isSpell() && AllZoneUtil.isCardInPlay("Bazaar of Wonders")) {
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
CardList all = AllZoneUtil.getCardsIn(Zone.Battlefield);
|
CardList all = AllZoneUtil.getCardsIn(Zone.Battlefield);
|
||||||
all = all.filter(AllZoneUtil.nonToken);
|
all = all.filter(CardListFilter.nonToken);
|
||||||
CardList graves = AllZoneUtil.getCardsIn(Zone.Graveyard);
|
CardList graves = AllZoneUtil.getCardsIn(Zone.Graveyard);
|
||||||
all.addAll(graves);
|
all.addAll(graves);
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class PhaseUtil {
|
|||||||
AllZone.getGameAction().resetActivationsPerTurn();
|
AllZone.getGameAction().resetActivationsPerTurn();
|
||||||
|
|
||||||
CardList lands = AllZoneUtil.getPlayerLandsInPlay(turn);
|
CardList lands = AllZoneUtil.getPlayerLandsInPlay(turn);
|
||||||
lands = lands.filter(AllZoneUtil.untapped);
|
lands = lands.filter(CardListFilter.untapped);
|
||||||
turn.setNumPowerSurgeLands(lands.size());
|
turn.setNumPowerSurgeLands(lands.size());
|
||||||
|
|
||||||
// anything before this point happens regardless of whether the Untap phase is skipped
|
// anything before this point happens regardless of whether the Untap phase is skipped
|
||||||
@@ -156,7 +156,7 @@ public class PhaseUtil {
|
|||||||
if (AllZone.getPhase().getPlayerTurn().isComputer()) {
|
if (AllZone.getPhase().getPlayerTurn().isComputer()) {
|
||||||
//search for lands the computer has and only untap 1
|
//search for lands the computer has and only untap 1
|
||||||
CardList landList = AllZoneUtil.getPlayerLandsInPlay(AllZone.getComputerPlayer());
|
CardList landList = AllZoneUtil.getPlayerLandsInPlay(AllZone.getComputerPlayer());
|
||||||
landList = landList.filter(AllZoneUtil.tapped);
|
landList = landList.filter(CardListFilter.tapped);
|
||||||
if (landList.size() > 0) {
|
if (landList.size() > 0) {
|
||||||
landList.get(0).untap();
|
landList.get(0).untap();
|
||||||
}
|
}
|
||||||
@@ -181,7 +181,7 @@ public class PhaseUtil {
|
|||||||
}//selectCard()
|
}//selectCard()
|
||||||
};//Input
|
};//Input
|
||||||
CardList landList = AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer());
|
CardList landList = AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer());
|
||||||
landList = landList.filter(AllZoneUtil.tapped);
|
landList = landList.filter(CardListFilter.tapped);
|
||||||
if (landList.size() > 0) {
|
if (landList.size() > 0) {
|
||||||
AllZone.getInputControl().setInput(target);
|
AllZone.getInputControl().setInput(target);
|
||||||
}
|
}
|
||||||
@@ -190,8 +190,8 @@ public class PhaseUtil {
|
|||||||
if (AllZoneUtil.isCardInPlay("Damping Field") || AllZoneUtil.isCardInPlay("Imi Statue")) {
|
if (AllZoneUtil.isCardInPlay("Damping Field") || AllZoneUtil.isCardInPlay("Imi Statue")) {
|
||||||
if (AllZone.getPhase().getPlayerTurn().isComputer()) {
|
if (AllZone.getPhase().getPlayerTurn().isComputer()) {
|
||||||
CardList artList = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
|
CardList artList = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
|
||||||
artList = artList.filter(AllZoneUtil.artifacts);
|
artList = artList.filter(CardListFilter.artifacts);
|
||||||
artList = artList.filter(AllZoneUtil.tapped);
|
artList = artList.filter(CardListFilter.tapped);
|
||||||
if (artList.size() > 0) {
|
if (artList.size() > 0) {
|
||||||
CardFactoryUtil.AI_getBestArtifact(artList).untap();
|
CardFactoryUtil.AI_getBestArtifact(artList).untap();
|
||||||
}
|
}
|
||||||
@@ -217,8 +217,8 @@ public class PhaseUtil {
|
|||||||
}//selectCard()
|
}//selectCard()
|
||||||
};//Input
|
};//Input
|
||||||
CardList artList = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield);
|
CardList artList = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield);
|
||||||
artList = artList.filter(AllZoneUtil.artifacts);
|
artList = artList.filter(CardListFilter.artifacts);
|
||||||
artList = artList.filter(AllZoneUtil.tapped);
|
artList = artList.filter(CardListFilter.tapped);
|
||||||
if (artList.size() > 0) {
|
if (artList.size() > 0) {
|
||||||
AllZone.getInputControl().setInput(target);
|
AllZone.getInputControl().setInput(target);
|
||||||
}
|
}
|
||||||
@@ -227,7 +227,7 @@ public class PhaseUtil {
|
|||||||
if ((AllZoneUtil.isCardInPlay("Smoke") || AllZoneUtil.isCardInPlay("Stoic Angel"))) {
|
if ((AllZoneUtil.isCardInPlay("Smoke") || AllZoneUtil.isCardInPlay("Stoic Angel"))) {
|
||||||
if (AllZone.getPhase().getPlayerTurn().isComputer()) {
|
if (AllZone.getPhase().getPlayerTurn().isComputer()) {
|
||||||
CardList creatures = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
CardList creatures = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
||||||
creatures = creatures.filter(AllZoneUtil.tapped);
|
creatures = creatures.filter(CardListFilter.tapped);
|
||||||
if (creatures.size() > 0) {
|
if (creatures.size() > 0) {
|
||||||
creatures.get(0).untap();
|
creatures.get(0).untap();
|
||||||
}
|
}
|
||||||
@@ -253,7 +253,7 @@ public class PhaseUtil {
|
|||||||
}//selectCard()
|
}//selectCard()
|
||||||
};//Input
|
};//Input
|
||||||
CardList creatures = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
CardList creatures = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||||
creatures = creatures.filter(AllZoneUtil.tapped);
|
creatures = creatures.filter(CardListFilter.tapped);
|
||||||
if (creatures.size() > 0) {
|
if (creatures.size() > 0) {
|
||||||
AllZone.getInputControl().setInput(target);
|
AllZone.getInputControl().setInput(target);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone {
|
|||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
CardList lands = tisLand.getController().getCardsIn(Zone.Battlefield);
|
CardList lands = tisLand.getController().getCardsIn(Zone.Battlefield);
|
||||||
lands = lands.filter(AllZoneUtil.lands);
|
lands = lands.filter(CardListFilter.lands);
|
||||||
for (Card land : lands) {
|
for (Card land : lands) {
|
||||||
land.tap();
|
land.tap();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -539,7 +539,7 @@ public class Upkeep implements java.io.Serializable {
|
|||||||
*/
|
*/
|
||||||
private static CardList abyss_getTargets(final Player player, final Card card) {
|
private static CardList abyss_getTargets(final Player player, final Card card) {
|
||||||
CardList creats = AllZoneUtil.getCreaturesInPlay(player);
|
CardList creats = AllZoneUtil.getCreaturesInPlay(player);
|
||||||
creats = creats.filter(AllZoneUtil.nonartifacts);
|
creats = creats.filter(CardListFilter.nonartifacts);
|
||||||
creats = creats.getTargetableCards(card);
|
creats = creats.getTargetableCards(card);
|
||||||
return creats;
|
return creats;
|
||||||
}
|
}
|
||||||
@@ -562,7 +562,7 @@ public class Upkeep implements java.io.Serializable {
|
|||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
CardList artifacts = player.getCardsIn(Zone.Battlefield);
|
CardList artifacts = player.getCardsIn(Zone.Battlefield);
|
||||||
artifacts = artifacts.filter(AllZoneUtil.artifacts);
|
artifacts = artifacts.filter(CardListFilter.artifacts);
|
||||||
|
|
||||||
if (player.isHuman()) {
|
if (player.isHuman()) {
|
||||||
AllZone.getInputControl().setInput(new Input() {
|
AllZone.getInputControl().setInput(new Input() {
|
||||||
@@ -2217,8 +2217,8 @@ public class Upkeep implements java.io.Serializable {
|
|||||||
public void resolve() {
|
public void resolve() {
|
||||||
int gain = 0;
|
int gain = 0;
|
||||||
CardList play = player.getCardsIn(Zone.Battlefield);
|
CardList play = player.getCardsIn(Zone.Battlefield);
|
||||||
CardList black = play.filter(AllZoneUtil.black);
|
CardList black = play.filter(CardListFilter.black);
|
||||||
CardList red = play.filter(AllZoneUtil.red);
|
CardList red = play.filter(CardListFilter.red);
|
||||||
if (black.size() > 0 && red.size() > 0) {
|
if (black.size() > 0 && red.size() > 0) {
|
||||||
gain = 4;
|
gain = 4;
|
||||||
}
|
}
|
||||||
@@ -2253,8 +2253,8 @@ public class Upkeep implements java.io.Serializable {
|
|||||||
public void resolve() {
|
public void resolve() {
|
||||||
int draw = 0;
|
int draw = 0;
|
||||||
CardList play = player.getCardsIn(Zone.Battlefield);
|
CardList play = player.getCardsIn(Zone.Battlefield);
|
||||||
CardList green = play.filter(AllZoneUtil.green);
|
CardList green = play.filter(CardListFilter.green);
|
||||||
CardList red = play.filter(AllZoneUtil.red);
|
CardList red = play.filter(CardListFilter.red);
|
||||||
|
|
||||||
if (green.size() > 0 && red.size() > 0) {
|
if (green.size() > 0 && red.size() > 0) {
|
||||||
draw = 2;
|
draw = 2;
|
||||||
@@ -2319,7 +2319,7 @@ public class Upkeep implements java.io.Serializable {
|
|||||||
private static void upkeep_Shapeshifter() {
|
private static void upkeep_Shapeshifter() {
|
||||||
final Player player = AllZone.getPhase().getPlayerTurn();
|
final Player player = AllZone.getPhase().getPlayerTurn();
|
||||||
CardList list = player.getCardsIn(Zone.Battlefield, "Shapeshifter");
|
CardList list = player.getCardsIn(Zone.Battlefield, "Shapeshifter");
|
||||||
list = list.filter(AllZoneUtil.nonToken);
|
list = list.filter(CardListFilter.nonToken);
|
||||||
|
|
||||||
for (final Card c : list) {
|
for (final Card c : list) {
|
||||||
SpellAbility ability = new Ability(c, "0") {
|
SpellAbility ability = new Ability(c, "0") {
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ public final class AbilityFactory_Copy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Card choice;
|
Card choice;
|
||||||
if (list.filter(AllZoneUtil.creatures).size() > 0) {
|
if (list.filter(CardListFilter.creatures).size() > 0) {
|
||||||
choice = CardFactoryUtil.AI_getBestCreature(list);
|
choice = CardFactoryUtil.AI_getBestCreature(list);
|
||||||
} else {
|
} else {
|
||||||
choice = CardFactoryUtil.AI_getMostExpensivePermanent(list, source, true);
|
choice = CardFactoryUtil.AI_getMostExpensivePermanent(list, source, true);
|
||||||
|
|||||||
@@ -291,7 +291,7 @@ public class AbilityFactory_PermanentState {
|
|||||||
untapList = untapList.getValidCards(tgt.getValidTgts(), source.getController(), source);
|
untapList = untapList.getValidCards(tgt.getValidTgts(), source.getController(), source);
|
||||||
|
|
||||||
|
|
||||||
untapList = untapList.filter(AllZoneUtil.tapped);
|
untapList = untapList.filter(CardListFilter.tapped);
|
||||||
// filter out enchantments and planeswalkers, their tapped state doesn't matter.
|
// filter out enchantments and planeswalkers, their tapped state doesn't matter.
|
||||||
String[] tappablePermanents = {"Creature", "Land", "Artifact"};
|
String[] tappablePermanents = {"Creature", "Land", "Artifact"};
|
||||||
untapList = untapList.getValidCards(tappablePermanents, source.getController(), source);
|
untapList = untapList.getValidCards(tappablePermanents, source.getController(), source);
|
||||||
@@ -358,7 +358,7 @@ public class AbilityFactory_PermanentState {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
// try to just tap already tapped things
|
// try to just tap already tapped things
|
||||||
tapList = list.filter(AllZoneUtil.untapped);
|
tapList = list.filter(CardListFilter.untapped);
|
||||||
|
|
||||||
if (untapTargetList(source, tgt, af, sa, mandatory, tapList))
|
if (untapTargetList(source, tgt, af, sa, mandatory, tapList))
|
||||||
return true;
|
return true;
|
||||||
@@ -474,7 +474,7 @@ public class AbilityFactory_PermanentState {
|
|||||||
else {
|
else {
|
||||||
CardList list = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
|
CardList list = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
|
||||||
list = list.getType(valid);
|
list = list.getType(valid);
|
||||||
list = list.filter(AllZoneUtil.tapped);
|
list = list.filter(CardListFilter.tapped);
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while (list.size() != 0 && count < num)
|
while (list.size() != 0 && count < num)
|
||||||
@@ -747,7 +747,7 @@ public class AbilityFactory_PermanentState {
|
|||||||
*/
|
*/
|
||||||
private static boolean tapPrefTargeting(Card source, Target tgt, AbilityFactory af, SpellAbility sa, boolean mandatory) {
|
private static boolean tapPrefTargeting(Card source, Target tgt, AbilityFactory af, SpellAbility sa, boolean mandatory) {
|
||||||
CardList tapList = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield);
|
CardList tapList = AllZone.getHumanPlayer().getCardsIn(Zone.Battlefield);
|
||||||
tapList = tapList.filter(AllZoneUtil.untapped);
|
tapList = tapList.filter(CardListFilter.untapped);
|
||||||
tapList = tapList.getValidCards(tgt.getValidTgts(), source.getController(), source);
|
tapList = tapList.getValidCards(tgt.getValidTgts(), source.getController(), source);
|
||||||
// filter out enchantments and planeswalkers, their tapped state doesn't matter.
|
// filter out enchantments and planeswalkers, their tapped state doesn't matter.
|
||||||
String[] tappablePermanents = {"Creature", "Land", "Artifact"};
|
String[] tappablePermanents = {"Creature", "Land", "Artifact"};
|
||||||
@@ -818,7 +818,7 @@ public class AbilityFactory_PermanentState {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
// try to just tap already tapped things
|
// try to just tap already tapped things
|
||||||
tapList = list.filter(AllZoneUtil.tapped);
|
tapList = list.filter(CardListFilter.tapped);
|
||||||
|
|
||||||
if (tapTargetList(af, sa, tapList, mandatory))
|
if (tapTargetList(af, sa, tapList, mandatory))
|
||||||
return true;
|
return true;
|
||||||
@@ -1264,7 +1264,7 @@ public class AbilityFactory_PermanentState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
validTappables = validTappables.getValidCards(valid, source.getController(), source);
|
validTappables = validTappables.getValidCards(valid, source.getController(), source);
|
||||||
validTappables = validTappables.filter(AllZoneUtil.untapped);
|
validTappables = validTappables.filter(CardListFilter.untapped);
|
||||||
|
|
||||||
Random r = MyRandom.random;
|
Random r = MyRandom.random;
|
||||||
boolean rr = false;
|
boolean rr = false;
|
||||||
@@ -1299,7 +1299,7 @@ public class AbilityFactory_PermanentState {
|
|||||||
private static CardList getTapAllTargets(String valid, Card source) {
|
private static CardList getTapAllTargets(String valid, Card source) {
|
||||||
CardList tmpList = AllZoneUtil.getCardsIn(Zone.Battlefield);
|
CardList tmpList = AllZoneUtil.getCardsIn(Zone.Battlefield);
|
||||||
tmpList = tmpList.getValidCards(valid, source.getController(), source);
|
tmpList = tmpList.getValidCards(valid, source.getController(), source);
|
||||||
tmpList = tmpList.filter(AllZoneUtil.untapped);
|
tmpList = tmpList.filter(CardListFilter.untapped);
|
||||||
return tmpList;
|
return tmpList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
|
|||||||
out.setOwner(in.getOwner());
|
out.setOwner(in.getOwner());
|
||||||
CardList all = new CardList(getAllCards());
|
CardList all = new CardList(getAllCards());
|
||||||
CardList tokens = AllZoneUtil.getCardsIn(Zone.Battlefield);
|
CardList tokens = AllZoneUtil.getCardsIn(Zone.Battlefield);
|
||||||
tokens = tokens.filter(AllZoneUtil.token);
|
tokens = tokens.filter(CardListFilter.token);
|
||||||
all.addAll(tokens);
|
all.addAll(tokens);
|
||||||
out.setCopiedSpell(true);
|
out.setCopiedSpell(true);
|
||||||
for (Trigger t : out.getTriggers()) {
|
for (Trigger t : out.getTriggers()) {
|
||||||
@@ -1092,7 +1092,7 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
|
|||||||
final Player player = getTargetPlayer();
|
final Player player = getTargetPlayer();
|
||||||
|
|
||||||
CardList lands = player.getCardsIn(Zone.Graveyard);
|
CardList lands = player.getCardsIn(Zone.Graveyard);
|
||||||
lands = lands.filter(AllZoneUtil.basicLands);
|
lands = lands.filter(CardListFilter.basicLands);
|
||||||
if (card.getController().isHuman()) {
|
if (card.getController().isHuman()) {
|
||||||
//now, select up to four lands
|
//now, select up to four lands
|
||||||
int end = -1;
|
int end = -1;
|
||||||
@@ -1326,7 +1326,7 @@ public abstract class AbstractCardFactory implements NewConstants, CardFactoryIn
|
|||||||
//may return null
|
//may return null
|
||||||
public Card getCreature() {
|
public Card getCreature() {
|
||||||
CardList tappedCreatures = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
CardList tappedCreatures = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||||
tappedCreatures = tappedCreatures.filter(AllZoneUtil.tapped);
|
tappedCreatures = tappedCreatures.filter(CardListFilter.tapped);
|
||||||
tappedCreatures = tappedCreatures.filter(AllZoneUtil.getCanTargetFilter(card));
|
tappedCreatures = tappedCreatures.filter(AllZoneUtil.getCanTargetFilter(card));
|
||||||
if (tappedCreatures.isEmpty()) {
|
if (tappedCreatures.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -558,7 +558,7 @@ public class CardFactory_Creatures {
|
|||||||
@Override
|
@Override
|
||||||
public boolean canPlay() {
|
public boolean canPlay() {
|
||||||
CardList possible = card.getController().getCardsIn(Zone.Hand);
|
CardList possible = card.getController().getCardsIn(Zone.Hand);
|
||||||
possible = possible.filter(AllZoneUtil.nonlands);
|
possible = possible.filter(CardListFilter.nonlands);
|
||||||
return !possible.isEmpty() && super.canPlay();
|
return !possible.isEmpty() && super.canPlay();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1017,7 +1017,7 @@ public class CardFactory_Creatures {
|
|||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
CardList allTokens = AllZoneUtil.getCreaturesInPlay(card.getController());
|
CardList allTokens = AllZoneUtil.getCreaturesInPlay(card.getController());
|
||||||
allTokens = allTokens.filter(AllZoneUtil.token);
|
allTokens = allTokens.filter(CardListFilter.token);
|
||||||
|
|
||||||
int multiplier = AllZoneUtil.getDoublingSeasonMagnitude(card.getController());
|
int multiplier = AllZoneUtil.getDoublingSeasonMagnitude(card.getController());
|
||||||
|
|
||||||
@@ -1048,7 +1048,7 @@ public class CardFactory_Creatures {
|
|||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI() {
|
public boolean canPlayAI() {
|
||||||
CardList allTokens = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
CardList allTokens = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
||||||
allTokens = allTokens.filter(AllZoneUtil.token);
|
allTokens = allTokens.filter(CardListFilter.token);
|
||||||
|
|
||||||
return allTokens.size() >= 2;
|
return allTokens.size() >= 2;
|
||||||
}
|
}
|
||||||
@@ -2271,7 +2271,7 @@ public class CardFactory_Creatures {
|
|||||||
public boolean canPlayAI() {
|
public boolean canPlayAI() {
|
||||||
//get all creatures
|
//get all creatures
|
||||||
CardList list = AllZone.getComputerPlayer().getCardsIn(Zone.Graveyard);
|
CardList list = AllZone.getComputerPlayer().getCardsIn(Zone.Graveyard);
|
||||||
list = list.filter(AllZoneUtil.creatures);
|
list = list.filter(CardListFilter.creatures);
|
||||||
return 0 < list.size();
|
return 0 < list.size();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -2295,12 +2295,12 @@ public class CardFactory_Creatures {
|
|||||||
Player opp = player.getOpponent();
|
Player opp = player.getOpponent();
|
||||||
int max = 0;
|
int max = 0;
|
||||||
CardList play = opp.getCardsIn(Zone.Battlefield);
|
CardList play = opp.getCardsIn(Zone.Battlefield);
|
||||||
play = play.filter(AllZoneUtil.nonToken);
|
play = play.filter(CardListFilter.nonToken);
|
||||||
play = play.filter(AllZoneUtil.white);
|
play = play.filter(CardListFilter.white);
|
||||||
max += play.size();
|
max += play.size();
|
||||||
|
|
||||||
CardList grave = opp.getCardsIn(Zone.Graveyard);
|
CardList grave = opp.getCardsIn(Zone.Graveyard);
|
||||||
grave = grave.filter(AllZoneUtil.white);
|
grave = grave.filter(CardListFilter.white);
|
||||||
max += grave.size();
|
max += grave.size();
|
||||||
|
|
||||||
String[] life = new String[max + 1];
|
String[] life = new String[max + 1];
|
||||||
@@ -2499,7 +2499,7 @@ public class CardFactory_Creatures {
|
|||||||
@Override
|
@Override
|
||||||
public boolean canPlay() {
|
public boolean canPlay() {
|
||||||
CardList grave = card.getController().getCardsIn(Zone.Graveyard);
|
CardList grave = card.getController().getCardsIn(Zone.Graveyard);
|
||||||
grave = grave.filter(AllZoneUtil.creatures);
|
grave = grave.filter(CardListFilter.creatures);
|
||||||
return super.canPlay() && grave.size() > 0;
|
return super.canPlay() && grave.size() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ public class CardFactory_Instants {
|
|||||||
final String kboost = getKeywordBoost();
|
final String kboost = getKeywordBoost();
|
||||||
|
|
||||||
CardList list = card.getController().getCardsIn(Zone.Battlefield);
|
CardList list = card.getController().getCardsIn(Zone.Battlefield);
|
||||||
list = list.filter(AllZoneUtil.white);
|
list = list.filter(CardListFilter.white);
|
||||||
|
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
final Card[] target = new Card[1];
|
final Card[] target = new Card[1];
|
||||||
|
|||||||
@@ -370,7 +370,7 @@ class CardFactory_Lands {
|
|||||||
}
|
}
|
||||||
}//selectCard()
|
}//selectCard()
|
||||||
};//Input
|
};//Input
|
||||||
if ((AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer()).filter(AllZoneUtil.untapped).size() < 2)) {
|
if ((AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer()).filter(CardListFilter.untapped).size() < 2)) {
|
||||||
AllZone.getGameAction().sacrifice(card);
|
AllZone.getGameAction().sacrifice(card);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@@ -418,7 +418,7 @@ class CardFactory_Lands {
|
|||||||
if (player.isComputer()) {
|
if (player.isComputer()) {
|
||||||
if (land.size() > 0) {
|
if (land.size() > 0) {
|
||||||
CardList tappedLand = new CardList(land.toArray());
|
CardList tappedLand = new CardList(land.toArray());
|
||||||
tappedLand = tappedLand.filter(AllZoneUtil.tapped);
|
tappedLand = tappedLand.filter(CardListFilter.tapped);
|
||||||
//if any are tapped, sacrifice it
|
//if any are tapped, sacrifice it
|
||||||
//else sacrifice random
|
//else sacrifice random
|
||||||
if (tappedLand.size() > 0) {
|
if (tappedLand.size() > 0) {
|
||||||
@@ -490,7 +490,7 @@ class CardFactory_Lands {
|
|||||||
|
|
||||||
public void execute() {
|
public void execute() {
|
||||||
CardList plains = AllZoneUtil.getPlayerLandsInPlay(card.getController());
|
CardList plains = AllZoneUtil.getPlayerLandsInPlay(card.getController());
|
||||||
plains = plains.filter(AllZoneUtil.untapped);
|
plains = plains.filter(CardListFilter.untapped);
|
||||||
|
|
||||||
if (player.isComputer()) {
|
if (player.isComputer()) {
|
||||||
if (plains.size() > 1) {
|
if (plains.size() > 1) {
|
||||||
@@ -509,7 +509,7 @@ class CardFactory_Lands {
|
|||||||
}
|
}
|
||||||
} else { //this is the human resolution
|
} else { //this is the human resolution
|
||||||
final int[] paid = {0};
|
final int[] paid = {0};
|
||||||
if ((AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer()).filter(AllZoneUtil.untapped).size() < 2)) {
|
if ((AllZoneUtil.getPlayerLandsInPlay(AllZone.getHumanPlayer()).filter(CardListFilter.untapped).size() < 2)) {
|
||||||
AllZone.getGameAction().sacrifice(card);
|
AllZone.getGameAction().sacrifice(card);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -871,7 +871,7 @@ class CardFactory_Lands {
|
|||||||
if (player.isComputer()) {
|
if (player.isComputer()) {
|
||||||
if (land.size() > 0) {
|
if (land.size() > 0) {
|
||||||
CardList tappedLand = new CardList(land.toArray());
|
CardList tappedLand = new CardList(land.toArray());
|
||||||
tappedLand = tappedLand.filter(AllZoneUtil.tapped);
|
tappedLand = tappedLand.filter(CardListFilter.tapped);
|
||||||
if (tappedLand.size() > 0) {
|
if (tappedLand.size() > 0) {
|
||||||
AllZone.getGameAction().moveToHand(CardFactoryUtil.getWorstLand(tappedLand));
|
AllZone.getGameAction().moveToHand(CardFactoryUtil.getWorstLand(tappedLand));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -638,7 +638,7 @@ public class CardFactory_Sorceries {
|
|||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI() {
|
public boolean canPlayAI() {
|
||||||
CardList c = AllZone.getHumanPlayer().getCardsIn(Zone.Library);
|
CardList c = AllZone.getHumanPlayer().getCardsIn(Zone.Library);
|
||||||
c = c.filter(AllZoneUtil.nonlands);
|
c = c.filter(CardListFilter.nonlands);
|
||||||
return c.size() > 0;
|
return c.size() > 0;
|
||||||
}
|
}
|
||||||
};//SpellAbility spell
|
};//SpellAbility spell
|
||||||
@@ -805,7 +805,7 @@ public class CardFactory_Sorceries {
|
|||||||
//randomly choose a nonland card
|
//randomly choose a nonland card
|
||||||
int getDamage() {
|
int getDamage() {
|
||||||
CardList notLand = card.getController().getCardsIn(Zone.Library);
|
CardList notLand = card.getController().getCardsIn(Zone.Library);
|
||||||
notLand = notLand.filter(AllZoneUtil.nonlands);
|
notLand = notLand.filter(CardListFilter.nonlands);
|
||||||
notLand.shuffle();
|
notLand.shuffle();
|
||||||
|
|
||||||
if (notLand.isEmpty()) return 0;
|
if (notLand.isEmpty()) return 0;
|
||||||
@@ -1117,10 +1117,10 @@ public class CardFactory_Sorceries {
|
|||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI() {
|
public boolean canPlayAI() {
|
||||||
CardList humTokenCreats = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
CardList humTokenCreats = AllZoneUtil.getCreaturesInPlay(AllZone.getHumanPlayer());
|
||||||
humTokenCreats = humTokenCreats.filter(AllZoneUtil.token);
|
humTokenCreats = humTokenCreats.filter(CardListFilter.token);
|
||||||
|
|
||||||
CardList compTokenCreats = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
CardList compTokenCreats = AllZoneUtil.getCreaturesInPlay(AllZone.getComputerPlayer());
|
||||||
compTokenCreats = compTokenCreats.filter(AllZoneUtil.token);
|
compTokenCreats = compTokenCreats.filter(CardListFilter.token);
|
||||||
|
|
||||||
return compTokenCreats.size() > humTokenCreats.size();
|
return compTokenCreats.size() > humTokenCreats.size();
|
||||||
}//canPlayAI()
|
}//canPlayAI()
|
||||||
@@ -1128,7 +1128,7 @@ public class CardFactory_Sorceries {
|
|||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
CardList tokens = AllZoneUtil.getCreaturesInPlay();
|
CardList tokens = AllZoneUtil.getCreaturesInPlay();
|
||||||
tokens = tokens.filter(AllZoneUtil.token);
|
tokens = tokens.filter(CardListFilter.token);
|
||||||
|
|
||||||
CardFactoryUtil.copyTokens(tokens);
|
CardFactoryUtil.copyTokens(tokens);
|
||||||
|
|
||||||
@@ -2561,7 +2561,7 @@ public class CardFactory_Sorceries {
|
|||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI() {
|
public boolean canPlayAI() {
|
||||||
CardList c = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
|
CardList c = AllZone.getComputerPlayer().getCardsIn(Zone.Battlefield);
|
||||||
c = c.filter(AllZoneUtil.nonlands);
|
c = c.filter(CardListFilter.nonlands);
|
||||||
return 2 >= c.size();
|
return 2 >= c.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2617,7 +2617,7 @@ public class CardFactory_Sorceries {
|
|||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI() {
|
public boolean canPlayAI() {
|
||||||
CardList c = AllZone.getComputerPlayer().getCardsIn(Zone.Hand);
|
CardList c = AllZone.getComputerPlayer().getCardsIn(Zone.Hand);
|
||||||
c = c.filter(AllZoneUtil.nonlands);
|
c = c.filter(CardListFilter.nonlands);
|
||||||
return 2 >= c.size() ||
|
return 2 >= c.size() ||
|
||||||
(AllZone.getComputerPlayer().hasMetalcraft() && AllZone.getHumanPlayer().getLife() <= 3);
|
(AllZone.getComputerPlayer().hasMetalcraft() && AllZone.getHumanPlayer().getLife() <= 3);
|
||||||
}
|
}
|
||||||
@@ -2649,13 +2649,13 @@ public class CardFactory_Sorceries {
|
|||||||
|
|
||||||
//"Destroy all artifacts",
|
//"Destroy all artifacts",
|
||||||
if (userChoice.contains(cardChoices[0])) {
|
if (userChoice.contains(cardChoices[0])) {
|
||||||
CardList cards = AllZoneUtil.getCardsIn(Zone.Battlefield).filter(AllZoneUtil.artifacts);
|
CardList cards = AllZoneUtil.getCardsIn(Zone.Battlefield).filter(CardListFilter.artifacts);
|
||||||
for (Card c : cards) AllZone.getGameAction().destroy(c);
|
for (Card c : cards) AllZone.getGameAction().destroy(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
//"Destroy all enchantments",
|
//"Destroy all enchantments",
|
||||||
if (userChoice.contains(cardChoices[1])) {
|
if (userChoice.contains(cardChoices[1])) {
|
||||||
CardList cards = AllZoneUtil.getCardsIn(Zone.Battlefield).filter(AllZoneUtil.enchantments);
|
CardList cards = AllZoneUtil.getCardsIn(Zone.Battlefield).filter(CardListFilter.enchantments);
|
||||||
for (Card c : cards) AllZone.getGameAction().destroy(c);
|
for (Card c : cards) AllZone.getGameAction().destroy(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2988,7 +2988,7 @@ public class CardFactory_Sorceries {
|
|||||||
@Override
|
@Override
|
||||||
public void showMessage() {
|
public void showMessage() {
|
||||||
CardList grave = card.getController().getCardsIn(Constant.Zone.Graveyard);
|
CardList grave = card.getController().getCardsIn(Constant.Zone.Graveyard);
|
||||||
grave = grave.filter(AllZoneUtil.creatures);
|
grave = grave.filter(CardListFilter.creatures);
|
||||||
grave = grave.filter(new CardListFilter() {
|
grave = grave.filter(new CardListFilter() {
|
||||||
public boolean addCard(Card c) {
|
public boolean addCard(Card c) {
|
||||||
return c.getCMC() <= x[0];
|
return c.getCMC() <= x[0];
|
||||||
@@ -3126,7 +3126,7 @@ public class CardFactory_Sorceries {
|
|||||||
//get all
|
//get all
|
||||||
CardList creatures = AllZoneUtil.getCreaturesInPlay();
|
CardList creatures = AllZoneUtil.getCreaturesInPlay();
|
||||||
CardList grave = card.getController().getCardsIn(Zone.Graveyard);
|
CardList grave = card.getController().getCardsIn(Zone.Graveyard);
|
||||||
grave = grave.filter(AllZoneUtil.creatures);
|
grave = grave.filter(CardListFilter.creatures);
|
||||||
|
|
||||||
if (AllZone.getHumanPlayer().canTarget(spell) || AllZone.getComputerPlayer().canTarget(spell))
|
if (AllZone.getHumanPlayer().canTarget(spell) || AllZone.getComputerPlayer().canTarget(spell))
|
||||||
display.add("Target player loses X life");
|
display.add("Target player loses X life");
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package forge.card.cost;
|
package forge.card.cost;
|
||||||
|
|
||||||
import forge.AllZone;
|
import forge.AllZone;
|
||||||
import forge.AllZoneUtil;
|
|
||||||
import forge.ButtonUtil;
|
import forge.ButtonUtil;
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
import forge.CardList;
|
import forge.CardList;
|
||||||
|
import forge.CardListFilter;
|
||||||
import forge.ComputerUtil;
|
import forge.ComputerUtil;
|
||||||
import forge.Constant;
|
import forge.Constant;
|
||||||
import forge.Constant.Zone;
|
import forge.Constant.Zone;
|
||||||
@@ -60,7 +60,7 @@ public class CostTapType extends CostPartWithList {
|
|||||||
|
|
||||||
if (cost.getTap())
|
if (cost.getTap())
|
||||||
typeList.remove(source);
|
typeList.remove(source);
|
||||||
typeList = typeList.filter(AllZoneUtil.untapped);
|
typeList = typeList.filter(CardListFilter.untapped);
|
||||||
|
|
||||||
Integer amount = convertAmount();
|
Integer amount = convertAmount();
|
||||||
if (typeList.size() == 0 || (amount != null && typeList.size() < amount))
|
if (typeList.size() == 0 || (amount != null && typeList.size() < amount))
|
||||||
|
|||||||
Reference in New Issue
Block a user