mirror of
https://github.com/correl/mage.git
synced 2024-12-26 19:16:54 +00:00
Implemented Teferi's Time Twist
This commit is contained in:
parent
82a32613f9
commit
34aca29d06
2 changed files with 124 additions and 0 deletions
123
Mage.Sets/src/mage/cards/t/TeferisTimeTwist.java
Normal file
123
Mage.Sets/src/mage/cards/t/TeferisTimeTwist.java
Normal file
|
@ -0,0 +1,123 @@
|
|||
package mage.cards.t;
|
||||
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class TeferisTimeTwist extends CardImpl {
|
||||
|
||||
public TeferisTimeTwist(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}");
|
||||
|
||||
// Exile target permanent you control. Return that card to the battlefield under its owner's control at the beginning of the next end step. If it enters the battlefield as a creature, it enters with an additional +1/+1 counter on it.
|
||||
this.getSpellAbility().addEffect(new TeferisTimeTwistEffect());
|
||||
this.getSpellAbility().addTarget(new TargetControlledPermanent());
|
||||
}
|
||||
|
||||
private TeferisTimeTwist(final TeferisTimeTwist card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TeferisTimeTwist copy() {
|
||||
return new TeferisTimeTwist(this);
|
||||
}
|
||||
}
|
||||
|
||||
class TeferisTimeTwistEffect extends OneShotEffect {
|
||||
|
||||
TeferisTimeTwistEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "Exile target permanent you control. Return that card to the battlefield " +
|
||||
"under its owner's control at the beginning of the next end step. " +
|
||||
"If it enters the battlefield as a creature, it enters with an additional +1/+1 counter on it.";
|
||||
}
|
||||
|
||||
private TeferisTimeTwistEffect(final TeferisTimeTwistEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TeferisTimeTwistEffect copy() {
|
||||
return new TeferisTimeTwistEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getFirstTarget());
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (permanent == null || player == null) {
|
||||
return false;
|
||||
}
|
||||
Effect effect = new TeferisTimeTwistReturnEffect(new MageObjectReference(
|
||||
permanent.getId(), permanent.getZoneChangeCounter(game) + 1, game
|
||||
));
|
||||
if (!player.moveCards(permanent, Zone.EXILED, source, game)) {
|
||||
return false;
|
||||
}
|
||||
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect), source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class TeferisTimeTwistReturnEffect extends OneShotEffect {
|
||||
|
||||
private final MageObjectReference mor;
|
||||
|
||||
TeferisTimeTwistReturnEffect(MageObjectReference mor) {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "return the exiled card to the battlefield";
|
||||
this.mor = mor;
|
||||
}
|
||||
|
||||
private TeferisTimeTwistReturnEffect(final TeferisTimeTwistReturnEffect effect) {
|
||||
super(effect);
|
||||
this.mor = effect.mor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TeferisTimeTwistReturnEffect copy() {
|
||||
return new TeferisTimeTwistReturnEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Card card = mor.getCard(game);
|
||||
if (card == null) {
|
||||
return false;
|
||||
}
|
||||
Player player = game.getPlayer(card.getOwnerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
if (!player.moveCards(card, Zone.BATTLEFIELD, source, game)) {
|
||||
return true;
|
||||
}
|
||||
Permanent permanent = game.getPermanent(card.getId());
|
||||
if (permanent != null && permanent.isCreature()) {
|
||||
// This is technically wrong as it should enter with the counters,
|
||||
// however there's currently no way to know that for sure
|
||||
// this is similar to the blood moon issue
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(), source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -193,6 +193,7 @@ public final class WarOfTheSpark extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Swamp", 258, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Tamiyo's Epiphany", 71, Rarity.COMMON, mage.cards.t.TamiyosEpiphany.class));
|
||||
cards.add(new SetCardInfo("Tamiyo, Collector of Tales", 220, Rarity.RARE, mage.cards.t.TamiyoCollectorOfTales.class));
|
||||
cards.add(new SetCardInfo("Teferi's Time Twist", 72, Rarity.COMMON, mage.cards.t.TeferisTimeTwist.class));
|
||||
cards.add(new SetCardInfo("Teferi, Time Raveler", 221, Rarity.RARE, mage.cards.t.TeferiTimeRaveler.class));
|
||||
cards.add(new SetCardInfo("Tenth District Legionnaire", 222, Rarity.UNCOMMON, mage.cards.t.TenthDistrictLegionnaire.class));
|
||||
cards.add(new SetCardInfo("Teyo's Lightshield", 33, Rarity.COMMON, mage.cards.t.TeyosLightshield.class));
|
||||
|
|
Loading…
Reference in a new issue