[ORI] Added Shadows of the Past, Nightsnare and Dark Dabbling.

This commit is contained in:
LevelX2 2015-07-05 19:10:18 +02:00
parent 39f2925376
commit a61dd323e6
4 changed files with 308 additions and 1 deletions

View file

@ -2,6 +2,7 @@ package mage.abilities.condition.common;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.filter.FilterCard;
import mage.game.Game;
import mage.players.Player;
import mage.util.CardUtil;
@ -14,20 +15,31 @@ import mage.util.CardUtil;
public class CardsInControllerGraveCondition implements Condition {
private final int value;
private final FilterCard filter;
public CardsInControllerGraveCondition(int value) {
this(value, null);
}
public CardsInControllerGraveCondition(int value, FilterCard filter) {
this.value = value;
this.filter = filter;
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (filter != null) {
return player != null && player.getGraveyard().count(filter, source.getSourceId(), source.getControllerId(), game) >= value;
}
return player != null && player.getGraveyard().size() >= value;
}
@Override
public String toString() {
return "there are " + CardUtil.numberToText(value, "one") + " or more cards in your graveyard";
return "there are " + CardUtil.numberToText(value, "one") + " or more "
+ (filter == null ? "cards" : filter.getMessage())
+ " in your graveyard";
}
}