diff --git a/Mage.Sets/src/mage/cards/s/StockingThePantry.java b/Mage.Sets/src/mage/cards/s/StockingThePantry.java new file mode 100644 index 00000000000..ead3bcf1a34 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/StockingThePantry.java @@ -0,0 +1,80 @@ +package mage.cards.s; + +import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.RemoveCountersSourceCost; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class StockingThePantry extends CardImpl { + + public StockingThePantry(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{G}"); + + // Whenever you put one or more +1/+1 counters on a creature you control, put a supply counter on Stocking the Pantry. + this.addAbility(new StockingThePantryTriggeredAbility()); + + // {2}, Remove a supply counter from Stocking the Pantry: Draw a card. + Ability ability = new SimpleActivatedAbility(new DrawCardSourceControllerEffect(1), new GenericManaCost(2)); + ability.addCost(new RemoveCountersSourceCost(CounterType.SUPPLY.createInstance())); + this.addAbility(ability); + } + + private StockingThePantry(final StockingThePantry card) { + super(card); + } + + @Override + public StockingThePantry copy() { + return new StockingThePantry(this); + } +} + +class StockingThePantryTriggeredAbility extends TriggeredAbilityImpl { + + StockingThePantryTriggeredAbility() { + super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.SUPPLY.createInstance())); + setTriggerPhrase("Whenever you put one or more +1/+1 counters on a creature you control, "); + } + + private StockingThePantryTriggeredAbility(final StockingThePantryTriggeredAbility ability) { + super(ability); + } + + @Override + public StockingThePantryTriggeredAbility copy() { + return new StockingThePantryTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.COUNTERS_ADDED; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (!event.getData().equals(CounterType.P1P1.getName())) { + return false; + } + Permanent permanent = game.getPermanentOrLKIBattlefield(event.getTargetId()); + if (permanent == null) { + permanent = game.getPermanentEntering(event.getTargetId()); + } + return permanent != null && permanent.isControlledBy(this.getControllerId()); + } +} diff --git a/Mage.Sets/src/mage/sets/Bloomburrow.java b/Mage.Sets/src/mage/sets/Bloomburrow.java index f3d83b9c438..75a02c1a642 100644 --- a/Mage.Sets/src/mage/sets/Bloomburrow.java +++ b/Mage.Sets/src/mage/sets/Bloomburrow.java @@ -170,6 +170,7 @@ public final class Bloomburrow extends ExpansionSet { cards.add(new SetCardInfo("Starseer Mentor", 233, Rarity.UNCOMMON, mage.cards.s.StarseerMentor.class)); cards.add(new SetCardInfo("Steampath Charger", 153, Rarity.COMMON, mage.cards.s.SteampathCharger.class)); cards.add(new SetCardInfo("Stickytongue Sentinel", 193, Rarity.COMMON, mage.cards.s.StickytongueSentinel.class)); + cards.add(new SetCardInfo("Stocking the Pantry", 194, Rarity.UNCOMMON, mage.cards.s.StockingThePantry.class)); cards.add(new SetCardInfo("Stormcatch Mentor", 234, Rarity.UNCOMMON, mage.cards.s.StormcatchMentor.class)); cards.add(new SetCardInfo("Stormchaser's Talent", 75, Rarity.RARE, mage.cards.s.StormchasersTalent.class)); cards.add(new SetCardInfo("Stormsplitter", 154, Rarity.MYTHIC, mage.cards.s.Stormsplitter.class)); diff --git a/Mage/src/main/java/mage/counters/CounterType.java b/Mage/src/main/java/mage/counters/CounterType.java index 54ae1be784e..b4efb9afd8c 100644 --- a/Mage/src/main/java/mage/counters/CounterType.java +++ b/Mage/src/main/java/mage/counters/CounterType.java @@ -206,6 +206,7 @@ public enum CounterType { STRIFE("strife"), STUDY("study"), STUN("stun"), + SUPPLY("supply"), SUSPECT("suspect"), TASK("task"), THEFT("theft"),