From c94ed2bf75f6d6a6c9f1539824af9ccbf06631d1 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 21 Jun 2019 20:56:39 -0400 Subject: [PATCH] Implemented Agent of Treachery --- .../src/mage/cards/a/AgentOfTreachery.java | 71 +++++++++++++++++++ Mage.Sets/src/mage/sets/CoreSet2020.java | 1 + 2 files changed, 72 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/a/AgentOfTreachery.java diff --git a/Mage.Sets/src/mage/cards/a/AgentOfTreachery.java b/Mage.Sets/src/mage/cards/a/AgentOfTreachery.java new file mode 100644 index 0000000000..52a67d10a8 --- /dev/null +++ b/Mage.Sets/src/mage/cards/a/AgentOfTreachery.java @@ -0,0 +1,71 @@ +package mage.cards.a; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfEndStepTriggeredAbility; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.condition.Condition; +import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.continuous.GainControlTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.constants.TargetController; +import mage.game.Game; +import mage.target.TargetPermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class AgentOfTreachery extends CardImpl { + + public AgentOfTreachery(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{U}{U}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.ROGUE); + this.power = new MageInt(2); + this.toughness = new MageInt(3); + + // When Agent of Treachery enters the battlefield, gain control of target permanent. + Ability ability = new EntersBattlefieldTriggeredAbility(new GainControlTargetEffect(Duration.Custom)); + ability.addTarget(new TargetPermanent()); + this.addAbility(ability); + + // At the beginning of your end step, if you control three or more permanents you don't own, draw three cards. + this.addAbility(new ConditionalInterveningIfTriggeredAbility( + new BeginningOfEndStepTriggeredAbility( + new DrawCardSourceControllerEffect(3), + TargetController.YOU, false + ), AgentOfTreacheryCondition.instance, "At the beginning of your end step, " + + "if you control three or more permanents you don't own, draw three cards." + )); + } + + private AgentOfTreachery(final AgentOfTreachery card) { + super(card); + } + + @Override + public AgentOfTreachery copy() { + return new AgentOfTreachery(this); + } +} + +enum AgentOfTreacheryCondition implements Condition { + instance; + + @Override + public boolean apply(Game game, Ability source) { + return game.getBattlefield() + .getAllActivePermanents(source.getControllerId()) + .stream() + .map(permanent -> !permanent.getOwnerId().equals(source.getControllerId())) + .count() > 2; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/CoreSet2020.java b/Mage.Sets/src/mage/sets/CoreSet2020.java index 0265687e6c..13d0795923 100644 --- a/Mage.Sets/src/mage/sets/CoreSet2020.java +++ b/Mage.Sets/src/mage/sets/CoreSet2020.java @@ -28,6 +28,7 @@ public final class CoreSet2020 extends ExpansionSet { this.maxCardNumberInBooster = 280; cards.add(new SetCardInfo("Aerial Assault", 1, Rarity.COMMON, mage.cards.a.AerialAssault.class)); + cards.add(new SetCardInfo("Agent of Treachery", 43, Rarity.RARE, mage.cards.a.AgentOfTreachery.class)); cards.add(new SetCardInfo("Ajani, Strength of the Pride", 2, Rarity.MYTHIC, mage.cards.a.AjaniStrengthOfThePride.class)); cards.add(new SetCardInfo("Angel of Vitality", 4, Rarity.UNCOMMON, mage.cards.a.AngelOfVitality.class)); cards.add(new SetCardInfo("Atemsis, All-Seeing", 46, Rarity.RARE, mage.cards.a.AtemsisAllSeeing.class));