forked from External/mage
43 lines
1.1 KiB
Java
43 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.filter.predicate.mageobject.SubtypePredicate;
|
|
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(new SubtypePredicate(SubType.GATE));
|
|
}
|
|
|
|
@Override
|
|
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
|
return game.getBattlefield().count(filter, sourceAbility.getSourceId(), sourceAbility.getControllerId(), game);
|
|
}
|
|
|
|
@Override
|
|
public GateYouControlCount copy() {
|
|
return instance;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "X";
|
|
}
|
|
|
|
@Override
|
|
public String getMessage() {
|
|
return "gate you control";
|
|
}
|
|
}
|