diff --git a/Mage.Sets/src/mage/cards/c/CalibratedBlast.java b/Mage.Sets/src/mage/cards/c/CalibratedBlast.java new file mode 100644 index 0000000000..3a1bc01af3 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CalibratedBlast.java @@ -0,0 +1,86 @@ +package mage.cards.c; + +import mage.abilities.Ability; +import mage.abilities.common.delayed.ReflexiveTriggeredAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.abilities.keyword.FlashbackAbility; +import mage.cards.*; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.TimingRule; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetAnyTarget; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class CalibratedBlast extends CardImpl { + + public CalibratedBlast(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{R}"); + + // Reveal cards from the top of your library until you reveal a nonland card. Put the revealed cards on the bottom of your library in a random order. When you reveal a nonland card this way, Calibrated Blast deals damage equal to that card's mana value to any target. + this.getSpellAbility().addEffect(new CalibratedBlastEffect()); + + // Flashback {3}{R}{R} + this.addAbility(new FlashbackAbility(new ManaCostsImpl<>("{3}{R}{R}"), TimingRule.INSTANT)); + } + + private CalibratedBlast(final CalibratedBlast card) { + super(card); + } + + @Override + public CalibratedBlast copy() { + return new CalibratedBlast(this); + } +} + +class CalibratedBlastEffect extends OneShotEffect { + + CalibratedBlastEffect() { + super(Outcome.Benefit); + staticText = "reveal cards from the top of your library until you reveal a nonland card. " + + "Put the revealed cards on the bottom of your library in a random order. When you reveal " + + "a nonland card this way, {this} deals damage equal to that card's mana value to any target"; + } + + private CalibratedBlastEffect(final CalibratedBlastEffect effect) { + super(effect); + } + + @Override + public CalibratedBlastEffect copy() { + return new CalibratedBlastEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + Cards cards = new CardsImpl(); + for (Card card : player.getLibrary().getCards(game)) { + cards.add(card); + if (card.isLand()) { + continue; + } + ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility( + new DamageTargetEffect(card.getManaValue()), false, "When you reveal " + + "a nonland card this way, {this} deals damage equal to that card's mana value to any target" + ); + ability.addTarget(new TargetAnyTarget()); + game.fireReflexiveTriggeredAbility(ability, source); + break; + } + player.revealCards(source, cards, game); + player.putCardsOnBottomOfLibrary(cards, game, source, false); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/ModernHorizons2.java b/Mage.Sets/src/mage/sets/ModernHorizons2.java index a597ba5fb1..515a436b67 100644 --- a/Mage.Sets/src/mage/sets/ModernHorizons2.java +++ b/Mage.Sets/src/mage/sets/ModernHorizons2.java @@ -37,6 +37,7 @@ public final class ModernHorizons2 extends ExpansionSet { cards.add(new SetCardInfo("Brainstone", 223, Rarity.UNCOMMON, mage.cards.b.Brainstone.class)); cards.add(new SetCardInfo("Break Ties", 8, Rarity.COMMON, mage.cards.b.BreakTies.class)); cards.add(new SetCardInfo("Cabal Coffers", 301, Rarity.MYTHIC, mage.cards.c.CabalCoffers.class)); + cards.add(new SetCardInfo("Calibrated Blast", 118, Rarity.RARE, mage.cards.c.CalibratedBlast.class)); cards.add(new SetCardInfo("Chance Encounter", 277, Rarity.RARE, mage.cards.c.ChanceEncounter.class)); cards.add(new SetCardInfo("Chatterstorm", 152, Rarity.COMMON, mage.cards.c.Chatterstorm.class)); cards.add(new SetCardInfo("Counterspell", 267, Rarity.UNCOMMON, mage.cards.c.Counterspell.class));