foul-magics/Mage.Sets/src/mage/cards/a/AbyssalPersecutor.java
2018-06-02 17:59:49 +02:00

78 lines
2.4 KiB
Java

package mage.cards.a;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
/**
*
* @author Loki
*/
public final class AbyssalPersecutor extends CardImpl {
public AbyssalPersecutor(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}{B}");
this.subtype.add(SubType.DEMON);
this.power = new MageInt(6);
this.toughness = new MageInt(6);
// Flying, trample
this.addAbility(FlyingAbility.getInstance());
this.addAbility(TrampleAbility.getInstance());
// You can't win the game and your opponents can't lose the game.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AbyssalPersecutorCannotWinEffect()));
}
public AbyssalPersecutor(final AbyssalPersecutor card) {
super(card);
}
@Override
public AbyssalPersecutor copy() {
return new AbyssalPersecutor(this);
}
}
class AbyssalPersecutorCannotWinEffect extends ContinuousRuleModifyingEffectImpl {
AbyssalPersecutorCannotWinEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment, false, false);
staticText = "You can't win the game and your opponents can't lose the game";
}
AbyssalPersecutorCannotWinEffect ( final AbyssalPersecutorCannotWinEffect effect ) {
super(effect);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == EventType.LOSES || event.getType() == EventType.WINS ;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if ((event.getType() == EventType.LOSES && game.getOpponents(source.getControllerId()).contains(event.getPlayerId()))
|| (event.getType() == EventType.WINS && event.getPlayerId().equals(source.getControllerId()))) {
return true;
}
return false;
}
@Override
public AbyssalPersecutorCannotWinEffect copy() {
return new AbyssalPersecutorCannotWinEffect(this);
}
}