From b0b3952a8ae9aa728c3e10c4653100bbf1dee853 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Wed, 8 Apr 2020 20:32:40 -0400 Subject: [PATCH] Implemented Super-Duper Death Ray --- .../src/mage/cards/s/SuperDuperDeathRay.java | 83 +++++++++++++++++++ Mage.Sets/src/mage/sets/Unstable.java | 1 + 2 files changed, 84 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/s/SuperDuperDeathRay.java diff --git a/Mage.Sets/src/mage/cards/s/SuperDuperDeathRay.java b/Mage.Sets/src/mage/cards/s/SuperDuperDeathRay.java new file mode 100644 index 0000000000..4a5f436e22 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SuperDuperDeathRay.java @@ -0,0 +1,83 @@ +package mage.cards.s; + +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.InfoEffect; +import mage.abilities.keyword.DeathtouchAbility; +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.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class SuperDuperDeathRay extends CardImpl { + + public SuperDuperDeathRay(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{R}"); + + // Trample + this.addAbility(new SimpleStaticAbility(new InfoEffect( + "Trample (This spell can deal excess damage to its target’s controller.)" + ))); + + // Super-Duper Death Ray deals 4 damage to target creature. + this.getSpellAbility().addEffect(new SuperDuperDeathRayEffect()); + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + } + + private SuperDuperDeathRay(final SuperDuperDeathRay card) { + super(card); + } + + @Override + public SuperDuperDeathRay copy() { + return new SuperDuperDeathRay(this); + } +} + +class SuperDuperDeathRayEffect extends OneShotEffect { + + SuperDuperDeathRayEffect() { + super(Outcome.Benefit); + staticText = "{this} deals 4 damage to target creature."; + } + + private SuperDuperDeathRayEffect(final SuperDuperDeathRayEffect effect) { + super(effect); + } + + @Override + public SuperDuperDeathRayEffect copy() { + return new SuperDuperDeathRayEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(source.getFirstTarget()); + MageObject sourceObject = source.getSourceObject(game); + if (permanent == null || sourceObject == null) { + return false; + } + int lethal = Math.max(permanent.getToughness().getValue() - permanent.getDamage(), 0); + if (sourceObject.getAbilities().containsKey(DeathtouchAbility.getInstance().getId())) { + lethal = Math.min(lethal, 1); + } + lethal = Math.min(lethal, 4); + permanent.damage(lethal, source.getSourceId(), game); + Player player = game.getPlayer(permanent.getControllerId()); + if (player != null && lethal < 4) { + player.damage(4 - lethal, source.getSourceId(), game); + } + return true; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/Unstable.java b/Mage.Sets/src/mage/sets/Unstable.java index 5b874239b1..4417dcb857 100644 --- a/Mage.Sets/src/mage/sets/Unstable.java +++ b/Mage.Sets/src/mage/sets/Unstable.java @@ -72,6 +72,7 @@ public final class Unstable extends ExpansionSet { cards.add(new SetCardInfo("Steamflogger Boss", 93, Rarity.RARE, mage.cards.s.SteamfloggerBoss.class)); cards.add(new SetCardInfo("Steel Squirrel", 162, Rarity.UNCOMMON, mage.cards.s.SteelSquirrel.class)); cards.add(new SetCardInfo("Summon the Pack", 74, Rarity.MYTHIC, mage.cards.s.SummonThePack.class)); + cards.add(new SetCardInfo("Super-Duper Death Ray", 97, Rarity.UNCOMMON, mage.cards.s.SuperDuperDeathRay.class)); cards.add(new SetCardInfo("Swamp", 214, Rarity.LAND, mage.cards.basiclands.Swamp.class, new CardGraphicInfo(FrameStyle.UST_FULL_ART_BASIC, false))); cards.add(new SetCardInfo("Sword of Dungeons & Dragons", 163, Rarity.MYTHIC, mage.cards.s.SwordOfDungeonsAndDragons.class)); cards.add(new SetCardInfo("Target Minotaur", "98a", Rarity.COMMON, mage.cards.t.TargetMinotaur.class, NON_FULL_USE_VARIOUS));