From 05e8063b9bd984cbc2b42da85ca6dd25d8cfb3f4 Mon Sep 17 00:00:00 2001 From: Hanmac Date: Sun, 11 Jun 2017 17:13:51 +0000 Subject: [PATCH] ReplaceMoved: update code and add ExcludeDestination --- .../forge/game/replacement/ReplaceMoved.java | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/forge-game/src/main/java/forge/game/replacement/ReplaceMoved.java b/forge-game/src/main/java/forge/game/replacement/ReplaceMoved.java index a88dedc02c2..46384d10698 100644 --- a/forge-game/src/main/java/forge/game/replacement/ReplaceMoved.java +++ b/forge-game/src/main/java/forge/game/replacement/ReplaceMoved.java @@ -30,21 +30,21 @@ public class ReplaceMoved extends ReplacementEffect { if (!runParams.get("Event").equals("Moved")) { return false; } - if (this.getMapParams().containsKey("ValidCard")) { - if (!matchesValid(runParams.get("Affected"), this.getMapParams().get("ValidCard").split(","), this.getHostCard())) { + if (hasParam("ValidCard")) { + if (!matchesValid(runParams.get("Affected"), getParam("ValidCard").split(","), getHostCard())) { return false; } } - if (this.getMapParams().containsKey("ValidLKI")) { - if (!matchesValid(runParams.get("CardLKI"), this.getMapParams().get("ValidLKI").split(","), this.getHostCard())) { + if (hasParam("ValidLKI")) { + if (!matchesValid(runParams.get("CardLKI"), getParam("ValidLKI").split(","), getHostCard())) { return false; } } boolean matchedZone = false; - if (this.getMapParams().containsKey("Origin")) { - for(ZoneType z : ZoneType.listValueOf(this.getMapParams().get("Origin"))) { + if (hasParam("Origin")) { + for(ZoneType z : ZoneType.listValueOf(getParam("Origin"))) { if(z == (ZoneType) runParams.get("Origin")) matchedZone = true; } @@ -55,9 +55,9 @@ public class ReplaceMoved extends ReplacementEffect { } } - if (this.getMapParams().containsKey("Destination")) { + if (hasParam("Destination")) { matchedZone = false; - for(ZoneType z : ZoneType.listValueOf(this.getMapParams().get("Destination"))) { + for(ZoneType z : ZoneType.listValueOf(getParam("Destination"))) { if(z == (ZoneType) runParams.get("Destination")) 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; }