mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
fixed Pattern Matcher counting itself when it searches (fixes #5994)
This commit is contained in:
parent
13ba8b0900
commit
24a7f13c81
1 changed files with 8 additions and 6 deletions
|
@ -19,9 +19,9 @@ import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.common.TargetCardInLibrary;
|
import mage.target.common.TargetCardInLibrary;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author TheElk801
|
* @author TheElk801
|
||||||
|
@ -72,14 +72,16 @@ class RegularExpression extends OneShotEffect {
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
List<NamePredicate> predicates = new ArrayList();
|
List<NamePredicate> predicates = game
|
||||||
game.getBattlefield()
|
.getBattlefield()
|
||||||
.getAllActivePermanents(
|
.getActivePermanents(
|
||||||
StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, source.getControllerId(), game
|
StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE,
|
||||||
|
source.getControllerId(), source.getSourceId(), game
|
||||||
).stream()
|
).stream()
|
||||||
.map(Permanent::getName)
|
.map(Permanent::getName)
|
||||||
.filter(s -> !"".equals(s))
|
.filter(s -> !"".equals(s))
|
||||||
.forEach(s -> predicates.add(new NamePredicate(s)));
|
.map(NamePredicate::new)
|
||||||
|
.collect(Collectors.toList());
|
||||||
FilterCard filter
|
FilterCard filter
|
||||||
= new FilterCard("a creature card with the same name as another creature you control");
|
= new FilterCard("a creature card with the same name as another creature you control");
|
||||||
filter.add(Predicates.or(predicates));
|
filter.add(Predicates.or(predicates));
|
||||||
|
|
Loading…
Reference in a new issue