mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
- Fixed Grave Scrabbler.
This commit is contained in:
parent
cf6ac805b7
commit
0e4a3a2142
1 changed files with 35 additions and 2 deletions
|
@ -2,7 +2,10 @@ package mage.sets.futuresight;
|
|||
|
||||
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;
|
||||
|
@ -12,6 +15,7 @@ import mage.cards.CardImpl;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.game.Game;
|
||||
import mage.target.common.TargetCardInGraveyard;
|
||||
|
||||
public class GraveScrabbler extends CardImpl {
|
||||
|
@ -29,9 +33,9 @@ public class GraveScrabbler extends CardImpl {
|
|||
|
||||
//When Grave Scrabbler enters the battlefield, if its madness cost was paid,
|
||||
//you may return target creature card from a graveyard to its owner's hand.
|
||||
EntersBattlefieldTriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect(), true);
|
||||
TriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect(), true);
|
||||
ability.addTarget(new TargetCardInGraveyard(new FilterCreatureCard("creature card in a graveyard")));
|
||||
this.addAbility(new ConditionalTriggeredAbility(ability, MadnessAbility.GetCondition(),
|
||||
this.addAbility(new ConditionalTriggeredAbility(ability, MadnessPaidCondition.getInstance(),
|
||||
"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."));
|
||||
}
|
||||
|
||||
|
@ -45,3 +49,32 @@ public class GraveScrabbler extends CardImpl {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
class MadnessPaidCondition implements Condition {
|
||||
|
||||
private static MadnessPaidCondition fInstance = null;
|
||||
|
||||
private MadnessPaidCondition() {
|
||||
}
|
||||
|
||||
public static Condition getInstance() {
|
||||
if (fInstance == null) {
|
||||
fInstance = new MadnessPaidCondition();
|
||||
}
|
||||
return fInstance;
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue