diff --git a/Mage.Sets/src/mage/cards/i/InsatiableFrugivore.java b/Mage.Sets/src/mage/cards/i/InsatiableFrugivore.java new file mode 100644 index 00000000000..52022f82fd6 --- /dev/null +++ b/Mage.Sets/src/mage/cards/i/InsatiableFrugivore.java @@ -0,0 +1,106 @@ +package mage.cards.i; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.Cost; +import mage.abilities.costs.common.ExileFromGraveCost; +import mage.abilities.costs.common.SacrificeXTargetCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.dynamicvalue.common.GetXValue; +import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.BoostControlledEffect; +import mage.abilities.effects.common.continuous.GainAbilityControlledEffect; +import mage.abilities.keyword.MenaceAbility; +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.StaticFilters; +import mage.filter.common.FilterControlledPermanent; +import mage.game.Game; +import mage.game.permanent.token.FoodToken; +import mage.players.Player; +import mage.target.common.TargetCardInYourGraveyard; + +import java.util.UUID; + +/** + * @author xenohedron + */ +public final class InsatiableFrugivore extends CardImpl { + + private static final FilterControlledPermanent filter = new FilterControlledPermanent(SubType.FOOD, "Foods"); + + public InsatiableFrugivore(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}"); + + this.subtype.add(SubType.RAT); + this.subtype.add(SubType.BERSERKER); + this.power = new MageInt(2); + this.toughness = new MageInt(4); + + // When Insatiable Frugivore enters, create a Food token, then you may exile three cards from your graveyard. If you do, repeat this process. + this.addAbility(new EntersBattlefieldTriggeredAbility(new InsatiableFrugivoreEffect())); + + // {3}{B}, Sacrifice X Foods: Creatures you control get +X/+0 and gain menace until end of turn. + Ability ability = new SimpleActivatedAbility( + new BoostControlledEffect(GetXValue.instance, StaticValue.get(0), Duration.EndOfTurn) + .setText("creatures you control get +X/+0"), + new ManaCostsImpl<>("{3}{B}") + ); + ability.addCost(new SacrificeXTargetCost(filter)); + ability.addEffect(new GainAbilityControlledEffect( + new MenaceAbility(false), Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURE + ).setText("and gain menace until end of turn")); + this.addAbility(ability); + + } + + private InsatiableFrugivore(final InsatiableFrugivore card) { + super(card); + } + + @Override + public InsatiableFrugivore copy() { + return new InsatiableFrugivore(this); + } +} + +class InsatiableFrugivoreEffect extends OneShotEffect { + + InsatiableFrugivoreEffect() { + super(Outcome.Benefit); + this.staticText = "create a Food token, then you may exile three cards from your graveyard. If you do, repeat this process"; + } + + private InsatiableFrugivoreEffect(final InsatiableFrugivoreEffect effect) { + super(effect); + } + + @Override + public InsatiableFrugivoreEffect copy() { + return new InsatiableFrugivoreEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller == null) { + return false; + } + boolean repeat; + do { + new FoodToken().putOntoBattlefield(1, game, source); + Cost cost = new ExileFromGraveCost(new TargetCardInYourGraveyard(3)); + repeat = cost.canPay(source, source, controller.getId(), game) + && controller.chooseUse(Outcome.Exile, "Exile three cards from your graveyard?", source, game) + && cost.pay(source, game, source, controller.getId(), false); + } while (repeat && controller.canRespond()); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/BloomburrowCommander.java b/Mage.Sets/src/mage/sets/BloomburrowCommander.java index 19461bbc1e5..6b5d49ca2b3 100644 --- a/Mage.Sets/src/mage/sets/BloomburrowCommander.java +++ b/Mage.Sets/src/mage/sets/BloomburrowCommander.java @@ -148,6 +148,7 @@ public final class BloomburrowCommander extends ExpansionSet { cards.add(new SetCardInfo("Illusory Ambusher", 167, Rarity.UNCOMMON, mage.cards.i.IllusoryAmbusher.class)); cards.add(new SetCardInfo("Inferno Titan", 198, Rarity.MYTHIC, mage.cards.i.InfernoTitan.class)); cards.add(new SetCardInfo("Ink-Eyes, Servant of Oni", 77, Rarity.RARE, mage.cards.i.InkEyesServantOfOni.class)); + cards.add(new SetCardInfo("Insatiable Frugivore", 18, Rarity.RARE, mage.cards.i.InsatiableFrugivore.class)); cards.add(new SetCardInfo("Inspiring Overseer", 141, Rarity.COMMON, mage.cards.i.InspiringOverseer.class)); cards.add(new SetCardInfo("Intellectual Offering", 168, Rarity.RARE, mage.cards.i.IntellectualOffering.class)); cards.add(new SetCardInfo("Ishai, Ojutai Dragonspeaker", 89, Rarity.MYTHIC, mage.cards.i.IshaiOjutaiDragonspeaker.class));