mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 20:11:59 -08:00
Removed obsolete Zone parameter in CardsImpl constructors.
This commit is contained in:
parent
65f4b4c2d7
commit
3dcdd7f046
66 changed files with 174 additions and 217 deletions
|
|
@ -35,7 +35,6 @@ import mage.abilities.effects.OneShotEffect;
|
|||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
|
@ -77,7 +76,7 @@ public class RevealTargetPlayerLibraryEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
Cards cards = new CardsImpl(Zone.LIBRARY);
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(player.getLibrary().getTopCards(game, amountCards.calculate(game, source, this)));
|
||||
player.revealCards(sourceObject.getIdName() + " - Top " + amountCards.toString() + "cards of " + targetPlayer.getName() + "\'s library", cards, game);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
|
|||
}
|
||||
int numberToReveal = this.numberCardsToReveal.calculate(game, source, this);
|
||||
if (numberToReveal > 0) {
|
||||
Cards revealedCards = new CardsImpl(Zone.HAND);
|
||||
Cards revealedCards = new CardsImpl();
|
||||
numberToReveal = Math.min(player.getHand().size(), numberToReveal);
|
||||
if (player.getHand().size() > numberToReveal) {
|
||||
TargetCardInHand chosenCards = new TargetCardInHand(numberToReveal, numberToReveal, new FilterCard("card in " + player.getLogName() + "'s hand"));
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ public abstract class SearchTargetGraveyardHandLibraryForCardNameAndExileEffect
|
|||
}
|
||||
|
||||
// cards in Library
|
||||
Cards cardsInLibrary = new CardsImpl(Zone.LIBRARY);
|
||||
Cards cardsInLibrary = new CardsImpl();
|
||||
cardsInLibrary.addAll(targetPlayer.getLibrary().getCards(game));
|
||||
cardsCount = (cardName.isEmpty() ? 0 : cardsInLibrary.count(filter, game));
|
||||
filter.setMessage("card named " + cardName + " in the library of " + targetPlayer.getLogName());
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ class HideawayExileEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
|
||||
Cards cards = new CardsImpl(Zone.LIBRARY);
|
||||
Cards cards = new CardsImpl();
|
||||
cards.addAll(controller.getLibrary().getTopCards(game, 4));
|
||||
if (cards.size() > 0) {
|
||||
TargetCard target1 = new TargetCard(Zone.LIBRARY, filter1);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ import java.util.Map;
|
|||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.util.ThreadLocalStringBuilder;
|
||||
|
|
@ -53,7 +52,6 @@ public class CardsImpl extends LinkedHashSet<UUID> implements Cards, Serializabl
|
|||
|
||||
private static Random rnd = new Random();
|
||||
private UUID ownerId;
|
||||
private Zone zone;
|
||||
|
||||
public CardsImpl() {
|
||||
}
|
||||
|
|
@ -70,21 +68,9 @@ public class CardsImpl extends LinkedHashSet<UUID> implements Cards, Serializabl
|
|||
}
|
||||
}
|
||||
|
||||
public CardsImpl(Zone zone) {
|
||||
this.zone = zone;
|
||||
}
|
||||
|
||||
public CardsImpl(Zone zone, Collection<Card> cards) {
|
||||
this(zone);
|
||||
for (Card card : cards) {
|
||||
this.add(card.getId());
|
||||
}
|
||||
}
|
||||
|
||||
public CardsImpl(final CardsImpl cards) {
|
||||
this.addAll(cards);
|
||||
this.ownerId = cards.ownerId;
|
||||
this.zone = cards.zone;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -126,7 +112,7 @@ public class CardsImpl extends LinkedHashSet<UUID> implements Cards, Serializabl
|
|||
if (this.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
UUID[] cards = this.toArray(new UUID[0]);
|
||||
UUID[] cards = this.toArray(new UUID[this.size()]);
|
||||
return game.getCard(cards[rnd.nextInt(cards.length)]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ package mage.game;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.UUID;
|
||||
import mage.constants.Zone;
|
||||
import mage.cards.CardsImpl;
|
||||
|
||||
/**
|
||||
|
|
@ -48,7 +47,7 @@ public class ExileZone extends CardsImpl implements Serializable {
|
|||
}
|
||||
|
||||
public ExileZone(UUID id, String name, boolean hidden) {
|
||||
super(Zone.EXILED);
|
||||
super();
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.hidden = hidden;
|
||||
|
|
|
|||
|
|
@ -4,12 +4,11 @@ import java.util.UUID;
|
|||
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.Zone;
|
||||
|
||||
public class Graveyard extends CardsImpl {
|
||||
|
||||
public Graveyard() {
|
||||
super(Zone.GRAVEYARD);
|
||||
super();
|
||||
}
|
||||
|
||||
public Graveyard(final Graveyard graveyard) {
|
||||
|
|
|
|||
|
|
@ -245,13 +245,13 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
this(UUID.randomUUID());
|
||||
this.name = name;
|
||||
this.range = range;
|
||||
hand = new CardsImpl(Zone.HAND);
|
||||
hand = new CardsImpl();
|
||||
graveyard = new Graveyard();
|
||||
abilities = new AbilitiesImpl<>();
|
||||
counters = new Counters();
|
||||
manaPool = new ManaPool(playerId);
|
||||
library = new Library(playerId);
|
||||
sideboard = new CardsImpl(Zone.OUTSIDE);
|
||||
sideboard = new CardsImpl();
|
||||
}
|
||||
|
||||
protected PlayerImpl(UUID id) {
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import java.util.List;
|
|||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
|
|
@ -91,9 +92,13 @@ public class TargetCardInLibrary extends TargetCard {
|
|||
cards = new ArrayList<>(targetPlayer.getLibrary().getTopCards(game, librarySearchLimit));
|
||||
}
|
||||
Collections.sort(cards, new CardNameComparator());
|
||||
Cards cardsId = new CardsImpl();
|
||||
for (Card card : cards) {
|
||||
cardsId.add(card);
|
||||
}
|
||||
while (!isChosen() && !doneChosing()) {
|
||||
chosen = targets.size() >= minNumberOfTargets;
|
||||
if (!player.chooseTarget(outcome, new CardsImpl(Zone.LIBRARY, cards), this, null, game)) {
|
||||
if (!player.chooseTarget(outcome, cardsId, this, null, game)) {
|
||||
return chosen;
|
||||
}
|
||||
chosen = targets.size() >= minNumberOfTargets;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue