- Fixed #8090. Test coming later.

This commit is contained in:
jeffwadsworth 2021-08-02 17:34:11 -05:00
parent 295439b0a5
commit 42a86bd196

View file

@ -20,9 +20,6 @@ import mage.util.CardUtil;
import java.util.UUID; import java.util.UUID;
import mage.abilities.condition.common.SourceRemainsInZoneCondition; import mage.abilities.condition.common.SourceRemainsInZoneCondition;
import mage.abilities.decorator.ConditionalAsThoughEffect;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneTargetEffect;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
/** /**
@ -65,7 +62,7 @@ public final class IntetTheDreamer extends CardImpl {
class IntetTheDreamerExileEffect extends OneShotEffect { class IntetTheDreamerExileEffect extends OneShotEffect {
public IntetTheDreamerExileEffect() { public IntetTheDreamerExileEffect() {
super(Outcome.Discard); super(Outcome.Benefit);
staticText = "exile the top card of your library face down. You may play that card without paying its mana cost for as long as Intet remains on the battlefield"; staticText = "exile the top card of your library face down. You may play that card without paying its mana cost for as long as Intet remains on the battlefield";
} }
@ -85,10 +82,8 @@ class IntetTheDreamerExileEffect extends OneShotEffect {
CardUtil.getExileZoneId(game, source.getSourceId(), sourceObject.getZoneChangeCounter(game)), // sourceObject must be used due to source not working correctly CardUtil.getExileZoneId(game, source.getSourceId(), sourceObject.getZoneChangeCounter(game)), // sourceObject must be used due to source not working correctly
sourceObject.getIdName() + " (" + sourceObject.getZoneChangeCounter(game) + ")"); sourceObject.getIdName() + " (" + sourceObject.getZoneChangeCounter(game) + ")");
card.setFaceDown(true, game); card.setFaceDown(true, game);
ContinuousEffect effect = new ConditionalAsThoughEffect( IntetTheDreamerAsThoughEffect effect = new IntetTheDreamerAsThoughEffect();
new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, TargetController.YOU, Duration.Custom, true), effect.setTargetPointer(new FixedTarget(card.getId(), game.getState().getZoneChangeCounter(card.getId())));
new SourceRemainsInZoneCondition(Zone.BATTLEFIELD));
effect.setTargetPointer(new FixedTarget(card, game));
game.getState().addEffect(effect, source); game.getState().addEffect(effect, source);
game.getState().setValue("Exiled_IntetTheDreamer" + card.getId(), Boolean.TRUE); // TODO This value will never be removed game.getState().setValue("Exiled_IntetTheDreamer" + card.getId(), Boolean.TRUE); // TODO This value will never be removed
return true; return true;
@ -103,6 +98,61 @@ class IntetTheDreamerExileEffect extends OneShotEffect {
} }
} }
class IntetTheDreamerAsThoughEffect extends AsThoughEffectImpl {
public IntetTheDreamerAsThoughEffect() {
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.Custom, Outcome.Benefit);
staticText = "You may play that card without paying its mana cost for as long as Intet remains on the battlefield.";
}
private IntetTheDreamerAsThoughEffect(final IntetTheDreamerAsThoughEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public IntetTheDreamerAsThoughEffect copy() {
return new IntetTheDreamerAsThoughEffect(this);
}
@Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
UUID targetId = getTargetPointer().getFirst(game, source);
if (targetId == null) {
this.discard();
return false;
}
Card card = game.getCard(objectId);
if (card == null) {
this.discard();
return false;
}
// split cards
objectId = card.getMainCard().getId();
if (objectId.equals(targetId)
&& affectedControllerId.equals(source.getControllerId())) {
Card exiledCard = game.getCard(objectId);
if (exiledCard == null) {
this.discard();
return false;
}
// cast without mana
allowCardToPlayWithoutMana(objectId, source, affectedControllerId, game);
// while Intet remains on battlefield
return new SourceRemainsInZoneCondition(Zone.BATTLEFIELD).apply(game, source);
}
return false;
}
}
class IntetTheDreamerLookEffect extends AsThoughEffectImpl { class IntetTheDreamerLookEffect extends AsThoughEffectImpl {
public IntetTheDreamerLookEffect() { public IntetTheDreamerLookEffect() {