From 24a7f13c8161bec644eabda86f0edd4f07b7bb86 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 21 Sep 2019 21:36:36 -0400 Subject: [PATCH] fixed Pattern Matcher counting itself when it searches (fixes #5994) --- Mage.Sets/src/mage/cards/p/PatternMatcher.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Mage.Sets/src/mage/cards/p/PatternMatcher.java b/Mage.Sets/src/mage/cards/p/PatternMatcher.java index 61844ffa6d..c53382c25e 100644 --- a/Mage.Sets/src/mage/cards/p/PatternMatcher.java +++ b/Mage.Sets/src/mage/cards/p/PatternMatcher.java @@ -19,9 +19,9 @@ import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.common.TargetCardInLibrary; -import java.util.ArrayList; import java.util.List; import java.util.UUID; +import java.util.stream.Collectors; /** * @author TheElk801 @@ -72,14 +72,16 @@ class RegularExpression extends OneShotEffect { if (player == null) { return false; } - List predicates = new ArrayList(); - game.getBattlefield() - .getAllActivePermanents( - StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, source.getControllerId(), game + List predicates = game + .getBattlefield() + .getActivePermanents( + StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, + source.getControllerId(), source.getSourceId(), game ).stream() .map(Permanent::getName) .filter(s -> !"".equals(s)) - .forEach(s -> predicates.add(new NamePredicate(s))); + .map(NamePredicate::new) + .collect(Collectors.toList()); FilterCard filter = new FilterCard("a creature card with the same name as another creature you control"); filter.add(Predicates.or(predicates));