fixed a few errors with urza lands

This commit is contained in:
Evan Kranzler 2020-05-01 07:55:18 -04:00
parent 8b09f99708
commit bc2ef9492e

View file

@ -5,6 +5,7 @@ import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.constants.SubType; import mage.constants.SubType;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.game.Game; import mage.game.Game;
public enum UrzaTerrainValue implements DynamicValue { public enum UrzaTerrainValue implements DynamicValue {
@ -15,9 +16,9 @@ public enum UrzaTerrainValue implements DynamicValue {
private final int value; private final int value;
private final SubType subType; private final SubType subType;
private static final FilterPermanent mineFilter = new FilterPermanent(SubType.MINE, ""); private static final FilterPermanent mineFilter = new FilterControlledPermanent(SubType.MINE);
private static final FilterPermanent towerFilter = new FilterPermanent(SubType.MINE, ""); private static final FilterPermanent towerFilter = new FilterControlledPermanent(SubType.TOWER);
private static final FilterPermanent powerPlantFilter = new FilterPermanent(SubType.POWER_PLANT, ""); private static final FilterPermanent powerPlantFilter = new FilterControlledPermanent(SubType.POWER_PLANT);
static { static {
mineFilter.add(SubType.URZAS.getPredicate()); mineFilter.add(SubType.URZAS.getPredicate());
@ -32,18 +33,18 @@ public enum UrzaTerrainValue implements DynamicValue {
@Override @Override
public int calculate(Game game, Ability sourceAbility, Effect effect) { public int calculate(Game game, Ability sourceAbility, Effect effect) {
if (subType != SubType.MINE && game.getBattlefield().countAll( if (subType != SubType.MINE && game.getBattlefield().count(
mineFilter, sourceAbility.getControllerId(), game mineFilter, sourceAbility.getSourceId(), sourceAbility.getControllerId(), game
) < 1) { ) < 1) {
return 1; return 1;
} }
if (subType != SubType.TOWER && game.getBattlefield().countAll( if (subType != SubType.TOWER && game.getBattlefield().count(
towerFilter, sourceAbility.getControllerId(), game towerFilter, sourceAbility.getSourceId(), sourceAbility.getControllerId(), game
) < 1) { ) < 1) {
return 1; return 1;
} }
if (subType != SubType.POWER_PLANT && game.getBattlefield().countAll( if (subType != SubType.POWER_PLANT && game.getBattlefield().count(
powerPlantFilter, sourceAbility.getControllerId(), game powerPlantFilter, sourceAbility.getSourceId(), sourceAbility.getControllerId(), game
) < 1) { ) < 1) {
return 1; return 1;
} }