mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
cleanup calls to respect range of influence
This commit is contained in:
parent
156c474df8
commit
4025b312ad
29 changed files with 39 additions and 41 deletions
|
|
@ -14,8 +14,8 @@ import mage.game.permanent.Permanent;
|
|||
*/
|
||||
public class CountersCount implements DynamicValue {
|
||||
|
||||
private CounterType counter;
|
||||
private FilterPermanent filter;
|
||||
private final CounterType counter;
|
||||
private final FilterPermanent filter;
|
||||
|
||||
public CountersCount(CounterType counterType) {
|
||||
this(counterType, new FilterPermanent());
|
||||
|
|
@ -34,7 +34,7 @@ public class CountersCount implements DynamicValue {
|
|||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
int count = 0;
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) {
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, sourceAbility.getControllerId(), sourceAbility, game)) {
|
||||
count += permanent.getCounters(game).getCount(counter);
|
||||
}
|
||||
return count;
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public class UntapLandsEffect extends OneShotEffect {
|
|||
if (upTo) {
|
||||
tappedLands = game.getBattlefield().getAllActivePermanents(filter, controller.getId(), game).size();
|
||||
} else {
|
||||
tappedLands = game.getBattlefield().getAllActivePermanents(filter, game).size();
|
||||
tappedLands = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game).size();
|
||||
}
|
||||
TargetLandPermanent target = new TargetLandPermanent(upTo ? 0 : Math.min(tappedLands, amount), amount, filter, true);
|
||||
if (target.canChoose(source.getControllerId(), source, game)) {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public class TargetTappedPermanentAsYouCast extends TargetPermanent {
|
|||
|
||||
@Override
|
||||
public Set<UUID> possibleTargets(UUID sourceControllerId, Ability source, Game game) {
|
||||
return game.getBattlefield().getAllActivePermanents(getFilter(), game).stream()
|
||||
return game.getBattlefield().getActivePermanents(getFilter(), source.getControllerId(), source, game).stream()
|
||||
.filter(Permanent::isTapped)
|
||||
.map(Permanent::getId)
|
||||
.collect(Collectors.toSet());
|
||||
|
|
@ -38,7 +38,7 @@ public class TargetTappedPermanentAsYouCast extends TargetPermanent {
|
|||
|
||||
@Override
|
||||
public boolean canChoose(UUID sourceControllerId, Ability source, Game game) {
|
||||
return game.getBattlefield().getAllActivePermanents(getFilter(), game).stream()
|
||||
return game.getBattlefield().getActivePermanents(getFilter(), source.getControllerId(), source, game).stream()
|
||||
.anyMatch(Permanent::isTapped);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue