diff --git a/forge-game/src/main/java/forge/game/trigger/TriggerChangesZone.java b/forge-game/src/main/java/forge/game/trigger/TriggerChangesZone.java index 8491b3548c0..b905bb5b442 100644 --- a/forge-game/src/main/java/forge/game/trigger/TriggerChangesZone.java +++ b/forge-game/src/main/java/forge/game/trigger/TriggerChangesZone.java @@ -25,10 +25,13 @@ import forge.game.spellability.SpellAbility; import forge.game.spellability.SpellAbilityStackInstance; import forge.util.Expressions; -import java.util.HashSet; import java.util.Map; import java.util.Set; +import org.apache.commons.lang3.ArrayUtils; + +import com.google.common.collect.Sets; + /** *

* Trigger_ChangesZone class. @@ -41,7 +44,7 @@ public class TriggerChangesZone extends Trigger { // stores the costs when this trigger has already been run (to prevent multiple card draw triggers for single // discard event of multiple cards on the Gitrog Moster for instance) - private Set processedCostEffects = new HashSet(); + private Set processedCostEffects = Sets.newHashSet(); /** *

@@ -67,7 +70,9 @@ public class TriggerChangesZone extends Trigger { if (this.mapParams.get("Origin") == null) { return false; } - if (!this.mapParams.get("Origin").equals(runParams2.get("Origin"))) { + if (!ArrayUtils.contains( + this.mapParams.get("Origin").split(","), runParams2.get("Origin") + )) { return false; } } @@ -75,24 +80,19 @@ public class TriggerChangesZone extends Trigger { if (this.mapParams.containsKey("Destination")) { if (!this.mapParams.get("Destination").equals("Any")) { - boolean validDest = false; - for (final String dest : this.mapParams.get("Destination").split(",")) { - if (dest.equals(runParams2.get("Destination"))) { - validDest = true; - break; - } - } - if (!validDest) { + if (!ArrayUtils.contains( + this.mapParams.get("Destination").split(","), runParams2.get("Destination") + )) { return false; } } } if (this.mapParams.containsKey("ExcludedDestinations")) { - for (final String notTo : this.mapParams.get("ExcludedDestinations").split(",")) { - if (notTo.equals(runParams2.get("Destination"))) { - return false; - } + if (!ArrayUtils.contains( + this.mapParams.get("ExcludedDestinations").split(","), runParams2.get("Destination") + )) { + return false; } }