From 8443b5ede113a94fd56956912795f3b1452662a6 Mon Sep 17 00:00:00 2001 From: wanderer120 Date: Mon, 15 Jun 2015 22:44:17 +0800 Subject: [PATCH] added greater harvester card. (p.s: i need this card, will add newer ones start from mirrodin after this ) --- .../mage/sets/darksteel/GreaterHarvester.java | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/darksteel/GreaterHarvester.java diff --git a/Mage.Sets/src/mage/sets/darksteel/GreaterHarvester.java b/Mage.Sets/src/mage/sets/darksteel/GreaterHarvester.java new file mode 100644 index 0000000000..820cbf29fd --- /dev/null +++ b/Mage.Sets/src/mage/sets/darksteel/GreaterHarvester.java @@ -0,0 +1,100 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package mage.sets.darksteel; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.SacrificeEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.filter.FilterPermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.game.Game; +import mage.game.events.DamagedPlayerEvent; +import mage.game.events.GameEvent; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author wanderer120 + */ +public class GreaterHarvester extends CardImpl { + + public static final FilterPermanent filter = new FilterPermanent("a permanent"); + + static{ + filter.add(Predicates.or(new CardTypePredicate(CardType.ARTIFACT), + new CardTypePredicate(CardType.CREATURE), + new CardTypePredicate(CardType.ENCHANTMENT), + new CardTypePredicate(CardType.PLANESWALKER), + new CardTypePredicate(CardType.LAND))); + } + + public GreaterHarvester(UUID ownerId) { + super(ownerId, 44, "Greater Harvester", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{B}{B}{B}"); + this.expansionSetCode = "DST"; + this.subtype.add("Horror"); + + this.power = new MageInt(5); + this.toughness = new MageInt(6); + + // At the beginning of your upkeep, sacrifice a permanent. + this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new SacrificeEffect(filter, 1, ""), TargetController.YOU, false)); + + //Whenever Greater Harvester deals combat damage to a player, that player sacrifices two permanents. + this.addAbility(new GreaterHarvesterAbility()); + } + + public GreaterHarvester(final GreaterHarvester card) { + super(card); + } + + @Override + public GreaterHarvester copy() { + return new GreaterHarvester(this); + } +} +class GreaterHarvesterAbility extends TriggeredAbilityImpl { + + public GreaterHarvesterAbility() { + super(Zone.BATTLEFIELD, new SacrificeEffect(new FilterPermanent(), 2, "")); + } + + public GreaterHarvesterAbility(final GreaterHarvesterAbility ability) { + super(ability); + } + + @Override + public GreaterHarvesterAbility copy() { + return new GreaterHarvesterAbility(this); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event instanceof DamagedPlayerEvent) { + DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; + if (damageEvent.isCombatDamage() && event.getSourceId().equals(this.getSourceId())) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getPlayerId())); + } + return true; + } + } + return false; + } + + @Override + public String getRule() { + return "Whenever {this} deals combat damage to a player, that player sacrifices two permanent."; + } +} \ No newline at end of file