ReplaceMoved: update code and add ExcludeDestination

This commit is contained in:
Hanmac
2017-06-11 17:13:51 +00:00
parent f0abcd9d90
commit 05e8063b9b

View File

@@ -30,21 +30,21 @@ public class ReplaceMoved extends ReplacementEffect {
if (!runParams.get("Event").equals("Moved")) { if (!runParams.get("Event").equals("Moved")) {
return false; return false;
} }
if (this.getMapParams().containsKey("ValidCard")) { if (hasParam("ValidCard")) {
if (!matchesValid(runParams.get("Affected"), this.getMapParams().get("ValidCard").split(","), this.getHostCard())) { if (!matchesValid(runParams.get("Affected"), getParam("ValidCard").split(","), getHostCard())) {
return false; return false;
} }
} }
if (this.getMapParams().containsKey("ValidLKI")) { if (hasParam("ValidLKI")) {
if (!matchesValid(runParams.get("CardLKI"), this.getMapParams().get("ValidLKI").split(","), this.getHostCard())) { if (!matchesValid(runParams.get("CardLKI"), getParam("ValidLKI").split(","), getHostCard())) {
return false; return false;
} }
} }
boolean matchedZone = false; boolean matchedZone = false;
if (this.getMapParams().containsKey("Origin")) { if (hasParam("Origin")) {
for(ZoneType z : ZoneType.listValueOf(this.getMapParams().get("Origin"))) { for(ZoneType z : ZoneType.listValueOf(getParam("Origin"))) {
if(z == (ZoneType) runParams.get("Origin")) if(z == (ZoneType) runParams.get("Origin"))
matchedZone = true; matchedZone = true;
} }
@@ -55,9 +55,9 @@ public class ReplaceMoved extends ReplacementEffect {
} }
} }
if (this.getMapParams().containsKey("Destination")) { if (hasParam("Destination")) {
matchedZone = false; matchedZone = false;
for(ZoneType z : ZoneType.listValueOf(this.getMapParams().get("Destination"))) { for(ZoneType z : ZoneType.listValueOf(getParam("Destination"))) {
if(z == (ZoneType) runParams.get("Destination")) if(z == (ZoneType) runParams.get("Destination"))
matchedZone = true; matchedZone = true;
} }
@@ -68,6 +68,18 @@ public class ReplaceMoved extends ReplacementEffect {
} }
} }
if (hasParam("ExcludeDestination")) {
matchedZone = false;
for(ZoneType z : ZoneType.listValueOf(getParam("ExcludeDestination"))) {
if(z == (ZoneType) runParams.get("Destination"))
matchedZone = true;
}
if(matchedZone)
{
return false;
}
}
return true; return true;
} }