mirror of
https://github.com/correl/mage.git
synced 2025-01-11 19:13:02 +00:00
Implemented Escape Protocol
This commit is contained in:
parent
49221f285f
commit
03b8c029b1
2 changed files with 117 additions and 0 deletions
116
Mage.Sets/src/mage/cards/e/EscapeProtocol.java
Normal file
116
Mage.Sets/src/mage/cards/e/EscapeProtocol.java
Normal file
|
@ -0,0 +1,116 @@
|
|||
package mage.cards.e;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.DelayedTriggeredAbility;
|
||||
import mage.abilities.common.CycleControllerTriggeredAbility;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DoIfCostPaid;
|
||||
import mage.abilities.effects.common.ExileTargetForSourceEffect;
|
||||
import mage.abilities.effects.common.ReturnToBattlefieldUnderOwnerControlTargetEffect;
|
||||
import mage.abilities.effects.common.SendOptionUsedEventEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class EscapeProtocol extends CardImpl {
|
||||
|
||||
public EscapeProtocol(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}");
|
||||
|
||||
// Whenever you cycle a card, you may pay {1}. When you do, exile target artifact or creature you control, then return it to the battlefield under its owner's control.
|
||||
this.addAbility(new CycleControllerTriggeredAbility(new DoIfCostPaid(
|
||||
new EscapeProtocolEffect(), new GenericManaCost(1)
|
||||
).setText("you may pay {1}. When you do, exile target artifact or creature you control, " +
|
||||
"then return it to the battlefield under its owner's control.")));
|
||||
}
|
||||
|
||||
private EscapeProtocol(final EscapeProtocol card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EscapeProtocol copy() {
|
||||
return new EscapeProtocol(this);
|
||||
}
|
||||
}
|
||||
|
||||
class EscapeProtocolEffect extends OneShotEffect {
|
||||
|
||||
EscapeProtocolEffect() {
|
||||
super(Outcome.Benefit);
|
||||
}
|
||||
|
||||
private EscapeProtocolEffect(final EscapeProtocolEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EscapeProtocolEffect copy() {
|
||||
return new EscapeProtocolEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
game.addDelayedTriggeredAbility(new EscapeProtocolReflexiveTriggeredAbility(), source);
|
||||
return new SendOptionUsedEventEffect().apply(game, source);
|
||||
}
|
||||
}
|
||||
|
||||
class EscapeProtocolReflexiveTriggeredAbility extends DelayedTriggeredAbility {
|
||||
|
||||
private static final FilterPermanent filter
|
||||
= new FilterControlledPermanent("artifact or creature you control");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.or(
|
||||
CardType.ARTIFACT.getPredicate(),
|
||||
CardType.CREATURE.getPredicate()
|
||||
));
|
||||
}
|
||||
|
||||
EscapeProtocolReflexiveTriggeredAbility() {
|
||||
super(new ExileTargetForSourceEffect(), Duration.OneUse, true);
|
||||
this.addEffect(new ReturnToBattlefieldUnderOwnerControlTargetEffect());
|
||||
this.addTarget(new TargetPermanent());
|
||||
}
|
||||
|
||||
private EscapeProtocolReflexiveTriggeredAbility(final EscapeProtocolReflexiveTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EscapeProtocolReflexiveTriggeredAbility copy() {
|
||||
return new EscapeProtocolReflexiveTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.OPTION_USED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
return event.getPlayerId().equals(this.getControllerId())
|
||||
&& event.getSourceId().equals(this.getSourceId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Exile target artifact or creature you control, " +
|
||||
"then return it to the battlefield under its owner's control.";
|
||||
}
|
||||
}
|
|
@ -124,6 +124,7 @@ public final class IkoriaLairOfBehemoths extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Easy Prey", 87, Rarity.UNCOMMON, mage.cards.e.EasyPrey.class));
|
||||
cards.add(new SetCardInfo("Eerie Ultimatum", 184, Rarity.RARE, mage.cards.e.EerieUltimatum.class));
|
||||
cards.add(new SetCardInfo("Emergent Ultimatum", 185, Rarity.RARE, mage.cards.e.EmergentUltimatum.class));
|
||||
cards.add(new SetCardInfo("Escape Protocol", 48, Rarity.UNCOMMON, mage.cards.e.EscapeProtocol.class));
|
||||
cards.add(new SetCardInfo("Essence Scatter", 49, Rarity.COMMON, mage.cards.e.EssenceScatter.class));
|
||||
cards.add(new SetCardInfo("Everquill Phoenix", 114, Rarity.RARE, mage.cards.e.EverquillPhoenix.class));
|
||||
cards.add(new SetCardInfo("Evolving Wilds", 247, Rarity.COMMON, mage.cards.e.EvolvingWilds.class));
|
||||
|
|
Loading…
Reference in a new issue