Implemented Agent of Treachery

This commit is contained in:
Evan Kranzler 2019-06-21 20:56:39 -04:00
parent 11dcc127a1
commit c94ed2bf75
2 changed files with 72 additions and 0 deletions

View file

@ -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;
}
}

View file

@ -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));