Removed some custom classes by use of framework classes.

This commit is contained in:
LevelX2 2016-05-29 09:52:43 +02:00
parent 2c11d9cfef
commit 0085b6b1ef
3 changed files with 21 additions and 112 deletions

View file

@ -28,14 +28,13 @@
package mage.sets.lorwyn;
import java.util.UUID;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.condition.common.OnOpponentsTurnCondition;
import mage.abilities.decorator.ConditionalTriggeredAbility;
import mage.abilities.effects.common.LoseLifeOpponentsEffect;
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;
/**
*
@ -49,7 +48,8 @@ public class FaerieTautings extends CardImpl {
this.subtype.add("Faerie");
// Whenever you cast a spell during an opponent's turn, you may have each opponent lose 1 life
this.addAbility(new FaerieTautingsTriggeredAbility());
this.addAbility(new ConditionalTriggeredAbility(new SpellCastControllerTriggeredAbility(new LoseLifeOpponentsEffect(1), true), OnOpponentsTurnCondition.getInstance(),
"Whenever you cast a spell during an opponent's turn, you may have each opponent lose 1 life."));
}
@ -62,35 +62,3 @@ public class FaerieTautings extends CardImpl {
return new FaerieTautings(this);
}
}
class FaerieTautingsTriggeredAbility extends TriggeredAbilityImpl {
FaerieTautingsTriggeredAbility() {
super(Zone.BATTLEFIELD, new LoseLifeOpponentsEffect(1), true);
}
FaerieTautingsTriggeredAbility(final FaerieTautingsTriggeredAbility ability) {
super(ability);
}
@Override
public FaerieTautingsTriggeredAbility copy() {
return new FaerieTautingsTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.SPELL_CAST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return event.getPlayerId().equals(this.controllerId)
&& game.getOpponents(this.controllerId).contains(game.getActivePlayerId());
}
@Override
public String getRule() {
return "Whenever you cast a spell during an opponent's turn, " + super.getRule();
}
}

View file

@ -29,15 +29,15 @@ package mage.sets.lorwyn;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.Ability;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.condition.common.OnOpponentsTurnCondition;
import mage.abilities.decorator.ConditionalTriggeredAbility;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.abilities.keyword.FlyingAbility;
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;
import mage.target.common.TargetControlledCreaturePermanent;
/**
@ -57,7 +57,10 @@ public class GlenElendraPranksters extends CardImpl {
// Flying
this.addAbility(FlyingAbility.getInstance());
// Whenever you cast a spell during an opponent's turn, you may return target creature you control to its owner's hand.
this.addAbility(new GlenElendraPrankstersTriggeredAbility());
Ability ability = new ConditionalTriggeredAbility(new SpellCastControllerTriggeredAbility(new ReturnToHandTargetEffect(), true), OnOpponentsTurnCondition.getInstance(),
"Whenever you cast a spell during an opponent's turn, you may have target creature get -1/-1 until end of turn.");
ability.addTarget(new TargetControlledCreaturePermanent());
this.addAbility(ability);
}
public GlenElendraPranksters(final GlenElendraPranksters card) {
@ -69,34 +72,3 @@ public class GlenElendraPranksters extends CardImpl {
return new GlenElendraPranksters(this);
}
}
class GlenElendraPrankstersTriggeredAbility extends TriggeredAbilityImpl {
GlenElendraPrankstersTriggeredAbility() {
super(Zone.BATTLEFIELD, new ReturnToHandTargetEffect(), true);
this.addTarget(new TargetControlledCreaturePermanent());
}
GlenElendraPrankstersTriggeredAbility(final GlenElendraPrankstersTriggeredAbility ability) {
super(ability);
}
@Override
public GlenElendraPrankstersTriggeredAbility copy() {
return new GlenElendraPrankstersTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.SPELL_CAST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return event.getPlayerId().equals(this.controllerId)
&& game.getOpponents(this.controllerId).contains(game.getActivePlayerId());
}
@Override
public String getRule() {
return "Whenever you cast a spell during an opponent's turn, " + super.getRule();
}
}

View file

@ -29,17 +29,16 @@ package mage.sets.modernmasters;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.Ability;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.condition.common.OnOpponentsTurnCondition;
import mage.abilities.decorator.ConditionalTriggeredAbility;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.target.common.TargetCreaturePermanent;
/**
@ -60,8 +59,10 @@ public class DreamspoilerWitches extends CardImpl {
// Flying
this.addAbility(FlyingAbility.getInstance());
// Whenever you cast a spell during an opponent's turn, you may have target creature get -1/-1 until end of turn.
this.addAbility(new DreamspoilerWitchesTriggeredAbility());
Ability ability = new ConditionalTriggeredAbility(new SpellCastControllerTriggeredAbility(new BoostTargetEffect(-1, -1, Duration.EndOfTurn), true), OnOpponentsTurnCondition.getInstance(),
"Whenever you cast a spell during an opponent's turn, you may have target creature get -1/-1 until end of turn.");
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}
public DreamspoilerWitches(final DreamspoilerWitches card) {
@ -73,35 +74,3 @@ public class DreamspoilerWitches extends CardImpl {
return new DreamspoilerWitches(this);
}
}
class DreamspoilerWitchesTriggeredAbility extends TriggeredAbilityImpl {
DreamspoilerWitchesTriggeredAbility() {
super(Zone.BATTLEFIELD, new BoostTargetEffect(-1,-1, Duration.EndOfTurn), true);
this.addTarget(new TargetCreaturePermanent());
}
DreamspoilerWitchesTriggeredAbility(final DreamspoilerWitchesTriggeredAbility ability) {
super(ability);
}
@Override
public DreamspoilerWitchesTriggeredAbility copy() {
return new DreamspoilerWitchesTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.SPELL_CAST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return event.getPlayerId().equals(this.controllerId)
&& game.getOpponents(this.controllerId).contains(game.getActivePlayerId());
}
@Override
public String getRule() {
return "Whenever you cast a spell during an opponent's turn, " + super.getRule();
}
}