Kill some unnecessary custom effects

This commit is contained in:
LoneFox 2015-11-11 11:07:13 +02:00
parent 70f77b858e
commit 38ea922ea9
4 changed files with 43 additions and 164 deletions

View file

@ -29,7 +29,7 @@ package mage.sets.dissension;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.BecomesTappedTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.RemoveCountersSourceCost;
import mage.abilities.effects.PreventionEffectImpl;
@ -38,12 +38,14 @@ import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.game.events.GameEvent;
/**
*
@ -51,13 +53,19 @@ import mage.game.permanent.Permanent;
*/
public class PalliationAccord extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("a creature an opponent controls");
static {
filter.add(new ControllerPredicate(TargetController.OPPONENT));
}
public PalliationAccord(UUID ownerId) {
super(ownerId, 122, "Palliation Accord", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}{U}");
this.expansionSetCode = "DIS";
// Whenever a creature an opponent controls becomes tapped, put a shield counter on Palliation Accord.
this.addAbility(new PallationAccordTriggeredAbility());
this.addAbility(new BecomesTappedTriggeredAbility(new AddCountersSourceEffect(CounterType.SHIELD.createInstance()), false, filter));
// Remove a shield counter from Palliation Accord: Prevent the next 1 damage that would be dealt to you this turn.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new PalliationAccordPreventionEffect(), new RemoveCountersSourceCost(CounterType.SHIELD.createInstance())));
}
@ -72,41 +80,6 @@ public class PalliationAccord extends CardImpl {
}
}
class PallationAccordTriggeredAbility extends TriggeredAbilityImpl {
PallationAccordTriggeredAbility() {
super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.SHIELD.createInstance()));
}
PallationAccordTriggeredAbility(final PallationAccordTriggeredAbility ability) {
super(ability);
}
@Override
public PallationAccordTriggeredAbility copy() {
return new PallationAccordTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.TAPPED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent p = game.getPermanent(event.getTargetId());
if (p != null && p.getCardType().contains(CardType.CREATURE)) {
if (game.getOpponents(this.controllerId).contains(p.getControllerId()))
return true;
}
return false;
}
@Override
public String getRule() {
return "Whenever a creature an opponent controls becomes tapped, " + modes.getText();
}
}
class PalliationAccordPreventionEffect extends PreventionEffectImpl {
public PalliationAccordPreventionEffect() {
@ -151,4 +124,4 @@ class PalliationAccordPreventionEffect extends PreventionEffectImpl {
}
return false;
}
}
}

View file

@ -29,17 +29,15 @@ package mage.sets.magic2012;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.BecomesTappedTriggeredAbility;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.constants.TargetController;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
/**
*
@ -47,6 +45,12 @@ import mage.game.permanent.Permanent;
*/
public class GideonsAvenger extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("a creature an opponent controls");
static {
filter.add(new ControllerPredicate(TargetController.OPPONENT));
}
public GideonsAvenger(UUID ownerId) {
super(ownerId, 17, "Gideon's Avenger", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{W}{W}");
this.expansionSetCode = "M12";
@ -56,7 +60,8 @@ public class GideonsAvenger extends CardImpl {
this.power = new MageInt(2);
this.toughness = new MageInt(2);
this.addAbility(new GideonsAvengerTriggeredAbility());
// Whenever a creature an opponent controls becomes tapped, put a +1/+1 counter on Gideon's Avenger.
this.addAbility(new BecomesTappedTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false, filter));
}
public GideonsAvenger(final GideonsAvenger card) {
@ -68,38 +73,3 @@ public class GideonsAvenger extends CardImpl {
return new GideonsAvenger(this);
}
}
class GideonsAvengerTriggeredAbility extends TriggeredAbilityImpl {
GideonsAvengerTriggeredAbility() {
super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance()));
}
GideonsAvengerTriggeredAbility(final GideonsAvengerTriggeredAbility ability) {
super(ability);
}
@Override
public GideonsAvengerTriggeredAbility copy() {
return new GideonsAvengerTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.TAPPED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent p = game.getPermanent(event.getTargetId());
if (p != null && p.getCardType().contains(CardType.CREATURE)) {
if (game.getOpponents(this.controllerId).contains(p.getControllerId()))
return true;
}
return false;
}
@Override
public String getRule() {
return "Whenever a creature an opponent controls becomes tapped, " + modes.getText();
}
}

