From cf2b6c3dae481cc609c543cc7091c2737579df15 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 12 Jan 2019 10:49:16 -0500 Subject: [PATCH] Implemented Plague Wight --- Mage.Sets/src/mage/cards/p/PlagueWight.java | 74 +++++++++++++++++++ .../src/mage/sets/RavnicaAllegiance.java | 1 + 2 files changed, 75 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/p/PlagueWight.java diff --git a/Mage.Sets/src/mage/cards/p/PlagueWight.java b/Mage.Sets/src/mage/cards/p/PlagueWight.java new file mode 100644 index 0000000000..6a1911a49f --- /dev/null +++ b/Mage.Sets/src/mage/cards/p/PlagueWight.java @@ -0,0 +1,74 @@ +package mage.cards.p; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BecomesBlockedTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.BoostAllEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.BlockedByIdPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class PlagueWight extends CardImpl { + + public PlagueWight(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}"); + + this.subtype.add(SubType.ZOMBIE); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // Whenever Plague Wight becomes blocked, each creature blocking it gets -1/-1 until end of turn. + this.addAbility(new BecomesBlockedTriggeredAbility(new PlagueWightEffect(), false)); + } + + private PlagueWight(final PlagueWight card) { + super(card); + } + + @Override + public PlagueWight copy() { + return new PlagueWight(this); + } +} + +class PlagueWightEffect extends OneShotEffect { + + PlagueWightEffect() { + super(Outcome.Benefit); + staticText = "each creature blocking it gets -1/-1 until end of turn."; + } + + private PlagueWightEffect(final PlagueWightEffect effect) { + super(effect); + } + + @Override + public PlagueWightEffect copy() { + return new PlagueWightEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(source.getSourceId()); + if (permanent == null) { + return false; + } + FilterCreaturePermanent filter = new FilterCreaturePermanent(); + filter.add(new BlockedByIdPredicate(source.getSourceId())); + game.addEffect(new BoostAllEffect(-1, -1, Duration.EndOfTurn, filter, false), source); + return true; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java index 14d1cc84e2..8121ea03f4 100644 --- a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java +++ b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java @@ -189,6 +189,7 @@ public final class RavnicaAllegiance extends ExpansionSet { cards.add(new SetCardInfo("Persistent Petitioners", 44, Rarity.COMMON, mage.cards.p.PersistentPetitioners.class)); cards.add(new SetCardInfo("Pestilent Spirit", 81, Rarity.RARE, mage.cards.p.PestilentSpirit.class)); cards.add(new SetCardInfo("Pitiless Pontiff", 194, Rarity.UNCOMMON, mage.cards.p.PitilessPontiff.class)); + cards.add(new SetCardInfo("Plague Wight", 82, Rarity.COMMON, mage.cards.p.PlagueWight.class)); cards.add(new SetCardInfo("Plains", 260, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Plaza of Harmony", 254, Rarity.RARE, mage.cards.p.PlazaOfHarmony.class)); cards.add(new SetCardInfo("Precognitive Perception", 45, Rarity.RARE, mage.cards.p.PrecognitivePerception.class));