remove unnecessary method that missed source param

This commit is contained in:
xenohedron 2025-06-08 00:57:07 -04:00
parent 4e929dfbbd
commit 50acfad59c
10 changed files with 9 additions and 19 deletions

View file

@ -103,7 +103,7 @@ class LlawanCephalidRuleModifyingEffect extends ContinuousRuleModifyingEffectImp
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && game.isOpponent(controller, event.getPlayerId())) {
Card card = game.getCard(event.getSourceId());
if (card != null && filter.match(card, source.getControllerId(), game)) {
if (card != null && filter.match(card, source.getControllerId(), source, game)) {
return true;
}
}

View file

@ -116,7 +116,7 @@ class MirrorOfFateTarget extends TargetCardInExile {
&& game.getState().getZone(card.getId()) == Zone.EXILED) {
for (ExileZone exile : game.getExile().getExileZones()) {
if (exile != null && exile.contains(id)) {
return filter.match(card, source.getControllerId(), game);
return filter.match(card, source.getControllerId(), source, game);
}
}
}

View file

@ -172,7 +172,7 @@ class TargetCardInMuseVesselExile extends TargetCardInExile {
exile = game.getExile().getExileZone(exileId);
}
if (exile != null && exile.contains(id)) {
return filter.match(card, source.getControllerId(), game);
return filter.match(card, source.getControllerId(), source, game);
}
}
return false;

View file

@ -154,7 +154,7 @@ class NissasEncouragementTarget extends TargetCardInLibrary {
return false;
}
}
return filter.match(card, playerId, game);
return filter.match(card, playerId, source, game);
}
return false;
}

View file

@ -46,7 +46,7 @@ public class ManaValueInGraveyard implements DynamicValue {
return 0;
}
int value = player.getGraveyard().stream().map(game::getCard).filter(Objects::nonNull)
.filter(card -> filter.match(card, playerId, game)).mapToInt(MageObject::getManaValue).sum();
.filter(card -> filter.match(card, playerId, sourceAbility, game)).mapToInt(MageObject::getManaValue).sum();
if (multiplier != null) {
value *= multiplier;
}

View file

@ -99,7 +99,7 @@ public class CardsImpl extends LinkedHashSet<UUID> implements Cards, Serializabl
@Override
public int count(FilterCard filter, UUID playerId, Game game) {
return (int) this.stream().filter(card -> filter.match(game.getCard(card), playerId, game)).count();
return (int) this.stream().filter(card -> filter.match(game.getCard(card), playerId, null, game)).count();
}

View file

@ -11,9 +11,7 @@ import mage.game.Game;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
/**
* Works with cards only. For objects like commanders you must override your canTarget method.
@ -56,10 +54,6 @@ public class FilterCard extends FilterObject<Card> {
return super.match(card, game);
}
public boolean match(Card card, UUID playerId, Game game) {
return match(card, playerId, null, game);
}
public boolean match(Card card, UUID playerId, Ability source, Game game) {
if (!this.match(card, game)) {
return false;
@ -80,10 +74,6 @@ public class FilterCard extends FilterObject<Card> {
extraPredicates.add(predicate);
}
public Set<Card> filter(Set<Card> cards, Game game) {
return cards.stream().filter(card -> match(card, game)).collect(Collectors.toSet());
}
public boolean hasPredicates() {
return !predicates.isEmpty() || !extraPredicates.isEmpty();
}

View file

@ -180,7 +180,7 @@ public class TargetCard extends TargetObject {
int possibleTargets = 0;
for (Card card : game.getExile().getPermanentExile().getCards(game)) {
if (sourceId == null || isNotTarget || !game.replaceEvent(new TargetEvent(card, sourceId, sourceControllerId))) {
if (filter.match(card, player.getId(), game)) {
if (filter.match(card, player.getId(), source, game)) {
possibleTargets++;
if (possibleTargets >= countUpTo) {
return possibleTargets; // early return for faster computation.

View file

@ -75,7 +75,7 @@ public class TargetCardInExile extends TargetCard {
ExileZone exileZone = game.getExile().getExileZone(zoneId);
if (exileZone != null) {
for (Card card : exileZone.getCards(game)) {
if (filter.match(card, sourceControllerId, game)) {
if (filter.match(card, sourceControllerId, source, game)) {
possibleTargets.add(card.getId());
}
}

View file

@ -47,7 +47,7 @@ public class TargetDiscard extends TargetCard {
@Override
public boolean canTarget(UUID id, Ability source, Game game) {
Card card = game.getPlayer(playerId).getHand().get(id, game);
return filter.match(card, source.getControllerId(), game);
return filter.match(card, source.getControllerId(), source, game);
}
@Override