diff --git a/Mage.Sets/src/mage/cards/r/RavenousRotbelly.java b/Mage.Sets/src/mage/cards/r/RavenousRotbelly.java new file mode 100644 index 0000000000..0c90d344ad --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/RavenousRotbelly.java @@ -0,0 +1,95 @@ +package mage.cards.r; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.delayed.ReflexiveTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.SacrificeOpponentsEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.filter.FilterPermanent; +import mage.filter.StaticFilters; +import mage.filter.common.FilterControlledPermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetPermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class RavenousRotbelly extends CardImpl { + + public RavenousRotbelly(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}"); + + this.subtype.add(SubType.ZOMBIE); + this.subtype.add(SubType.HORROR); + this.power = new MageInt(4); + this.toughness = new MageInt(5); + + // When Ravenous Rotbelly enters the battlefield, you may sacrifice up to three Zombies. When you sacrifice one or more Zombies this way, each opponent sacrifices that many creatures. + this.addAbility(new EntersBattlefieldTriggeredAbility(new RavenousRotbellyEffect())); + } + + private RavenousRotbelly(final RavenousRotbelly card) { + super(card); + } + + @Override + public RavenousRotbelly copy() { + return new RavenousRotbelly(this); + } +} + +class RavenousRotbellyEffect extends OneShotEffect { + + private static final FilterPermanent filter + = new FilterControlledPermanent(SubType.ZOMBIE, "Zombies you control"); + + RavenousRotbellyEffect() { + super(Outcome.Benefit); + staticText = "you may sacrifice up to three Zombies. When you sacrifice " + + "one or more Zombies this way, each opponent sacrifices that many creatures"; + } + + private RavenousRotbellyEffect(final RavenousRotbellyEffect effect) { + super(effect); + } + + @Override + public RavenousRotbellyEffect copy() { + return new RavenousRotbellyEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + TargetPermanent target = new TargetPermanent(0, 3, filter, true); + player.choose(outcome, target, source.getSourceId(), game); + int amount = 0; + for (UUID permanentId : target.getTargets()) { + Permanent permanent = game.getPermanent(permanentId); + if (permanent != null && permanent.sacrifice(source, game)) { + amount++; + } + } + if (amount < 1) { + return false; + } + game.fireReflexiveTriggeredAbility(new ReflexiveTriggeredAbility( + new SacrificeOpponentsEffect(amount, StaticFilters.FILTER_PERMANENT_CREATURES), + false, "each opponent sacrifices that many creatures" + ), source); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/MidnightHuntCommander.java b/Mage.Sets/src/mage/sets/MidnightHuntCommander.java index 322f2910b5..eaeecae3ae 100644 --- a/Mage.Sets/src/mage/sets/MidnightHuntCommander.java +++ b/Mage.Sets/src/mage/sets/MidnightHuntCommander.java @@ -22,6 +22,7 @@ public final class MidnightHuntCommander extends ExpansionSet { cards.add(new SetCardInfo("Avacyn's Memorial", 31, Rarity.MYTHIC, mage.cards.a.AvacynsMemorial.class)); cards.add(new SetCardInfo("Kyler, Sigardian Emissary", 4, Rarity.MYTHIC, mage.cards.k.KylerSigardianEmissary.class)); cards.add(new SetCardInfo("Leinore, Autumn Sovereign", 1, Rarity.MYTHIC, mage.cards.l.LeinoreAutumnSovereign.class)); + cards.add(new SetCardInfo("Ravenous Rotbelly", 22, Rarity.RARE, mage.cards.r.RavenousRotbelly.class)); cards.add(new SetCardInfo("Wilhelt, the Rotcleaver", 2, Rarity.MYTHIC, mage.cards.w.WilheltTheRotcleaver.class)); cards.add(new SetCardInfo("Zombie Apocalypse", 131, Rarity.RARE, mage.cards.z.ZombieApocalypse.class)); }