View file

@ -29,17 +29,14 @@ package mage.sets.ninthedition;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.effects.common.ReturnToHandSourceEffect;
import mage.abilities.keyword.HasteAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
/**
*
@ -61,8 +58,8 @@ public class ViashinoSandstalker extends CardImpl {
this.addAbility(HasteAbility.getInstance());
// At the beginning of the end step, return Viashino Sandstalker to its owner's hand.
this.addAbility(new BeginningOfEndStepTriggeredAbility(new ReturnToHandSourceEffect(true), false));
this.addAbility(new BeginningOfEndStepTriggeredAbility(new ReturnToHandSourceEffect(true),
TargetController.ANY, false));
}
public ViashinoSandstalker(final ViashinoSandstalker card) {
@ -74,34 +71,3 @@ public class ViashinoSandstalker extends CardImpl {
return new ViashinoSandstalker(this);
}
}
class BeginningOfEndStepTriggeredAbility extends TriggeredAbilityImpl {
public BeginningOfEndStepTriggeredAbility(Effect effect, boolean optional) {
super(Zone.BATTLEFIELD, effect, optional);
}
public BeginningOfEndStepTriggeredAbility(final BeginningOfEndStepTriggeredAbility ability) {
super(ability);
}
@Override
public BeginningOfEndStepTriggeredAbility copy() {
return new BeginningOfEndStepTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.END_TURN_STEP_PRE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return true;
}
@Override
public String getRule() {
return "At the beginning of the end step, return {this} to its owner's hand";
}
}

View file

@ -28,16 +28,15 @@
package mage.sets.seventhedition;
import java.util.UUID;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.BecomesTappedTriggeredAbility;
import mage.abilities.effects.common.GainLifeEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent.EventType;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.constants.TargetController;
import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
/**
*
@ -46,12 +45,19 @@ import mage.game.permanent.Permanent;
*/
public class Thoughtleech extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("an Island an opponent controls");
static {
filter.add(new SubtypePredicate("Island"));
filter.add(new ControllerPredicate(TargetController.OPPONENT));
}
public Thoughtleech(UUID ownerId) {
super(ownerId, 274, "Thoughtleech", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{G}{G}");
this.expansionSetCode = "7ED";
// Whenever an Island an opponent controls becomes tapped, you may gain 1 life.
this.addAbility(new ThoughtleechTriggeredAbility());
this.addAbility(new BecomesTappedTriggeredAbility(new GainLifeEffect(1), true, filter));
}
public Thoughtleech(final Thoughtleech card) {
@ -63,39 +69,3 @@ public class Thoughtleech extends CardImpl {
return new Thoughtleech(this);
}
}
class ThoughtleechTriggeredAbility extends TriggeredAbilityImpl {
ThoughtleechTriggeredAbility() {
super(Zone.BATTLEFIELD, new GainLifeEffect(1), true);
}
ThoughtleechTriggeredAbility(final ThoughtleechTriggeredAbility ability) {
super(ability);
}
@Override
public ThoughtleechTriggeredAbility copy() {
return new ThoughtleechTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.TAPPED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent p = game.getPermanent(event.getTargetId());
if(p != null && p.getSubtype().contains("Island")) {
if(game.getOpponents(this.controllerId).contains(p.getControllerId()))
return true;
}
return false;
}
@Override
public String getRule() {
return "Whenever an Island an opponent controls becomes tapped, " + modes.getText();
}
}