Revert unnecessary changes of getCards()

This commit is contained in:
Lyu Zong-Hong
2021-02-10 19:48:22 +09:00
parent 24800840be
commit 3812a85a8e
8 changed files with 16 additions and 19 deletions

View File

@@ -636,7 +636,7 @@ public class Game {
if (!visitor.visitAll(player.getZone(ZoneType.Library).getCards())) { if (!visitor.visitAll(player.getZone(ZoneType.Library).getCards())) {
return; return;
} }
if (!visitor.visitAll(player.getZone(ZoneType.Battlefield).getCards(false, true))) { if (!visitor.visitAll(player.getZone(ZoneType.Battlefield).getCards(false))) {
return; return;
} }
if (!visitor.visitAll(player.getZone(ZoneType.Exile).getCards())) { if (!visitor.visitAll(player.getZone(ZoneType.Exile).getCards())) {

View File

@@ -100,7 +100,7 @@ public class SubgameEffect extends SpellAbilityEffect {
final FCollectionView<Player> players = subgame.getPlayers(); final FCollectionView<Player> players = subgame.getPlayers();
final FCollectionView<Player> maingamePlayers = maingame.getPlayers(); final FCollectionView<Player> maingamePlayers = maingame.getPlayers();
final List<ZoneType> outsideZones = Arrays.asList(ZoneType.Hand, ZoneType.Battlefield, final List<ZoneType> outsideZones = Arrays.asList(ZoneType.Hand, ZoneType.Battlefield,
ZoneType.Graveyard, ZoneType.Exile, ZoneType.Stack, ZoneType.Sideboard, ZoneType.Ante); ZoneType.Graveyard, ZoneType.Exile, ZoneType.Stack, ZoneType.Sideboard, ZoneType.Ante, ZoneType.Merged);
for (int i = 0; i < players.size(); i++) { for (int i = 0; i < players.size(); i++) {
final Player player = players.get(i); final Player player = players.get(i);

View File

@@ -4283,7 +4283,7 @@ public class CardFactoryUtil {
final StringBuilder sbMutate = new StringBuilder(); final StringBuilder sbMutate = new StringBuilder();
sbMutate.append("SP$ Mutate | Cost$ "); sbMutate.append("SP$ Mutate | Cost$ ");
sbMutate.append(cost); sbMutate.append(cost);
sbMutate.append(" | Mutate True | ValidTgts$ Creature.sharesOwnerWith+nonHuman"); sbMutate.append(" | ValidTgts$ Creature.sharesOwnerWith+nonHuman");
final SpellAbility sa = AbilityFactory.getAbility(sbMutate.toString(), card); final SpellAbility sa = AbilityFactory.getAbility(sbMutate.toString(), card);
sa.setDescription("Mutate " + ManaCostParser.parse(cost) + sa.setDescription("Mutate " + ManaCostParser.parse(cost) +

View File

@@ -1497,7 +1497,7 @@ public class Player extends GameEntity implements Comparable<Player> {
} }
PlayerZone zone = getZone(zoneType); PlayerZone zone = getZone(zoneType);
return zone == null ? CardCollection.EMPTY : zone.getCards(filterOutPhasedOut, true); return zone == null ? CardCollection.EMPTY : zone.getCards(filterOutPhasedOut);
} }
public final CardCollectionView getCardsIncludePhasingIn(final ZoneType zone) { public final CardCollectionView getCardsIncludePhasingIn(final ZoneType zone) {

View File

@@ -470,7 +470,7 @@ public class PlayerView extends GameEntityView {
void updateZone(PlayerZone zone) { void updateZone(PlayerZone zone) {
TrackableProperty prop = getZoneProp(zone.getZoneType()); TrackableProperty prop = getZoneProp(zone.getZoneType());
if (prop == null) { return; } if (prop == null) { return; }
set(prop, CardView.getCollection(zone.getCards(false, true))); set(prop, CardView.getCollection(zone.getCards(false)));
//update delirium //update delirium
if (ZoneType.Graveyard == zone.getZoneType()) if (ZoneType.Graveyard == zone.getZoneType())

View File

@@ -106,7 +106,7 @@ public class PlayerZone extends Zone {
} }
public CardCollectionView getCardsPlayerCanActivate(Player who) { public CardCollectionView getCardsPlayerCanActivate(Player who) {
CardCollectionView cl = getCards(false, true); CardCollectionView cl = getCards(false);
boolean checkingForOwner = who == player; boolean checkingForOwner = who == player;
if (checkingForOwner && (is(ZoneType.Battlefield) || is(ZoneType.Hand))) { if (checkingForOwner && (is(ZoneType.Battlefield) || is(ZoneType.Hand))) {

View File

@@ -84,20 +84,18 @@ public class PlayerZoneBattlefield extends PlayerZone {
} }
@Override @Override
public final CardCollectionView getCards(final boolean filterOutPhasedOut, final boolean filterOutMerged) { public final CardCollectionView getCards(final boolean filter) {
// Battlefield filters out Phased Out cards by default. Needs to call // Battlefield filters out Phased Out cards by default. Needs to call
// getCards(false) to get Phased Out cards // getCards(false) to get Phased Out cards
// For merged permanent, also filter out all merged cards except the top one
CardCollectionView cards = super.getCards(false, false); CardCollectionView cards = super.getCards(false);
if (!filterOutPhasedOut && !filterOutMerged) { if (!filter) {
return cards; return cards;
} }
boolean hasFilteredCard = false; boolean hasFilteredCard = false;
for (Card c : cards) { for (Card c : cards) {
if (filterOutPhasedOut && c.isPhasedOut() || if (c.isPhasedOut()) {
filterOutMerged && c.getMergedToCard() != null) {
hasFilteredCard = true; hasFilteredCard = true;
break; break;
} }
@@ -106,8 +104,7 @@ public class PlayerZoneBattlefield extends PlayerZone {
if (hasFilteredCard) { if (hasFilteredCard) {
CardCollection filteredCollection = new CardCollection(); CardCollection filteredCollection = new CardCollection();
for (Card c : cards) { for (Card c : cards) {
if ((!filterOutPhasedOut || !c.isPhasedOut()) && if (!c.isPhasedOut()) {
(!filterOutMerged || c.getMergedToCard() == null)) {
filteredCollection.add(c); filteredCollection.add(c);
} }
} }

View File

@@ -190,10 +190,10 @@ public class Zone implements java.io.Serializable, Iterable<Card> {
} }
public final CardCollectionView getCards() { public final CardCollectionView getCards() {
return getCards(true, true); return getCards(true);
} }
public CardCollectionView getCards(final boolean filterOutPhasedOut, final boolean filterOutMerged) { public CardCollectionView getCards(final boolean filter) {
return cardList; // Non-Battlefield PlayerZones don't care about the filter return cardList; // Non-Battlefield PlayerZones don't care about the filter
} }