From a4e9b21b82b9f8de9da93b864b7ed95cdc1868ee Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sun, 5 Apr 2020 09:22:01 -0400 Subject: [PATCH] Implemented Drannith Stinger --- .../src/mage/cards/d/DrannithStinger.java | 46 ++++++++++++++++ .../src/mage/sets/IkoriaLairOfBehemoths.java | 1 + .../CycleControllerTriggeredAbility.java | 55 +++++++++++++++++++ 3 files changed, 102 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/d/DrannithStinger.java create mode 100644 Mage/src/main/java/mage/abilities/common/CycleControllerTriggeredAbility.java diff --git a/Mage.Sets/src/mage/cards/d/DrannithStinger.java b/Mage.Sets/src/mage/cards/d/DrannithStinger.java new file mode 100644 index 0000000000..7c029631a5 --- /dev/null +++ b/Mage.Sets/src/mage/cards/d/DrannithStinger.java @@ -0,0 +1,46 @@ +package mage.cards.d; + +import mage.MageInt; +import mage.abilities.common.CycleControllerTriggeredAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.DamagePlayersEffect; +import mage.abilities.keyword.CyclingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.TargetController; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class DrannithStinger extends CardImpl { + + public DrannithStinger(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.WIZARD); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Whenever you cycle another card, Drannith Stinger deals 1 damage to each opponent. + this.addAbility(new CycleControllerTriggeredAbility( + new DamagePlayersEffect(1, TargetController.OPPONENT) + )); + + // Cycling {1} + this.addAbility(new CyclingAbility(new ManaCostsImpl("{1}"))); + } + + private DrannithStinger(final DrannithStinger card) { + super(card); + } + + @Override + public DrannithStinger copy() { + return new DrannithStinger(this); + } +} diff --git a/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java b/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java index bf7f68ca29..e03b840ee3 100644 --- a/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java +++ b/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java @@ -37,6 +37,7 @@ public final class IkoriaLairOfBehemoths extends ExpansionSet { cards.add(new SetCardInfo("Colossification", 148, Rarity.RARE, mage.cards.c.Colossification.class)); cards.add(new SetCardInfo("Dire Tactics", 183, Rarity.UNCOMMON, mage.cards.d.DireTactics.class)); cards.add(new SetCardInfo("Dirge Bat", 84, Rarity.RARE, mage.cards.d.DirgeBat.class)); + cards.add(new SetCardInfo("Drannith Stinger", 113, Rarity.COMMON, mage.cards.d.DrannithStinger.class)); cards.add(new SetCardInfo("Dreamtail Heron", 47, Rarity.COMMON, mage.cards.d.DreamtailHeron.class)); cards.add(new SetCardInfo("Essence Scatter", 49, Rarity.COMMON, mage.cards.e.EssenceScatter.class)); cards.add(new SetCardInfo("Fertilid", 152, Rarity.COMMON, mage.cards.f.Fertilid.class)); diff --git a/Mage/src/main/java/mage/abilities/common/CycleControllerTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/CycleControllerTriggeredAbility.java new file mode 100644 index 0000000000..2f1bd592a0 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/common/CycleControllerTriggeredAbility.java @@ -0,0 +1,55 @@ +package mage.abilities.common; + +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.Effect; +import mage.abilities.keyword.CyclingAbility; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.stack.StackAbility; +import mage.game.stack.StackObject; + +/** + * @author TheElk801 + */ +public class CycleControllerTriggeredAbility extends TriggeredAbilityImpl { + + public CycleControllerTriggeredAbility(Effect effect) { + this(effect, false); + } + + public CycleControllerTriggeredAbility(Effect effect, boolean optional) { + super(Zone.BATTLEFIELD, effect, optional); + } + + private CycleControllerTriggeredAbility(final CycleControllerTriggeredAbility ability) { + super(ability); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ACTIVATED_ABILITY; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (game.getState().getStack().isEmpty() + || !event.getPlayerId().equals(this.getControllerId()) + || event.getSourceId().equals(this.getSourceId())) { + return false; + } + StackObject item = game.getState().getStack().getFirst(); + return item instanceof StackAbility + && item.getStackAbility() instanceof CyclingAbility; + } + + @Override + public String getRule() { + return "Whenever you cycle another card, " + super.getRule(); + } + + @Override + public CycleControllerTriggeredAbility copy() { + return new CycleControllerTriggeredAbility(this); + } +}