diff --git a/Mage.Sets/src/mage/cards/r/RalIzzetViceroy.java b/Mage.Sets/src/mage/cards/r/RalIzzetViceroy.java new file mode 100644 index 00000000000..45f603a1b59 --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/RalIzzetViceroy.java @@ -0,0 +1,97 @@ +package mage.cards.r; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.LoyaltyAbility; +import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.abilities.effects.common.GetEmblemEffect; +import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.command.emblems.RalIzzetViceroyEmblem; +import mage.players.Player; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author TheElk801 + */ +public final class RalIzzetViceroy extends CardImpl { + + public RalIzzetViceroy(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{3}{U}{R}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.RAL); + this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(5)); + + // +1: Look at the top two cards of your library. Put one of them into your hand and the other into your graveyard. + this.addAbility(new LoyaltyAbility( + new LookLibraryAndPickControllerEffect( + new StaticValue(2), false, new StaticValue(1), + StaticFilters.FILTER_CARD, Zone.GRAVEYARD, false, false + ), 1 + )); + + // -3: Ral, Izzet Viceroy deals damage to target creature equal to the total number of instant and sorcery cards you own in exile and in your graveyard. + Ability ability = new LoyaltyAbility( + new DamageTargetEffect(new RalIzzetViceroyCount()) + .setText("{this} deals damage to target creature " + + "equal to the total number of instant " + + "and sorcery cards you own in exile " + + "and in your graveyard"), -3 + ); + ability.addTarget(new TargetCreaturePermanent()); + this.addAbility(ability); + + // -8: You get an emblem with "Whenever you cast an instant or sorcery spell, this emblem deals 4 damage to any target and you draw two cards." + this.addAbility(new LoyaltyAbility( + new GetEmblemEffect(new RalIzzetViceroyEmblem()), -8 + )); + } + + public RalIzzetViceroy(final RalIzzetViceroy card) { + super(card); + } + + @Override + public RalIzzetViceroy copy() { + return new RalIzzetViceroy(this); + } +} + +class RalIzzetViceroyCount implements DynamicValue { + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + Player player = game.getPlayer(sourceAbility.getControllerId()); + if (player != null) { + return player.getGraveyard().count( + StaticFilters.FILTER_CARD_INSTANT_OR_SORCERY, game + ) + game.getExile().getExileZone(player.getId()).count( + StaticFilters.FILTER_CARD_INSTANT_OR_SORCERY, game + ); + } + return 0; + } + + @Override + public RalIzzetViceroyCount copy() { + return new RalIzzetViceroyCount(); + } + + @Override + public String getMessage() { + return ""; + } +} diff --git a/Mage.Sets/src/mage/sets/GuildsOfRavnica.java b/Mage.Sets/src/mage/sets/GuildsOfRavnica.java index c1b0b6840ca..1221ebb9c2c 100644 --- a/Mage.Sets/src/mage/sets/GuildsOfRavnica.java +++ b/Mage.Sets/src/mage/sets/GuildsOfRavnica.java @@ -30,6 +30,7 @@ public final class GuildsOfRavnica extends ExpansionSet { cards.add(new SetCardInfo("Narcomoeba", 47, Rarity.RARE, mage.cards.n.Narcomoeba.class)); cards.add(new SetCardInfo("Necrotic Wound", 79, Rarity.UNCOMMON, mage.cards.n.NecroticWound.class)); cards.add(new SetCardInfo("Overgrown Tomb", 253, Rarity.RARE, mage.cards.o.OvergrownTomb.class)); + cards.add(new SetCardInfo("Ral, Izzet Viceroy", 195, Rarity.MYTHIC, mage.cards.r.RalIzzetViceroy.class)); cards.add(new SetCardInfo("Sacred Foundry", 254, Rarity.RARE, mage.cards.s.SacredFoundry.class)); cards.add(new SetCardInfo("Sinister Sabotage", 54, Rarity.UNCOMMON, mage.cards.s.SinisterSabotage.class)); cards.add(new SetCardInfo("Steam Vents", 257, Rarity.RARE, mage.cards.s.SteamVents.class)); diff --git a/Mage/src/main/java/mage/game/command/emblems/RalIzzetViceroyEmblem.java b/Mage/src/main/java/mage/game/command/emblems/RalIzzetViceroyEmblem.java new file mode 100644 index 00000000000..4c2eac1842c --- /dev/null +++ b/Mage/src/main/java/mage/game/command/emblems/RalIzzetViceroyEmblem.java @@ -0,0 +1,32 @@ +package mage.game.command.emblems; + +import mage.abilities.Ability; +import mage.abilities.common.SpellCastControllerTriggeredAbility; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.game.command.Emblem; +import mage.target.common.TargetAnyTarget; + +/** + * + * @author TheElk801 + */ +public class RalIzzetViceroyEmblem extends Emblem { + + // You get an emblem with "Whenever you cast an instant or sorcery spell, this emblem deals 4 damage to any target and you draw two cards." + public RalIzzetViceroyEmblem() { + this.setName("Emblem Ral"); + Ability ability = new SpellCastControllerTriggeredAbility( + Zone.COMMAND, new DamageTargetEffect(4, "this emblem"), + StaticFilters.FILTER_SPELL_AN_INSTANT_OR_SORCERY, false, false + ); + ability.addEffect( + new DrawCardSourceControllerEffect(2) + .setText("and you draw two cards") + ); + ability.addTarget(new TargetAnyTarget()); + getAbilities().add(ability); + } +}