This commit is contained in:
Alex W. Jackson 2022-10-06 22:01:54 -04:00
parent 4b469c8840
commit 92cafbd8b1
3 changed files with 18 additions and 49 deletions

View file

@ -37,7 +37,7 @@ public class TapTargetCost extends CostImpl {
@Override
public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) {
List<Permanent> permanents = new ArrayList<>();
if (target.choose(Outcome.Tap, controllerId, source.getSourceId(), source, game)) {
if (target.getMaxNumberOfTargets() > 0 && target.choose(Outcome.Tap, controllerId, source.getSourceId(), source, game)) {
for (UUID targetId : target.getTargets()) {
Permanent permanent = game.getPermanent(targetId);
if (permanent == null) {
@ -47,6 +47,9 @@ public class TapTargetCost extends CostImpl {
permanents.add(permanent);
}
}
if (target.getNumberOfTargets() == 0) {
paid = true; // e.g. Aryel with X = 0
}
source.getEffects().setValue("tappedPermanents", permanents);
return paid;
}
@ -64,5 +67,4 @@ public class TapTargetCost extends CostImpl {
public TapTargetCost copy() {
return new TapTargetCost(this);
}
}

View file

@ -39,7 +39,7 @@ public class TapVariableTargetCost extends VariableCostImpl {
@Override
public int getMaxValue(Ability source, Game game) {
return game.getBattlefield().countAll(filter, source.getControllerId(), game);
return game.getBattlefield().count(filter, source.getControllerId(), source, game);
}
@Override