[NEO] Implemented Touch the Spirit Realm (#8640)

* [NEO] Implemented Touch the Spirit Realm

* Removed filter class, using StaticFilters
This commit is contained in:
Craig Brennan 2022-02-04 00:56:43 +00:00 committed by GitHub
parent 8477260070
commit 9a4bcb6ca5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 96 additions and 0 deletions

View file

@ -0,0 +1,95 @@
package mage.cards.t;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
import mage.abilities.common.delayed.OnLeaveReturnExiledToBattlefieldAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
import mage.abilities.effects.common.ExileUntilSourceLeavesEffect;
import mage.abilities.effects.common.ReturnToBattlefieldUnderOwnerControlTargetEffect;
import mage.abilities.keyword.ChannelAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.targetpointer.FixedTarget;
import mage.util.CardUtil;
/**
*
* @author Addictiveme
*/
public final class TouchTheSpiritRealm extends CardImpl {
private static final FilterPermanent filter = StaticFilters.FILTER_PERMANENT_ARTIFACT_OR_CREATURE;
public TouchTheSpiritRealm(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}");
// When Touch the Spirit Realm enters the battlefield, exile up to one target artifact or creature until
// Touch the Spirit Realm leaves the battlefield.
Ability ability = new EntersBattlefieldTriggeredAbility(new ExileUntilSourceLeavesEffect(filter.getMessage())
.setText("exile up to one target " + filter.getMessage()
+ " until {this} leaves the battlefield"));
ability.addTarget(new TargetPermanent(0, 1, filter, false));
ability.addEffect(new CreateDelayedTriggeredAbilityEffect(new OnLeaveReturnExiledToBattlefieldAbility()));
this.addAbility(ability);
// Channel - {1}{W}, Discard Touch the Spirit Realm: Exile target artifact or creature.
// Return it to the battlefield under its owner's control at the beginning of the next end step.
Ability channelAbility = new ChannelAbility("{1}{W}", new TouchTheSpiritRealmEffect());
channelAbility.addTarget(new TargetPermanent(filter));
this.addAbility(channelAbility);
}
private TouchTheSpiritRealm(final TouchTheSpiritRealm card) {
super(card);
}
@Override
public TouchTheSpiritRealm copy() {
return new TouchTheSpiritRealm(this);
}
}
class TouchTheSpiritRealmEffect extends OneShotEffect {
public TouchTheSpiritRealmEffect() {
super(Outcome.Detriment);
staticText = "Exile target artifact or creature. Return it to the battlefield under its owner's control at the beginning of the next end step";
}
private TouchTheSpiritRealmEffect(final TouchTheSpiritRealmEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (player == null || permanent == null) {
return false;
}
Card card = permanent.getMainCard();
player.moveCardsToExile(permanent, source, game, true, CardUtil.getExileZoneId(game, source), CardUtil.getSourceName(game, source));
ReturnToBattlefieldUnderOwnerControlTargetEffect returnEffect = new ReturnToBattlefieldUnderOwnerControlTargetEffect(false, true);
returnEffect.setTargetPointer(new FixedTarget(card,game));
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(returnEffect), source);
return true;
}
@Override
public TouchTheSpiritRealmEffect copy() {
return new TouchTheSpiritRealmEffect(this);
}
}

View file

@ -146,6 +146,7 @@ public final class KamigawaNeonDynasty extends ExpansionSet {
cards.add(new SetCardInfo("The Wandering Emperor", 42, Rarity.MYTHIC, mage.cards.t.TheWanderingEmperor.class));
cards.add(new SetCardInfo("Thirst for Knowledge", 85, Rarity.UNCOMMON, mage.cards.t.ThirstForKnowledge.class));
cards.add(new SetCardInfo("Thousand-Faced Shadow", 86, Rarity.RARE, mage.cards.t.ThousandFacedShadow.class));
cards.add(new SetCardInfo("Touch the Spirit Realm", 40, Rarity.UNCOMMON, mage.cards.t.TouchTheSpiritRealm.class));
cards.add(new SetCardInfo("Towashi Guide-Bot", 262, Rarity.UNCOMMON, mage.cards.t.TowashiGuideBot.class));
cards.add(new SetCardInfo("Tribute to Horobi", 124, Rarity.RARE, mage.cards.t.TributeToHorobi.class));
cards.add(new SetCardInfo("Twinshot Sniper", 168, Rarity.UNCOMMON, mage.cards.t.TwinshotSniper.class));