From 51fb4df5a093dbafdcfa71d551912907720ef0ed Mon Sep 17 00:00:00 2001 From: PurpleCrowbar <26198472+PurpleCrowbar@users.noreply.github.com> Date: Mon, 12 Sep 2022 23:34:03 +0100 Subject: [PATCH] [DMC] Implement Rasputin, the Oneiromancer (#9515) --- .../mage/cards/r/RasputinTheOneiromancer.java | 105 ++++++++++++++++++ .../mage/sets/DominariaUnitedCommander.java | 2 + .../permanent/token/RasputinKnightToken.java | 32 ++++++ 3 files changed, 139 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/r/RasputinTheOneiromancer.java create mode 100644 Mage/src/main/java/mage/game/permanent/token/RasputinKnightToken.java diff --git a/Mage.Sets/src/mage/cards/r/RasputinTheOneiromancer.java b/Mage.Sets/src/mage/cards/r/RasputinTheOneiromancer.java new file mode 100644 index 0000000000..47ed97ac1a --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/RasputinTheOneiromancer.java @@ -0,0 +1,105 @@ +package mage.cards.r; + +import mage.MageInt; +import mage.Mana; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.RemoveCountersSourceCost; +import mage.abilities.costs.common.RemoveVariableCountersSourceCost; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.dynamicvalue.common.CountersSourceCount; +import mage.abilities.dynamicvalue.common.OpponentsCount; +import mage.abilities.dynamicvalue.common.RemovedCountersForCostValue; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.mana.DynamicManaAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.permanent.token.GoblinToken; +import mage.game.permanent.token.RasputinKnightToken; +import mage.game.permanent.token.Token; + +import java.util.UUID; + +/** + * @author PurpleCrowbar + */ +public final class RasputinTheOneiromancer extends CardImpl { + + public RasputinTheOneiromancer(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}{U}"); + addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.WIZARD); + + this.power = new MageInt(4); + this.toughness = new MageInt(1); + + // When Rasputin, the Oneiromancer enters the battlefield, put a dream counter on it for each + // opponent you have. Each opponent creates a 1/1 red Goblin creature token. + Ability ability = new EntersBattlefieldTriggeredAbility(new AddCountersSourceEffect( + CounterType.DREAM.createInstance(), OpponentsCount.instance, false + ).setText("put a dream counter on it for each opponent you have.")); + ability.addEffect(new RasputinCreateGoblinsEffect()); + this.addAbility(ability); + + // {T}, Remove one or more dream counters from Rasputin: Add that much {C}. + Ability ability2 = new DynamicManaAbility( + Mana.ColorlessMana(1), + RemovedCountersForCostValue.instance, + new TapSourceCost(), + "Add that much {C}", + true, new CountersSourceCount(CounterType.DREAM)); + ability2.addCost(new RemoveVariableCountersSourceCost(CounterType.DREAM.createInstance(), 1, + "Remove one or more dream counters from {this}")); + this.addAbility(ability2); + + // {T}, Remove a dream counter from Rasputin: Create a 2/2 white Knight creature token with protection from red. + Ability ability3 = new SimpleActivatedAbility(new CreateTokenEffect(new RasputinKnightToken()), new TapSourceCost()); + ability3.addCost(new RemoveCountersSourceCost(CounterType.DREAM.createInstance(1))); + this.addAbility(ability3); + } + + private RasputinTheOneiromancer(final RasputinTheOneiromancer card) { + super(card); + } + + @Override + public RasputinTheOneiromancer copy() { + return new RasputinTheOneiromancer(this); + } +} + +class RasputinCreateGoblinsEffect extends OneShotEffect { + + public RasputinCreateGoblinsEffect() { + super(Outcome.Detriment); + this.staticText = "each opponent creates a 1/1 red Goblin creature token"; + } + + private RasputinCreateGoblinsEffect(final RasputinCreateGoblinsEffect effect) { + super(effect); + } + + @Override + public RasputinCreateGoblinsEffect copy() { + return new RasputinCreateGoblinsEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + for (UUID opponentId : game.getOpponents(source.getControllerId())) { + Token token = new GoblinToken(); + token.putOntoBattlefield(1, game, source, opponentId); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/DominariaUnitedCommander.java b/Mage.Sets/src/mage/sets/DominariaUnitedCommander.java index 909fc33aa1..aabf2ab96c 100644 --- a/Mage.Sets/src/mage/sets/DominariaUnitedCommander.java +++ b/Mage.Sets/src/mage/sets/DominariaUnitedCommander.java @@ -147,6 +147,8 @@ public final class DominariaUnitedCommander extends ExpansionSet { cards.add(new SetCardInfo("Prophetic Prism", 189, Rarity.COMMON, mage.cards.p.PropheticPrism.class)); cards.add(new SetCardInfo("Radiant Flames", 126, Rarity.RARE, mage.cards.r.RadiantFlames.class)); cards.add(new SetCardInfo("Rakdos Carnarium", 226, Rarity.UNCOMMON, mage.cards.r.RakdosCarnarium.class)); + cards.add(new SetCardInfo("Rasputin, the Oneiromancer", 40, Rarity.RARE, mage.cards.r.RasputinTheOneiromancer.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Rasputin, the Oneiromancer", 62, Rarity.RARE, mage.cards.r.RasputinTheOneiromancer.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Read the Bones", 117, Rarity.COMMON, mage.cards.r.ReadTheBones.class)); cards.add(new SetCardInfo("Reliquary Tower", 227, Rarity.UNCOMMON, mage.cards.r.ReliquaryTower.class)); cards.add(new SetCardInfo("Rienne, Angel of Rebirth", 166, Rarity.MYTHIC, mage.cards.r.RienneAngelOfRebirth.class)); diff --git a/Mage/src/main/java/mage/game/permanent/token/RasputinKnightToken.java b/Mage/src/main/java/mage/game/permanent/token/RasputinKnightToken.java new file mode 100644 index 0000000000..8802598aee --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/RasputinKnightToken.java @@ -0,0 +1,32 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.ObjectColor; +import mage.abilities.keyword.ProtectionAbility; +import mage.constants.CardType; +import mage.constants.SubType; + +/** + * @author PurpleCrowbar + */ +public final class RasputinKnightToken extends TokenImpl { + + public RasputinKnightToken() { + super("Knight Token", "2/2 white Knight creature token with protection from red"); + cardType.add(CardType.CREATURE); + color.setWhite(true); + subtype.add(SubType.KNIGHT); + power = new MageInt(2); + toughness = new MageInt(2); + this.addAbility(ProtectionAbility.from(ObjectColor.RED)); + setOriginalExpansionSetCode("DMC"); + } + + public RasputinKnightToken(final RasputinKnightToken token) { + super(token); + } + + public RasputinKnightToken copy() { + return new RasputinKnightToken(this); + } +}