From f5e5df6d6ea867931812fa2ed4354482765991ed Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 20 Dec 2019 19:57:59 -0500 Subject: [PATCH] Implemented Ironscale Hydra --- .../src/mage/cards/i/IronscaleHydra.java | 81 +++++++++++++++++++ .../src/mage/sets/TherosBeyondDeath.java | 1 + 2 files changed, 82 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/i/IronscaleHydra.java diff --git a/Mage.Sets/src/mage/cards/i/IronscaleHydra.java b/Mage.Sets/src/mage/cards/i/IronscaleHydra.java new file mode 100644 index 00000000000..b9c8cfd6fba --- /dev/null +++ b/Mage.Sets/src/mage/cards/i/IronscaleHydra.java @@ -0,0 +1,81 @@ +package mage.cards.i; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.PreventionEffectImpl; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class IronscaleHydra extends CardImpl { + + public IronscaleHydra(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}{G}"); + + this.subtype.add(SubType.HYDRA); + this.power = new MageInt(5); + this.toughness = new MageInt(5); + + // If a creature would deal combat damage to Ironscale Hydra, prevent that damage and put a +1/+1 counter on Ironscale Hydra. + this.addAbility(new SimpleStaticAbility(new IronscaleHydraEffect())); + } + + private IronscaleHydra(final IronscaleHydra card) { + super(card); + } + + @Override + public IronscaleHydra copy() { + return new IronscaleHydra(this); + } +} + +class IronscaleHydraEffect extends PreventionEffectImpl { + + private static final Effect effect = new AddCountersSourceEffect(CounterType.P1P1.createInstance()); + + IronscaleHydraEffect() { + super(Duration.WhileOnBattlefield, Integer.MAX_VALUE, true, false); + staticText = "If a creature would deal combat damage to {this}, " + + "prevent that damage and put a +1/+1 counter on {this}."; + } + + private IronscaleHydraEffect(final IronscaleHydraEffect effect) { + super(effect); + } + + @Override + public IronscaleHydraEffect copy() { + return new IronscaleHydraEffect(this); + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + if (!super.applies(event, source, game) + || !event.getTargetId().equals(source.getSourceId())) { + return false; + } + Permanent damageSource = game.getPermanent(event.getSourceId()); + return damageSource != null && damageSource.isCreature(); + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + effect.apply(game, source); + return super.replaceEvent(event, source, game); + } +} diff --git a/Mage.Sets/src/mage/sets/TherosBeyondDeath.java b/Mage.Sets/src/mage/sets/TherosBeyondDeath.java index dcfb5edc379..4edf7b3e07e 100644 --- a/Mage.Sets/src/mage/sets/TherosBeyondDeath.java +++ b/Mage.Sets/src/mage/sets/TherosBeyondDeath.java @@ -39,6 +39,7 @@ public final class TherosBeyondDeath extends ExpansionSet { cards.add(new SetCardInfo("Hero of the Winds", 23, Rarity.UNCOMMON, mage.cards.h.HeroOfTheWinds.class)); cards.add(new SetCardInfo("Indomitable Will", 25, Rarity.COMMON, mage.cards.i.IndomitableWill.class)); cards.add(new SetCardInfo("Inevitable End", 102, Rarity.UNCOMMON, mage.cards.i.InevitableEnd.class)); + cards.add(new SetCardInfo("Ironscale Hydra", 296, Rarity.RARE, mage.cards.i.IronscaleHydra.class)); cards.add(new SetCardInfo("Island", 251, Rarity.LAND, mage.cards.basiclands.Island.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Klothys's Design", 176, Rarity.UNCOMMON, mage.cards.k.KlothyssDesign.class)); cards.add(new SetCardInfo("Leonin of the Lost Pride", 28, Rarity.COMMON, mage.cards.l.LeoninOfTheLostPride.class));