mirror of
https://github.com/correl/mage.git
synced 2024-11-16 03:00:12 +00:00
fix Erratic Explosion
wouldn't reveal any cards, since ec7c888
updated Erratic Mutation to match, but it wasn't broken
This commit is contained in:
parent
f06de472a4
commit
99d33eb771
2 changed files with 31 additions and 28 deletions
|
@ -28,6 +28,8 @@
|
||||||
package mage.sets.planarchaos;
|
package mage.sets.planarchaos;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import mage.MageObject;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
|
@ -40,13 +42,10 @@ import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardsImpl;
|
import mage.cards.CardsImpl;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Library;
|
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
|
@ -57,7 +56,6 @@ public class ErraticMutation extends CardImpl {
|
||||||
super(ownerId, 41, "Erratic Mutation", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{2}{U}");
|
super(ownerId, 41, "Erratic Mutation", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{2}{U}");
|
||||||
this.expansionSetCode = "PLC";
|
this.expansionSetCode = "PLC";
|
||||||
|
|
||||||
|
|
||||||
// Choose target creature. Reveal cards from the top of your library until you reveal a nonland card. That creature gets +X/-X until end of turn, where X is that card's converted mana cost. Put all cards revealed this way on the bottom of your library in any order.
|
// Choose target creature. Reveal cards from the top of your library until you reveal a nonland card. That creature gets +X/-X until end of turn, where X is that card's converted mana cost. Put all cards revealed this way on the bottom of your library in any order.
|
||||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||||
this.getSpellAbility().addEffect(new ErraticMutationEffect());
|
this.getSpellAbility().addEffect(new ErraticMutationEffect());
|
||||||
|
@ -77,7 +75,7 @@ public class ErraticMutation extends CardImpl {
|
||||||
class ErraticMutationEffect extends OneShotEffect {
|
class ErraticMutationEffect extends OneShotEffect {
|
||||||
|
|
||||||
public ErraticMutationEffect() {
|
public ErraticMutationEffect() {
|
||||||
super(Outcome.DrawCard);
|
super(Outcome.UnboostCreature);
|
||||||
this.staticText = "Choose target creature. Reveal cards from the top of your library until you reveal a nonland card. That creature gets +X/-X until end of turn, where X is that card's converted mana cost. Put all cards revealed this way on the bottom of your library in any order";
|
this.staticText = "Choose target creature. Reveal cards from the top of your library until you reveal a nonland card. That creature gets +X/-X until end of turn, where X is that card's converted mana cost. Put all cards revealed this way on the bottom of your library in any order";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,29 +90,33 @@ class ErraticMutationEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (player != null && player.getLibrary().size() > 0) {
|
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||||
CardsImpl cards = new CardsImpl();
|
if (controller != null && sourceObject != null) {
|
||||||
Library library = player.getLibrary();
|
CardsImpl toReveal = new CardsImpl();
|
||||||
Card card = null;
|
Card nonLandCard = null;
|
||||||
do {
|
|
||||||
card = library.removeFromTop(game);
|
while (nonLandCard == null && controller.getLibrary().size() > 0) {
|
||||||
if (card != null) {
|
Card card = controller.getLibrary().removeFromTop(game);
|
||||||
cards.add(card);
|
toReveal.add(card);
|
||||||
|
if (!card.getCardType().contains(CardType.LAND)) {
|
||||||
|
nonLandCard = card;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} while (library.size() > 0 && card != null && card.getCardType().contains(CardType.LAND));
|
|
||||||
// reveal cards
|
// reveal cards
|
||||||
if (!cards.isEmpty()) {
|
if (!toReveal.isEmpty()) {
|
||||||
player.revealCards("Erratic Mutation", cards, game);
|
controller.revealCards(sourceObject.getIdName(), toReveal, game);
|
||||||
}
|
}
|
||||||
// the nonland card
|
// the nonland card
|
||||||
int boostValue = card.getManaCost().convertedManaCost();
|
if (nonLandCard != null) {
|
||||||
|
int boostValue = nonLandCard.getManaCost().convertedManaCost();
|
||||||
// unboost target
|
// unboost target
|
||||||
ContinuousEffect effect = new BoostTargetEffect(boostValue, boostValue * -1, Duration.EndOfTurn);
|
ContinuousEffect effect = new BoostTargetEffect(boostValue, -boostValue, Duration.EndOfTurn);
|
||||||
effect.setTargetPointer(new FixedTarget(this.getTargetPointer().getFirst(game, source)));
|
effect.setTargetPointer(new FixedTarget(this.getTargetPointer().getFirst(game, source)));
|
||||||
game.addEffect(effect, source);
|
game.addEffect(effect, source);
|
||||||
|
}
|
||||||
// put the cards on the bottom of the library in any order
|
// put the cards on the bottom of the library in any order
|
||||||
return player.putCardsOnBottomOfLibrary(cards, game, source, true);
|
return controller.putCardsOnBottomOfLibrary(toReveal, game, source, true);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,13 +89,14 @@ class ErraticExplosionEffect extends OneShotEffect {
|
||||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||||
if (controller != null && sourceObject != null) {
|
if (controller != null && sourceObject != null) {
|
||||||
CardsImpl toReveal = new CardsImpl();
|
CardsImpl toReveal = new CardsImpl();
|
||||||
boolean nonLandFound = false;
|
|
||||||
Card nonLandCard = null;
|
Card nonLandCard = null;
|
||||||
|
|
||||||
while (nonLandFound && controller.getLibrary().size() > 0) {
|
while (nonLandCard == null && controller.getLibrary().size() > 0) {
|
||||||
nonLandCard = controller.getLibrary().removeFromTop(game);
|
Card card = controller.getLibrary().removeFromTop(game);
|
||||||
toReveal.add(nonLandCard);
|
toReveal.add(card);
|
||||||
nonLandFound = nonLandCard.getCardType().contains(CardType.LAND);
|
if (!card.getCardType().contains(CardType.LAND)) {
|
||||||
|
nonLandCard = card;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// reveal cards
|
// reveal cards
|
||||||
if (!toReveal.isEmpty()) {
|
if (!toReveal.isEmpty()) {
|
||||||
|
|
Loading…
Reference in a new issue