* Corpse Augur - Fixed that all cards in target players graveyard were counted instead of only creature cards.

This commit is contained in:
LevelX2 2015-12-13 17:39:38 +01:00
parent 63915101f5
commit bdc9260dfa
2 changed files with 26 additions and 5 deletions

View file

@ -30,6 +30,7 @@ package mage.abilities.dynamicvalue.common;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.filter.FilterCard;
import mage.game.Game;
import mage.players.Player;
@ -39,23 +40,41 @@ import mage.players.Player;
*/
public class CardsInTargetPlayersGraveyardCount implements DynamicValue {
private final FilterCard filter;
public CardsInTargetPlayersGraveyardCount() {
this.filter = null;
}
public CardsInTargetPlayersGraveyardCount(FilterCard filter) {
this.filter = filter;
}
public CardsInTargetPlayersGraveyardCount(final CardsInTargetPlayersGraveyardCount dynamicValue) {
this.filter = dynamicValue.filter;
}
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
Player player = game.getPlayer(effect.getTargetPointer().getFirst(game, sourceAbility));
if (player != null) {
return player.getGraveyard().size();
if (filter == null) {
return player.getGraveyard().size();
} else {
return player.getGraveyard().count(filter, sourceAbility.getControllerId(), sourceAbility.getSourceId(), game);
}
}
return 0;
}
@Override
public CardsInTargetPlayersGraveyardCount copy() {
return new CardsInTargetPlayersGraveyardCount();
return new CardsInTargetPlayersGraveyardCount(this);
}
@Override
public String getMessage() {
return "cards in target player's graveyard";
return (filter == null ? "cards" : filter.getMessage()) + " in target player's graveyard";
}
}