forked from External/mage
(WIP) Replacing blocking/blocked by predicates (#8729)
* replaced blocking/blocked by predicates * added test for knight of dusk (currently fails) * added source parameter to filters and everything else that needs it * some changes to various predicates * test fix * small changes to filter code * merge fix * fixed a test failure * small change to Karn, Scion of Urza * removed sourceId from filter methods and other similar places * added new getobject method to fix some test failures * a few more fixes * fixed merge conflicts * merge fix
This commit is contained in:
parent
53877424a0
commit
80e11b2052
1719 changed files with 3384 additions and 3325 deletions
|
|
@ -2,6 +2,7 @@ package mage.cards;
|
|||
|
||||
import mage.MageItem;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
|
|
@ -110,21 +111,21 @@ public class CardsImpl extends LinkedHashSet<UUID> implements Cards, Serializabl
|
|||
}
|
||||
|
||||
@Override
|
||||
public int count(FilterCard filter, UUID sourceId, UUID playerId, Game game) {
|
||||
if (sourceId == null) {
|
||||
public int count(FilterCard filter, UUID playerId, Ability source, Game game) {
|
||||
if (source == null) {
|
||||
return count(filter, playerId, game);
|
||||
}
|
||||
return (int) this.stream().filter(card -> filter.match(game.getCard(card), sourceId, playerId, game)).count();
|
||||
return (int) this.stream().filter(card -> filter.match(game.getCard(card), playerId, source, game)).count();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Card> getCards(FilterCard filter, UUID sourceId, UUID playerId, Game game) {
|
||||
public Set<Card> getCards(FilterCard filter, UUID playerId, Ability source, Game game) {
|
||||
Set<Card> cards = new LinkedHashSet<>();
|
||||
for (UUID cardId : this) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null) {
|
||||
boolean match = filter.match(card, sourceId, playerId, game);
|
||||
boolean match = filter.match(card, playerId, source, game);
|
||||
if (match) {
|
||||
cards.add(game.getCard(cardId));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue