[DSC] Implement Zimone, Mystery Unraveler.

This commit is contained in:
Grath 2024-09-28 16:11:33 -04:00
parent 5e1dace946
commit 43b28334e6
3 changed files with 102 additions and 1 deletions

View file

@ -0,0 +1,89 @@
package mage.cards.z;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.LandfallAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.IfAbilityHasResolvedXTimesEffect;
import mage.abilities.effects.keyword.ManifestDreadEffect;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.card.FaceDownPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetControlledPermanent;
import mage.watchers.common.AbilityResolvedWatcher;
/**
*
* @author Grath
*/
public final class ZimoneMysteryUnraveler extends CardImpl {
public ZimoneMysteryUnraveler(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}{U}");
this.supertype.add(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// Landfall -- Whenever a land you control enters, manifest dread if this is the first time this ability has resolved this turn. Otherwise, you may turn a permanent you control face up.
Ability ability = new LandfallAbility(new IfAbilityHasResolvedXTimesEffect(
Outcome.Benefit, 1, new ManifestDreadEffect()
).setText("manifest dread if this is the first time this ability has resolved this turn."), false);
ability.addEffect(new IfAbilityHasResolvedXTimesEffect(Outcome.Benefit, 2, true, new ZimoneMysteryUnravelerEffect()));
this.addAbility(ability, new AbilityResolvedWatcher());
}
private ZimoneMysteryUnraveler(final ZimoneMysteryUnraveler card) {
super(card);
}
@Override
public ZimoneMysteryUnraveler copy() {
return new ZimoneMysteryUnraveler(this);
}
}
class ZimoneMysteryUnravelerEffect extends OneShotEffect {
public ZimoneMysteryUnravelerEffect() {
super(Outcome.Benefit);
this.staticText = "you may turn a permanent you control face up";
}
protected ZimoneMysteryUnravelerEffect(final ZimoneMysteryUnravelerEffect effect) {
super(effect);
}
@Override
public ZimoneMysteryUnravelerEffect copy() {
return new ZimoneMysteryUnravelerEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
FilterControlledPermanent filter = new FilterControlledPermanent("a permanent you control");
filter.add(FaceDownPredicate.instance);
if (controller != null) {
TargetControlledPermanent target = new TargetControlledPermanent(filter);
if (controller.chooseUse(Outcome.Benefit, "Turn a permanent you control face up?", source, game) && controller.choose(Outcome.BoostCreature, target, source, game)) {
Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent != null) {
return permanent.turnFaceUp(source, game, source.getControllerId());
}
}
}
return false;
}
}

View file

@ -292,5 +292,6 @@ public final class DuskmournHouseOfHorrorCommander extends ExpansionSet {
cards.add(new SetCardInfo("Yavimaya Coast", 327, Rarity.RARE, mage.cards.y.YavimayaCoast.class)); cards.add(new SetCardInfo("Yavimaya Coast", 327, Rarity.RARE, mage.cards.y.YavimayaCoast.class));
cards.add(new SetCardInfo("Yavimaya Elder", 208, Rarity.COMMON, mage.cards.y.YavimayaElder.class)); cards.add(new SetCardInfo("Yavimaya Elder", 208, Rarity.COMMON, mage.cards.y.YavimayaElder.class));
cards.add(new SetCardInfo("Yedora, Grave Gardener", 209, Rarity.UNCOMMON, mage.cards.y.YedoraGraveGardener.class)); cards.add(new SetCardInfo("Yedora, Grave Gardener", 209, Rarity.UNCOMMON, mage.cards.y.YedoraGraveGardener.class));
cards.add(new SetCardInfo("Zimone, Mystery Unraveler", 8, Rarity.MYTHIC, mage.cards.z.ZimoneMysteryUnraveler.class));
} }
} }

View file

@ -18,21 +18,28 @@ public class IfAbilityHasResolvedXTimesEffect extends OneShotEffect {
private final int resolutionNumber; private final int resolutionNumber;
private final Effects effects; private final Effects effects;
private final boolean orMore;
public IfAbilityHasResolvedXTimesEffect(int resolutionNumber, Effect effect) { public IfAbilityHasResolvedXTimesEffect(int resolutionNumber, Effect effect) {
this(effect.getOutcome(), resolutionNumber, effect); this(effect.getOutcome(), resolutionNumber, effect);
} }
public IfAbilityHasResolvedXTimesEffect(Outcome outcome, int resolutionNumber, Effect... effects) { public IfAbilityHasResolvedXTimesEffect(Outcome outcome, int resolutionNumber, Effect... effects) {
this(outcome, resolutionNumber, false, effects);
}
public IfAbilityHasResolvedXTimesEffect(Outcome outcome, int resolutionNumber, boolean orMore, Effect... effects) {
super(outcome); super(outcome);
this.resolutionNumber = resolutionNumber; this.resolutionNumber = resolutionNumber;
this.effects = new Effects(effects); this.effects = new Effects(effects);
this.orMore = orMore;
} }
private IfAbilityHasResolvedXTimesEffect(final IfAbilityHasResolvedXTimesEffect effect) { private IfAbilityHasResolvedXTimesEffect(final IfAbilityHasResolvedXTimesEffect effect) {
super(effect); super(effect);
this.resolutionNumber = effect.resolutionNumber; this.resolutionNumber = effect.resolutionNumber;
this.effects = effect.effects.copy(); this.effects = effect.effects.copy();
this.orMore = effect.orMore;
} }
@Override @Override
@ -42,7 +49,8 @@ public class IfAbilityHasResolvedXTimesEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
if (AbilityResolvedWatcher.getResolutionCount(game, source) != resolutionNumber) { int resolutionCount = AbilityResolvedWatcher.getResolutionCount(game, source);
if (resolutionCount < resolutionNumber || (!orMore && resolutionCount > resolutionNumber)) {
return false; return false;
} }
boolean result = false; boolean result = false;
@ -62,6 +70,9 @@ public class IfAbilityHasResolvedXTimesEffect extends OneShotEffect {
if (staticText != null && !staticText.isEmpty()) { if (staticText != null && !staticText.isEmpty()) {
return staticText; return staticText;
} }
if (orMore) {
return "otherwise, " + effects.getText(mode);
}
return "if this is the " + CardUtil.numberToOrdinalText(resolutionNumber) + return "if this is the " + CardUtil.numberToOrdinalText(resolutionNumber) +
" time this ability has resolved this turn, " + effects.getText(mode); " time this ability has resolved this turn, " + effects.getText(mode);
} }