From 6521b2e3a68c5c329940bd68fd4f72a6d791dda9 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 7 Nov 2020 16:43:03 -0500 Subject: [PATCH] [CMR] Implemented Explosion of Riches --- .../src/mage/cards/e/ExplosionOfRiches.java | 82 +++++++++++++++++++ Mage.Sets/src/mage/sets/CommanderLegends.java | 1 + 2 files changed, 83 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/e/ExplosionOfRiches.java diff --git a/Mage.Sets/src/mage/cards/e/ExplosionOfRiches.java b/Mage.Sets/src/mage/cards/e/ExplosionOfRiches.java new file mode 100644 index 0000000000..8fb94b9dff --- /dev/null +++ b/Mage.Sets/src/mage/cards/e/ExplosionOfRiches.java @@ -0,0 +1,82 @@ +package mage.cards.e; + +import mage.abilities.Ability; +import mage.abilities.common.delayed.ReflexiveTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.game.Game; +import mage.players.Player; +import mage.target.Target; +import mage.target.common.TargetOpponent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ExplosionOfRiches extends CardImpl { + + public ExplosionOfRiches(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{5}{R}"); + + // Draw a card, then each other player may draw a card. Whenever a card is drawn this way, Explosion of Riches deals 5 damage to target opponent chosen at random from among your opponents. + this.getSpellAbility().addEffect(new ExplosionOfRichesEffect()); + } + + private ExplosionOfRiches(final ExplosionOfRiches card) { + super(card); + } + + @Override + public ExplosionOfRiches copy() { + return new ExplosionOfRiches(this); + } +} + +class ExplosionOfRichesEffect extends OneShotEffect { + + ExplosionOfRichesEffect() { + super(Outcome.Benefit); + staticText = "draw a card, then each other player may draw a card. Whenever a card is drawn this way, " + + "{this} deals 5 damage to target opponent chosen at random from among your opponents"; + } + + private ExplosionOfRichesEffect(final ExplosionOfRichesEffect effect) { + super(effect); + } + + @Override + public ExplosionOfRichesEffect copy() { + return new ExplosionOfRichesEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { + Player player = game.getPlayer(playerId); + if (player == null) { + continue; + } + if (!playerId.equals(source.getControllerId()) + && !player.chooseUse(outcome, "Draw a card?", source, game)) { + continue; + } + if (player.drawCards(1, source.getSourceId(), game) >= 1) { + continue; + } + ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility( + new DamageTargetEffect(5), false, + "{this} deals damage to target opponent chosen at random" + ); + Target target = new TargetOpponent(); + target.setRandom(true); + ability.addTarget(target); + game.fireReflexiveTriggeredAbility(ability, source); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/CommanderLegends.java b/Mage.Sets/src/mage/sets/CommanderLegends.java index 93babff480..ce8ef50139 100644 --- a/Mage.Sets/src/mage/sets/CommanderLegends.java +++ b/Mage.Sets/src/mage/sets/CommanderLegends.java @@ -156,6 +156,7 @@ public final class CommanderLegends extends ExpansionSet { cards.add(new SetCardInfo("Expedite", 413, Rarity.COMMON, mage.cards.e.Expedite.class)); cards.add(new SetCardInfo("Explore", 426, Rarity.COMMON, mage.cards.e.Explore.class)); cards.add(new SetCardInfo("Explorer's Scope", 461, Rarity.COMMON, mage.cards.e.ExplorersScope.class)); + cards.add(new SetCardInfo("Explosion of Riches", 176, Rarity.UNCOMMON, mage.cards.e.ExplosionOfRiches.class)); cards.add(new SetCardInfo("Exquisite Huntmaster", 122, Rarity.COMMON, mage.cards.e.ExquisiteHuntmaster.class)); cards.add(new SetCardInfo("Eyeblight Assassin", 123, Rarity.COMMON, mage.cards.e.EyeblightAssassin.class)); cards.add(new SetCardInfo("Eyeblight Cullers", 124, Rarity.COMMON, mage.cards.e.EyeblightCullers.class));