From eff0bb0e636156425c0685d96f312e8a21ed9555 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sun, 27 Jan 2019 09:14:36 -0500 Subject: [PATCH] Implemented Catacomb Dragon --- .../src/mage/cards/c/CatacombDragon.java | 86 +++++++++++++++++++ Mage.Sets/src/mage/sets/Mirage.java | 1 + 2 files changed, 87 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/c/CatacombDragon.java diff --git a/Mage.Sets/src/mage/cards/c/CatacombDragon.java b/Mage.Sets/src/mage/cards/c/CatacombDragon.java new file mode 100644 index 0000000000..c76e5deda0 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CatacombDragon.java @@ -0,0 +1,86 @@ +package mage.cards.c; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BecomesBlockedByCreatureTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class CatacombDragon extends CardImpl { + + private static final FilterCreaturePermanent filter + = new FilterCreaturePermanent("a nonartifact, non-Dragon creature"); + + static { + filter.add(Predicates.not(new CardTypePredicate(CardType.ARTIFACT))); + filter.add(Predicates.not(new SubtypePredicate(SubType.DRAGON))); + } + + public CatacombDragon(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}{B}"); + + this.subtype.add(SubType.DRAGON); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Whenever Catacomb Dragon becomes blocked by a nonartifact, non-Dragon creature, that creature gets -X/-0 until end of turn, where X is half the creature's power, rounded down. + this.addAbility(new BecomesBlockedByCreatureTriggeredAbility(new CatacombDragonEffect(), filter, false)); + } + + private CatacombDragon(final CatacombDragon card) { + super(card); + } + + @Override + public CatacombDragon copy() { + return new CatacombDragon(this); + } +} + +class CatacombDragonEffect extends OneShotEffect { + + CatacombDragonEffect() { + super(Outcome.Benefit); + staticText = "that creature gets -X/-0 until end of turn, where X is half the creature's power, rounded down."; + } + + private CatacombDragonEffect(final CatacombDragonEffect effect) { + super(effect); + } + + @Override + public CatacombDragonEffect copy() { + return new CatacombDragonEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); + if (permanent == null || !permanent.isCreature()) { + return false; + } + int unBoost = -1 * Math.floorDiv(permanent.getPower().getValue(), 2); + game.addEffect(new BoostTargetEffect(unBoost, 0), source); + return true; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/Mirage.java b/Mage.Sets/src/mage/sets/Mirage.java index 4a45154f42..e5c8a2afe0 100644 --- a/Mage.Sets/src/mage/sets/Mirage.java +++ b/Mage.Sets/src/mage/sets/Mirage.java @@ -61,6 +61,7 @@ public final class Mirage extends ExpansionSet { cards.add(new SetCardInfo("Cadaverous Knight", 110, Rarity.COMMON, mage.cards.c.CadaverousKnight.class)); cards.add(new SetCardInfo("Canopy Dragon", 209, Rarity.RARE, mage.cards.c.CanopyDragon.class)); cards.add(new SetCardInfo("Carrion", 111, Rarity.RARE, mage.cards.c.Carrion.class)); + cards.add(new SetCardInfo("Catacomb Dragon", 112, Rarity.RARE, mage.cards.c.CatacombDragon.class)); cards.add(new SetCardInfo("Celestial Dawn", 6, Rarity.RARE, mage.cards.c.CelestialDawn.class)); cards.add(new SetCardInfo("Cerulean Wyvern", 57, Rarity.UNCOMMON, mage.cards.c.CeruleanWyvern.class)); cards.add(new SetCardInfo("Chaos Charm", 163, Rarity.COMMON, mage.cards.c.ChaosCharm.class));