mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
fix Java warning in CardList.java and remove obsolete function
This commit is contained in:
@@ -214,7 +214,6 @@ public class CardList implements Iterable<Card> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//cardType is like "Land" or "Goblin", returns a new CardList that is a subset of current CardList
|
//cardType is like "Land" or "Goblin", returns a new CardList that is a subset of current CardList
|
||||||
public CardList getType(final String cardType) {
|
public CardList getType(final String cardType) {
|
||||||
return this.filter(new CardListFilter() {
|
return this.filter(new CardListFilter() {
|
||||||
@@ -241,28 +240,6 @@ public class CardList implements Iterable<Card> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public CardList getTapState(String TappedOrUntapped)
|
|
||||||
{
|
|
||||||
CardList cl = new CardList();
|
|
||||||
Card c;
|
|
||||||
for (int i=0; i<size(); i++)
|
|
||||||
{
|
|
||||||
c = getCard(i);
|
|
||||||
if (TappedOrUntapped.equals("Tapped"))
|
|
||||||
{
|
|
||||||
if (c.isTapped() == true)
|
|
||||||
cl.add(c);
|
|
||||||
}
|
|
||||||
else if (TappedOrUntapped.equals("Untapped"))
|
|
||||||
{
|
|
||||||
if (c.isUntapped() == true)
|
|
||||||
cl.add(c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return cl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CardList getKeyword(final String keyword) {
|
public CardList getKeyword(final String keyword) {
|
||||||
return this.filter(new CardListFilter() {
|
return this.filter(new CardListFilter() {
|
||||||
public boolean addCard(Card c) {
|
public boolean addCard(Card c) {
|
||||||
@@ -305,16 +282,6 @@ public class CardList implements Iterable<Card> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/*no longer needed
|
|
||||||
public CardList canBeDamagedBy(final Card card) {
|
|
||||||
return this.filter(new CardListFilter() {
|
|
||||||
public boolean addCard(Card c) {
|
|
||||||
return CardFactoryUtil.canDamage(card, c);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
public CardList filter(CardListFilter f) {
|
public CardList filter(CardListFilter f) {
|
||||||
CardList c = new CardList();
|
CardList c = new CardList();
|
||||||
for(int i = 0; i < size(); i++)
|
for(int i = 0; i < size(); i++)
|
||||||
@@ -352,7 +319,7 @@ public class CardList implements Iterable<Card> {
|
|||||||
|
|
||||||
public void shuffle() {
|
public void shuffle() {
|
||||||
// reseed Random each time we want to Shuffle
|
// reseed Random each time we want to Shuffle
|
||||||
MyRandom.random = MyRandom.random;
|
//MyRandom.random = MyRandom.random;
|
||||||
Collections.shuffle(list, MyRandom.random);
|
Collections.shuffle(list, MyRandom.random);
|
||||||
Collections.shuffle(list, MyRandom.random);
|
Collections.shuffle(list, MyRandom.random);
|
||||||
Collections.shuffle(list, MyRandom.random);
|
Collections.shuffle(list, MyRandom.random);
|
||||||
@@ -416,4 +383,5 @@ public class CardList implements Iterable<Card> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
}//end class CardList
|
||||||
|
|||||||
@@ -3916,7 +3916,7 @@ public class CardFactoryUtil {
|
|||||||
{
|
{
|
||||||
CardList list = new CardList(AllZone.Computer_Battlefield.getCards());
|
CardList list = new CardList(AllZone.Computer_Battlefield.getCards());
|
||||||
list = list.getType(d[2]);
|
list = list.getType(d[2]);
|
||||||
list = list.getTapState("Tapped");
|
list = list.filter(AllZoneUtil.tapped);
|
||||||
|
|
||||||
for(int i = 0; i < n && i < list.size(); i++)
|
for(int i = 0; i < n && i < list.size(); i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -447,10 +447,8 @@ class CardFactory_Lands {
|
|||||||
private static final long serialVersionUID = 6175830918425915833L;
|
private static final long serialVersionUID = 6175830918425915833L;
|
||||||
final Player player = card.getController();
|
final Player player = card.getController();
|
||||||
public void execute() {
|
public void execute() {
|
||||||
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, card.getController());
|
CardList plains = AllZoneUtil.getPlayerLandsInPlay(card.getController());
|
||||||
CardList plains = new CardList(play.getCards());
|
plains = plains.filter(AllZoneUtil.untapped);
|
||||||
plains = plains.getType("Land");
|
|
||||||
plains = plains.getTapState("Untapped");
|
|
||||||
|
|
||||||
if( player.isComputer()) {
|
if( player.isComputer()) {
|
||||||
if( plains.size() > 1 ) {
|
if( plains.size() > 1 ) {
|
||||||
@@ -470,8 +468,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 ((new CardList(AllZone.Human_Battlefield.getCards())
|
if ((AllZoneUtil.getPlayerLandsInPlay(AllZone.HumanPlayer).filter(AllZoneUtil.untapped).size() < 2))
|
||||||
.getType("Land").getTapState("Untapped").size() < 2))
|
|
||||||
{
|
{
|
||||||
AllZone.GameAction.sacrifice(card);
|
AllZone.GameAction.sacrifice(card);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user