* Grave Scrabbler - Fixed that it was also possible to return a card from graveyard even if not cast by madness.

This commit is contained in:
LevelX2 2018-02-14 17:35:47 +01:00
parent e77b457414
commit 00dd941260

View file

@ -2,10 +2,8 @@ package mage.cards.g;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.decorator.ConditionalTriggeredAbility;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
@ -16,7 +14,6 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
import mage.target.common.TargetCardInGraveyard;
public class GraveScrabbler extends CardImpl {
@ -35,7 +32,7 @@ public class GraveScrabbler extends CardImpl {
//you may return target creature card from a graveyard to its owner's hand.
TriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect(), true);
ability.addTarget(new TargetCardInGraveyard(new FilterCreatureCard("creature card in a graveyard")));
this.addAbility(new ConditionalTriggeredAbility(ability, MadnessPaidCondition.instance,
this.addAbility(new ConditionalTriggeredAbility(ability, MadnessAbility.GetCondition(),
"When {this} enters the battlefield, if its madness cost was paid, you may return target creature card from a graveyard to its owner's hand."));
}
@ -49,21 +46,3 @@ public class GraveScrabbler extends CardImpl {
}
}
enum MadnessPaidCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
Card card = game.getCard(source.getSourceId());
if (card != null) {
for (Ability ability : card.getAbilities()) {
if (ability instanceof MadnessAbility) {
return ((MadnessAbility) ability).getCosts().isPaid();
}
}
}
return false;
}
}