mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 03:22:00 -08:00
remove unnecessary method that missed source param
This commit is contained in:
parent
4e929dfbbd
commit
50acfad59c
10 changed files with 9 additions and 19 deletions
|
|
@ -103,7 +103,7 @@ class LlawanCephalidRuleModifyingEffect extends ContinuousRuleModifyingEffectImp
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null && game.isOpponent(controller, event.getPlayerId())) {
|
if (controller != null && game.isOpponent(controller, event.getPlayerId())) {
|
||||||
Card card = game.getCard(event.getSourceId());
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ class MirrorOfFateTarget extends TargetCardInExile {
|
||||||
&& game.getState().getZone(card.getId()) == Zone.EXILED) {
|
&& game.getState().getZone(card.getId()) == Zone.EXILED) {
|
||||||
for (ExileZone exile : game.getExile().getExileZones()) {
|
for (ExileZone exile : game.getExile().getExileZones()) {
|
||||||
if (exile != null && exile.contains(id)) {
|
if (exile != null && exile.contains(id)) {
|
||||||
return filter.match(card, source.getControllerId(), game);
|
return filter.match(card, source.getControllerId(), source, game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,7 @@ class TargetCardInMuseVesselExile extends TargetCardInExile {
|
||||||
exile = game.getExile().getExileZone(exileId);
|
exile = game.getExile().getExileZone(exileId);
|
||||||
}
|
}
|
||||||
if (exile != null && exile.contains(id)) {
|
if (exile != null && exile.contains(id)) {
|
||||||
return filter.match(card, source.getControllerId(), game);
|
return filter.match(card, source.getControllerId(), source, game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ class NissasEncouragementTarget extends TargetCardInLibrary {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return filter.match(card, playerId, game);
|
return filter.match(card, playerId, source, game);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ public class ManaValueInGraveyard implements DynamicValue {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int value = player.getGraveyard().stream().map(game::getCard).filter(Objects::nonNull)
|
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) {
|
if (multiplier != null) {
|
||||||
value *= multiplier;
|
value *= multiplier;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ public class CardsImpl extends LinkedHashSet<UUID> implements Cards, Serializabl
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int count(FilterCard filter, UUID playerId, Game game) {
|
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();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,7 @@ import mage.game.Game;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Works with cards only. For objects like commanders you must override your canTarget method.
|
* 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);
|
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) {
|
public boolean match(Card card, UUID playerId, Ability source, Game game) {
|
||||||
if (!this.match(card, game)) {
|
if (!this.match(card, game)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -80,10 +74,6 @@ public class FilterCard extends FilterObject<Card> {
|
||||||
extraPredicates.add(predicate);
|
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() {
|
public boolean hasPredicates() {
|
||||||
return !predicates.isEmpty() || !extraPredicates.isEmpty();
|
return !predicates.isEmpty() || !extraPredicates.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -180,7 +180,7 @@ public class TargetCard extends TargetObject {
|
||||||
int possibleTargets = 0;
|
int possibleTargets = 0;
|
||||||
for (Card card : game.getExile().getPermanentExile().getCards(game)) {
|
for (Card card : game.getExile().getPermanentExile().getCards(game)) {
|
||||||
if (sourceId == null || isNotTarget || !game.replaceEvent(new TargetEvent(card, sourceId, sourceControllerId))) {
|
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++;
|
possibleTargets++;
|
||||||
if (possibleTargets >= countUpTo) {
|
if (possibleTargets >= countUpTo) {
|
||||||
return possibleTargets; // early return for faster computation.
|
return possibleTargets; // early return for faster computation.
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ public class TargetCardInExile extends TargetCard {
|
||||||
ExileZone exileZone = game.getExile().getExileZone(zoneId);
|
ExileZone exileZone = game.getExile().getExileZone(zoneId);
|
||||||
if (exileZone != null) {
|
if (exileZone != null) {
|
||||||
for (Card card : exileZone.getCards(game)) {
|
for (Card card : exileZone.getCards(game)) {
|
||||||
if (filter.match(card, sourceControllerId, game)) {
|
if (filter.match(card, sourceControllerId, source, game)) {
|
||||||
possibleTargets.add(card.getId());
|
possibleTargets.add(card.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ public class TargetDiscard extends TargetCard {
|
||||||
@Override
|
@Override
|
||||||
public boolean canTarget(UUID id, Ability source, Game game) {
|
public boolean canTarget(UUID id, Ability source, Game game) {
|
||||||
Card card = game.getPlayer(playerId).getHand().get(id, 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
|
@Override
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue