[CMR] Implemented Explosion of Riches

This commit is contained in:
Evan Kranzler 2020-11-07 16:43:03 -05:00
parent 72cb50fce0
commit 6521b2e3a6
2 changed files with 83 additions and 0 deletions

View file

@ -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;
}
}

View file

@ -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));