mirror of
https://github.com/correl/mage.git
synced 2024-11-22 03:00:11 +00:00
Reimplement Greater Harvester
This commit is contained in:
parent
1e1eb30e5a
commit
67cfbaea58
1 changed files with 7 additions and 63 deletions
|
@ -1,10 +1,8 @@
|
|||
package mage.cards.g;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
|
||||
import mage.abilities.effects.common.SacrificeEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -12,30 +10,15 @@ import mage.constants.CardType;
|
|||
import mage.constants.SubType;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamagedPlayerEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.filter.StaticFilters;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author wanderer120
|
||||
* @author xenohedron
|
||||
*/
|
||||
public final class GreaterHarvester extends CardImpl {
|
||||
|
||||
static final FilterPermanent filter = new FilterPermanent("a permanent");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.or(CardType.ARTIFACT.getPredicate(),
|
||||
CardType.CREATURE.getPredicate(),
|
||||
CardType.ENCHANTMENT.getPredicate(),
|
||||
CardType.PLANESWALKER.getPredicate(),
|
||||
CardType.LAND.getPredicate()));
|
||||
}
|
||||
|
||||
public GreaterHarvester(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}{B}{B}");
|
||||
this.subtype.add(SubType.HORROR);
|
||||
|
@ -44,10 +27,10 @@ public final class GreaterHarvester extends CardImpl {
|
|||
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));
|
||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new SacrificeEffect(StaticFilters.FILTER_PERMANENT_A, 1, ""), TargetController.YOU, false));
|
||||
|
||||
//Whenever Greater Harvester deals combat damage to a player, that player sacrifices two permanents.
|
||||
this.addAbility(new GreaterHarvesterAbility());
|
||||
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new SacrificeEffect(StaticFilters.FILTER_PERMANENTS, 2, "that player"), false, true));
|
||||
}
|
||||
|
||||
private GreaterHarvester(final GreaterHarvester card) {
|
||||
|
@ -59,42 +42,3 @@ public final class GreaterHarvester extends CardImpl {
|
|||
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 checkEventType(GameEvent event, Game game) {
|
||||
return EventType.DAMAGED_PLAYER == event.getType();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
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.";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue