mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +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
|
// Don't grab Ante Zones
|
||||||
List<ZoneType> restartZones = new ArrayList<>(Arrays.asList(ZoneType.Battlefield,
|
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);
|
ZoneType leaveZone = ZoneType.smartValueOf(sa.hasParam("RestrictFromZone") ? sa.getParam("RestrictFromZone") : null);
|
||||||
restartZones.remove(leaveZone);
|
restartZones.remove(leaveZone);
|
||||||
String leaveRestriction = sa.hasParam("RestrictFromValid") ? sa.getParam("RestrictFromValid") : "Card";
|
String leaveRestriction = sa.hasParam("RestrictFromValid") ? sa.getParam("RestrictFromValid") : "Card";
|
||||||
|
|
||||||
for (Player p : players) {
|
for (Player p : players) {
|
||||||
CardCollection newLibrary = new CardCollection(p.getCardsIn(restartZones));
|
CardCollection newLibrary = new CardCollection(p.getCardsIn(restartZones, false));
|
||||||
List<Card> filteredCards = null;
|
List<Card> filteredCards = null;
|
||||||
if (leaveZone != null) {
|
if (leaveZone != null) {
|
||||||
filteredCards = CardLists.filter(p.getCardsIn(leaveZone),
|
filteredCards = CardLists.filter(p.getCardsIn(leaveZone),
|
||||||
CardPredicates.restriction(leaveRestriction.split(","), p, sa.getHostCard(), null));
|
CardPredicates.restriction(leaveRestriction.split(","), p, sa.getHostCard(), null));
|
||||||
newLibrary.addAll(filteredCards);
|
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);
|
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.
|
* gets a list of all cards in a given player's requested zones.
|
||||||
*/
|
*/
|
||||||
public final CardCollectionView getCardsIn(final Iterable<ZoneType> 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();
|
final CardCollection result = new CardCollection();
|
||||||
for (final ZoneType z : zones) {
|
for (final ZoneType z : zones) {
|
||||||
result.addAll(getCardsIn(z));
|
result.addAll(getCardsIn(z, filterOutPhasedOut));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user