From c2d21c6fc61dffc71c80f8588bc47c49a7be82f6 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 29 Oct 2020 08:49:11 -0400 Subject: [PATCH] [CMR] Implemented Profane Transfusion --- .../src/mage/cards/p/ProfaneTransfusion.java | 94 +++++++++++++++++++ Mage.Sets/src/mage/sets/CommanderLegends.java | 1 + 2 files changed, 95 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/p/ProfaneTransfusion.java diff --git a/Mage.Sets/src/mage/cards/p/ProfaneTransfusion.java b/Mage.Sets/src/mage/cards/p/ProfaneTransfusion.java new file mode 100644 index 00000000000..d90d3e5ec8c --- /dev/null +++ b/Mage.Sets/src/mage/cards/p/ProfaneTransfusion.java @@ -0,0 +1,94 @@ +package mage.cards.p; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.game.Game; +import mage.game.permanent.token.PhyrexianRebirthHorrorToken; +import mage.game.permanent.token.Token; +import mage.players.Player; +import mage.target.TargetPlayer; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ProfaneTransfusion extends CardImpl { + + public ProfaneTransfusion(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{6}{B}{B}{B}"); + + // Two target players exchange life totals. You create an X/X colorless Horror artifact creature token, where X is the difference between those players' life totals. + this.getSpellAbility().addEffect(new ProfaneTransfusionEffect()); + this.getSpellAbility().addTarget(new TargetPlayer(2)); + } + + private ProfaneTransfusion(final ProfaneTransfusion card) { + super(card); + } + + @Override + public ProfaneTransfusion copy() { + return new ProfaneTransfusion(this); + } +} + +class ProfaneTransfusionEffect extends OneShotEffect { + + ProfaneTransfusionEffect() { + super(Outcome.Benefit); + staticText = "two target players exchange life totals. " + + "You create an X/X colorless Horror artifact creature token, " + + "where X is the difference between those players' life totals"; + } + + private ProfaneTransfusionEffect(final ProfaneTransfusionEffect effect) { + super(effect); + } + + @Override + public ProfaneTransfusionEffect copy() { + return new ProfaneTransfusionEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + if (source.getTargets().get(0).getTargets().size() < 2) { + return false; + } + Player player1 = game.getPlayer(source.getTargets().get(0).getTargets().get(0)); + Player player2 = game.getPlayer(source.getTargets().get(0).getTargets().get(1)); + if (player1 == null || player2 == null) { + return false; + } + int lifePlayer1 = player1.getLife(); + int lifePlayer2 = player2.getLife(); + int lifeDifference = Math.abs(lifePlayer1 - lifePlayer2); + + Token token = new PhyrexianRebirthHorrorToken(); + token.setPower(lifeDifference); + token.setToughness(lifeDifference); + + if (lifeDifference == 0 + || !player1.isLifeTotalCanChange() + || !player2.isLifeTotalCanChange()) { + return token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + } + + if (lifePlayer1 < lifePlayer2 && (!player1.isCanGainLife() || !player2.isCanLoseLife())) { + return token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + } + + if (lifePlayer1 > lifePlayer2 && (!player1.isCanLoseLife() || !player2.isCanGainLife())) { + return token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + } + + player1.setLife(lifePlayer2, game, source); + player2.setLife(lifePlayer1, game, source); + return token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + } +} diff --git a/Mage.Sets/src/mage/sets/CommanderLegends.java b/Mage.Sets/src/mage/sets/CommanderLegends.java index 48b80f23a61..73c8fc57d5b 100644 --- a/Mage.Sets/src/mage/sets/CommanderLegends.java +++ b/Mage.Sets/src/mage/sets/CommanderLegends.java @@ -72,6 +72,7 @@ public final class CommanderLegends extends ExpansionSet { cards.add(new SetCardInfo("Nekusar, the Mindrazer", 529, Rarity.MYTHIC, mage.cards.n.NekusarTheMindrazer.class)); cards.add(new SetCardInfo("Phyrexian Rager", 142, Rarity.COMMON, mage.cards.p.PhyrexianRager.class)); cards.add(new SetCardInfo("Phyrexian Triniform", 331, Rarity.MYTHIC, mage.cards.p.PhyrexianTriniform.class)); + cards.add(new SetCardInfo("Profane Transfusion", 145, Rarity.MYTHIC, mage.cards.p.ProfaneTransfusion.class)); cards.add(new SetCardInfo("Prophetic Prism", 334, Rarity.COMMON, mage.cards.p.PropheticPrism.class)); cards.add(new SetCardInfo("Prossh, Skyraider of Kher", 530, Rarity.MYTHIC, mage.cards.p.ProsshSkyraiderOfKher.class)); cards.add(new SetCardInfo("Prying Eyes", 86, Rarity.COMMON, mage.cards.p.PryingEyes.class));