This commit is contained in:
jeffwadsworth 2019-12-30 15:22:39 -06:00
parent 6f9db86eb9
commit e4591f42f0
6 changed files with 113 additions and 52 deletions

View file

@ -1,4 +1,3 @@
package mage.cards.b;
import java.util.UUID;
@ -71,7 +70,8 @@ class BringToLightEffect extends OneShotEffect {
if (controller != null) {
int numberColors = ColorsOfManaSpentToCastCount.getInstance().calculate(game, source, this);
FilterCard filter = new FilterCard();
filter.add(Predicates.or(new CardTypePredicate(CardType.CREATURE), new CardTypePredicate(CardType.INSTANT), new CardTypePredicate(CardType.SORCERY)));
filter.add(Predicates.or(new CardTypePredicate(CardType.CREATURE),
new CardTypePredicate(CardType.INSTANT), new CardTypePredicate(CardType.SORCERY)));
filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, numberColors + 1));
TargetCardInLibrary target = new TargetCardInLibrary(filter);
controller.searchLibrary(target, source, game);
@ -81,9 +81,13 @@ class BringToLightEffect extends OneShotEffect {
}
controller.shuffleLibrary(source, game);
if (card != null) {
if (controller.chooseUse(outcome, "Cast " + card.getName() + " without paying its mana cost?", source, game)) {
if (card.getSpellAbility() != null) {
controller.cast(card.getSpellAbility(), game, true, new MageObjectReference(source.getSourceObject(game), game));
if (controller.chooseUse(Outcome.PlayForFree, "Cast " + card.getName()
+ " without paying its mana cost?", source, game)) {
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE);
Boolean cardWasCast = controller.cast(controller.chooseAbilityForCast(card, game, true),
game, true, new MageObjectReference(source.getSourceObject(game), game));
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
if (cardWasCast) {
} else {
Logger.getLogger(BringToLightEffect.class).error("Bring to Light: spellAbility == null " + card.getName());
}

View file

@ -26,7 +26,10 @@ public final class CollectedConjuring extends CardImpl {
public CollectedConjuring(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{U}{R}");
// Exile the top six cards of your library. You may cast up to two sorcery cards with converted mana costs 3 or less from among them without paying their mana cost. Put the exiled cards not cast this way on the bottom of your library in a random order.
// Exile the top six cards of your library. You may cast up to two sorcery
// cards with converted mana costs 3 or less from among them without paying
// their mana cost. Put the exiled cards not cast this way on the bottom
// of your library in a random order.
this.getSpellAbility().addEffect(new CollectedConjuringEffect());
}
@ -42,7 +45,8 @@ public final class CollectedConjuring extends CardImpl {
class CollectedConjuringEffect extends OneShotEffect {
private static final FilterCard filter = new FilterCard("sorcery cards with converted mana cost 3 or less");
private static final FilterCard filter = new FilterCard(
"sorcery cards with converted mana cost 3 or less");
static {
filter.add(new CardTypePredicate(CardType.SORCERY));
@ -56,11 +60,11 @@ class CollectedConjuringEffect extends OneShotEffect {
}
CollectedConjuringEffect() {
super(Outcome.Benefit);
this.staticText = "Exile the top six cards of your library. " +
"You may cast up to two sorcery cards with converted mana costs 3 or less from among them " +
"without paying their mana cost. Put the exiled cards not cast this way " +
"on the bottom of your library in a random order.";
super(Outcome.PlayForFree);
this.staticText = "Exile the top six cards of your library. "
+ "You may cast up to two sorcery cards with converted mana costs 3 or less from among them "
+ "without paying their mana cost. Put the exiled cards not cast this way "
+ "on the bottom of your library in a random order.";
}
private CollectedConjuringEffect(final CollectedConjuringEffect effect) {
@ -76,14 +80,17 @@ class CollectedConjuringEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (controller == null || sourceObject == null) {
if (controller == null
|| sourceObject == null) {
return false;
}
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 6));
controller.moveCards(cards, Zone.EXILED, source, game);
int cardsCast = 0;
while (!cards.getCards(filter, source.getSourceId(), source.getControllerId(), game).isEmpty() && cardsCast < 2) {
if (!controller.chooseUse(Outcome.PlayForFree, "Cast a card exiled with " + sourceObject.getLogName() + " without paying its mana cost?", source, game)) {
while (!cards.getCards(filter, source.getSourceId(), source.getControllerId(), game).isEmpty()
&& cardsCast < 2) {
if (!controller.chooseUse(Outcome.PlayForFree, "Cast a card exiled with "
+ sourceObject.getLogName() + " without paying its mana cost?", source, game)) {
break;
}
TargetCard targetCard = new TargetCard(1, Zone.EXILED, filter2);
@ -94,11 +101,16 @@ class CollectedConjuringEffect extends OneShotEffect {
if (card == null) {
continue;
}
if (controller.cast(card.getSpellAbility(), game, true, new MageObjectReference(source.getSourceObject(game), game))) {
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE);
Boolean cardWasCast = controller.cast(controller.chooseAbilityForCast(card, game, true),
game, true, new MageObjectReference(source.getSourceObject(game), game));
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
if (cardWasCast) {
cards.remove(card);
cardsCast++;
} else {
game.informPlayer(controller, "You're not able to cast " + card.getIdName() + " or you canceled the casting.");
game.informPlayer(controller, "You're not able to cast "
+ card.getIdName() + " or you canceled the casting.");
}
}
controller.putCardsOnBottomOfLibrary(cards, game, source, false);

View file

@ -126,7 +126,8 @@ class FinaleOfPromiseEffect extends OneShotEffect {
.filter(Objects::nonNull)
.map(Card::getName)
.collect(Collectors.joining(" -> "));
if (!controller.chooseUse(Outcome.Detriment, "Cast cards by choose order: " + cardsOrder + "?", "Finale of Promise",
if (!controller.chooseUse(Outcome.Detriment, "Cast cards by choose order: "
+ cardsOrder + "?", "Finale of Promise",
"Use that order", "Reverse", source, game)) {
Collections.reverse(cardsToCast);
}
@ -136,7 +137,10 @@ class FinaleOfPromiseEffect extends OneShotEffect {
for (UUID id : cardsToCast) {
Card card = game.getCard(id);
if (card != null) {
controller.cast(card.getSpellAbility(), game, true, new MageObjectReference(source.getSourceObject(game), game));
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE);
controller.cast(controller.chooseAbilityForCast(card, game, true),
game, true, new MageObjectReference(source.getSourceObject(game), game));
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
ContinuousEffect effect = new FinaleOfPromiseReplacementEffect();
effect.setTargetPointer(new FixedTarget(card.getId(), game.getState().getZoneChangeCounter(card.getId())));
game.addEffect(effect, source);
@ -205,6 +209,7 @@ class FinaleOfPromiseReplacementEffect extends ReplacementEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
return zEvent.getToZone() == Zone.GRAVEYARD && event.getTargetId().equals(getTargetPointer().getFirst(game, source));
return zEvent.getToZone() == Zone.GRAVEYARD
&& event.getTargetId().equals(getTargetPointer().getFirst(game, source));
}
}

View file

@ -1,4 +1,3 @@
package mage.cards.m;
import java.util.List;
@ -32,9 +31,11 @@ public final class MindsDilation extends CardImpl {
public MindsDilation(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{5}{U}{U}");
// Whenever an opponent casts their first spell each turn, that player exiles the top card of their library. If it's a nonland card,
// Whenever an opponent casts their first spell each turn,
// that player exiles the top card of their library. If it's a nonland card,
// you may cast it without paying its mana cost.
this.addAbility(new MindsDilationTriggeredAbility(new MindsDilationEffect(), false), new SpellsCastWatcher());
this.addAbility(new MindsDilationTriggeredAbility(new MindsDilationEffect(),
false), new SpellsCastWatcher());
}
public MindsDilation(final MindsDilation card) {
@ -81,16 +82,19 @@ class MindsDilationTriggeredAbility extends SpellCastOpponentTriggeredAbility {
@Override
public String getRule() {
return "Whenever an opponent casts their first spell each turn, that player exiles the top card of their library."
+ " If it's a nonland card, you may cast it without paying its mana cost.";
return "Whenever an opponent casts their first spell each turn, "
+ "that player exiles the top card of their library."
+ " If it's a nonland card, you may cast it without "
+ "paying its mana cost.";
}
}
class MindsDilationEffect extends OneShotEffect {
MindsDilationEffect() {
super(Outcome.Benefit);
this.staticText = "that player exiles the top card of their library. If it's a nonland card, you may cast it without paying its mana cost";
super(Outcome.PlayForFree);
this.staticText = "that player exiles the top card of their library. "
+ "If it's a nonland card, you may cast it without paying its mana cost";
}
MindsDilationEffect(final MindsDilationEffect effect) {
@ -107,13 +111,20 @@ class MindsDilationEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source));
if (controller != null && sourceObject != null && opponent != null) {
if (controller != null
&& sourceObject != null
&& opponent != null) {
if (opponent.getLibrary().hasCards()) {
Card card = opponent.getLibrary().getFromTop(game);
if (card != null && opponent.moveCards(card, Zone.EXILED, source, game)) {
if (card != null
&& opponent.moveCards(card, Zone.EXILED, source, game)) {
if (!card.isLand()) {
if (controller.chooseUse(outcome, "Cast " + card.getLogName() + " without paying its mana cost from exile?", source, game)) {
controller.cast(card.getSpellAbility(), game, true, new MageObjectReference(source.getSourceObject(game), game));
if (controller.chooseUse(outcome, "Cast " + card.getLogName()
+ " without paying its mana cost from exile?", source, game)) {
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE);
controller.cast(controller.chooseAbilityForCast(card, game, true),
game, true, new MageObjectReference(source.getSourceObject(game), game));
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
}
}
}

View file

@ -28,13 +28,17 @@ public final class MizzixsMastery extends CardImpl {
public MizzixsMastery(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{R}");
// Exile target card that's an instant or sorcery from your graveyard. For each card exiled this way, copy it, and you may cast the copy without paying its mana cost. Exile Mizzix's Mastery.
// Exile target card that's an instant or sorcery from your graveyard.
// For each card exiled this way, copy it, and you may cast the copy
// without paying its mana cost. Exile Mizzix's Mastery.
this.getSpellAbility().addEffect(new MizzixsMasteryEffect());
this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(new FilterInstantOrSorceryCard("card that's an instant or sorcery from your graveyard")));
this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(
new FilterInstantOrSorceryCard("card that's an instant or sorcery from your graveyard")));
this.getSpellAbility().addEffect(ExileSpellEffect.getInstance());
// Overload {5}{R}{R}{R}
Ability ability = new OverloadAbility(this, new MizzixsMasteryOverloadEffect(), new ManaCostsImpl("{5}{R}{R}{R}"));
Ability ability = new OverloadAbility(this, new MizzixsMasteryOverloadEffect(),
new ManaCostsImpl("{5}{R}{R}{R}"));
ability.addEffect(ExileSpellEffect.getInstance());
this.addAbility(ability);
}
@ -53,7 +57,9 @@ class MizzixsMasteryEffect extends OneShotEffect {
public MizzixsMasteryEffect() {
super(Outcome.PlayForFree);
this.staticText = "Exile target card that's an instant or sorcery from your graveyard. For each card exiled this way, copy it, and you may cast the copy without paying its mana cost";
this.staticText = "Exile target card that's an instant or sorcery from your "
+ "graveyard. For each card exiled this way, copy it, and you "
+ "may cast the copy without paying its mana cost";
}
public MizzixsMasteryEffect(final MizzixsMasteryEffect effect) {
@ -74,8 +80,12 @@ class MizzixsMasteryEffect extends OneShotEffect {
if (controller.moveCards(card, Zone.EXILED, source, game)) {
Card cardCopy = game.copyCard(card, source, source.getControllerId());
if (cardCopy.getSpellAbility().canChooseTarget(game)
&& controller.chooseUse(outcome, "Cast copy of " + card.getName() + " without paying its mana cost?", source, game)) {
controller.cast(cardCopy.getSpellAbility(), game, true, new MageObjectReference(source.getSourceObject(game), game));
&& controller.chooseUse(outcome, "Cast copy of "
+ card.getName() + " without paying its mana cost?", source, game)) {
game.getState().setValue("PlayFromNotOwnHandZone" + cardCopy.getId(), Boolean.TRUE);
controller.cast(controller.chooseAbilityForCast(cardCopy, game, true),
game, true, new MageObjectReference(source.getSourceObject(game), game));
game.getState().setValue("PlayFromNotOwnHandZone" + cardCopy.getId(), null);
}
}
}
@ -89,7 +99,9 @@ class MizzixsMasteryOverloadEffect extends OneShotEffect {
public MizzixsMasteryOverloadEffect() {
super(Outcome.PlayForFree);
this.staticText = "Exile each card that's an instant or sorcery from your graveyard. For each card exiled this way, copy it, and you may cast the copy without paying its mana cost. Exile {this}";
this.staticText = "Exile each card that's an instant or sorcery from "
+ "your graveyard. For each card exiled this way, copy it, "
+ "and you may cast the copy without paying its mana cost. Exile {this}";
}
public MizzixsMasteryOverloadEffect(final MizzixsMasteryOverloadEffect effect) {
@ -105,7 +117,8 @@ class MizzixsMasteryOverloadEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Set<Card> cardsToExile = controller.getGraveyard().getCards(new FilterInstantOrSorceryCard(), source.getId(), source.getControllerId(), game);
Set<Card> cardsToExile = controller.getGraveyard().getCards(
new FilterInstantOrSorceryCard(), source.getId(), source.getControllerId(), game);
if (!cardsToExile.isEmpty()) {
if (controller.moveCards(cardsToExile, Zone.EXILED, source, game)) {
Cards copiedCards = new CardsImpl();
@ -114,18 +127,25 @@ class MizzixsMasteryOverloadEffect extends OneShotEffect {
}
boolean continueCasting = true;
while (continueCasting && controller.isInGame()) {
TargetCard targetCard = new TargetCard(0, 1, Zone.EXILED, new FilterCard("copied card to cast without paying its mana cost?"));
TargetCard targetCard = new TargetCard(0, 1, Zone.EXILED,
new FilterCard("copied card to cast without paying its mana cost?"));
targetCard.setNotTarget(true);
if (controller.choose(outcome, copiedCards, targetCard, game)) {
if (controller.choose(Outcome.PlayForFree, copiedCards, targetCard, game)) {
Card selectedCard = game.getCard(targetCard.getFirstTarget());
if (selectedCard != null && selectedCard.getSpellAbility().canChooseTarget(game)) {
if (controller.cast(selectedCard.getSpellAbility(), game, true, new MageObjectReference(source.getSourceObject(game), game))) {
if (selectedCard != null
&& selectedCard.getSpellAbility().canChooseTarget(game)) {
game.getState().setValue("PlayFromNotOwnHandZone" + selectedCard.getId(), Boolean.TRUE);
Boolean cardWasCast = controller.cast(controller.chooseAbilityForCast(selectedCard, game, true),
game, true, new MageObjectReference(source.getSourceObject(game), game));
game.getState().setValue("PlayFromNotOwnHandZone" + selectedCard.getId(), null);
if (cardWasCast) {
copiedCards.remove(selectedCard);
}
}
}
continueCasting = !copiedCards.isEmpty()
&& controller.chooseUse(outcome, "Cast one of the copied cards without paying its mana cost?", source, game);
&& controller.chooseUse(Outcome.PlayForFree, "Cast one of the copied "
+ "cards without paying its mana cost?", source, game);
}
}
}

View file

@ -35,7 +35,8 @@ public final class OmnispellAdept extends CardImpl {
this.power = new MageInt(3);
this.toughness = new MageInt(4);
// {2}{U}, {T}: You may cast an instant or sorcery card from your hand without paying its mana cost.
// {2}{U}, {T}: You may cast an instant or sorcery card from your hand
// without paying its mana cost.
Ability ability = new SimpleActivatedAbility(
new OmnispellAdeptEffect(), new ManaCostsImpl("{2}{U}")
);
@ -55,11 +56,13 @@ public final class OmnispellAdept extends CardImpl {
class OmnispellAdeptEffect extends OneShotEffect {
private static final FilterCard filter = new FilterInstantOrSorceryCard("instant or sorcery card from your hand");
private static final FilterCard filter = new FilterInstantOrSorceryCard(
"instant or sorcery card from your hand");
public OmnispellAdeptEffect() {
super(Outcome.PlayForFree);
this.staticText = "you may cast an instant or sorcery card from your hand without paying its mana cost";
this.staticText = "you may cast an instant or sorcery card from your hand "
+ "without paying its mana cost";
}
public OmnispellAdeptEffect(final OmnispellAdeptEffect effect) {
@ -79,13 +82,16 @@ class OmnispellAdeptEffect extends OneShotEffect {
}
Target target = new TargetCardInHand(filter);
if (target.canChoose(source.getSourceId(), controller.getId(), game)
&& controller.chooseUse(outcome, "Cast an instant or sorcery card from your hand without paying its mana cost?", source, game)) {
&& controller.chooseUse(Outcome.PlayForFree, "Cast an instant or sorcery "
+ "card from your hand without paying its mana cost?", source, game)) {
Card cardToCast = null;
boolean cancel = false;
while (controller.canRespond() && !cancel) {
if (controller.chooseTarget(outcome, target, source, game)) {
while (controller.canRespond()
&& !cancel) {
if (controller.chooseTarget(Outcome.PlayForFree, target, source, game)) {
cardToCast = game.getCard(target.getFirstTarget());
if (cardToCast != null && cardToCast.getSpellAbility().canChooseTarget(game)) {
if (cardToCast != null
&& cardToCast.getSpellAbility().canChooseTarget(game)) {
cancel = true;
}
} else {
@ -93,7 +99,10 @@ class OmnispellAdeptEffect extends OneShotEffect {
}
}
if (cardToCast != null) {
controller.cast(cardToCast.getSpellAbility(), game, true, new MageObjectReference(source.getSourceObject(game), game));
game.getState().setValue("PlayFromNotOwnHandZone" + cardToCast.getId(), Boolean.TRUE);
controller.cast(controller.chooseAbilityForCast(cardToCast, game, true),
game, true, new MageObjectReference(source.getSourceObject(game), game));
game.getState().setValue("PlayFromNotOwnHandZone" + cardToCast.getId(), null);
}
}
return true;