(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:
Evan Kranzler 2022-03-23 18:45:02 -04:00 committed by GitHub
parent 53877424a0
commit 80e11b2052
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1719 changed files with 3384 additions and 3325 deletions

View file

@ -789,7 +789,7 @@ public abstract class PlayerImpl implements Player, Serializable {
return toDiscard;
}
TargetDiscard target = new TargetDiscard(minAmount, maxAmount, StaticFilters.FILTER_CARD, getId());
choose(Outcome.Discard, target, source != null ? source.getSourceId() : null, game);
choose(Outcome.Discard, target, source, game);
toDiscard.addAll(target.getTargets());
return toDiscard;
}
@ -2730,7 +2730,7 @@ public abstract class PlayerImpl implements Player, Serializable {
}
}
if (newTarget.choose(Outcome.Neutral, searchingController.getId(), targetPlayer.getId(), game)) {
if (newTarget.choose(Outcome.Neutral, searchingController.getId(), targetPlayer.getId(), source, game)) {
target.getTargets().clear();
for (UUID targetId : newTarget.getTargets()) {
target.add(targetId, game);
@ -2758,7 +2758,7 @@ public abstract class PlayerImpl implements Player, Serializable {
Set<Card> cards = this.getLibrary()
.getCards(game)
.stream()
.filter(card -> filter.match(card, source.getSourceId(), getId(), game))
.filter(card -> filter.match(card, getId(), source, game))
.collect(Collectors.toSet());
Card card = RandomUtil.randomFromCollection(cards);
if (card == null) {
@ -4231,7 +4231,7 @@ public abstract class PlayerImpl implements Player, Serializable {
}
private void addCostTargetOptions(List<Ability> options, Ability option, int targetNum, Game game) {
for (UUID targetId : option.getCosts().getTargets().get(targetNum).possibleTargets(option.getSourceId(), playerId, game)) {
for (UUID targetId : option.getCosts().getTargets().get(targetNum).possibleTargets(playerId, option, game)) {
Ability newOption = option.copy();
newOption.getCosts().getTargets().get(targetNum).addTarget(targetId, option, game, true);
if (targetNum < option.getCosts().getTargets().size() - 1) {
@ -4322,7 +4322,7 @@ public abstract class PlayerImpl implements Player, Serializable {
@Override
public boolean canPaySacrificeCost(Permanent permanent, Ability source, UUID controllerId, Game game) {
return sacrificeCostFilter == null || !sacrificeCostFilter.match(permanent, source.getSourceId(), controllerId, game);
return sacrificeCostFilter == null || !sacrificeCostFilter.match(permanent, controllerId, source, game);
}
@Override