Some minor changes.

This commit is contained in:
LevelX2 2015-06-16 00:03:17 +02:00
parent 0e72d4a93f
commit 40e22d9f49
3 changed files with 37 additions and 30 deletions

View file

@ -22,6 +22,7 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
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;
/**
@ -29,17 +30,17 @@ 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 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";
@ -50,7 +51,7 @@ public class GreaterHarvester extends CardImpl {
// 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());
}
@ -64,6 +65,7 @@ public class GreaterHarvester extends CardImpl {
return new GreaterHarvester(this);
}
}
class GreaterHarvesterAbility extends TriggeredAbilityImpl {
public GreaterHarvesterAbility() {
@ -79,16 +81,20 @@ class GreaterHarvesterAbility extends TriggeredAbilityImpl {
return new GreaterHarvesterAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return EventType.DAMAGED_PLAYER.equals(event.getType());
}
@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;
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;
}
@ -97,4 +103,4 @@ class GreaterHarvesterAbility extends TriggeredAbilityImpl {
public String getRule() {
return "Whenever {this} deals combat damage to a player, that player sacrifices two permanent.";
}
}
}

View file

@ -100,16 +100,19 @@ class TeysaEnvoyOfGhostsTriggeredAbility extends TriggeredAbilityImpl {
return new TeysaEnvoyOfGhostsTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event instanceof DamagedPlayerEvent) {
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event;
Permanent p = game.getPermanent(event.getSourceId());
if (damageEvent.getPlayerId().equals(controllerId) && damageEvent.isCombatDamage() && p != null && p.getCardType().contains(CardType.CREATURE)) {
game.getState().setValue(sourceId.toString(), p.getControllerId());
getEffects().get(0).setTargetPointer(new FixedTarget(event.getSourceId()));
return true;
}
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event;
Permanent sourcePermanent = game.getPermanent(event.getSourceId());
if (damageEvent.getPlayerId().equals(getControllerId()) && damageEvent.isCombatDamage() && sourcePermanent != null && sourcePermanent.getCardType().contains(CardType.CREATURE)) {
game.getState().setValue(sourceId.toString(), sourcePermanent.getControllerId());
getEffects().get(0).setTargetPointer(new FixedTarget(event.getSourceId()));
return true;
}
return false;
}

View file

@ -28,7 +28,6 @@
package mage.sets.mirrodinbesieged;
import java.util.UUID;
import mage.Mana;
import mage.constants.CardType;
import mage.constants.Duration;
@ -46,7 +45,6 @@ import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.abilities.mana.ColorlessManaAbility;
import mage.abilities.mana.SimpleManaAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterAttackingCreature;
import mage.game.Game;