From 9fe08dd4381ae13bf0fd4f1706564d0cdbd574d9 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 19 Apr 2018 15:27:13 -0400 Subject: [PATCH] updated Blightning and Rakdos's Return --- Mage.Sets/src/mage/cards/b/Blightning.java | 55 ++++++++++++++++--- Mage.Sets/src/mage/cards/r/RakdossReturn.java | 53 +++++++++++++++--- 2 files changed, 93 insertions(+), 15 deletions(-) diff --git a/Mage.Sets/src/mage/cards/b/Blightning.java b/Mage.Sets/src/mage/cards/b/Blightning.java index 7094630412..44579c451e 100644 --- a/Mage.Sets/src/mage/cards/b/Blightning.java +++ b/Mage.Sets/src/mage/cards/b/Blightning.java @@ -24,17 +24,24 @@ * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. -*/ - + */ package mage.cards.b; import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.discard.DiscardTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.target.TargetPlayer; +import mage.constants.Outcome; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetPlayerOrPlaneswalker; +import mage.target.targetpointer.FixedTarget; /** * @@ -43,14 +50,12 @@ import mage.target.TargetPlayer; public class Blightning extends CardImpl { public Blightning(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{1}{B}{R}"); - - + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{B}{R}"); // Blightning deals 3 damage to target player. That player discards two cards. - this.getSpellAbility().addTarget(new TargetPlayer()); + this.getSpellAbility().addTarget(new TargetPlayerOrPlaneswalker()); this.getSpellAbility().addEffect(new DamageTargetEffect(3)); - this.getSpellAbility().addEffect(new DiscardTargetEffect(2)); + this.getSpellAbility().addEffect(new BlightningEffect()); } public Blightning(final Blightning card) { @@ -62,3 +67,37 @@ public class Blightning extends CardImpl { return new Blightning(this); } } + +class BlightningEffect extends OneShotEffect { + + BlightningEffect() { + super(Outcome.Benefit); + this.staticText = "That player or that planeswalker’s controller discards two cards."; + } + + BlightningEffect(final BlightningEffect effect) { + super(effect); + } + + @Override + public BlightningEffect copy() { + return new BlightningEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getFirstTarget()); + if (player == null) { + Permanent permanent = game.getPermanent(source.getFirstTarget()); + if (permanent != null) { + player = game.getPlayer(permanent.getControllerId()); + } + } + if (player == null) { + return false; + } + Effect effect = new DiscardTargetEffect(2); + effect.setTargetPointer(new FixedTarget(player.getId(), game)); + return true; + } +} diff --git a/Mage.Sets/src/mage/cards/r/RakdossReturn.java b/Mage.Sets/src/mage/cards/r/RakdossReturn.java index 702e001a8b..ec2ac74be1 100644 --- a/Mage.Sets/src/mage/cards/r/RakdossReturn.java +++ b/Mage.Sets/src/mage/cards/r/RakdossReturn.java @@ -25,17 +25,24 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.cards.r; import java.util.UUID; +import mage.abilities.Ability; import mage.abilities.dynamicvalue.common.ManacostVariableValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.discard.DiscardTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.Outcome; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; import mage.target.common.TargetOpponent; +import mage.target.targetpointer.FixedTarget; /** * @@ -43,18 +50,16 @@ import mage.target.common.TargetOpponent; */ public class RakdossReturn extends CardImpl { - public RakdossReturn (UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{X}{B}{R}"); - - + public RakdossReturn(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{B}{R}"); // Rakdos's Return deals X damage to target opponent. That player discards X cards. this.getSpellAbility().addEffect(new DamageTargetEffect(new ManacostVariableValue())); - this.getSpellAbility().addEffect(new DiscardTargetEffect(new ManacostVariableValue())); + this.getSpellAbility().addEffect(new RakdossReturnEffect()); this.getSpellAbility().addTarget(new TargetOpponent()); } - public RakdossReturn (final RakdossReturn card) { + public RakdossReturn(final RakdossReturn card) { super(card); } @@ -63,3 +68,37 @@ public class RakdossReturn extends CardImpl { return new RakdossReturn(this); } } + +class RakdossReturnEffect extends OneShotEffect { + + RakdossReturnEffect() { + super(Outcome.Benefit); + this.staticText = "That player or that planeswalker’s controller discards X cards."; + } + + RakdossReturnEffect(final RakdossReturnEffect effect) { + super(effect); + } + + @Override + public RakdossReturnEffect copy() { + return new RakdossReturnEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getFirstTarget()); + if (player == null) { + Permanent permanent = game.getPermanent(source.getFirstTarget()); + if (permanent != null) { + player = game.getPlayer(permanent.getControllerId()); + } + } + if (player == null) { + return false; + } + Effect effect = new DiscardTargetEffect(new ManacostVariableValue()); + effect.setTargetPointer(new FixedTarget(player.getId(), game)); + return true; + } +}