mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
two useless functions in AllZoneUtil less.
This commit is contained in:
@@ -20,18 +20,6 @@ public final class AllZoneUtil {
|
||||
|
||||
//////////// Creatures
|
||||
|
||||
/**
|
||||
* use to get a list of creatures in play for a given player.
|
||||
*
|
||||
* @param player the player to get creatures for
|
||||
* @return a CardList containing all creatures a given player has in play
|
||||
*/
|
||||
public static CardList getCreaturesInPlay(final Player player) {
|
||||
CardList creats = player.getCardsIn(Zone.Battlefield);
|
||||
return creats.filter(CardListFilter.creatures);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gets a list of all cards of a certain type that a given player has in given zone.
|
||||
*
|
||||
@@ -83,10 +71,11 @@ public final class AllZoneUtil {
|
||||
* @return a CardList with all cards currently in a graveyard
|
||||
*/
|
||||
public static CardList getCardsIn(final Constant.Zone zone, String cardName) {
|
||||
CardList cards = getCardsIn(zone);
|
||||
return cards.getName(cardName);
|
||||
return getCardsIn(zone).getName(cardName);
|
||||
}
|
||||
|
||||
//////////// Creatures
|
||||
|
||||
/**
|
||||
* use to get a CardList of all creatures on the battlefield for both players
|
||||
*
|
||||
@@ -97,6 +86,19 @@ public final class AllZoneUtil {
|
||||
return creats.filter(CardListFilter.creatures);
|
||||
}
|
||||
|
||||
/**
|
||||
* use to get a list of creatures in play for a given player.
|
||||
*
|
||||
* @param player the player to get creatures for
|
||||
* @return a CardList containing all creatures a given player has in play
|
||||
*/
|
||||
public static CardList getCreaturesInPlay(final Player player) {
|
||||
CardList creats = player.getCardsIn(Zone.Battlefield);
|
||||
return creats.filter(CardListFilter.creatures);
|
||||
}
|
||||
|
||||
|
||||
|
||||
///////////////// Lands
|
||||
|
||||
/**
|
||||
@@ -184,18 +186,6 @@ public final class AllZoneUtil {
|
||||
return player.getCardsIn(Zone.Battlefield, cardName).size() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Answers the question: "Does <player> have <given card> in play?".
|
||||
*
|
||||
* @param card the card to look for
|
||||
* @param player the player whose battlefield we want to check
|
||||
* @return true if that player has that card in play, false otherwise
|
||||
* @since 1.0.15
|
||||
*/
|
||||
public static boolean isCardInPlay(final Card card, final Player player) {
|
||||
return player.getCardsIn(Zone.Battlefield).contains(card);
|
||||
}
|
||||
|
||||
//////////////// getting all cards of a given color
|
||||
|
||||
/**
|
||||
@@ -241,8 +231,7 @@ public final class AllZoneUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
CardList list = getCardsInZone(zone);
|
||||
for (Card c : list) {
|
||||
for (Card c : zone.getCards()) {
|
||||
if (card.equals(c)) {
|
||||
return c;
|
||||
}
|
||||
@@ -251,17 +240,6 @@ public final class AllZoneUtil {
|
||||
return card;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>getCardsInZone.</p>
|
||||
*
|
||||
* @param zone a {@link forge.PlayerZone} object.
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
public static CardList getCardsInZone(final PlayerZone zone) {
|
||||
return new CardList(zone.getCards());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <p>compareTypeAmountInPlay.</p>
|
||||
*
|
||||
|
||||
@@ -1044,7 +1044,7 @@ public class ComputerUtil {
|
||||
* @return a {@link forge.CardList} object.
|
||||
*/
|
||||
static public CardList chooseExileFrom(Constant.Zone zone, String type, Card activate, Card target, int amount) {
|
||||
CardList typeList = AllZoneUtil.getCardsInZone(AllZone.getComputerPlayer().getZone(zone));
|
||||
CardList typeList = new CardList(AllZone.getComputerPlayer().getZone(zone).getCards());
|
||||
typeList = typeList.getValidCards(type.split(","), activate.getController(), activate);
|
||||
if (target != null && target.getController().isComputer() && typeList.contains(target))
|
||||
typeList.remove(target); // don't exile the card we're pumping
|
||||
|
||||
@@ -780,7 +780,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
||||
PlayerZone pZone = (PlayerZone) a;
|
||||
HandArea p = playerHandPanel;
|
||||
|
||||
Card[] c = AllZoneUtil.getCardsInZone(pZone).toArray();
|
||||
Card[] c = pZone.getCards();
|
||||
|
||||
List<Card> tmp, diff;
|
||||
tmp = new ArrayList<Card>();
|
||||
@@ -837,7 +837,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
||||
public void update(final Observable a, final Object b) {
|
||||
PlayerZone pZone = (PlayerZone) a;
|
||||
|
||||
Card[] c = AllZoneUtil.getCardsInZone(pZone).toArray();
|
||||
Card[] c = pZone.getCards();
|
||||
|
||||
GuiDisplayUtil.setupPlayZone(playerPlayPanel, c);
|
||||
}
|
||||
@@ -851,7 +851,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
||||
public void update(final Observable a, final Object b) {
|
||||
PlayerZone pZone = (PlayerZone) a;
|
||||
|
||||
Card[] c = AllZoneUtil.getCardsInZone(pZone).toArray();
|
||||
Card[] c = pZone.getCards();
|
||||
|
||||
GuiDisplayUtil.setupPlayZone(oppPlayPanel, c);
|
||||
}
|
||||
@@ -1619,17 +1619,8 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see #getCardsAsIterable()
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
protected Card[] getCards() {
|
||||
return AllZoneUtil.getCardsInZone(zone).toArray();
|
||||
}
|
||||
|
||||
protected Iterable<Card> getCardsAsIterable() {
|
||||
return new ImmutableIterableFrom<Card>(AllZoneUtil.getCardsInZone(zone));
|
||||
return new ImmutableIterableFrom<Card>(Arrays.asList(zone.getCards()));
|
||||
}
|
||||
|
||||
protected void doAction(final Card c) {
|
||||
|
||||
@@ -88,8 +88,7 @@ public class CostExile extends CostPartWithList {
|
||||
public boolean canPay(SpellAbility ability, Card source, Player activator, Cost cost) {
|
||||
PlayerZone zone = activator.getZone(getFrom());
|
||||
if (!getThis()) {
|
||||
CardList typeList = AllZoneUtil.getCardsInZone(zone);
|
||||
|
||||
CardList typeList = new CardList(zone.getCards());
|
||||
typeList = typeList.getValidCards(getType().split(";"), activator, source);
|
||||
|
||||
Integer amount = convertAmount();
|
||||
|
||||
Reference in New Issue
Block a user