From 06aba8beffae593f14d93e54c0bbf83592a36466 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Wed, 14 Apr 2021 08:33:34 -0400 Subject: [PATCH] [C21] Implemented Inkshield --- Mage.Sets/src/mage/cards/i/Inkshield.java | 74 +++++++++++++++++++ .../src/mage/sets/Commander2021Edition.java | 1 + 2 files changed, 75 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/i/Inkshield.java diff --git a/Mage.Sets/src/mage/cards/i/Inkshield.java b/Mage.Sets/src/mage/cards/i/Inkshield.java new file mode 100644 index 00000000000..c7285343082 --- /dev/null +++ b/Mage.Sets/src/mage/cards/i/Inkshield.java @@ -0,0 +1,74 @@ +package mage.cards.i; + +import mage.abilities.Ability; +import mage.abilities.effects.PreventionEffectData; +import mage.abilities.effects.PreventionEffectImpl; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.token.SilverquillToken; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class Inkshield extends CardImpl { + + public Inkshield(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{W}{B}"); + + // Prevent all combat damage that would be dealt to you this turn. For each 1 damage prevented this way, create a 2/1 white and black Inkling creature token with flying. + this.getSpellAbility().addEffect(new InkshieldEffect()); + } + + private Inkshield(final Inkshield card) { + super(card); + } + + @Override + public Inkshield copy() { + return new Inkshield(this); + } +} + +class InkshieldEffect extends PreventionEffectImpl { + + InkshieldEffect() { + super(Duration.EndOfTurn, Integer.MAX_VALUE, true, false); + staticText = "prevent all combat damage that would be dealt to you this turn. " + + "For each 1 damage prevented this way, create a 2/1 white and black Inkling creature token with flying"; + } + + private InkshieldEffect(final InkshieldEffect effect) { + super(effect); + } + + @Override + public InkshieldEffect copy() { + return new InkshieldEffect(this); + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.DAMAGE_PLAYER; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + return super.applies(event, source, game) && source.isControlledBy(event.getTargetId()); + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + PreventionEffectData preventionEffectData = preventDamageAction(event, source, game); + if (preventionEffectData.getPreventedDamage() > 0) { + new CreateTokenEffect(new SilverquillToken(), preventionEffectData.getPreventedDamage()).apply(game, source); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/Commander2021Edition.java b/Mage.Sets/src/mage/sets/Commander2021Edition.java index 2601d64d3b3..39dcd22697a 100644 --- a/Mage.Sets/src/mage/sets/Commander2021Edition.java +++ b/Mage.Sets/src/mage/sets/Commander2021Edition.java @@ -149,6 +149,7 @@ public final class Commander2021Edition extends ExpansionSet { cards.add(new SetCardInfo("Incubation Druid", 195, Rarity.RARE, mage.cards.i.IncubationDruid.class)); cards.add(new SetCardInfo("Infernal Offering", 146, Rarity.RARE, mage.cards.i.InfernalOffering.class)); cards.add(new SetCardInfo("Inferno Project", 52, Rarity.RARE, mage.cards.i.InfernoProject.class)); + cards.add(new SetCardInfo("Inkshield", 71, Rarity.RARE, mage.cards.i.Inkshield.class)); cards.add(new SetCardInfo("Inspiring Refrain", 27, Rarity.RARE, mage.cards.i.InspiringRefrain.class)); cards.add(new SetCardInfo("Izzet Boilerworks", 294, Rarity.UNCOMMON, mage.cards.i.IzzetBoilerworks.class)); cards.add(new SetCardInfo("Izzet Signet", 247, Rarity.COMMON, mage.cards.i.IzzetSignet.class));