Implemented Ghostly Pilferer

This commit is contained in:
Evan Kranzler 2020-06-15 19:25:34 -04:00
parent ba599ae4d9
commit 8356b3392d
2 changed files with 95 additions and 0 deletions

View file

@ -0,0 +1,94 @@
package mage.cards.g;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.BecomesTappedSourceTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.DiscardCardCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.combat.CantBeBlockedSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.stack.Spell;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class GhostlyPilferer extends CardImpl {
public GhostlyPilferer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}");
this.subtype.add(SubType.SPIRIT);
this.subtype.add(SubType.ROGUE);
this.power = new MageInt(2);
this.toughness = new MageInt(1);
// Whenever Ghostly Pilferer becomes tapped, you may pay {2}. If you do, draw a card.
this.addAbility(new BecomesTappedSourceTriggeredAbility(new DoIfCostPaid(
new DrawCardSourceControllerEffect(1), new GenericManaCost(2)
)));
// Whenever an opponent casts a spell from anywhere other than their hand, draw a card.
this.addAbility(new GhostlyPilfererTriggeredAbility());
// Discard a card: Ghostly Pilferer can't be blocked this turn.
this.addAbility(new SimpleActivatedAbility(
new CantBeBlockedSourceEffect(Duration.EndOfTurn), new DiscardCardCost()
));
}
private GhostlyPilferer(final GhostlyPilferer card) {
super(card);
}
@Override
public GhostlyPilferer copy() {
return new GhostlyPilferer(this);
}
}
class GhostlyPilfererTriggeredAbility extends TriggeredAbilityImpl {
GhostlyPilfererTriggeredAbility() {
super(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), false);
}
private GhostlyPilfererTriggeredAbility(final GhostlyPilfererTriggeredAbility ability) {
super(ability);
}
@Override
public GhostlyPilfererTriggeredAbility copy() {
return new GhostlyPilfererTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.SPELL_CAST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getZone() == Zone.HAND) {
return false;
}
Spell spell = game.getStack().getSpell(event.getTargetId());
return spell != null;
}
@Override
public String getRule() {
return "Whenever an opponent casts a spell from anywhere other than their hand, draw a card.";
}
}

View file

@ -87,6 +87,7 @@ public final class CoreSet2021 extends ExpansionSet {
cards.add(new SetCardInfo("Garruk's Gorehorn", 184, Rarity.COMMON, mage.cards.g.GarruksGorehorn.class));
cards.add(new SetCardInfo("Garruk's Warsteed", 337, Rarity.RARE, mage.cards.g.GarruksWarsteed.class));
cards.add(new SetCardInfo("Garruk, Savage Herald", 336, Rarity.MYTHIC, mage.cards.g.GarrukSavageHerald.class));
cards.add(new SetCardInfo("Ghostly Pilferer", 52, Rarity.RARE, mage.cards.g.GhostlyPilferer.class));
cards.add(new SetCardInfo("Glorious Anthem", 21, Rarity.RARE, mage.cards.g.GloriousAnthem.class));
cards.add(new SetCardInfo("Goblin Arsonist", 147, Rarity.COMMON, mage.cards.g.GoblinArsonist.class));
cards.add(new SetCardInfo("Goremand", 101, Rarity.UNCOMMON, mage.cards.g.Goremand.class));