forked from External/mage
* 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
42 lines
1.1 KiB
Java
42 lines
1.1 KiB
Java
package mage.abilities.dynamicvalue.common;
|
|
|
|
import mage.abilities.Ability;
|
|
import mage.abilities.dynamicvalue.DynamicValue;
|
|
import mage.abilities.effects.Effect;
|
|
import mage.constants.SubType;
|
|
import mage.filter.FilterPermanent;
|
|
import mage.filter.common.FilterControlledPermanent;
|
|
import mage.game.Game;
|
|
|
|
/**
|
|
* @author JayDi85
|
|
*/
|
|
public enum GateYouControlCount implements DynamicValue {
|
|
|
|
instance;
|
|
private static final FilterPermanent filter = new FilterControlledPermanent("Gate you control");
|
|
|
|
static {
|
|
filter.add(SubType.GATE.getPredicate());
|
|
}
|
|
|
|
@Override
|
|
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
|
return game.getBattlefield().count(filter, sourceAbility.getControllerId(), sourceAbility, game);
|
|
}
|
|
|
|
@Override
|
|
public GateYouControlCount copy() {
|
|
return instance;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "1"; // uses "for each" effects, so must be 1, not X
|
|
}
|
|
|
|
@Override
|
|
public String getMessage() {
|
|
return "Gate you control";
|
|
}
|
|
}
|