From c5a277fb4cfef26f71765e210f3214303514081f Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 11 Jan 2019 23:46:26 -0500 Subject: [PATCH] Implemented Rumbling Ruin --- Mage.Sets/src/mage/cards/r/RumblingRuin.java | 76 +++++++++++++++++++ .../src/mage/sets/RavnicaAllegiance.java | 1 + 2 files changed, 77 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/r/RumblingRuin.java diff --git a/Mage.Sets/src/mage/cards/r/RumblingRuin.java b/Mage.Sets/src/mage/cards/r/RumblingRuin.java new file mode 100644 index 0000000000..901e2c92fc --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/RumblingRuin.java @@ -0,0 +1,76 @@ +package mage.cards.r; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.combat.CantBlockAllEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.counters.CounterType; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.common.FilterOpponentsCreaturePermanent; +import mage.filter.predicate.mageobject.PowerPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class RumblingRuin extends CardImpl { + + public RumblingRuin(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{R}"); + + this.subtype.add(SubType.ELEMENTAL); + this.power = new MageInt(6); + this.toughness = new MageInt(6); + + // When Rumbling Ruin enters the battlefield, count the number of +1/+1 counters on creatures you control. Creatures your opponents control with power less than or equal to that number can't block this turn. + this.addAbility(new EntersBattlefieldTriggeredAbility(new RumblingRuinEffect())); + } + + private RumblingRuin(final RumblingRuin card) { + super(card); + } + + @Override + public RumblingRuin copy() { + return new RumblingRuin(this); + } +} + +class RumblingRuinEffect extends OneShotEffect { + + RumblingRuinEffect() { + super(Outcome.Benefit); + staticText = ""; + } + + private RumblingRuinEffect(final RumblingRuinEffect effect) { + super(effect); + } + + @Override + public RumblingRuinEffect copy() { + return new RumblingRuinEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + int counter = 1; + for (Permanent permanent : game.getBattlefield().getAllActivePermanents(source.getControllerId())) { + if (permanent == null || !permanent.isCreature()) { + continue; + } + counter += permanent.getCounters(game).getCount(CounterType.P1P1); + } + FilterCreaturePermanent filter = new FilterOpponentsCreaturePermanent(); + filter.add(new PowerPredicate(ComparisonType.FEWER_THAN, counter)); + game.addEffect(new CantBlockAllEffect(filter, Duration.EndOfTurn), 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 651ce18c59..05a83f59c0 100644 --- a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java +++ b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java @@ -220,6 +220,7 @@ public final class RavnicaAllegiance extends ExpansionSet { cards.add(new SetCardInfo("Rubble Slinger", 217, Rarity.COMMON, mage.cards.r.RubbleSlinger.class)); cards.add(new SetCardInfo("Rubblebelt Recluse", 111, Rarity.COMMON, mage.cards.r.RubblebeltRecluse.class)); cards.add(new SetCardInfo("Rubblebelt Runner", 202, Rarity.COMMON, mage.cards.r.RubblebeltRunner.class)); + cards.add(new SetCardInfo("Rumbling Ruin", 112, Rarity.UNCOMMON, mage.cards.r.RumblingRuin.class)); cards.add(new SetCardInfo("Sage's Row Savant", 49, Rarity.COMMON, mage.cards.s.SagesRowSavant.class)); cards.add(new SetCardInfo("Sagittars' Volley", 138, Rarity.COMMON, mage.cards.s.SagittarsVolley.class)); cards.add(new SetCardInfo("Saruli Caretaker", 139, Rarity.COMMON, mage.cards.s.SaruliCaretaker.class));