mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
two useless functions in AllZoneUtil less.
This commit is contained in:
@@ -20,18 +20,6 @@ public final class AllZoneUtil {
|
|||||||
|
|
||||||
//////////// Creatures
|
//////////// 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.
|
* 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
|
* @return a CardList with all cards currently in a graveyard
|
||||||
*/
|
*/
|
||||||
public static CardList getCardsIn(final Constant.Zone zone, String cardName) {
|
public static CardList getCardsIn(final Constant.Zone zone, String cardName) {
|
||||||
CardList cards = getCardsIn(zone);
|
return getCardsIn(zone).getName(cardName);
|
||||||
return cards.getName(cardName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//////////// Creatures
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* use to get a CardList of all creatures on the battlefield for both players
|
* 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);
|
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
|
///////////////// Lands
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -184,18 +186,6 @@ public final class AllZoneUtil {
|
|||||||
return player.getCardsIn(Zone.Battlefield, cardName).size() > 0;
|
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
|
//////////////// getting all cards of a given color
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -241,8 +231,7 @@ public final class AllZoneUtil {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
CardList list = getCardsInZone(zone);
|
for (Card c : zone.getCards()) {
|
||||||
for (Card c : list) {
|
|
||||||
if (card.equals(c)) {
|
if (card.equals(c)) {
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
@@ -251,17 +240,6 @@ public final class AllZoneUtil {
|
|||||||
return card;
|
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>
|
* <p>compareTypeAmountInPlay.</p>
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1044,7 +1044,7 @@ public class ComputerUtil {
|
|||||||
* @return a {@link forge.CardList} object.
|
* @return a {@link forge.CardList} object.
|
||||||
*/
|
*/
|
||||||
static public CardList chooseExileFrom(Constant.Zone zone, String type, Card activate, Card target, int amount) {
|
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);
|
typeList = typeList.getValidCards(type.split(","), activate.getController(), activate);
|
||||||
if (target != null && target.getController().isComputer() && typeList.contains(target))
|
if (target != null && target.getController().isComputer() && typeList.contains(target))
|
||||||
typeList.remove(target); // don't exile the card we're pumping
|
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;
|
PlayerZone pZone = (PlayerZone) a;
|
||||||
HandArea p = playerHandPanel;
|
HandArea p = playerHandPanel;
|
||||||
|
|
||||||
Card[] c = AllZoneUtil.getCardsInZone(pZone).toArray();
|
Card[] c = pZone.getCards();
|
||||||
|
|
||||||
List<Card> tmp, diff;
|
List<Card> tmp, diff;
|
||||||
tmp = new ArrayList<Card>();
|
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) {
|
public void update(final Observable a, final Object b) {
|
||||||
PlayerZone pZone = (PlayerZone) a;
|
PlayerZone pZone = (PlayerZone) a;
|
||||||
|
|
||||||
Card[] c = AllZoneUtil.getCardsInZone(pZone).toArray();
|
Card[] c = pZone.getCards();
|
||||||
|
|
||||||
GuiDisplayUtil.setupPlayZone(playerPlayPanel, c);
|
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) {
|
public void update(final Observable a, final Object b) {
|
||||||
PlayerZone pZone = (PlayerZone) a;
|
PlayerZone pZone = (PlayerZone) a;
|
||||||
|
|
||||||
Card[] c = AllZoneUtil.getCardsInZone(pZone).toArray();
|
Card[] c = pZone.getCards();
|
||||||
|
|
||||||
GuiDisplayUtil.setupPlayZone(oppPlayPanel, c);
|
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() {
|
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) {
|
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) {
|
public boolean canPay(SpellAbility ability, Card source, Player activator, Cost cost) {
|
||||||
PlayerZone zone = activator.getZone(getFrom());
|
PlayerZone zone = activator.getZone(getFrom());
|
||||||
if (!getThis()) {
|
if (!getThis()) {
|
||||||
CardList typeList = AllZoneUtil.getCardsInZone(zone);
|
CardList typeList = new CardList(zone.getCards());
|
||||||
|
|
||||||
typeList = typeList.getValidCards(getType().split(";"), activator, source);
|
typeList = typeList.getValidCards(getType().split(";"), activator, source);
|
||||||
|
|
||||||
Integer amount = convertAmount();
|
Integer amount = convertAmount();
|
||||||
|
|||||||
Reference in New Issue
Block a user