From e37438caf6463963ad424a45abd3bd886fb12392 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 18 Apr 2020 13:11:27 -0400 Subject: [PATCH] Implemented Agitator Ant --- Mage.Sets/src/mage/cards/a/AgitatorAnt.java | 98 +++++++++++++++++++ .../src/mage/sets/Commander2020Edition.java | 1 + 2 files changed, 99 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/a/AgitatorAnt.java diff --git a/Mage.Sets/src/mage/cards/a/AgitatorAnt.java b/Mage.Sets/src/mage/cards/a/AgitatorAnt.java new file mode 100644 index 0000000000..e33d7a1a23 --- /dev/null +++ b/Mage.Sets/src/mage/cards/a/AgitatorAnt.java @@ -0,0 +1,98 @@ +package mage.cards.a; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfEndStepTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.combat.GoadTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.TargetController; +import mage.counters.CounterType; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetPermanent; +import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.targetpointer.FixedTarget; + +import java.util.Objects; +import java.util.UUID; +import java.util.stream.Collectors; + +/** + * @author TheElk801 + */ +public final class AgitatorAnt extends CardImpl { + + public AgitatorAnt(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}"); + + this.subtype.add(SubType.INSECT); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // At the beginning of your end step, each player may put two +1/+1 counters on a creature they control. Goad each creature that had counters put on it this way. + this.addAbility(new BeginningOfEndStepTriggeredAbility( + new AgitatorAntEffect(), TargetController.YOU, false + )); + } + + private AgitatorAnt(final AgitatorAnt card) { + super(card); + } + + @Override + public AgitatorAnt copy() { + return new AgitatorAnt(this); + } +} + +class AgitatorAntEffect extends OneShotEffect { + + AgitatorAntEffect() { + super(Outcome.Benefit); + staticText = "each player may put two +1/+1 counters on a creature they control. " + + "Goad each creature that had counters put on it this way."; + } + + private AgitatorAntEffect(final AgitatorAntEffect effect) { + super(effect); + } + + @Override + public AgitatorAntEffect copy() { + return new AgitatorAntEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + for (Player player : game + .getState() + .getPlayersInRange(source.getControllerId(), game) + .stream() + .map(game::getPlayer) + .filter(Objects::nonNull).collect(Collectors.toList())) { + if (game.getBattlefield().countAll( + StaticFilters.FILTER_PERMANENT_CREATURE, player.getId(), game + ) < 1 || !player.chooseUse( + Outcome.BoostCreature, "Put two +1/+1 counters on a creature you control?", source, game + )) { + continue; + } + TargetPermanent targetPermanent = new TargetControlledCreaturePermanent(0, 1); + targetPermanent.setNotTarget(true); + player.choose(Outcome.BoostCreature, targetPermanent, source.getSourceId(), game); + Permanent permanent = game.getPermanent(targetPermanent.getFirstTarget()); + if (permanent == null || !permanent.addCounters(CounterType.P1P1.createInstance(2), source, game)) { + continue; + } + new GoadTargetEffect().setTargetPointer(new FixedTarget(permanent, game)).apply(game, source); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/Commander2020Edition.java b/Mage.Sets/src/mage/sets/Commander2020Edition.java index 67585324c8..e6b0138c5c 100644 --- a/Mage.Sets/src/mage/sets/Commander2020Edition.java +++ b/Mage.Sets/src/mage/sets/Commander2020Edition.java @@ -36,6 +36,7 @@ public final class Commander2020Edition extends ExpansionSet { cards.add(new SetCardInfo("Acidic Slime", 165, Rarity.UNCOMMON, mage.cards.a.AcidicSlime.class)); cards.add(new SetCardInfo("Adriana, Captain of the Guard", 200, Rarity.RARE, mage.cards.a.AdrianaCaptainOfTheGuard.class)); cards.add(new SetCardInfo("Aerial Responder", 72, Rarity.UNCOMMON, mage.cards.a.AerialResponder.class)); + cards.add(new SetCardInfo("Agitator Ant", 49, Rarity.RARE, mage.cards.a.AgitatorAnt.class)); cards.add(new SetCardInfo("Ajani Unyielding", 201, Rarity.MYTHIC, mage.cards.a.AjaniUnyielding.class)); cards.add(new SetCardInfo("Akroma's Vengeance", 74, Rarity.RARE, mage.cards.a.AkromasVengeance.class)); cards.add(new SetCardInfo("Akroma, Angel of Wrath", 73, Rarity.MYTHIC, mage.cards.a.AkromaAngelOfWrath.class));