Fix Dour Port-Mage (#5651)

This commit is contained in:
tool4ever
2024-07-19 16:09:04 +00:00
committed by GitHub
parent 0d322e3082
commit e86baf27be
3 changed files with 16 additions and 12 deletions

View File

@@ -130,9 +130,9 @@ public class CardZoneTable extends ForwardingTable<ZoneType, ZoneType, CardColle
} }
} }
public CardCollection filterCards(Iterable<ZoneType> origin, ZoneType destination, String valid, Card host, CardTraitBase sa) { public CardCollection filterCards(Iterable<ZoneType> origin, Iterable<ZoneType> destination, String valid, Card host, CardTraitBase sa) {
CardCollection allCards = new CardCollection(); CardCollection allCards = new CardCollection();
if (destination != null && !containsColumn(destination)) { if (destination != null && !Iterables.any(destination, d -> columnKeySet().contains(d))) {
return allCards; return allCards;
} }
if (origin != null) { if (origin != null) {
@@ -147,9 +147,11 @@ public class CardZoneTable extends ForwardingTable<ZoneType, ZoneType, CardColle
lkiLookup = lastStateGraveyard; lkiLookup = lastStateGraveyard;
} }
if (destination != null) { if (destination != null) {
if (row(z).containsKey(destination)) { for (ZoneType zt : destination) {
for (Card c : row(z).get(destination)) { if (row(z).containsKey(zt)) {
allCards.add(lkiLookup.get(c)); for (Card c : row(z).get(zt)) {
allCards.add(lkiLookup.get(c));
}
} }
} }
} else { } else {
@@ -162,8 +164,10 @@ public class CardZoneTable extends ForwardingTable<ZoneType, ZoneType, CardColle
} }
} }
} else if (destination != null) { } else if (destination != null) {
for (CardCollection c : column(destination).values()) { for (ZoneType zt : destination) {
allCards.addAll(c); for (CardCollection c : column(zt).values()) {
allCards.addAll(c);
}
} }
} else { } else {
for (CardCollection c : values()) { for (CardCollection c : values()) {

View File

@@ -123,16 +123,16 @@ public class StaticAbilityPanharmonicon {
} }
List<ZoneType> trigOrigin = null; List<ZoneType> trigOrigin = null;
ZoneType trigDestination = null; List<ZoneType> trigDestination = null;
if (trigger.hasParam("Destination") && !trigger.getParam("Destination").equals("Any")) { if (trigger.hasParam("Destination") && !trigger.getParam("Destination").equals("Any")) {
trigDestination = ZoneType.valueOf(trigger.getParam("Destination")); trigDestination = ZoneType.listValueOf(trigger.getParam("Destination"));
} }
if (trigger.hasParam("Origin") && !trigger.getParam("Origin").equals("Any")) { if (trigger.hasParam("Origin") && !trigger.getParam("Origin").equals("Any")) {
trigOrigin = ZoneType.listValueOf(trigger.getParam("Origin")); trigOrigin = ZoneType.listValueOf(trigger.getParam("Origin"));
} }
CardCollection causesForTrigger = table.filterCards(trigOrigin, trigDestination, trigger.getParam("ValidCards"), trigger.getHostCard(), trigger); CardCollection causesForTrigger = table.filterCards(trigOrigin, trigDestination, trigger.getParam("ValidCards"), trigger.getHostCard(), trigger);
CardCollection causesForStatic = table.filterCards(origin == null ? null : ImmutableList.of(ZoneType.smartValueOf(origin)), ZoneType.smartValueOf(destination), stAb.getParam("ValidCause"), host, stAb); CardCollection causesForStatic = table.filterCards(origin == null ? null : ImmutableList.of(ZoneType.smartValueOf(origin)), destination == null ? null : ZoneType.listValueOf(destination), stAb.getParam("ValidCause"), host, stAb);
// check that whatever caused the trigger to fire is also a cause the static applies for // check that whatever caused the trigger to fire is also a cause the static applies for
if (Collections.disjoint(causesForTrigger, causesForStatic)) { if (Collections.disjoint(causesForTrigger, causesForStatic)) {

View File

@@ -74,11 +74,11 @@ public class TriggerChangesZoneAll extends Trigger {
} }
private CardCollection filterCards(CardZoneTable table) { private CardCollection filterCards(CardZoneTable table) {
ZoneType destination = null; List<ZoneType> destination = null;
List<ZoneType> origin = null; List<ZoneType> origin = null;
if (hasParam("Destination") && !getParam("Destination").equals("Any")) { if (hasParam("Destination") && !getParam("Destination").equals("Any")) {
destination = ZoneType.valueOf(getParam("Destination")); destination = ZoneType.listValueOf(getParam("Destination"));
} }
if (hasParam("Origin") && !getParam("Origin").equals("Any")) { if (hasParam("Origin") && !getParam("Origin").equals("Any")) {