mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
Fix Karn Liberated leaving emblems + phased out
This commit is contained in:
@@ -33,20 +33,30 @@ public class RestartGameEffect extends SpellAbilityEffect {
|
||||
|
||||
// Don't grab Ante Zones
|
||||
List<ZoneType> restartZones = new ArrayList<>(Arrays.asList(ZoneType.Battlefield,
|
||||
ZoneType.Library, ZoneType.Graveyard, ZoneType.Hand, ZoneType.Exile, ZoneType.Command));
|
||||
ZoneType.Library, ZoneType.Graveyard, ZoneType.Hand, ZoneType.Exile));
|
||||
|
||||
ZoneType leaveZone = ZoneType.smartValueOf(sa.hasParam("RestrictFromZone") ? sa.getParam("RestrictFromZone") : null);
|
||||
restartZones.remove(leaveZone);
|
||||
String leaveRestriction = sa.hasParam("RestrictFromValid") ? sa.getParam("RestrictFromValid") : "Card";
|
||||
|
||||
for (Player p : players) {
|
||||
CardCollection newLibrary = new CardCollection(p.getCardsIn(restartZones));
|
||||
CardCollection newLibrary = new CardCollection(p.getCardsIn(restartZones, false));
|
||||
List<Card> filteredCards = null;
|
||||
if (leaveZone != null) {
|
||||
filteredCards = CardLists.filter(p.getCardsIn(leaveZone),
|
||||
CardPredicates.restriction(leaveRestriction.split(","), p, sa.getHostCard(), null));
|
||||
newLibrary.addAll(filteredCards);
|
||||
}
|
||||
|
||||
// special handling for Karn to filter out non-cards
|
||||
CardCollection cmdCards = new CardCollection(p.getCardsIn(ZoneType.Command));
|
||||
for (Card c : cmdCards) {
|
||||
if (c.isCommander()) {
|
||||
newLibrary.add(c);
|
||||
}
|
||||
}
|
||||
p.getZone(ZoneType.Command).removeAllCards(true);
|
||||
|
||||
playerLibraries.put(p, newLibrary);
|
||||
}
|
||||
|
||||
|
||||
@@ -1512,9 +1512,12 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
* gets a list of all cards in a given player's requested zones.
|
||||
*/
|
||||
public final CardCollectionView getCardsIn(final Iterable<ZoneType> zones) {
|
||||
return getCardsIn(zones, true);
|
||||
}
|
||||
public final CardCollectionView getCardsIn(final Iterable<ZoneType> zones, boolean filterOutPhasedOut) {
|
||||
final CardCollection result = new CardCollection();
|
||||
for (final ZoneType z : zones) {
|
||||
result.addAll(getCardsIn(z));
|
||||
result.addAll(getCardsIn(z, filterOutPhasedOut));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user